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.

Examples:

GUILD_MANA_TYPES['Necromancer'] # => 'arcane'
GUILD_MANA_TYPES['Barbarian'] # => nil
{
  '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

Class Method Details

.ageInteger

Returns the current age of the character.

Returns:

  • (Integer)

    the character's age.



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.

Parameters:

  • val (Integer)

    the age to set for the character.



78
79
80
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 78

def self.age=(val)
  @@age = val
end

.agilityInteger

Returns the current agility of the character.

Returns:

  • (Integer)

    the character's agility.



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.

Parameters:

  • val (Integer)

    the agility to set for the character.



143
144
145
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 143

def self.agility=(val)
  @@agility = val
end

.balanceInteger

Returns the current balance of the character.

Returns:

  • (Integer)

    the character's balance.



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.

Parameters:

  • val (Integer)

    the balance to set for 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.

Returns:

  • (Boolean)

    true if the character is a Barbarian, false otherwise.



344
345
346
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 344

def self.barbarian?
  @@guild == 'Barbarian'
end

.bard?Boolean

Checks if the character's guild is Bard.

Returns:

  • (Boolean)

    true if the character is a Bard, false otherwise.



350
351
352
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 350

def self.bard?
  @@guild == 'Bard'
end

.charismaInteger

Returns the current charisma of the character.

Returns:

  • (Integer)

    the character's charisma.



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.

Parameters:

  • val (Integer)

    the charisma to set for the character.



195
196
197
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 195

def self.charisma=(val)
  @@charisma = val
end

.circleInteger

Returns the current circle of the character.

Returns:

  • (Integer)

    the character's circle.



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.

Parameters:

  • val (Integer)

    the circle to set for 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.

Returns:

  • (Boolean)

    true if the character is a Cleric, false otherwise.



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.

Returns:

  • (Boolean)

    true if the character is a Commoner, false otherwise.



362
363
364
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 362

def self.commoner?
  @@guild == 'Commoner'
end

.concentrationInteger

Returns the concentration of the character from XML data.

Returns:

  • (Integer)

    the character's concentration.



296
297
298
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 296

def self.concentration
  XMLData.concentration
end

.disciplineInteger

Returns the current discipline of the character.

Returns:

  • (Integer)

    the character's discipline.



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.

Parameters:

  • val (Integer)

    the discipline to set for 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.

Returns:

  • (Boolean)

    true if the character is an Empath, false otherwise.



368
369
370
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 368

def self.empath?
  @@guild == 'Empath'
end

.encumbranceInteger?

Returns the current encumbrance of the character.

Returns:

  • (Integer, nil)

    the character's encumbrance or nil if not set.



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.

Parameters:

  • val (Integer, nil)

    the encumbrance to set for the character.



260
261
262
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 260

def self.encumbrance=(val)
  @@encumbrance = val
end

.fatigueInteger

Returns the stamina of the character from XML data as fatigue.

Returns:

  • (Integer)

    the character's fatigue.



284
285
286
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 284

def self.fatigue
  XMLData.stamina
end

.favorsInteger

Returns the current favors of the character.

Returns:

  • (Integer)

    the character's favors.



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.

Parameters:

  • val (Integer)

    the favors to set for the character.



208
209
210
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 208

def self.favors=(val)
  @@favors = val
end

.genderString?

Returns the current gender of the character.

Returns:

  • (String, nil)

    the character's gender or nil if not set.



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.

Parameters:

  • val (String)

    the gender to set for the character.



65
66
67
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 65

def self.gender=(val)
  @@gender = val
end

.guildString?

Returns the current guild of the character.

Returns:

  • (String, nil)

    the character's guild or nil if not set.



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.

Parameters:

  • val (String)

    the guild to set for the character.



52
53
54
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 52

def self.guild=(val)
  @@guild = val
end

.healthInteger

Returns the health of the character from XML data.

Returns:

  • (Integer)

    the character's health.



272
273
274
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 272

def self.health
  XMLData.health
end

.intelligenceInteger

Returns the current intelligence of the character.

Returns:

  • (Integer)

    the character's intelligence.



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.

Parameters:

  • val (Integer)

    the intelligence to set for 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.

Parameters:

  • array (Array)

    the array containing serialized stats.



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

.luckInteger

Returns the current luck of the character.

Returns:

  • (Integer)

    the character's luck.



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.

Parameters:

  • val (Integer)

    the luck to set for the character.



234
235
236
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 234

def self.luck=(val)
  @@luck = val
end

.manaInteger

Returns the mana of the character from XML data.

Returns:

  • (Integer)

    the character's mana.



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.

Returns:

  • (Boolean)

    true if the character is a Moon Mage, false otherwise.



374
375
376
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 374

def self.moon_mage?
  @@guild == 'Moon Mage'
end

.nameString

Returns the name of the character from XML data.

Returns:

  • (String)

    the character's name.



266
267
268
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 266

def self.name
  XMLData.name
end

.native_manaString?

Returns the native mana type for the current guild.

Returns:

  • (String, nil)

    the native mana type or nil if not applicable.



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.

Returns:

  • (Boolean)

    true if the character is a Necromancer, false otherwise.



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.

Returns:

  • (Boolean)

    true if the character is a Paladin, false otherwise.



386
387
388
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 386

def self.paladin?
  @@guild == 'Paladin'
end

.raceString?

Returns the current race of the character.

Returns:

  • (String, nil)

    the character's race or nil if not set.



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.

Parameters:

  • val (String)

    the race to set for 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.

Returns:

  • (Boolean)

    true if the character is a Ranger, false otherwise.



392
393
394
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 392

def self.ranger?
  @@guild == 'Ranger'
end

.reflexInteger

Returns the current reflex of the character.

Returns:

  • (Integer)

    the character's reflex.



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.

Parameters:

  • val (Integer)

    the reflex to set for the character.



130
131
132
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 130

def self.reflex=(val)
  @@reflex = val
end

.serializeArray

Serializes the character's stats into an array.

Returns:

  • (Array)

    an array containing the serialized stats.



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

.spiritInteger

Returns the spirit of the character from XML data.

Returns:

  • (Integer)

    the character's spirit.



290
291
292
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 290

def self.spirit
  XMLData.spirit
end

.staminaInteger

Returns the current stamina of the character.

Returns:

  • (Integer)

    the character's stamina.



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.

Parameters:

  • val (Integer)

    the stamina to set for the character.



117
118
119
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 117

def self.stamina=(val)
  @@stamina = val
end

.strengthInteger

Returns the current strength of the character.

Returns:

  • (Integer)

    the character's strength.



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.

Parameters:

  • val (Integer)

    the strength to set for the character.



104
105
106
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 104

def self.strength=(val)
  @@strength = val
end

.tdpsInteger

Returns the current TDPS of the character.

Returns:

  • (Integer)

    the character's TDPS.



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.

Parameters:

  • val (Integer)

    the TDPS to set for 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.

Returns:

  • (Boolean)

    true if the character is a Thief, false otherwise.



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.

Returns:

  • (Boolean)

    true if the character is a Trader, false otherwise.



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.

Returns:

  • (Boolean)

    true if the character is a Warrior Mage, false otherwise.



410
411
412
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 410

def self.warrior_mage?
  @@guild == 'Warrior Mage'
end

.wisdomInteger

Returns the current wisdom of the character.

Returns:

  • (Integer)

    the character's wisdom.



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.

Parameters:

  • val (Integer)

    the wisdom to set for the character.



169
170
171
# File 'documented/dragonrealms/drinfomon/drstats.rb', line 169

def self.wisdom=(val)
  @@wisdom = val
end