Class: Lich::Gemstone::ReadyList
- Inherits:
-
Object
- Object
- Lich::Gemstone::ReadyList
- Defined in:
- documented/gemstone/readylist.rb
Overview
Represents a ready list for managing equipped items in the Lich game. This class provides methods to check, reset, and validate the items in the ready list.
Constant Summary collapse
- ORIGINAL_READY_LIST =
The original list of ready items. This constant defines the default items that can be included in the ready list.
[:shield, :weapon, :secondary_weapon, :ranged_weapon, :ammo_bundle, :ammo2_bundle, :sheath, :secondary_sheath, :wand]
- ORIGINAL_STORE_LIST =
The original list of store items. This constant defines the default items that can be included in the store list.
[:shield, :weapon, :secondary_weapon, :ranged_weapon, :ammo_bundle, :wand]
Class Method Summary collapse
-
.check(silent: false, quiet: false) ⇒ void
Checks the current settings of the ready list.
-
.checked=(value) ⇒ Boolean
Sets the checked status of the ready list.
-
.checked? ⇒ Boolean
Checks if the ready list has been validated.
-
.ready_list ⇒ Hash
Returns the current ready list.
-
.reset(all: false) ⇒ void
Resets the ready and store lists.
-
.store_list ⇒ Hash
Returns the current store list.
-
.valid?(all: false) ⇒ Boolean
Validates the items in the ready list.
Class Method Details
.check(silent: false, quiet: false) ⇒ void
This method returns an undefined value.
Checks the current settings of the ready list.
117 118 119 120 121 122 123 124 125 126 |
# File 'documented/gemstone/readylist.rb', line 117 def check(silent: false, quiet: false) if quiet start_pattern = /<output class="mono"\/>/ else start_pattern = /Your current settings are:/ end waitrt? Lich::Util.issue_command("ready list", start_pattern, silent: silent, quiet: quiet) @checked = true end |
.checked=(value) ⇒ Boolean
Sets the checked status of the ready list.
71 72 73 |
# File 'documented/gemstone/readylist.rb', line 71 def checked=(value) @checked = value end |
.checked? ⇒ Boolean
Checks if the ready list has been validated.
64 65 66 |
# File 'documented/gemstone/readylist.rb', line 64 def checked? @checked end |
.ready_list ⇒ Hash
Returns the current ready list.
52 53 54 |
# File 'documented/gemstone/readylist.rb', line 52 def ready_list @ready_list end |
.reset(all: false) ⇒ void
This method returns an undefined value.
Resets the ready and store lists.
99 100 101 102 103 104 105 106 107 108 109 |
# File 'documented/gemstone/readylist.rb', line 99 def reset(all: false) @checked = false @ready_list.each do |key, _value| next unless all || ORIGINAL_READY_LIST.include?(key) @ready_list[key] = nil end @store_list.each do |key, _value| next unless all || ORIGINAL_STORE_LIST.include?(key) @store_list[key] = nil end end |
.store_list ⇒ Hash
Returns the current store list.
58 59 60 |
# File 'documented/gemstone/readylist.rb', line 58 def store_list @store_list end |
.valid?(all: false) ⇒ Boolean
This method requires that the ready list has been checked before validation.
Validates the items in the ready list.
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'documented/gemstone/readylist.rb', line 81 def valid?(all: false) # check if existing ready items are valid or not return false unless checked? @ready_list.each do |key, value| next unless all || ORIGINAL_READY_LIST.include?(key) unless key.eql?(:wand) || value.nil? || GameObj.inv.map(&:id).include?(value.id) || GameObj.containers.values.flatten.map(&:id).include?(value.id) || GameObj.right_hand.id.include?(value.id) || GameObj.left_hand.id.include?(value.id) @checked = false return false end end return true end |