Move potion constants into a module.

This commit is contained in:
Major-
2015-02-26 22:32:59 +00:00
parent be4a4ea7c9
commit 0b6b6ccd03
2 changed files with 13 additions and 4 deletions
+11 -4
View File
@@ -4,14 +4,21 @@ java_import 'org.apollo.game.model.entity.Skill'
private
DRINK_POTION_SOUND = 334
EMPTY_VIAL_ID = 229
module Constants
# The sound made when drinking a potion.
DRINK_POTION_SOUND = 334
# The id of an empty vial.
EMPTY_VIAL_ID = 229
end
# A drinkable potion.
class Potion < Consumable
def initialize(id, name, doses)
super(name, id, DRINK_POTION_SOUND)
super(name, id, Constants::DRINK_POTION_SOUND)
@doses = doses
end
@@ -24,7 +31,7 @@ class Potion < Consumable
player.send_message("You have #{ @doses.length - index } dose#{ "s" unless index == 3 } of potion left.", true)
else
player.send_message('You drink the last of your potion.', true)
player.inventory.add(EMPTY_VIAL_ID)
player.inventory.add(Constants::EMPTY_VIAL_ID)
end
drink(player)
+2
View File
@@ -7,6 +7,8 @@ java_import 'org.apollo.game.model.def.ItemDefinition'
java_import 'org.apollo.game.model.inter.EnterAmountListener'
java_import 'org.apollo.game.model.inter.dialogue.DialogueAdapter'
private
WATER_VIAL_ID = 227
EMPTY_VIAL_ID = 229