diff --git a/scripts/go2.lic b/scripts/go2.lic index 9e5001159..03858f3b2 100644 --- a/scripts/go2.lic +++ b/scripts/go2.lic @@ -10,10 +10,13 @@ contributors: Deysh, Doug, Gildaren, Sarvatt, Tysong, Xanlin, Dissonance game: any tags: core, movement - version: 2.2.13 + version: 2.3.0 required: Lich >= 5.4.1 changelog: + 2.3.0 (2025-11-26) + 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.13 (2025-11-22) Added support for ;go2 locker taking to public locker or CHE locker as applicable, if Lich version is 5.12.2 or later Added support for ;go2 guild or ;go2 guild shop to automatically look for the calling character's profession and go to the appropriate guild or guild shop. @@ -390,6 +393,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'], @@ -443,6 +447,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] @@ -783,7 +788,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' @@ -805,7 +810,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 @@ -821,9 +826,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 @@ -849,6 +854,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? @@ -870,6 +876,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" @@ -935,7 +942,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 @@ -1044,6 +1051,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'}" @@ -1172,6 +1180,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 @@ -1202,6 +1211,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 @@ -1281,6 +1292,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}" @@ -1760,9 +1775,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" @@ -2124,6 +2139,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 setting_unhide.is_a?(FalseClass) && checkhidden + setting_typeahead = 0 + end loop { moves_sent = $room_count @@ -2335,7 +2355,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 @@ -2352,7 +2372,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 @@ -2402,7 +2422,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