Class: Lich::Gemstone::CharacterStatus
- Inherits:
-
Object
- Object
- Lich::Gemstone::CharacterStatus
- Defined in:
- documented/games.rb
Overview
Base class for character status tracking
Class Method Summary collapse
-
.fix_injury_mode(mode = 'both') ⇒ void
private
Sets the GemStone injury display mode (wounds, scars, or both).
-
.method_missing(_method_name = nil) ⇒ nil
private
Responds to unknown CharacterStatus class methods with a helpful error.
Class Method Details
.fix_injury_mode(mode = 'both') ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Sets the GemStone injury display mode (wounds, scars, or both).
Sends _injury commands to the server and waits up to 7.5 seconds for XMLData.injury_mode to reflect the change. Allows scripts to ensure a consistent view of character wounds/scars.
1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 |
# File 'documented/games.rb', line 1860 def fix_injury_mode(mode = 'both') # Default mode 'both' handles wounds (precedence) then scars case mode when 'scar', 'scars' unless XMLData.injury_mode == 1 Game._puts '_injury 1' 150.times { sleep 0.05; break if XMLData.injury_mode == 1 } end when 'wound', 'wounds' # future proof leaving in place, but this will likely not be used unless XMLData.injury_mode == 0 Game._puts '_injury 0' 150.times { sleep 0.05; break if XMLData.injury_mode == 0 } end when 'both' unless XMLData.injury_mode == 2 Game._puts '_injury 2' 150.times { sleep 0.05; break if XMLData.injury_mode == 2 } end else raise ArgumentError, "Invalid mode: #{mode}. Use 'scar', 'wound', or 'both'." end end |
.method_missing(_method_name = nil) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Responds to unknown CharacterStatus class methods with a helpful error.
Returns a bold error message listing valid injury areas (arms, limbs, torso, etc.).
1888 1889 1890 1891 1892 |
# File 'documented/games.rb', line 1888 def method_missing(_method_name = nil) result = Lich::Messaging.mono(Lich::Messaging.msg_format("bold", "#{self.name.split('::').last}: Invalid area, try one of these: arms, limbs, torso, #{XMLData.injuries.keys.join(', ')}")) # the _respond method used in Lich::Messaging returns nil upon success return result end |