Skip to content
64 changes: 49 additions & 15 deletions scripts/ebounty.lic
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@
game: Gemstone
tags: bounty, adventure's guild, advguild, bounties
required: Lich >= 5.12.10
version: 1.9.1
version: 1.9.2

Version Control:
Major_change.feature_addition.bugfix
v1.9.2 (2025-01-27)
- add CLI support for ;ebounty forage bounty
- add CLI support for ;ebounty forage "herb" <qty> "location"
- bugfix in heirloom_search and forage_bounty to use Claim.mine? instead of checkpcs
- anchor ending gem names in search functions to prevent false matching on other items
- fix resting spot for SG shattered
- fix forage tag in starting room crash
- fix between script(s) added erroneous commas between script parameters
v1.9.1 (2025-01-18)
- bugfix for running gem tracking script
v1.9.0 (2025-01-08)
Expand Down Expand Up @@ -642,7 +650,7 @@ module EBounty
scripts.split(/,\s*/).each do |i|
tokens = i.split(/\s+/)
if (tokens.size > 1)
Script.run(tokens[0], tokens[1..-1].join(", "))
Script.run(tokens[0], tokens[1..-1].join(" "))
else
Script.run(tokens[0])
end
Expand Down Expand Up @@ -1027,7 +1035,7 @@ module EBounty
"Wehnimer's Landing" => 'u7120',
'Zul Logoth' => 'u13006016',
'Cold River' => 'u7503205',
"Contempt" => 'u7150608',
"Contempt" => "#{XMLData.game.eql?('GSF') ? 'u7150607' : 'u7150608'}",
}

resting_keys = [
Expand Down Expand Up @@ -1065,8 +1073,12 @@ module EBounty
"u7120" => @settings[:landing_resting], # Wehnimer's Landing
"u13006016" => @settings[:zul_resting], # Zul Logoth
'u7503205' => @settings[:hw_resting], # Hinterwilds
'u7150608' => @settings[:contempt_resting], # Sailor's Grief
}
if XMLData.game.eql?('GSF')
@resting_spots['u7150607'] = @settings[:contempt_resting] # Sailor's Grief Shattered
else
@resting_spots['u7150608'] = @settings[:contempt_resting] # Sailor's Grief
end
end
end

