diff --git a/data/plugins/skill-mining/mining.rb b/data/plugins/skill-mining/mining.rb index a1dae272..34a8ac80 100644 --- a/data/plugins/skill-mining/mining.rb +++ b/data/plugins/skill-mining/mining.rb @@ -10,8 +10,8 @@ ORE_SIZE = 1 class MiningAction < DistancedAction attr_reader :position, :ore, :counter, :started - def initialize(player, position, ore) - super 0, true, player, position, ORE_SIZE + def initialize(mob, position, ore) + super 0, true, mob, position, ORE_SIZE @position = position @ore = ore @started = false @@ -20,12 +20,12 @@ class MiningAction < DistancedAction def find_pickaxe PICKAXE_IDS.each do |id| - weapon = player.equipment.get EquipmentConstants::WEAPON + weapon = mob.equipment.get EquipmentConstants::WEAPON if weapon.id == id return PICKAXES[id] end - if player.inventory.contains id + if mob.inventory.contains id return PICKAXES[id] end end @@ -33,31 +33,31 @@ class MiningAction < DistancedAction return nil end - # starts the mining animation, sets counters/flags and turns the player to + # starts the mining animation, sets counters/flags and turns the mob to # the ore def start_mine(pickaxe) @started = true - player.send_message "You swing your pick at the rock." - player.turn_to @position - player.play_animation pickaxe.animation + mob.send_message "You swing your pick at the rock." + mob.turn_to @position + mob.play_animation pickaxe.animation @counter = pickaxe.pulses end def executeAction - skills = player.skill_set + skills = mob.skill_set level = skills.get_skill(Skill::MINING).current_level pickaxe = find_pickaxe - # verify the player can mine with their pickaxe + # verify the mob can mine with their pickaxe if not (pickaxe != nil and level >= pickaxe.level) - player.send_message "You do not have a pickaxe for which you have the level to use." + mob.send_message "You do not have a pickaxe for which you have the level to use." stop return end - # verify the player can mine the ore + # verify the mob can mine the ore if ore.level > level - player.send_message "You do not have the required level to mine this rock." + mob.send_message "You do not have the required level to mine this rock." stop return end @@ -68,13 +68,13 @@ class MiningAction < DistancedAction else # count down and check if we can have a chance at some ore now if @counter == 0 - # TODO: calculate the chance that the player can actually get the rock + # TODO: calculate the chance that the mob can actually get the rock - if player.inventory.add ore.id + if mob.inventory.add ore.id ore_def = ItemDefinition.lookup @ore.id # TODO: split off into some method name = ore_def.name.sub(/ ore$/, "").downcase - player.send_message "You manage to mine some #{name}." + mob.send_message "You manage to mine some #{name}." skills.add_experience Skill::MINING, ore.exp # TODO: expire the rock end @@ -94,12 +94,12 @@ end class ExpiredProspectingAction < DistancedAction attr_reader :position - def initialize(player, position) - super 0, true, player, position, ORE_SIZE + def initialize(mob, position) + super 0, true, mob, position, ORE_SIZE end def executeAction - player.send_message "There is currently no ore available in this rock." + mob.send_message "There is currently no ore available in this rock." stop end @@ -112,8 +112,8 @@ end class ProspectingAction < DistancedAction attr_reader :position, :ore - def initialize(player, position, ore) - super PROSPECT_PULSES, true, player, position, ORE_SIZE + def initialize(mob, position, ore) + super PROSPECT_PULSES, true, mob, position, ORE_SIZE @position = position @ore = ore @started = false @@ -123,13 +123,13 @@ class ProspectingAction < DistancedAction if not @started @started = true - player.send_message "You examine the rock for ores..." - player.turn_to @position + mob.send_message "You examine the rock for ores..." + mob.turn_to @position else ore_def = ItemDefinition.lookup @ore.id name = ore_def.name.sub(/ ore$/, "").downcase - player.send_message "This rock contains #{name}." + mob.send_message "This rock contains #{name}." stop end @@ -140,24 +140,22 @@ class ProspectingAction < DistancedAction end end -on :event, :object_action do |ctx, player, event| +on :event, :object_action do |ctx, mob, event| if event.option == 1 ore = ORES[event.id] if ore != nil - player.startAction MiningAction.new(player, event.position, ore) + mob.startAction MiningAction.new(mob, event.position, ore) end end end -on :event, :object_action do |ctx, player, event| +on :event, :object_action do |ctx, mob, event| if event.option == 2 ore = ORES[event.id] if ore != nil - player.startAction ProspectingAction.new(player, event.position, ore) - else - if EXPIRED_ORES[event.id] != nil - player.startAction ExpiredProspectingAction.new(player, event.position) - end + mob.startAction ProspectingAction.new(mob, event.position, ore) + elsif EXPIRED_ORES[event.id] != nil + mob.startAction ExpiredProspectingAction.new(mob, event.position) end end end \ No newline at end of file diff --git a/src/org/apollo/fs/decoder/ItemDefinitionDecoder.java b/src/org/apollo/fs/decoder/ItemDefinitionDecoder.java index 1b86e304..1183311c 100644 --- a/src/org/apollo/fs/decoder/ItemDefinitionDecoder.java +++ b/src/org/apollo/fs/decoder/ItemDefinitionDecoder.java @@ -72,21 +72,21 @@ public final class ItemDefinitionDecoder { if (opcode == 0) { return definition; } else if (opcode == 1) { - buffer.getShort();// & 0xFFFF; // model Id + buffer.getShort(); } else if (opcode == 2) { definition.setName(ByteBufferUtil.readString(buffer)); } else if (opcode == 3) { definition.setDescription(ByteBufferUtil.readString(buffer)); } else if (opcode == 4) { - buffer.getShort();// & 0xFFFF; // sprite scale + buffer.getShort(); } else if (opcode == 5) { - buffer.getShort();// & 0xFFFF; // sprite pitch + buffer.getShort(); } else if (opcode == 6) { - buffer.getShort();// & 0xFFFF; //sprite camera roll + buffer.getShort(); } else if (opcode == 7) { - buffer.getShort(); // sprite dX + buffer.getShort(); } else if (opcode == 8) { - buffer.getShort(); // sprite dY + buffer.getShort(); } else if (opcode == 10) { buffer.getShort(); } else if (opcode == 11) { @@ -96,15 +96,15 @@ public final class ItemDefinitionDecoder { } else if (opcode == 16) { definition.setMembersOnly(true); } else if (opcode == 23) { - buffer.getShort(); // & 0xFFFF; //primaryMaleEquipModelId - buffer.get(); // maleEquipYTranslation + buffer.getShort(); + buffer.get(); } else if (opcode == 24) { - buffer.getShort(); // & 0xFFFF; // secondaryMaleEquipModelId + buffer.getShort(); } else if (opcode == 25) { - buffer.getShort(); // & 0xFFFF; // primaryFemaleEquipModelId - buffer.get(); // femaleEquipYTranslation + buffer.getShort(); + buffer.get(); } else if (opcode == 26) { - buffer.getShort(); // & 0xFFFF; // secondaryFemaleEquipModelId + buffer.getShort(); } else if (opcode >= 30 && opcode < 35) { String str = ByteBufferUtil.readString(buffer); if (str.equalsIgnoreCase("hidden")) { @@ -116,40 +116,40 @@ public final class ItemDefinitionDecoder { } else if (opcode == 40) { int colourCount = buffer.get() & 0xFF; for (int i = 0; i < colourCount; i++) { - buffer.getShort(); // & 0xFFFF; // original colour - buffer.getShort(); // & 0xFFFF; // replacement colour + buffer.getShort(); + buffer.getShort(); } } else if (opcode == 78) { - buffer.getShort(); // & 0xFFFF; // tertiaryMaleEquipModelId + buffer.getShort(); } else if (opcode == 79) { - buffer.getShort(); // & 0xFFFF; // tertiaryFemaleEquipModelId + buffer.getShort(); } else if (opcode == 90) { - buffer.getShort(); // & 0xFFFF; // primaryMaleHeadPiece + buffer.getShort(); } else if (opcode == 91) { - buffer.getShort(); // & 0xFFFF; // primaryFemaleHeadPiece + buffer.getShort(); } else if (opcode == 92) { - buffer.getShort(); // & 0xFFFF; // secondaryMaleHeadPiece + buffer.getShort(); } else if (opcode == 93) { - buffer.getShort(); // & 0xFFFF; // secondaryFemaleHeadPiece + buffer.getShort(); } else if (opcode == 95) { - buffer.getShort(); // & 0xFFFF; // spriteCameraYaw + buffer.getShort(); } else if (opcode == 97) { definition.setNoteInfoId(buffer.getShort() & 0xFFFF); } else if (opcode == 98) { definition.setNoteGraphicId(buffer.getShort() & 0xFFFF); } else if (opcode >= 100 && opcode < 110) { - buffer.getShort(); // & 0xFFFF; // stack id - buffer.getShort(); // & 0xFFFF; // stack size + buffer.getShort(); + buffer.getShort(); } else if (opcode == 110) { - buffer.getShort(); // & 0xFFFF; // groundScaleX + buffer.getShort(); } else if (opcode == 111) { - buffer.getShort(); // & 0xFFFF; // groundScaleY + buffer.getShort(); } else if (opcode == 112) { - buffer.getShort(); // & 0xFFFF; // groundScaleZ + buffer.getShort(); } else if (opcode == 113) { - buffer.get(); // light ambiance + buffer.get(); } else if (opcode == 114) { - buffer.getShort(); // * 5; // light diffusion + buffer.getShort(); } else if (opcode == 115) { definition.setTeam(buffer.get() & 0xFF); }