Class: Lich::Common::Char

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

Class Method Summary collapse

Class Method Details

.cheString?

Retrieves the ‘che’ value of the character if the game is GS.

Examples:

che_value = Char.che

Returns:

  • (String, nil)

    The ‘che’ value of the character or nil if not applicable.



319
320
321
# File 'lib/attributes/char.rb', line 319

def Char.che
  Infomon.get('che') if XMLData.game =~ /^GS/
end

.citizenshipString?

Retrieves the citizenship of the character if the game is GS.

Examples:

citizenship = Char.citizenship

Returns:

  • (String, nil)

    The citizenship of the character or nil if not applicable.



299
300
301
# File 'lib/attributes/char.rb', line 299

def Char.citizenship
  Infomon.get('citizenship') if XMLData.game =~ /^GS/
end

.citizenship=(_val) ⇒ void

Deprecated.

Updating via Char.citizenship is no longer supported. Update or fix your script.

This method returns an undefined value.

Sets the citizenship of the character (deprecated).

Examples:

Char.citizenship = "New Citizenship"

Parameters:

  • _val (Object)

    The value to set for citizenship.



310
311
312
# File 'lib/attributes/char.rb', line 310

def Char.citizenship=(_val)
  echo "Updating via Char.citizenship is no longer supported. Update or fix your script."
end

.dump_infovoid

Deprecated.

Char.dump_info is no longer used. Update or fix your script.

This method returns an undefined value.

Dumps character information (deprecated).

Examples:

Char.dump_info


227
228
229
# File 'lib/attributes/char.rb', line 227

def Char.dump_info
  echo "Char.dump_info is no longer used. Update or fix your script."
end

.encumbranceString

Retrieves the encumbrance text of the character.

Examples:

character_encumbrance = Char.encumbrance

Returns:

  • (String)

    The encumbrance text of the character.



47
48
49
# File 'lib/attributes/char.rb', line 47

def Char.encumbrance
  XMLData.encumbrance_text
end

.healthInteger

Retrieves the current health of the character.

Examples:

current_health = Char.health

Returns:

  • (Integer)

    The current health of the character.



65
66
67
# File 'lib/attributes/char.rb', line 65

def Char.health
  XMLData.health
end

.infovoid

Deprecated.

Char.info is no longer supported. Update or fix your script.

This method returns an undefined value.

Retrieves character information (deprecated).

Examples:

Char.info


280
281
282
# File 'lib/attributes/char.rb', line 280

def Char.info
  echo "Char.info is no longer supported. Update or fix your script."
end

.init(_blah) ⇒ void

Deprecated.

Char.init is no longer used. Update or fix your script.

This method returns an undefined value.

Initializes the Char class.

Parameters:

  • _blah (Object)

    Unused parameter.



11
12
13
# File 'lib/attributes/char.rb', line 11

def Char.init(_blah)
  echo 'Char.init is no longer used. Update or fix your script.'
end

.load_info(_string) ⇒ void

Deprecated.

Char.load_info is no longer used. Update or fix your script.

This method returns an undefined value.

Loads character information from a string (deprecated).

Examples:

Char.load_info("character data")

Parameters:

  • _string (String)

    The string containing character information.



238
239
240
# File 'lib/attributes/char.rb', line 238

def Char.load_info(_string)
  echo "Char.load_info is no longer used. Update or fix your script."
end

.manaInteger

Retrieves the current mana of the character.

Examples:

current_mana = Char.mana

Returns:

  • (Integer)

    The current mana of the character.



74
75
76
# File 'lib/attributes/char.rb', line 74

def Char.mana
  XMLData.mana
end

.max_healthInteger

Retrieves the maximum health of the character.

Examples:

max_health = Char.max_health

Returns:

  • (Integer)

    The maximum health of the character.



101
102
103
104
# File 'lib/attributes/char.rb', line 101

def Char.max_health
  # Object.module_eval { XMLData.max_health }
  XMLData.max_health
end

.max_manaInteger

Retrieves the maximum mana of the character.

Examples:

