Class: Lich::Gemstone::StowList
- Inherits:
-
Object
- Object
- Lich::Gemstone::StowList
- Defined in:
- lib/gemstone/stowlist.rb
Overview
Represents a list of items that can be stowed.
Class Method Summary collapse
-
.check(silent: false, quiet: false) ⇒ void
Checks the stow list and issues a command to the game.
-
.checked=(value) ⇒ Boolean
Sets the checked status of the stow list.
-
.checked? ⇒ Boolean
Checks if the stow list has been checked.
-
.reset ⇒ void
Resets the stow list and its checked status.
-
.stow_list ⇒ Hash
Returns the entire stow list.
-
.valid? ⇒ Boolean
Validates the stow list entries against the game inventory.
Class Method Details
.check(silent: false, quiet: false) ⇒ void
This method returns an undefined value.
Checks the stow list and issues a command to the game.
95 96 97 98 99 100 101 102 103 |
# File 'lib/gemstone/stowlist.rb', line 95 def check(silent: false, quiet: false) if quiet start_pattern = /<output class="mono"\/>/ else start_pattern = /You have the following containers set as stow targets:/ end Lich::Util.issue_command("stow list", start_pattern, silent: silent, quiet: quiet) @checked = true end |
.checked=(value) ⇒ Boolean
Sets the checked status of the stow list.
56 57 58 |
# File 'lib/gemstone/stowlist.rb', line 56 def checked=(value) @checked = value end |
.checked? ⇒ Boolean
Checks if the stow list has been checked.
48 49 50 |
# File 'lib/gemstone/stowlist.rb', line 48 def checked? @checked end |
.reset ⇒ void
This method returns an undefined value.
Resets the stow list and its checked status.
81 82 83 84 85 86 |
# File 'lib/gemstone/stowlist.rb', line 81 def reset @checked = false @stow_list.each_key do |key| @stow_list[key] = nil end end |
.stow_list ⇒ Hash
Returns the entire stow list.
41 42 43 |
# File 'lib/gemstone/stowlist.rb', line 41 def stow_list @stow_list end |
.valid? ⇒ Boolean
Note:
This method will set @checked to false if any entry is invalid.
Validates the stow list entries against the game inventory.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/gemstone/stowlist.rb', line 64 def valid? # check if existing containers are valid or not return false unless checked? @stow_list.each_value do |value| unless value.nil? || GameObj.inv.map(&:id).include?(value.id) @checked = false return false end end return true end |