Class: Lich::Gemstone::ReadyList
- Inherits:
-
Object
- Object
- Lich::Gemstone::ReadyList
- Defined in:
- lib/gemstone/readylist.rb
Overview
Represents a list of ready items in the game.
Class Method Summary collapse
-
.check(silent: false, quiet: false) ⇒ void
Checks the current settings of the ready list.
-
.checked=(value) ⇒ Boolean
Sets the checked state of the ready list.
-
.checked? ⇒ Boolean
Checks if the ready list has been validated.
-
.ready_list ⇒ Hash
Returns the current ready list.
-
.reset ⇒ void
Resets the ready list and its checked state.
-
.valid? ⇒ 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.
84 85 86 87 88 89 90 91 92 |
# File 'lib/gemstone/readylist.rb', line 84 def check(silent: false, quiet: false) if quiet start_pattern = /<output class="mono"\/>/ else start_pattern = /Your current settings are:/ end Lich::Util.issue_command("ready list", start_pattern, silent: silent, quiet: quiet) @checked = true end |
.checked=(value) ⇒ Boolean
Sets the checked state of the ready list.
46 47 48 |
# File 'lib/gemstone/readylist.rb', line 46 def checked=(value) @checked = value end |
.checked? ⇒ Boolean
Checks if the ready list has been validated.
37 38 39 |
# File 'lib/gemstone/readylist.rb', line 37 def checked? @checked end |
.ready_list ⇒ Hash
Returns the current ready list.
29 30 31 |
# File 'lib/gemstone/readylist.rb', line 29 def ready_list @ready_list end |
.reset ⇒ void
This method returns an undefined value.
Resets the ready list and its checked state.
71 72 73 74 75 76 |
# File 'lib/gemstone/readylist.rb', line 71 def reset @checked = false @ready_list.each_key do |key| @ready_list[key] = nil end end |
.valid? ⇒ Boolean
Note:
If any item is invalid, the checked state will be reset to false.
Validates the items in the ready list.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/gemstone/readylist.rb', line 55 def valid? # check if existing ready items are valid or not return false unless checked? @ready_list.each_value do |value| unless value.nil? || GameObj.inv.map(&:id).include?(value.id) || GameObj.containers.values.flatten.map(&:id).include?(value.id) @checked = false return false end end return true end |