Module: Lich::DragonRealms::DRStats
- Defined in:
- documented/dragonrealms/drinfomon/drstats.rb
Overview
Module for managing DragonRealms character statistics.
This module handles various character attributes such as race, guild, and stats.
Constant Summary collapse
- GUILD_MANA_TYPES =
Guilds and their native mana types, frozen for immutability. Guilds and their native mana types, frozen for immutability.
{ 'Necromancer' => 'arcane', 'Barbarian' => nil, 'Thief' => nil, 'Moon Mage' => 'lunar', 'Trader' => 'lunar', 'Warrior Mage' => 'elemental', 'Bard' => 'elemental', 'Cleric' => 'holy', 'Paladin' => 'holy', 'Empath' => 'life', 'Ranger' => 'life' }.freeze
- @@race =
nil- @@guild =
nil- @@gender =
nil- @@encumbrance =
nil
Class Method Summary collapse
-
.age ⇒ Integer
Returns the current age of the character.
-
.age=(val) ⇒ void
Sets the age of the character.
-
.agility ⇒ Integer
Returns the current agility of the character.
-
.agility=(val) ⇒ void
Sets the agility of the character.
-
.balance ⇒ Integer
Returns the current balance of the character.
-
.balance=(val) ⇒ void
Sets the balance of the character.
-
.barbarian? ⇒ Boolean
Checks if the character's guild is Barbarian.
-
.bard? ⇒ Boolean
Checks if the character's guild is Bard.
-
.charisma ⇒ Integer
Returns the current charisma of the character.
-
.charisma=(val) ⇒ void
Sets the charisma of the character.
-
.circle ⇒ Integer
Returns the current circle of the character.
-
.circle=(val) ⇒ void
Sets the circle of the character.
-
.cleric? ⇒ Boolean
Checks if the character's guild is Cleric.
-
.commoner? ⇒ Boolean
Checks if the character's guild is Commoner.
-
.concentration ⇒ Integer
Returns the concentration of the character from XML data.
-
.discipline ⇒ Integer
Returns the current discipline of the character.
-
.discipline=(val) ⇒ void
Sets the discipline of the character.
-
.empath? ⇒ Boolean
Checks if the character's guild is Empath.
-
.encumbrance ⇒ Integer?
Returns the current encumbrance of the character.
-
.encumbrance=(val) ⇒ void
Sets the encumbrance of the character.
-
.fatigue ⇒ Integer
Returns the stamina of the character from XML data as fatigue.
-
.favors ⇒ Integer
Returns the current favors of the character.
-
.favors=(val) ⇒ void
Sets the favors of the character.
-
.gender ⇒ String?
Returns the current gender of the character.
-
.gender=(val) ⇒ void
Sets the gender of the character.
-
.guild ⇒ String?
Returns the current guild of the character.
-
.guild=(val) ⇒ void
Sets the guild of the character.
-
.health ⇒ Integer
Returns the health of the character from XML data.
-
.intelligence ⇒ Integer
Returns the current intelligence of the character.
-
.intelligence=(val) ⇒ void
Sets the intelligence of the character.
-
.load_serialized=(array) ⇒ void
Loads character stats from a serialized array.
-
.luck ⇒ Integer
Returns the current luck of the character.
-
.luck=(val) ⇒ void
Sets the luck of the character.
-
.mana ⇒ Integer
Returns the mana of the character from XML data.
-
.moon_mage? ⇒ Boolean
Checks if the character's guild is Moon Mage.
-
.name ⇒ String
Returns the name of the character from XML data.
-
.native_mana ⇒ String?
Returns the native mana type for the current guild.
-
.necromancer? ⇒ Boolean
Checks if the character's guild is Necromancer.
-
.paladin? ⇒ Boolean
Checks if the character's guild is Paladin.
-
.race ⇒ String?
Returns the current race of the character.
-
.race=(val) ⇒ void
Sets the race of the character.
-
.ranger? ⇒ Boolean
Checks if the character's guild is Ranger.
-
.reflex ⇒ Integer
Returns the current reflex of the character.
-
.reflex=(val) ⇒ void
Sets the reflex of the character.
-
.serialize ⇒ Array
Serializes the character's stats into an array.
-
.spirit ⇒ Integer
Returns the spirit of the character from XML data.
-
.stamina ⇒ Integer
Returns the current stamina of the character.
-
.stamina=(val) ⇒ void
Sets the stamina of the character.
-
.strength ⇒ Integer
Returns the current strength of the character.
-
.strength=(val) ⇒ void
Sets the strength of the character.
-
.tdps ⇒ Integer
Returns the current TDPS of the character.
-
.tdps=(val) ⇒ void
Sets the TDPS of the character.
-
.thief? ⇒ Boolean
Checks if the character's guild is Thief.
-
.trader? ⇒ Boolean
Checks if the character's guild is Trader.
-
.warrior_mage? ⇒ Boolean
Checks if the character's guild is Warrior Mage.
-
.wisdom ⇒ Integer
Returns the current wisdom of the character.
-
.wisdom=(val) ⇒ void
Sets the wisdom of the character.
Class Method Details
.age ⇒ Integer
Returns the current age of the character.
71 72 73 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 71 def self.age @@age end |
.age=(val) ⇒ void
This method returns an undefined value.
Sets the age of the character.
78 79 80 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 78 def self.age=(val) @@age = val end |
.agility ⇒ Integer
Returns the current agility of the character.
136 137 138 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 136 def self.agility @@agility end |
.agility=(val) ⇒ void
This method returns an undefined value.
Sets the agility of the character.
143 144 145 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 143 def self.agility=(val) @@agility = val end |
.balance ⇒ Integer
Returns the current balance of the character.
240 241 242 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 240 def self.balance @@balance end |
.balance=(val) ⇒ void
This method returns an undefined value.
Sets the balance of the character.
247 248 249 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 247 def self.balance=(val) @@balance = val end |
.barbarian? ⇒ Boolean
Checks if the character's guild is Barbarian.
344 345 346 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 344 def self. @@guild == 'Barbarian' end |
.bard? ⇒ Boolean
Checks if the character's guild is Bard.
350 351 352 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 350 def self. @@guild == 'Bard' end |
.charisma ⇒ Integer
Returns the current charisma of the character.
188 189 190 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 188 def self.charisma @@charisma end |
.charisma=(val) ⇒ void
This method returns an undefined value.
Sets the charisma of the character.
195 196 197 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 195 def self.charisma=(val) @@charisma = val end |
.circle ⇒ Integer
Returns the current circle of the character.
84 85 86 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 84 def self.circle @@circle end |
.circle=(val) ⇒ void
This method returns an undefined value.
Sets the circle of the character.
91 92 93 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 91 def self.circle=(val) @@circle = val end |
.cleric? ⇒ Boolean
Checks if the character's guild is Cleric.
356 357 358 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 356 def self.cleric? @@guild == 'Cleric' end |
.commoner? ⇒ Boolean
Checks if the character's guild is Commoner.
362 363 364 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 362 def self.commoner? @@guild == 'Commoner' end |
.concentration ⇒ Integer
Returns the concentration of the character from XML data.
296 297 298 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 296 def self.concentration XMLData.concentration end |
.discipline ⇒ Integer
Returns the current discipline of the character.
175 176 177 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 175 def self.discipline @@discipline end |
.discipline=(val) ⇒ void
This method returns an undefined value.
Sets the discipline of the character.
182 183 184 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 182 def self.discipline=(val) @@discipline = val end |
.empath? ⇒ Boolean
Checks if the character's guild is Empath.
368 369 370 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 368 def self.empath? @@guild == 'Empath' end |
.encumbrance ⇒ Integer?
Returns the current encumbrance of the character.
253 254 255 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 253 def self.encumbrance @@encumbrance end |
.encumbrance=(val) ⇒ void
This method returns an undefined value.
Sets the encumbrance of the character.
260 261 262 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 260 def self.encumbrance=(val) @@encumbrance = val end |
.fatigue ⇒ Integer
Returns the stamina of the character from XML data as fatigue.
284 285 286 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 284 def self.fatigue XMLData.stamina end |
.favors ⇒ Integer
Returns the current favors of the character.
201 202 203 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 201 def self.favors @@favors end |
.favors=(val) ⇒ void
This method returns an undefined value.
Sets the favors of the character.
208 209 210 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 208 def self.favors=(val) @@favors = val end |
.gender ⇒ String?
Returns the current gender of the character.
58 59 60 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 58 def self.gender @@gender end |
.gender=(val) ⇒ void
This method returns an undefined value.
Sets the gender of the character.
65 66 67 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 65 def self.gender=(val) @@gender = val end |
.guild ⇒ String?
Returns the current guild of the character.
45 46 47 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 45 def self.guild @@guild end |
.guild=(val) ⇒ void
This method returns an undefined value.
Sets the guild of the character.
52 53 54 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 52 def self.guild=(val) @@guild = val end |
.health ⇒ Integer
Returns the health of the character from XML data.
272 273 274 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 272 def self.health XMLData.health end |
.intelligence ⇒ Integer
Returns the current intelligence of the character.
149 150 151 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 149 def self.intelligence @@intelligence end |
.intelligence=(val) ⇒ void
This method returns an undefined value.
Sets the intelligence of the character.
156 157 158 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 156 def self.intelligence=(val) @@intelligence = val end |
.load_serialized=(array) ⇒ void
This method returns an undefined value.
Loads character stats from a serialized array.
335 336 337 338 339 340 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 335 def self.load_serialized=(array) return if array.nil? || array.empty? @@race, @@guild, @@gender, @@age = array[0..3] @@circle, @@strength, @@stamina, @@reflex, @@agility, @@intelligence, @@wisdom, @@discipline, @@charisma, @@favors, @@tdps, @@luck, @@encumbrance = array[4..16] end |
.luck ⇒ Integer
Returns the current luck of the character.
227 228 229 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 227 def self.luck @@luck end |
.luck=(val) ⇒ void
This method returns an undefined value.
Sets the luck of the character.
234 235 236 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 234 def self.luck=(val) @@luck = val end |
.mana ⇒ Integer
Returns the mana of the character from XML data.
278 279 280 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 278 def self.mana XMLData.mana end |
.moon_mage? ⇒ Boolean
Checks if the character's guild is Moon Mage.
374 375 376 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 374 def self.moon_mage? @@guild == 'Moon Mage' end |
.name ⇒ String
Returns the name of the character from XML data.
266 267 268 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 266 def self.name XMLData.name end |
.native_mana ⇒ String?
Returns the native mana type for the current guild.
322 323 324 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 322 def self.native_mana GUILD_MANA_TYPES[@@guild] end |
.necromancer? ⇒ Boolean
Checks if the character's guild is Necromancer.
380 381 382 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 380 def self.necromancer? @@guild == 'Necromancer' end |
.paladin? ⇒ Boolean
Checks if the character's guild is Paladin.
386 387 388 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 386 def self.paladin? @@guild == 'Paladin' end |
.race ⇒ String?
Returns the current race of the character.
32 33 34 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 32 def self.race @@race end |
.race=(val) ⇒ void
This method returns an undefined value.
Sets the race of the character.
39 40 41 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 39 def self.race=(val) @@race = val end |
.ranger? ⇒ Boolean
Checks if the character's guild is Ranger.
392 393 394 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 392 def self.ranger? @@guild == 'Ranger' end |
.reflex ⇒ Integer
Returns the current reflex of the character.
123 124 125 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 123 def self.reflex @@reflex end |
.reflex=(val) ⇒ void
This method returns an undefined value.
Sets the reflex of the character.
130 131 132 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 130 def self.reflex=(val) @@reflex = val end |
.serialize ⇒ Array
Serializes the character's stats into an array.
328 329 330 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 328 def self.serialize [@@race, @@guild, @@gender, @@age, @@circle, @@strength, @@stamina, @@reflex, @@agility, @@intelligence, @@wisdom, @@discipline, @@charisma, @@favors, @@tdps, @@luck, @@encumbrance] end |
.spirit ⇒ Integer
Returns the spirit of the character from XML data.
290 291 292 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 290 def self.spirit XMLData.spirit end |
.stamina ⇒ Integer
Returns the current stamina of the character.
110 111 112 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 110 def self.stamina @@stamina end |
.stamina=(val) ⇒ void
This method returns an undefined value.
Sets the stamina of the character.
117 118 119 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 117 def self.stamina=(val) @@stamina = val end |
.strength ⇒ Integer
Returns the current strength of the character.
97 98 99 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 97 def self.strength @@strength end |
.strength=(val) ⇒ void
This method returns an undefined value.
Sets the strength of the character.
104 105 106 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 104 def self.strength=(val) @@strength = val end |
.tdps ⇒ Integer
Returns the current TDPS of the character.
214 215 216 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 214 def self.tdps @@tdps end |
.tdps=(val) ⇒ void
This method returns an undefined value.
Sets the TDPS of the character.
221 222 223 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 221 def self.tdps=(val) @@tdps = val end |
.thief? ⇒ Boolean
Checks if the character's guild is Thief.
398 399 400 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 398 def self.thief? @@guild == 'Thief' end |
.trader? ⇒ Boolean
Checks if the character's guild is Trader.
404 405 406 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 404 def self.trader? @@guild == 'Trader' end |
.warrior_mage? ⇒ Boolean
Checks if the character's guild is Warrior Mage.
410 411 412 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 410 def self.warrior_mage? @@guild == 'Warrior Mage' end |
.wisdom ⇒ Integer
Returns the current wisdom of the character.
162 163 164 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 162 def self.wisdom @@wisdom end |
.wisdom=(val) ⇒ void
This method returns an undefined value.
Sets the wisdom of the character.
169 170 171 |
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 169 def self.wisdom=(val) @@wisdom = val end |