max_mana = Char.max_mana

Returns:

  • (Integer)

    The maximum mana of the character.



122
123
124
# File 'lib/attributes/char.rb', line 122

def Char.max_mana
  Object.module_eval { XMLData.max_mana }
end

.max_spiritInteger

Retrieves the maximum spirit of the character.

Examples:

max_spirit = Char.max_spirit

Returns:

  • (Integer)

    The maximum spirit of the character.



142
143
144
# File 'lib/attributes/char.rb', line 142

def Char.max_spirit
  Object.module_eval { XMLData.max_spirit }
end

.max_staminaInteger

Retrieves the maximum stamina of the character.

Examples:

max_stamina = Char.max_stamina

Returns:

  • (Integer)

    The maximum stamina of the character.



162
163
164
# File 'lib/attributes/char.rb', line 162

def Char.max_stamina
  Object.module_eval { XMLData.max_stamina }
end

.maxhealthInteger

Deprecated.

Use Char.max_health instead.

Retrieves the maximum health of the character (deprecated).

Examples:

max_health = Char.maxhealth

Returns:

  • (Integer)

    The maximum health of the character.



112
113
114
115
# File 'lib/attributes/char.rb', line 112

def Char.maxhealth
  Lich.deprecated("Char.maxhealth", "Char.max_health", caller[0], fe_log: true)
  Char.max_health
end

.maxmanaInteger

Deprecated.

Use Char.max_mana instead.

Retrieves the maximum mana of the character (deprecated).

Examples:

max_mana = Char.maxmana

Returns:

  • (Integer)

    The maximum mana of the character.



132
133
134
135
# File 'lib/attributes/char.rb', line 132

def Char.maxmana
  Lich.deprecated("Char.maxmana", "Char.max_mana", caller[0], fe_log: true)
  Char.max_mana
end

.maxspiritInteger

Deprecated.

Use Char.max_spirit instead.

Retrieves the maximum spirit of the character (deprecated).

Examples:

max_spirit = Char.maxspirit

Returns:

  • (Integer)

    The maximum spirit of the character.



152
153
154
155
# File 'lib/attributes/char.rb', line 152

def Char.maxspirit
  Lich.deprecated("Char.maxspirit", "Char.max_spirit", caller[0], fe_log: true)
  Char.max_spirit
end

.maxstaminaInteger

Deprecated.

Use Char.max_stamina instead.

Retrieves the maximum stamina of the character (deprecated).

Examples:

max_stamina = Char.maxstamina

Returns:

  • (Integer)

    The maximum stamina of the character.



172
173
174
175
# File 'lib/attributes/char.rb', line 172

def Char.maxstamina
  Lich.deprecated("Char.maxstamina", "Char.max_stamina", caller[0], fe_log: true)
  Char.max_stamina
end

.method_missing(meth, *args) ⇒ Object

Handles missing methods by delegating to Stats, Skills, or Spellsong.

Examples:

Char.some_missing_method

Parameters:

  • meth (Symbol)

    The missing method name.

  • args (Array)

    The arguments to pass to the method.

Returns:

  • (Object)

    The result of the delegated method call.

Raises:

  • (NoMethodError)

    If the method is not found in any of the classes.



263
264
265
266
267
268
269
270
271
272
# File 'lib/attributes/char.rb', line 263

def Char.method_missing(meth, *args)
  polyfill = [Stats, Skills, Spellsong].find { |klass|
    klass.respond_to?(meth, *args)
  }
  if polyfill
    Lich.deprecated("Char.#{meth}", "#{polyfill}.#{meth}", caller[0])
    return polyfill.send(meth, *args)
  end
  super(meth, *args)
end

.nameString

Retrieves the name of the character.

Examples:

character_name = Char.name

Returns:

  • (String)

    The name of the character.



20
21
22
# File 'lib/attributes/char.rb', line 20

def Char.name
  XMLData.name
end

.percent_encumbranceInteger

Retrieves the encumbrance value of the character as a percentage.

Examples:

