Class: Lich::Common::Char
- Inherits:
-
Object
- Object
- Lich::Common::Char
- Defined in:
- documented/attributes/char.rb
Overview
Represents a character in the game.
This class provides methods to access various character attributes.
Class Method Summary collapse
-
.che ⇒ String?
Returns the 'che' attribute of the character if applicable.
-
.citizenship ⇒ String?
Returns the citizenship of the character if applicable.
- .citizenship=(_val) ⇒ void deprecated Deprecated.
- .dump_info ⇒ void deprecated Deprecated.
-
.encumbrance ⇒ String
Returns the current encumbrance of the character.
-
.health ⇒ Integer
Returns the current health of the character.
- .info ⇒ void deprecated Deprecated.
- .init(_blah) ⇒ void deprecated Deprecated.
- .load_info(_string) ⇒ void deprecated Deprecated.
-
.mana ⇒ Integer
Returns the current mana of the character.
-
.max_health ⇒ Integer
Returns the maximum health of the character.
-
.max_mana ⇒ Integer
Returns the maximum mana of the character.
-
.max_spirit ⇒ Integer
Returns the maximum spirit of the character.
-
.max_stamina ⇒ Integer
Returns the maximum stamina of the character.
- .maxhealth ⇒ Integer deprecated Deprecated.
- .maxmana ⇒ Integer deprecated Deprecated.
- .maxspirit ⇒ Integer deprecated Deprecated.
- .maxstamina ⇒ Integer deprecated Deprecated.
-
.method_missing(meth, *args) ⇒ Object
Handles calls to methods that are not defined.
-
.name ⇒ String
Returns the name of the character.
-
.percent_encumbrance ⇒ Integer
Returns the percentage of the character's encumbrance.
-
.percent_health ⇒ Integer
Returns the percentage of the character's health.
-
.percent_mana ⇒ Integer
Returns the percentage of the character's mana.
-
.percent_spirit ⇒ Integer
Returns the percentage of the character's spirit.
-
.percent_stamina ⇒ Integer
Returns the percentage of the character's stamina.
-
.percent_stance ⇒ Integer
Returns the percentage of the character's stance.
-
.respond_to?(m, *args) ⇒ Boolean
Checks if the character responds to a method.
- .skills ⇒ void deprecated Deprecated.
-
.spirit ⇒ Integer
Returns the current spirit of the character.
-
.stamina ⇒ Integer
Returns the current stamina of the character.
-
.stance ⇒ String
Returns the current stance of the character.
Class Method Details
.che ⇒ String?
Returns the 'che' attribute of the character if applicable.
248 249 250 |
# File 'documented/attributes/char.rb', line 248 def self.che Infomon.get('che') if XMLData.game =~ /^GS/ end |
.citizenship ⇒ String?
Returns the citizenship of the character if applicable.
232 233 234 |
# File 'documented/attributes/char.rb', line 232 def self.citizenship Infomon.get('citizenship') if XMLData.game =~ /^GS/ end |
.citizenship=(_val) ⇒ void
This method returns an undefined value.
Sets the citizenship of the character (deprecated).
This method is no longer supported and should be updated in scripts.
242 243 244 |
# File 'documented/attributes/char.rb', line 242 def self.citizenship=(_val) echo "Updating via Char.citizenship is no longer supported. Update or fix your script." end |
.dump_info ⇒ void
This method returns an undefined value.
Dumps character information (deprecated).
This method is no longer used and should be updated in scripts.
175 176 177 |
# File 'documented/attributes/char.rb', line 175 def self.dump_info echo "Char.dump_info is no longer used. Update or fix your script." end |
.encumbrance ⇒ String
Returns the current encumbrance of the character.
39 40 41 |
# File 'documented/attributes/char.rb', line 39 def self.encumbrance XMLData.encumbrance_text end |
.health ⇒ Integer
Returns the current health of the character.
51 52 53 |
# File 'documented/attributes/char.rb', line 51 def self.health XMLData.health end |
.info ⇒ void
This method returns an undefined value.
Returns character information (deprecated).
This method is no longer supported and should be updated in scripts.
217 218 219 |
# File 'documented/attributes/char.rb', line 217 def self.info echo "Char.info is no longer supported. Update or fix your script." end |
.init(_blah) ⇒ void
This method returns an undefined value.
Initializes the character (deprecated).
This method is no longer used and should be updated in scripts.
15 16 17 |
# File 'documented/attributes/char.rb', line 15 def self.init(_blah) echo 'Char.init is no longer used. Update or fix your script.' end |
.load_info(_string) ⇒ void
This method returns an undefined value.
Loads character information (deprecated).
This method is no longer used and should be updated in scripts.
185 186 187 |
# File 'documented/attributes/char.rb', line 185 def self.load_info(_string) echo "Char.load_info is no longer used. Update or fix your script." end |
.mana ⇒ Integer
Returns the current mana of the character.
57 58 59 |
# File 'documented/attributes/char.rb', line 57 def self.mana XMLData.mana end |
.max_health ⇒ Integer
Returns the maximum health of the character.
75 76 77 78 |
# File 'documented/attributes/char.rb', line 75 def self.max_health # Object.module_eval { XMLData.max_health } XMLData.max_health end |
.max_mana ⇒ Integer
Returns the maximum mana of the character.
92 93 94 |
# File 'documented/attributes/char.rb', line 92 def self.max_mana Object.module_eval { XMLData.max_mana } end |
.max_spirit ⇒ Integer
Returns the maximum spirit of the character.
108 109 110 |
# File 'documented/attributes/char.rb', line 108 def self.max_spirit Object.module_eval { XMLData.max_spirit } end |
.max_stamina ⇒ Integer
Returns the maximum stamina of the character.
124 125 126 |
# File 'documented/attributes/char.rb', line 124 def self.max_stamina Object.module_eval { XMLData.max_stamina } end |
.maxhealth ⇒ Integer
Returns the maximum health of the character (deprecated).
This method is deprecated; use #max_health instead.
85 86 87 88 |
# File 'documented/attributes/char.rb', line 85 def self.maxhealth Lich.deprecated("Char.maxhealth", "Char.max_health", caller[0], fe_log: true) Char.max_health end |
.maxmana ⇒ Integer
Returns the maximum mana of the character (deprecated).
This method is deprecated; use #max_mana instead.
101 102 103 104 |
# File 'documented/attributes/char.rb', line 101 def self.maxmana Lich.deprecated("Char.maxmana", "Char.max_mana", caller[0], fe_log: true) Char.max_mana end |
.maxspirit ⇒ Integer
Returns the maximum spirit of the character (deprecated).
This method is deprecated; use #max_spirit instead.
117 118 119 120 |
# File 'documented/attributes/char.rb', line 117 def self.maxspirit Lich.deprecated("Char.maxspirit", "Char.max_spirit", caller[0], fe_log: true) Char.max_spirit end |
.maxstamina ⇒ Integer
Returns the maximum stamina of the character (deprecated).
This method is deprecated; use #max_stamina instead.
133 134 135 136 |
# File 'documented/attributes/char.rb', line 133 def self.maxstamina Lich.deprecated("Char.maxstamina", "Char.max_stamina", caller[0], fe_log: true) Char.max_stamina end |
.method_missing(meth, *args) ⇒ Object
Handles calls to methods that are not defined.
201 202 203 204 205 206 207 208 209 210 |
# File 'documented/attributes/char.rb', line 201 def self.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
Returns the name of the character.
21 22 23 |
# File 'documented/attributes/char.rb', line 21 def self.name XMLData.name end |
.percent_encumbrance ⇒ Integer
Returns the percentage of the character's encumbrance.
45 46 47 |
# File 'documented/attributes/char.rb', line 45 def self.percent_encumbrance XMLData.encumbrance_value end |
.percent_health ⇒ Integer
Returns the percentage of the character's health.
140 141 142 |
# File 'documented/attributes/char.rb', line 140 def self.percent_health ((XMLData.health.to_f / XMLData.max_health.to_f) * 100).to_i end |
.percent_mana ⇒ Integer
Returns the percentage of the character's mana.
146 147 148 149 150 151 152 |
# File 'documented/attributes/char.rb', line 146 def self.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
Returns the percentage of the character's spirit.
156 157 158 |
# File 'documented/attributes/char.rb', line 156 def self.percent_spirit ((XMLData.spirit.to_f / XMLData.max_spirit.to_f) * 100).to_i end |
.percent_stamina ⇒ Integer
Returns the percentage of the character's stamina.
162 163 164 165 166 167 168 |
# File 'documented/attributes/char.rb', line 162 def self.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
Returns the percentage of the character's stance.
33 34 35 |
# File 'documented/attributes/char.rb', line 33 def self.percent_stance XMLData.stance_value end |
.respond_to?(m, *args) ⇒ Boolean
Checks if the character responds to a method.
193 194 195 |
# File 'documented/attributes/char.rb', line 193 def self.respond_to?(m, *args) [Stats, Skills, Spellsong].any? { |k| k.respond_to?(m) } or super(m, *args) end |
.skills ⇒ void
This method returns an undefined value.
Returns character skills (deprecated).
This method is no longer supported and should be updated in scripts.
226 227 228 |
# File 'documented/attributes/char.rb', line 226 def self.skills echo "Char.skills is no longer supported. Update or fix your script." end |
.spirit ⇒ Integer
Returns the current spirit of the character.
63 64 65 |
# File 'documented/attributes/char.rb', line 63 def self.spirit XMLData.spirit end |
.stamina ⇒ Integer
Returns the current stamina of the character.
69 70 71 |
# File 'documented/attributes/char.rb', line 69 def self.stamina XMLData.stamina end |
.stance ⇒ String
Returns the current stance of the character.
27 28 29 |
# File 'documented/attributes/char.rb', line 27 def self.stance XMLData.stance_text end |