Class: Edgeville::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/edgeville.rb

Constant Summary collapse

SKILL_LIST =
%w(Overall Attack Defence Strength Hitpoints Ranged Prayer Magic Cooking Woodcutting Fletching Fishing Firemaking Crafting Smithing Mining Herblore Agility Thieving Slayer Farming Runecraft Construction Hunter Summoning)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Player

Returns a new instance of Player.



9
10
11
# File 'lib/edgeville.rb', line 9

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/edgeville.rb', line 6

def name
  @name
end

Instance Method Details

#clean_nameObject



13
14
15
# File 'lib/edgeville.rb', line 13

def clean_name
  @name.gsub(/[^\w]/,"_").downcase
end

#skillsObject



17
18
19
20
21
22
23
24
# File 'lib/edgeville.rb', line 17

def skills
  stats = {}
  SKILL_LIST.each_with_index do |skill,i|
    line = highscores[i].split(",")
    stats[skill.downcase.to_sym] = { :rank => line[0].to_i, :level => line[1].to_i, :xp => line[2].to_i }
  end
  stats
end