Expand Down Expand Up @@ -2071,7 +2083,7 @@ module EBounty
bounty_eval += %Q{ || !!(count = 0;EBounty.data.containers.each{|i| i.contents.each{ |k| if k.name =~ /bundle of #{EBounty.data.bundle_skin}/ && !EBounty.data.bundle_skin.to_s.empty? && !hidden?; lines = Lich::Util.quiet_command_xml("measure #"+k.id.to_s, /You glance through/);count += lines.sum { |l| l.scan(/count a total of (\\d+) <a exist/).flatten.map(&:to_i).sum };end;};};count >= EBounty.data.remaining_skins.to_i && @CORRECT_PERCENT_MIND >= EBounty.data.complete_mind)}
bounty_eval += %Q{ || !!(j=0;EBounty.data.containers.each{|i| j += i.contents.count{|l| l.name =~ /#{EBounty.data.skin}/i && !EBounty.data.skin.to_s.empty?}.to_i }; j >= EBounty.data.remaining_skins.to_i && @CORRECT_PERCENT_MIND >= EBounty.data.complete_mind)}
elsif checkbounty =~ /The gem dealer/
bounty_eval += %Q{ || !!(t=0;EBounty.data.containers.each{|k| t += k.contents.count{|v| v.name =~ /#{EBounty.data.gem.strip}/i && !EBounty.data.gem.to_s.empty?}.to_i}; t>= EBounty.data.remaining_gems.to_i && @CORRECT_PERCENT_MIND >= EBounty.data.complete_mind)}
bounty_eval += %Q{ || !!(t=0;EBounty.data.containers.each{|k| t += k.contents.count{|v| v.name =~ /#{EBounty.data.gem.strip}$/i && !EBounty.data.gem.to_s.empty?}.to_i}; t>= EBounty.data.remaining_gems.to_i && @CORRECT_PERCENT_MIND >= EBounty.data.complete_mind)}
end

UserVars.op['bounty_eval'] = bounty_eval
Expand Down Expand Up @@ -2184,7 +2196,7 @@ module EBounty
EBounty.msg("debug", "scripts: #{i}")
tokens = i.split(/\s+/)
if (tokens.size > 1)
Script.run(tokens[0], tokens[1..-1].join(", "))
Script.run(tokens[0], tokens[1..-1].join(" "))
else
Script.run(tokens[0])
end
Expand Down Expand Up @@ -2944,7 +2956,8 @@ module EBounty
location_list = location_list.first(10)

location_list.each do |room|
if Room.current.path_to(room) == nil
next if room.id.eql?(Room.current.id)
if Room.current.path_to(room).nil?
location_list.delete(room)
else
travel = Map.estimate_time(Room.current.path_to(room))
Expand All @@ -2965,8 +2978,13 @@ module EBounty
location_list = location_list.sort { |a, b| shortest_distances[a] <=> shortest_distances[b] }

location_list.each do |room|
travel = Map.estimate_time(Room.current.path_to(room))
location_list.delete(room) if travel.to_i > 90
next if room.id.eql?(Room.current.id)
if Room.current.path_to(room).nil?
location_list.delete(room)
else
travel = Map.estimate_time(Room.current.path_to(room))
location_list.delete(room) if travel.to_i > 90
end
end

return location_list
Expand Down Expand Up @@ -3014,7 +3032,7 @@ module EBounty
location_list.each do |room|
EBounty.go2(room)

unless (GameObj.targets.count.positive? && EBounty.data.settings[:forage_options].include?("run")) || checkpcs || GameObj.loot.any? { |i| i.name =~ /black void/ }
unless (GameObj.targets.count.positive? && EBounty.data.settings[:forage_options].include?("run")) || !Claim.mine? || GameObj.loot.any? { |i| i.name =~ /black void/ }

empty_hands

Expand Down Expand Up @@ -3288,7 +3306,7 @@ module EBounty
EBounty.data.containers.each { |container|
EBounty.open_container(container)
container.contents.each { |item|
if item.name =~ /#{EBounty.data.gem}/
if item.name =~ /#{EBounty.data.gem}$/
count += 1
end
}
Expand Down Expand Up @@ -3362,7 +3380,7 @@ module EBounty
EBounty.change_stance(100)

loop {
unless (GameObj.targets.count.positive? && EBounty.data.settings[:heirloom_options].include?("run")) || checkpcs || GameObj.loot.each { |i| i.name =~ /black void/ }
unless (GameObj.targets.count.positive? && EBounty.data.settings[:heirloom_options].include?("run")) || !Claim.mine? || GameObj.loot.each { |i| i.name =~ /black void/ }
unless Map.current.tags.include?("meta:nomagic")
if Stats.prof =~ /Cleric|Empath/i && EBounty.data.settings[:heirloom_options].include?("use_213")
lines = EBounty.get_command("sense", /You open your soul to the lesser/, silent: true, quiet: true)
Expand Down Expand Up @@ -3675,14 +3693,30 @@ when 'remove'
EBounty::Task.bounty_remove(true)
EBounty.go2(EBounty.data.start_room)
when 'forage'
if Script.current.vars[2].nil? || Script.current.vars[3].nil?
EBounty.msg "error", ' Proper syntax: ;ebounty forage "herb to find" <how many>'
if Script.current.vars[2].nil? || (Script.current.vars[3].nil? && Script.current.vars[2] != 'bounty')
EBounty.msg "error", ' Please use one of the following proper syntax for the forage option:'
EBounty.msg "error", ' To search closest 10 rooms for foraged herb:'
EBounty.msg "error", ' Autodetect Bounty: ;ebounty forage bounty'
EBounty.msg "error", ' Closest 10 Rooms: ;ebounty forage "herb to find" <how many>'
EBounty.msg "error", ' All Rooms At Location: ;ebounty forage "herb to find" <how many> "location to search"'
exit
end
return_room = Room.current.id
EBounty.load(EBounty.load_profile)
EBounty.set_variables(load_profile: false)
EBounty::Task.forage_bounty(Script.current.vars[2], Script.current.vars[3].to_i)
if Script.current.vars[2] == 'bounty'
unless Bounty.task.herb?
EBounty.msg "error", ' Started ebounty with ;ebounty forage bounty'
EBounty.msg "error", ' But you have no bounty!'
EBounty.msg "error", " #{Bounty.task.inspect}"
exit
end
EBounty::Task.forage_bounty(Bounty.task.herb, Bounty.task.number, Bounty.task.area)
elsif Script.current.vars[4].is_a?(String)
EBounty::Task.forage_bounty(Script.current.vars[2], Script.current.vars[3].to_i, Script.current.vars[4])
else
EBounty::Task.forage_bounty(Script.current.vars[2], Script.current.vars[3].to_i)
end
EBounty.go2(return_room)
when /location/i
if Bounty.task.requirements[:area].nil?
Expand Down