class Elvarg::Stats::Skill
Represents a Skill
in OldSchool RuneScape
Attributes
@return [String] The link to the `.gif` of the related Skill
@return [Integer] The unique id of this Skill
@return [String] The human readable name of this Skill
@return [Symbol] The symbol of this Skill
@see Elvarg::Stats::SKILLS for list of symbols
Public Class Methods
Creates a new Skill
object.
@example Create a Hunter Skill
object
hunter = Elvarg::Stats::Skill.new(:hunter, 22) hunter.level #=> 1
@example Create a Hitpoints Skill
object
hitpoints = Elvarg::Stats::Skill.new(:hitpoints, 4) hitpoints.level #=> 10
@example Create a Runecraft Skill
, with no id will default to 0
runecraft = Elvarg::Stats::Skill.new(:runecraft) runecraft.level #=> 1 runecraft.id #=> 0
@param symbol [Symbol] the symbol of this skill. @param id [Integer] the unique identifier of this skill, 1 is attack.
(0).
# File lib/stats/skill.rb, line 36 def initialize(symbol, id = 0) @id = id @symbol = symbol @name = symbol.to_s.capitalize @icon = 'https://www.runescape.com/img/rsp777/' \ "hiscores/skill_icon_#{@name.downcase}1.gif" end
Public Instance Methods
Determines if this Skill
will affect a player's combat
@example Attack will affect one's combat level
Elvarg::Stats::Skill.new(:attack).combat? #=> true
@example Woodcutting will not affect one's combat level
Elvarg::Stats::Skill.new(:woodcutting).combat? #=> false
@return [true] if this Skill
affects a player's combat @return [false] if this Skill
does not affect a player's combat
# File lib/stats/skill.rb, line 76 def combat? COMBAT_SKILLS.include? @symbol end
Determines if this Skill
is a member's only skill.
@example Slayer is a member's only skill.
Elvarg::Stats::Skill.new(:hunter).member? #=> true
@example Runecraft is a free-to-play skill.
Elvarg::Stats::Skill.new(:runecraft).member? #=> false
@return [true] if this Skill
is a member's only skill. @return [false] if this Skill
is free-to-play.
# File lib/stats/skill.rb, line 53 def member? MEMBER_SKILLS.include? @symbol end
Determines if this Skill
does not affect a player's combat
@note This is the inverse of `combat?` @see combat?
# File lib/stats/skill.rb, line 85 def skiller_friendly? !combat? end