encumbrance_percentage = Char.percent_encumbrance

Returns:

  • (Integer)

    The percentage of the character’s encumbrance.



56
57
58
# File 'lib/attributes/char.rb', line 56

def Char.percent_encumbrance
  XMLData.encumbrance_value
end

.percent_healthInteger

Retrieves the current health of the character as a percentage.

Examples:

health_percentage = Char.percent_health

Returns:

  • (Integer)

    The percentage of the character’s health.



182
183
184
# File 'lib/attributes/char.rb', line 182

def Char.percent_health
  ((XMLData.health.to_f / XMLData.max_health.to_f) * 100).to_i
end

.percent_manaInteger

Retrieves the current mana of the character as a percentage.

Examples:

mana_percentage = Char.percent_mana

Returns:

  • (Integer)

    The percentage of the character’s mana.



191
192
193
194
195
196
197
# File 'lib/attributes/char.rb', line 191

def Char.percent_mana
  if XMLData.max_mana == 0
    100
  else
    ((XMLData.mana.to_f / XMLData.max_mana.to_f) * 100).to_i
  end
end

.percent_spiritInteger

Retrieves the current spirit of the character as a percentage.

Examples:

spirit_percentage = Char.percent_spirit

Returns:

  • (Integer)

    The percentage of the character’s spirit.



204
205
206
# File 'lib/attributes/char.rb', line 204

def Char.percent_spirit
  ((XMLData.spirit.to_f / XMLData.max_spirit.to_f) * 100).to_i
end

.percent_staminaInteger

Retrieves the current stamina of the character as a percentage.

Examples:

stamina_percentage = Char.percent_stamina

Returns:

  • (Integer)

    The percentage of the character’s stamina.



213
214
215
216
217
218
219
# File 'lib/attributes/char.rb', line 213

def Char.percent_stamina
  if XMLData.max_stamina == 0
    100
  else
    ((XMLData.stamina.to_f / XMLData.max_stamina.to_f) * 100).to_i
  end
end

.percent_stanceInteger

Retrieves the stance value of the character as a percentage.

Examples:

stance_percentage = Char.percent_stance

Returns:

  • (Integer)

    The percentage of the character’s stance.



38
39
40
# File 'lib/attributes/char.rb', line 38

def Char.percent_stance
  XMLData.stance_value
end

.respond_to?(m, *args) ⇒ Boolean

Checks if the character responds to a method.

Examples:

if Char.respond_to?(:health)
  puts "Char can respond to health"
end

Parameters:

  • m (Symbol)

    The method name to check.

  • args (Array)

    The arguments to pass to the method.

Returns:

  • (Boolean)

    True if the character responds to the method, false otherwise.



251
252
253
# File 'lib/attributes/char.rb', line 251

def Char.respond_to?(m, *args)
  [Stats, Skills, Spellsong].any? { |k| k.respond_to?(m) } or super(m, *args)
end

.skillsvoid

Deprecated.

Char.skills is no longer supported. Update or fix your script.

This method returns an undefined value.

Retrieves character skills (deprecated).

Examples:

Char.skills


290
291
292
# File 'lib/attributes/char.rb', line 290

def Char.skills
  echo "Char.skills is no longer supported. Update or fix your script."
end

.spiritInteger

Retrieves the current spirit of the character.

Examples:

current_spirit = Char.spirit

Returns:

  • (Integer)

    The current spirit of the character.



83
84
85
# File 'lib/attributes/char.rb', line 83

def Char.spirit
  XMLData.spirit
end

.staminaInteger

Retrieves the current stamina of the character.

Examples:

current_stamina = Char.stamina

Returns:

  • (Integer)

    The current stamina of the character.



92
93
94
# File 'lib/attributes/char.rb', line 92

def Char.stamina
  XMLData.stamina
end

.stanceString

Retrieves the stance text of the character.

Examples:

character_stance = Char.stance

Returns:

  • (String)

    The stance text of the character.



29
30
31
# File 'lib/attributes/char.rb', line 29

def Char.stance
  XMLData.stance_text
end