From ccf49b7ad38f82efe59cffbd738fc26455e3be3a Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Tue, 3 Jun 2025 11:36:31 -0400 Subject: [PATCH 1/3] feat(go2.lic): v2.3.0 add unhide option --- scripts/go2.lic | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/go2.lic b/scripts/go2.lic index e8e9f5030..c5cd7da4e 100644 --- a/scripts/go2.lic +++ b/scripts/go2.lic @@ -10,10 +10,12 @@ contributors: Deysh, Doug, Gildaren, Sarvatt, Tysong, Xanlin game: any tags: core, movement - version: 2.2.11 + version: 2.3.0 required: Lich >= 5.4.1 changelog: + 2.3.0 (2025-06-03) + Add "unhide" option, when true unhides when hidden. when false(default) and hidden, sets typeahead to 0 2.2.11 (2025-04-24) Bugfix in CLI gigas_min_number setting not working 2.2.10 (2025-04-22) @@ -369,6 +371,7 @@ module Go2 :rogue_password => UserVars.rogue_password, :delay => CharSettings['delay'], :typeahead => CharSettings['typeahead'], + :unhide => CharSettings['unhide'], :stop_for_dead => CharSettings['stop for dead'], :get_silvers => CharSettings['get silvers'], :get_return_silvers => CharSettings['get return trip silvers'], @@ -422,6 +425,7 @@ module Go2 UserVars.rogue_password = settings[:rogue_password] CharSettings['delay'] = settings[:delay] CharSettings['typeahead'] = settings[:typeahead] + CharSettings['unhide'] = settings[:unhide] CharSettings['stop for dead'] = settings[:stop_for_dead] CharSettings['get silvers'] = settings[:get_silvers] CharSettings['get return trip silvers'] = settings[:get_return_silvers] @@ -828,6 +832,7 @@ module Go2 end CharSettings['typeahead'] = 0 if CharSettings['typeahead'].nil? CharSettings['delay'] = 0 if CharSettings['delay'].nil? + CharSettings['unhide'] = false if CharSettings['unhide'].nil? CharSettings['hide_room_descriptions'] = false if CharSettings['hide_room_descriptions'].nil? CharSettings['hide_room_titles'] = false if CharSettings['hide_room_titles'].nil? CharSettings['echo_input'] = true if CharSettings['echo_input'].nil? @@ -849,6 +854,7 @@ module Go2 output << "" output << " options:" output << " --typeahead=<#> Sets the number of typeahead lines to use." + output << " --unhide= Unhides if hidden to prevent movement issues" output << " --delay=<#> Sets the delay in seconds between movements" output << " (disables typeahead)." output << " --echo_input= When 'on', echos the script input from when the script was called" @@ -1023,6 +1029,7 @@ module Go2 output << " (not used because delay > 0)" end output << "" + output << " unhide: #{CharSettings['unhide']}" output << " delay: #{CharSettings['delay']}" output << " echo input: #{CharSettings['echo_input'] ? 'on' : 'off'}" output << "hide room descriptions: #{CharSettings['hide_room_descriptions'] ? 'on' : 'off'}" @@ -1151,6 +1158,7 @@ module Go2 target_search_array = Array.new setting_typeahead = nil + setting_unhide = nil setting_delay = nil setting_disable_confirm = false setting_use_vaalor_shortcut = nil @@ -1181,6 +1189,8 @@ module Go2 for var in Script.current.vars[1..-1] if var =~ /^(?:\-\-)?typeahead=([0-9]+)$/i setting_typeahead = $1.to_i + elsif (var =~ /^(?:\-\-)?unhide=(on|true|yes|off|false|no)$/i) + setting_unhide = setting_value[$1.downcase] elsif var =~ /^(?:\-\-)?delay=([0-9\.]+)$/i setting_delay = $1.to_f elsif var =~ /^\-\-instability=([0-9]+)$/i @@ -1260,6 +1270,10 @@ module Go2 CharSettings['delay'] = setting_delay echo "delay setting changed to #{setting_delay} seconds" end + unless setting_unhide.nil? + CharSettings['unhide'] = setting_unhide + echo "go2 #{(setting_unhide ? 'will' : 'will not')} unhide if hidden to prevent movement issues" + end unless setting_typeahead.nil? CharSettings['typeahead'] = setting_typeahead echo "typeahead setting changed to #{setting_typeahead}" @@ -1936,6 +1950,11 @@ module Go2 # Store start room for future use UserVars.go2_start_room = start_room.id + if setting_unhide.is_a?(TrueClass) && checkhidden + fput("unhide") + elsif settings_unhide.is_a?(FalseClass) && checkhidden + setting_typeahead = 0 + end loop { moves_sent = $room_count From 1cb2ace18456ab4474d3fb678f8f0dff34660109 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Tue, 3 Jun 2025 11:41:34 -0400 Subject: [PATCH 2/3] Update scripts/go2.lic Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- scripts/go2.lic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/go2.lic b/scripts/go2.lic index c5cd7da4e..37ffe1ff5 100644 --- a/scripts/go2.lic +++ b/scripts/go2.lic @@ -1952,7 +1952,7 @@ module Go2 UserVars.go2_start_room = start_room.id if setting_unhide.is_a?(TrueClass) && checkhidden fput("unhide") - elsif settings_unhide.is_a?(FalseClass) && checkhidden + elsif setting_unhide.is_a?(FalseClass) && checkhidden setting_typeahead = 0 end From ee31ec8fd95d5ab945b1e0e9f3c841762530aa45 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Fri, 6 Jun 2025 10:28:10 -0400 Subject: [PATCH 3/3] fix: change class checks to is_a? checks --- scripts/go2.lic | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/go2.lic b/scripts/go2.lic index 37ffe1ff5..be16d6cbb 100644 --- a/scripts/go2.lic +++ b/scripts/go2.lic @@ -16,6 +16,7 @@ changelog: 2.3.0 (2025-06-03) Add "unhide" option, when true unhides when hidden. when false(default) and hidden, sets typeahead to 0 + Change class checks to is_a? checks 2.2.11 (2025-04-24) Bugfix in CLI gigas_min_number setting not working 2.2.10 (2025-04-22) @@ -766,7 +767,7 @@ module Go2 _respond("#{monsterbold_start}= #{opt.capitalize} =#{monsterbold_end}\n") @@categories[opt.to_sym].each do |id, _| value = @settings[id] - value.class == Array ? print_array.call(id, value, 1) : print_value.call(id, value, 1) + value.is_a?(Array) ? print_array.call(id, value, 1) : print_value.call(id, value, 1) end end if $frontend == 'stormfront' @@ -788,7 +789,7 @@ module Go2 if value == 'reset' @settings.delete(key) echo " Reset #{key}" - elsif @settings[key].class == Array + elsif @settings[key].is_a?(Array) if value =~ /\d/ && @settings[key][value.to_i] @settings[key].delete_at(value.to_i) else @@ -804,9 +805,9 @@ module Go2 echo " #{key.inspect} is now #{@settings[key].join(', ').inspect}" else - if @settings[key].class == FalseClass || @settings[key].class == TrueClass + if @settings[key].is_a?(FalseClass) || @settings[key].is_a?(TrueClass) value = value =~ /^true|1|yes|on/ ? true : false - elsif @settings[key].class == Integer + elsif @settings[key].is_a?(Integer) value = value.to_i end @@ -920,7 +921,7 @@ module Go2 } change_map_vaalor_shortcut = proc { |use_shortcut| - unless Map.list.any? { |room| room.timeto.any? { |_adj_id, time| time.class == Proc and time._dump =~ /$go2_use_vaalor_shortcut/ } } + unless Map.list.any? { |room| room.timeto.any? { |_adj_id, time| time.is_a?(StringProc) and time._dump =~ /$go2_use_vaalor_shortcut/ } } if use_shortcut Room[16745].timeto['16746'] = 15 Room[16746].timeto['16745'] = 15 @@ -1753,9 +1754,9 @@ module Go2 end if Room.current.wayto.keys.include?(next_id.to_s) way = Room.current.wayto[next_id.to_s] - if way.class == Proc + if way.is_a?(StringProc) way.call - elsif way.class == String + elsif way.is_a?(String) move way else echo "error: map database movement is neither a Proc or a String" @@ -2165,7 +2166,7 @@ module Go2 end waitrt? - if room.wayto[next_id].class == Proc + if room.wayto[next_id].is_a?(StringProc) if setting_drag echo "error: drag feature can't deal with StringProc movements yet" exit @@ -2182,7 +2183,7 @@ module Go2 break if GameObj.pcs.any? { |pc| pc.status =~ /dead/ } idx -= 1 break unless (way = Room.current.wayto[path[idx].to_s]) - if way.class == Proc + if way.is_a?(StringProc) way.call else move way @@ -2232,7 +2233,7 @@ module Go2 break if GameObj.pcs.any? { |pc| pc.status =~ /dead/ } idx -= 1 break unless (way = Room.current.wayto[path[idx].to_s]) - if way.class == Proc + if way.is_a?(StringProc) way.call else move way