mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 08:39:11 +00:00
Add extra utility methods to Inventory and utils plugin.
This commit is contained in:
@@ -7,6 +7,16 @@ def valid_arg_length(args, length, player, message)
|
||||
return valid
|
||||
end
|
||||
|
||||
# Returns the name of the Object, Npc, or Item with the specified id.
|
||||
def name_of(type, id)
|
||||
types = [ :object, :item, :npc ]
|
||||
unless types.include?(type)
|
||||
raise "Invalid type of #{type} specified, must be one of #{types}"
|
||||
end
|
||||
|
||||
return Kernel.const_get("#{type.capitalize}Definition").lookup(id).name.to_s
|
||||
end
|
||||
|
||||
# Add a has_keys? method to hash
|
||||
class Hash
|
||||
|
||||
@@ -19,7 +29,7 @@ end
|
||||
|
||||
class Player
|
||||
|
||||
# Returns whether or not the player's
|
||||
# Returns whether or not the player's current level is greater than or equal to the specified level.
|
||||
def has_level(skill, level)
|
||||
return skill_set.get_skill(skill).current_level >= level
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user