mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 16:49:11 +00:00
Fix bugs in the mining plugin.
This commit is contained in:
@@ -22,13 +22,11 @@ class MiningAction < DistancedAction
|
||||
def find_pickaxe
|
||||
PICKAXE_IDS.each do |id|
|
||||
weapon = mob.equipment.get(EquipmentConstants::WEAPON)
|
||||
if weapon != nil && weapon.id == id
|
||||
if (weapon != nil && weapon.id == id)
|
||||
return PICKAXES[id]
|
||||
end
|
||||
|
||||
if mob.inventory.contains(id)
|
||||
return PICKAXES[id]
|
||||
end
|
||||
return PICKAXES[id] if mob.inventory.contains(id)
|
||||
end
|
||||
|
||||
return nil
|
||||
@@ -39,7 +37,6 @@ class MiningAction < DistancedAction
|
||||
def start_mine(pickaxe)
|
||||
@started = true
|
||||
mob.send_message('You swing your pick at the rock.', true)
|
||||
mob.turn_to(@position)
|
||||
mob.play_animation(pickaxe.animation)
|
||||
@counter = pickaxe.pulses
|
||||
end
|
||||
@@ -48,6 +45,7 @@ class MiningAction < DistancedAction
|
||||
skills = mob.skill_set
|
||||
level = skills.get_skill(MINING_SKILL_ID).current_level
|
||||
pickaxe = find_pickaxe
|
||||
mob.turn_to(@position)
|
||||
|
||||
# verify the mob can mine with their pickaxe
|
||||
unless (pickaxe != nil and level >= pickaxe.level)
|
||||
@@ -75,7 +73,7 @@ class MiningAction < DistancedAction
|
||||
ore_def = ItemDefinition.lookup(@ore.id) # TODO: split off into some method
|
||||
name = ore_def.name.sub(/ ore$/, '').downcase
|
||||
|
||||
mob.send_message("You manage to mine some #{name}.")
|
||||
mob.send_message("You manage to mine some #{name}.", true)
|
||||
skills.add_experience(MINING_SKILL_ID, ore.exp)
|
||||
# TODO: expire the rock
|
||||
end
|
||||
@@ -121,7 +119,7 @@ class ProspectingAction < DistancedAction
|
||||
end
|
||||
|
||||
def executeAction
|
||||
if not @started
|
||||
unless @started
|
||||
@started = true
|
||||
|
||||
mob.send_message('You examine the rock for ores...')
|
||||
@@ -131,7 +129,6 @@ class ProspectingAction < DistancedAction
|
||||
name = ore_def.name.sub(/ ore$/, '').downcase
|
||||
|
||||
mob.send_message("This rock contains #{name}.")
|
||||
|
||||
stop
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user