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
Sets the GemStone character injury display mode (wounds, scars, or both).
-
.method_missing(_method_name = nil) ⇒ nil
private
Handles calls to undefined injury body part methods.
Class Method Details
.fix_injury_mode(mode = 'both') ⇒ void
This method returns an undefined value.
Sets the GemStone character injury display mode (wounds, scars, or both).
Sends the _injury command and waits up to 7.5 seconds for XMLData.injury_mode to reflect the change. Does nothing if the character is already in the requested mode.
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 |
# File 'documented/games.rb', line 1581 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.
Handles calls to undefined injury body part methods.
Returns a formatted error message listing valid parts (arms, limbs, torso, etc.) extracted from XMLData.injuries.
1610 1611 1612 1613 1614 |
# File 'documented/games.rb', line 1610 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 |