mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
Fix various skills (broken in cf7a742).
This commit is contained in:
@@ -31,15 +31,15 @@ on :message, :item_on_item do |ctx, player, message|
|
||||
secondary = message.target_id
|
||||
hash = HERBLORE_ITEM_ON_ITEM[primary]
|
||||
|
||||
if hash == nil
|
||||
if hash.nil?
|
||||
secondary = message.id
|
||||
primary = message.target_id
|
||||
hash = HERBLORE_ITEM_ON_ITEM[primary]
|
||||
end
|
||||
|
||||
if hash != nil
|
||||
unless hash.nil?
|
||||
method = hash[secondary]
|
||||
if method != nil
|
||||
unless method.nil?
|
||||
method.invoke(player, primary, secondary)
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
@@ -51,13 +51,13 @@ on :message, :first_item_option do |ctx, player, message|
|
||||
id = message.id
|
||||
method = HERBLORE_ITEM[id]
|
||||
|
||||
if method != nil
|
||||
unless method.nil?
|
||||
method.invoke(player, id, message.slot)
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
method = DRINK_ITEM[id]
|
||||
|
||||
if method != nil
|
||||
unless method.nil?
|
||||
method.invoke(player, id, message.slot)
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
@@ -69,7 +69,7 @@ def append_herblore_item(method, key, secondary = -1)
|
||||
HERBLORE_ITEM[key] = method
|
||||
else
|
||||
hash = HERBLORE_ITEM_ON_ITEM[key]
|
||||
hash = {} if hash == nil
|
||||
hash = {} if hash.nil?
|
||||
|
||||
hash[secondary] = method
|
||||
HERBLORE_ITEM_ON_ITEM[key] = hash
|
||||
@@ -79,16 +79,17 @@ end
|
||||
# Utility method for checking if a player's inventory has an item of the specified id, with optionally the specified amount (1 by default), at the specified slot.
|
||||
def check_slot(player, slot, id, amount = 1)
|
||||
item = player.inventory.get(slot)
|
||||
return (item != nil and item.id == id and item.amount >= amount)
|
||||
return (!item.nil? and item.id == id and item.amount >= amount)
|
||||
end
|
||||
|
||||
# Utility method for checking if a player's Herblore (maximum) level is at a required height. Also informs the player if this is not the case with use of the action
|
||||
# variable, like so: "You need a Herblore level of at least #{required.to_s} to #{action}."
|
||||
def check_skill(player, required, action)
|
||||
if required > player.skill_set.skill(HERBLORE_SKILL_ID).current_level
|
||||
if (required > player.skill_set.get_skill(Skill::HERBLORE).current_level)
|
||||
player.send_message("You need a Herblore level of at least #{required} to #{action}.")
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user