Class: Lich::Common::Char
- Inherits:
-
Object
- Object
- Lich::Common::Char
- Defined in:
- lib/attributes/char.rb
Class Method Summary collapse
-
.che ⇒ String?
Retrieves the ‘che’ value of the character if the game is GS.
-
.citizenship ⇒ String?
Retrieves the citizenship of the character if the game is GS.
-
.citizenship=(_val) ⇒ void
deprecated
Deprecated.
Updating via Char.citizenship is no longer supported. Update or fix your script.
-
.dump_info ⇒ void
deprecated
Deprecated.
Char.dump_info is no longer used. Update or fix your script.
-
.encumbrance ⇒ String
Retrieves the encumbrance text of the character.
-
.health ⇒ Integer
Retrieves the current health of the character.
-
.info ⇒ void
deprecated
Deprecated.
Char.info is no longer supported. Update or fix your script.
-
.init(_blah) ⇒ void
deprecated
Deprecated.
Char.init is no longer used. Update or fix your script.
-
.load_info(_string) ⇒ void
deprecated
Deprecated.
Char.load_info is no longer used. Update or fix your script.
-
.mana ⇒ Integer
Retrieves the current mana of the character.
-
.max_health ⇒ Integer
Retrieves the maximum health of the character.
-
.max_mana ⇒ Integer
Retrieves the maximum mana of the character.
-
.max_spirit ⇒ Integer
Retrieves the maximum spirit of the character.
-
.max_stamina ⇒ Integer
Retrieves the maximum stamina of the character.
-
.maxhealth ⇒ Integer
deprecated
Deprecated.
Use Char.max_health instead.
-
.maxmana ⇒ Integer
deprecated
Deprecated.
Use Char.max_mana instead.
-
.maxspirit ⇒ Integer
deprecated
Deprecated.
Use Char.max_spirit instead.
-
.maxstamina ⇒ Integer
deprecated
Deprecated.
Use Char.max_stamina instead.
-
.method_missing(meth, *args) ⇒ Object
Handles missing methods by delegating to Stats, Skills, or Spellsong.
-
.name ⇒ String
Retrieves the name of the character.
-
.percent_encumbrance ⇒ Integer
Retrieves the encumbrance value of the character as a percentage.
-
.percent_health ⇒ Integer
Retrieves the current health of the character as a percentage.
-
.percent_mana ⇒ Integer
Retrieves the current mana of the character as a percentage.
-
.percent_spirit ⇒ Integer
Retrieves the current spirit of the character as a percentage.
-
.percent_stamina ⇒ Integer
Retrieves the current stamina of the character as a percentage.
-
.percent_stance ⇒ Integer
Retrieves the stance value of the character as a percentage.
-
.respond_to?(m, *args) ⇒ Boolean
Checks if the character responds to a method.
-
.skills ⇒ void
deprecated
Deprecated.
Char.skills is no longer supported. Update or fix your script.
-
.spirit ⇒ Integer
Retrieves the current spirit of the character.
-
.stamina ⇒ Integer
Retrieves the current stamina of the character.
-
.stance ⇒ String
Retrieves the stance text of the character.
Class Method Details
.che ⇒ String?
Retrieves the ‘che’ value of the character if the game is GS.
319 320 321 |
# File 'lib/attributes/char.rb', line 319 def Char.che Infomon.get('che') if XMLData.game =~ /^GS/ end |
.citizenship ⇒ String?
Retrieves the citizenship of the character if the game is GS.
299 300 301 |
# File 'lib/attributes/char.rb', line 299 def Char.citizenship Infomon.get('citizenship') if XMLData.game =~ /^GS/ end |
.citizenship=(_val) ⇒ void
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).
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_info ⇒ void
Char.dump_info is no longer used. Update or fix your script.
This method returns an undefined value.
Dumps character information (deprecated).
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 |
.encumbrance ⇒ String
Retrieves the encumbrance text of the character.
47 48 49 |
# File 'lib/attributes/char.rb', line 47 def Char.encumbrance XMLData.encumbrance_text end |
.health ⇒ Integer
Retrieves the current health of the character.
65 66 67 |
# File 'lib/attributes/char.rb', line 65 def Char.health XMLData.health end |
.info ⇒ void
Char.info is no longer supported. Update or fix your script.
This method returns an undefined value.
Retrieves character information (deprecated).
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
Char.init is no longer used. Update or fix your script.
This method returns an undefined value.
Initializes the Char class.
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
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).
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 |
.mana ⇒ Integer
Retrieves the current mana of the character.
74 75 76 |
# File 'lib/attributes/char.rb', line 74 def Char.mana XMLData.mana end |
.max_health ⇒ Integer
Retrieves 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_mana ⇒ Integer
Retrieves 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_spirit ⇒ Integer
Retrieves 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_stamina ⇒ Integer
Retrieves 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 |
.maxhealth ⇒ Integer
Use Char.max_health instead.
Retrieves the maximum health of the character (deprecated).
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 |
.maxmana ⇒ Integer
Use Char.max_mana instead.
Retrieves the maximum mana of the character (deprecated).
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 |
.maxspirit ⇒ Integer
Use Char.max_spirit instead.
Retrieves the maximum spirit of the character (deprecated).
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 |
.maxstamina ⇒ Integer
Use Char.max_stamina instead.
Retrieves the maximum stamina of the character (deprecated).
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.
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 |
.name ⇒ String
Retrieves the name of the character.
20 21 22 |
# File 'lib/attributes/char.rb', line 20 def Char.name XMLData.name end |
.percent_encumbrance ⇒ Integer
Retrieves the encumbrance value of the character as a percentage.
56 57 58 |
# File 'lib/attributes/char.rb', line 56 def Char.percent_encumbrance XMLData.encumbrance_value end |
.percent_health ⇒ Integer
Retrieves the current health of the character as a percentage.
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_mana ⇒ Integer
Retrieves the current mana of the character as a percentage.
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_spirit ⇒ Integer
Retrieves the current spirit of the character as a percentage.
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_stamina ⇒ Integer
Retrieves the current stamina of the character as a percentage.
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_stance ⇒ Integer
Retrieves the stance value of the character as a percentage.
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.
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 |
.skills ⇒ void
Char.skills is no longer supported. Update or fix your script.
This method returns an undefined value.
Retrieves character skills (deprecated).
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 |
.spirit ⇒ Integer
Retrieves the current spirit of the character.
83 84 85 |
# File 'lib/attributes/char.rb', line 83 def Char.spirit XMLData.spirit end |
.stamina ⇒ Integer
Retrieves the current stamina of the character.
92 93 94 |
# File 'lib/attributes/char.rb', line 92 def Char.stamina XMLData.stamina end |