mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Cleanup code.
This commit is contained in:
@@ -10,10 +10,11 @@ HERBLORE_ID = Skill::HERBLORE
|
|||||||
HERBLORE_DIALOGUE = 4429
|
HERBLORE_DIALOGUE = 4429
|
||||||
|
|
||||||
HERBLORE_ITEM = {}
|
HERBLORE_ITEM = {}
|
||||||
HERBLORE_ITEM_ITEM = {}
|
HERBLORE_ITEM_ON_ITEM = {}
|
||||||
|
|
||||||
DRINK_ITEM = {}
|
DRINK_ITEM = {}
|
||||||
|
|
||||||
|
|
||||||
# A module which describes an invocable method of the Herblore skill.
|
# A module which describes an invocable method of the Herblore skill.
|
||||||
module HerbloreMethod
|
module HerbloreMethod
|
||||||
def self.new
|
def self.new
|
||||||
@@ -29,12 +30,12 @@ end
|
|||||||
on :event, :item_on_item do |ctx, player, event|
|
on :event, :item_on_item do |ctx, player, event|
|
||||||
primary = event.id
|
primary = event.id
|
||||||
secondary = event.target_id
|
secondary = event.target_id
|
||||||
hash = HERBLORE_ITEM_ITEM[primary]
|
hash = HERBLORE_ITEM_ON_ITEM[primary]
|
||||||
|
|
||||||
if hash == nil
|
if hash == nil
|
||||||
secondary = event.id
|
secondary = event.id
|
||||||
primary = event.target_id
|
primary = event.target_id
|
||||||
hash = HERBLORE_ITEM_ITEM[primary]
|
hash = HERBLORE_ITEM_ON_ITEM[primary]
|
||||||
end
|
end
|
||||||
|
|
||||||
if hash != nil
|
if hash != nil
|
||||||
@@ -70,11 +71,11 @@ def append_herblore_item(method, key, secondary = -1)
|
|||||||
if secondary == -1
|
if secondary == -1
|
||||||
HERBLORE_ITEM[key] = method
|
HERBLORE_ITEM[key] = method
|
||||||
else
|
else
|
||||||
hash = HERBLORE_ITEM_ITEM[key]
|
hash = HERBLORE_ITEM_ON_ITEM[key]
|
||||||
hash = {} if hash == nil
|
hash = {} if hash == nil
|
||||||
|
|
||||||
hash[secondary] = method
|
hash[secondary] = method
|
||||||
HERBLORE_ITEM_ITEM[key] = hash
|
HERBLORE_ITEM_ON_ITEM[key] = hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,7 @@ class GrindingDialogueListener < DialogueAdapter
|
|||||||
# Called when a button has been clicked whilst the dialogue was opened.
|
# Called when a button has been clicked whilst the dialogue was opened.
|
||||||
def buttonClicked(button)
|
def buttonClicked(button)
|
||||||
amount = get_amount(button)
|
amount = get_amount(button)
|
||||||
if amount == 0
|
return false if amount == 0
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
interfaces = @player.interface_set
|
interfaces = @player.interface_set
|
||||||
interfaces.close
|
interfaces.close
|
||||||
@@ -226,7 +224,7 @@ class GrindingAction < Action
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Appends a grinded ingredient to the ItemOnItemEvent handler interception.
|
# Appends a grinded ingredient to the ItemOnItemEvent handler interception.
|
||||||
def append_grinded(id, raw)
|
def append_ground(id, raw)
|
||||||
grinded = GroundIngredient.new(id, raw)
|
grinded = GroundIngredient.new(id, raw)
|
||||||
append_herblore_item(grinded, PESTLE_MORTAR, raw)
|
append_herblore_item(grinded, PESTLE_MORTAR, raw)
|
||||||
return grinded
|
return grinded
|
||||||
@@ -251,8 +249,8 @@ YEW_ROOTS = Ingredient.new(6049)
|
|||||||
MAGIC_ROOTS = Ingredient.new(6051)
|
MAGIC_ROOTS = Ingredient.new(6051)
|
||||||
|
|
||||||
# Grinded ingredients
|
# Grinded ingredients
|
||||||
UNICORN_HORN_DUST = append_grinded(235, 237)
|
UNICORN_HORN_DUST = append_ground(235, 237)
|
||||||
DRAGON_SCALE_DUST = append_grinded(241, 243)
|
DRAGON_SCALE_DUST = append_ground(241, 243)
|
||||||
CHOCOLATE_DUST = append_grinded(1975, 1973)
|
CHOCOLATE_DUST = append_ground(1975, 1973)
|
||||||
CRUSHED_NEST = append_grinded(6693, 5075)
|
CRUSHED_NEST = append_ground(6693, 5075)
|
||||||
GROUND_MUD_RUNE = append_grinded(9594, 4698)
|
GROUND_MUD_RUNE = append_ground(9594, 4698)
|
||||||
Reference in New Issue
Block a user