mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-05 08:40:08 +00:00
Remove skill id constants from bootstrap, improve consumables code.
This commit is contained in:
@@ -7,12 +7,12 @@ CONSUME_ANIMATION_ID = 829
|
||||
|
||||
# An item that can be consumed to produce a skill effect.
|
||||
class Consumable
|
||||
attr_reader :name, :id
|
||||
attr_reader :name, :id, :sound
|
||||
|
||||
def initialize(name, id, sound_id)
|
||||
def initialize(name, id, sound)
|
||||
@name = name.to_s.gsub(/_/, ' ')
|
||||
@id = id
|
||||
@sound_id = sound_id
|
||||
@sound = sound
|
||||
end
|
||||
|
||||
def consume(player)
|
||||
@@ -39,7 +39,7 @@ class ConsumeAction < Action
|
||||
def execute()
|
||||
if @executions == 0
|
||||
mob.inventory.reset(@slot)
|
||||
consumable.consume(mob)
|
||||
@consumable.consume(mob)
|
||||
mob.play_animation(Animation.new(CONSUME_ANIMATION_ID))
|
||||
@executions += 1
|
||||
else
|
||||
@@ -56,7 +56,8 @@ end
|
||||
# Intercepts the first item option message and consumes the consumable, if necessary.
|
||||
on :message, :first_item_option do |ctx, player, message|
|
||||
consumable = CONSUMABLES[message.id]
|
||||
unless consumable == nil
|
||||
|
||||
unless consumable.nil?
|
||||
player.start_action(ConsumeAction.new(player, message.slot, consumable))
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user