Class: Wowr::Classes::CharacterSheet
- Inherits:
-
Object
- Object
- Wowr::Classes::CharacterSheet
- Defined in:
- lib/wowr/classes.rb
Overview
Full character details uses characterInfo element NEEDS TO EXTEND BASE CHARACTER THING
Instance Attribute Summary collapse
-
#agility ⇒ Object
(also: #agi)
readonly
character_tab.
-
#arena_teams ⇒ Object
readonly
character_info.
-
#battle_group ⇒ Object
readonly
character_info.
-
#buffs ⇒ Object
readonly
Returns the value of attribute buffs.
-
#char_url ⇒ Object
readonly
character_info.
-
#debuffs ⇒ Object
readonly
Returns the value of attribute debuffs.
-
#defenses ⇒ Object
readonly
Returns the value of attribute defenses.
-
#faction ⇒ Object
readonly
character_info.
-
#faction_id ⇒ Object
readonly
character_info.
-
#gender ⇒ Object
readonly
character_info.
-
#gender_id ⇒ Object
readonly
character_info.
-
#guild ⇒ Object
readonly
character_info.
-
#guild_url ⇒ Object
readonly
character_info.
-
#health ⇒ Object
readonly
character_tab.
-
#intellect ⇒ Object
(also: #int)
readonly
character_tab.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#klass ⇒ Object
readonly
character_info.
-
#klass_id ⇒ Object
readonly
character_info.
-
#last_modified ⇒ Object
readonly
character_info.
-
#level ⇒ Object
readonly
character_info.
-
#melee ⇒ Object
readonly
Returns the value of attribute melee.
-
#name ⇒ Object
readonly
character_info.
-
#professions ⇒ Object
readonly
Returns the value of attribute professions.
-
#pvp ⇒ Object
readonly
Returns the value of attribute pvp.
-
#race ⇒ Object
readonly
character_info.
-
#race_id ⇒ Object
readonly
character_info.
-
#ranged ⇒ Object
readonly
Returns the value of attribute ranged.
-
#realm ⇒ Object
readonly
character_info.
-
#resistances ⇒ Object
readonly
Returns the value of attribute resistances.
-
#second_bar ⇒ Object
readonly
character_tab.
-
#spell ⇒ Object
readonly
Returns the value of attribute spell.
-
#spirit ⇒ Object
(also: #spi)
readonly
character_tab.
-
#stamina ⇒ Object
(also: #sta)
readonly
character_tab.
-
#strength ⇒ Object
(also: #str)
readonly
character_tab.
-
#talent_spec ⇒ Object
readonly
Returns the value of attribute talent_spec.
-
#title ⇒ Object
readonly
character_info.
Instance Method Summary collapse
-
#character_info(elem) ⇒ Object
<character battleGroup=“Conviction” charUrl=“r=Genjuros&n=Jonlok” class=“Warlock” classId=“9” faction=“Horde” factionId=“1” gender=“Male” genderId=“0” guildName=“” lastModified=“12 February 2008” level=“41” name=“Jonlok” prefix=“” race=“Orc” raceId=“2” realm=“Genjuros” suffix=“”/>.
- #character_tab(elem) ⇒ Object
-
#initialize(elem) ⇒ CharacterSheet
constructor
It’s made up of two parts Don’t care about battlegroups yet I don’t think I can call stuff from the constructor?.
Constructor Details
#initialize(elem) ⇒ CharacterSheet
It’s made up of two parts Don’t care about battlegroups yet I don’t think I can call stuff from the constructor?
127 128 129 130 |
# File 'lib/wowr/classes.rb', line 127 def initialize(elem) character_info(elem%'character') character_tab(elem%'characterTab') end |
Instance Attribute Details
#agility ⇒ Object (readonly) Also known as: agi
character_tab
108 109 110 |
# File 'lib/wowr/classes.rb', line 108 def agility @agility end |
#arena_teams ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def arena_teams @arena_teams end |
#battle_group ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def battle_group @battle_group end |
#buffs ⇒ Object (readonly)
Returns the value of attribute buffs.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def buffs @buffs end |
#char_url ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def char_url @char_url end |
#debuffs ⇒ Object (readonly)
Returns the value of attribute debuffs.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def debuffs @debuffs end |
#defenses ⇒ Object (readonly)
Returns the value of attribute defenses.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def defenses @defenses end |
#faction ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def faction @faction end |
#faction_id ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def faction_id @faction_id end |
#gender ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def gender @gender end |
#gender_id ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def gender_id @gender_id end |
#guild ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def guild @guild end |
#guild_url ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def guild_url @guild_url end |
#health ⇒ Object (readonly)
character_tab
108 109 110 |
# File 'lib/wowr/classes.rb', line 108 def health @health end |
#intellect ⇒ Object (readonly) Also known as: int
character_tab
108 109 110 |
# File 'lib/wowr/classes.rb', line 108 def intellect @intellect end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def items @items end |
#klass ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def klass @klass end |
#klass_id ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def klass_id @klass_id end |
#last_modified ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def last_modified @last_modified end |
#level ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def level @level end |
#melee ⇒ Object (readonly)
Returns the value of attribute melee.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def melee @melee end |
#name ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def name @name end |
#professions ⇒ Object (readonly)
Returns the value of attribute professions.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def professions @professions end |
#pvp ⇒ Object (readonly)
Returns the value of attribute pvp.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def pvp @pvp end |
#race ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def race @race end |
#race_id ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def race_id @race_id end |
#ranged ⇒ Object (readonly)
Returns the value of attribute ranged.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def ranged @ranged end |
#realm ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def realm @realm end |
#resistances ⇒ Object (readonly)
Returns the value of attribute resistances.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def resistances @resistances end |
#second_bar ⇒ Object (readonly)
character_tab
108 109 110 |
# File 'lib/wowr/classes.rb', line 108 def @second_bar end |
#spell ⇒ Object (readonly)
Returns the value of attribute spell.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def spell @spell end |
#spirit ⇒ Object (readonly) Also known as: spi
character_tab
108 109 110 |
# File 'lib/wowr/classes.rb', line 108 def spirit @spirit end |
#stamina ⇒ Object (readonly) Also known as: sta
character_tab
108 109 110 |
# File 'lib/wowr/classes.rb', line 108 def stamina @stamina end |
#strength ⇒ Object (readonly) Also known as: str
character_tab
108 109 110 |
# File 'lib/wowr/classes.rb', line 108 def strength @strength end |
#talent_spec ⇒ Object (readonly)
Returns the value of attribute talent_spec.
116 117 118 |
# File 'lib/wowr/classes.rb', line 116 def talent_spec @talent_spec end |
#title ⇒ Object (readonly)
character_info
96 97 98 |
# File 'lib/wowr/classes.rb', line 96 def title @title end |
Instance Method Details
#character_info(elem) ⇒ Object
<character
battleGroup="Conviction"
charUrl="r=Genjuros&n=Jonlok"
class="Warlock"
classId="9"
faction="Horde"
factionId="1"
gender="Male"
genderId="0"
guildName=""
lastModified="12 February 2008"
level="41"
name="Jonlok"
prefix=""
race="Orc"
raceId="2"
realm="Genjuros"
suffix=""/>
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/wowr/classes.rb', line 150 def character_info(elem) # basic info @name = elem[:name] @level = elem[:level].to_i @char_url = elem[:charUrl] @klass = elem[:class] @klass_id = elem[:classId].to_i @gender = elem[:gender] @gender_id = elem[:genderId].to_i @race = elem[:race] @race_id = elem[:raceId].to_i @faction = elem[:faction] @faction_id = elem[:factionId].to_i @guild = elem[:guildName] == "" ? nil : elem[:guildName] @guild_url = elem[:guildUrl] == "" ? nil : elem[:guildUrl] @prefix = elem[:prefix] @suffix = elem[:suffix] @realm = elem[:realm] @battle_group = elem[:battleGroup] # format is February 11, 2008 @last_modified = elem[:lastModified] == "" ? nil : DateTime.parse(elem[:lastModified]) #@last_modified = elem[:lastModified]#.to_time @arena_teams = [] (elem/:arenaTeam).each do |arena_team| @arena_teams << ArenaTeam.new(arena_team) end end |
#character_tab(elem) ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/wowr/classes.rb', line 189 def character_tab(elem) # <title value=""/> @title = (elem%'title')[:value] == "" ? nil : (elem%'title')[:value] #@known_titles = <knownTitles/> @health = (elem%'characterBars'%'health')[:effective].to_i @second_bar = SecondBar.new(elem%'characterBars'%'secondBar') # base stats @strength = Strength.new(elem%'baseStats'%'strength') @agility = Agility.new(elem%'baseStats'%'agility') @stamina = Stamina.new(elem%'baseStats'%'stamina') @intellect = Intellect.new(elem%'baseStats'%'intellect') @spirit = Spirit.new(elem%'baseStats'%'spirit') # damage stuff @melee = Melee.new(elem%'melee') @ranged = Ranged.new(elem%'ranged') @spell = Spell.new(elem.at(' > spell')) # TODO: hacky? @defenses = Defenses.new(elem%'defenses') # TODO: Massive problem, doesn't fill in resistances for some reason resist_types = ['arcane', 'fire', 'frost', 'holy', 'nature', 'shadow'] @resistances = {} resist_types.each do |res| @resistances[res] = Resistance.new(elem%'resistances'%res) end @talent_spec = TalentSpec.new(elem%'talentSpec') @pvp = Pvp.new(elem%'pvp') @professions = [] (elem%'professions'/:skill).each do |skill| @professions << Profession.new(skill) end @items = [] (elem%'items'/:item).each do |item| @items << EquippedItem.new(item) end @buffs = [] (elem%'buffs'/:spell).each do |buff| @buffs << Buff.new(buff) end @debuffs = [] (elem%'debuffs'/:spell).each do |debuff| @debuffs << Buff.new(debuff) end end |