mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
Move potion constants into a module.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user