Skip to content

Commit

Permalink
Merge pull request #6793 from MahtraDR/remedy_fixes
Browse files Browse the repository at this point in the history
[scripts][remedy] Move from bputs to DRCI functions
  • Loading branch information
MahtraDR authored Apr 1, 2024
2 parents 8448b37 + ba3bda8 commit fd0d0b0
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions remedy.lic
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ class Remedy
end

# buy ingredients if missing
if @water == 'water' && DRC.bput("tap my #{@water}", 'You tap', 'I could not find what you were referring to.') == 'I could not find what you were referring to.'
if @water == 'water' && DRCI.exists?(@water)
buy_item('water')
end
if @alcohol == 'alcohol' && DRC.bput("tap my #{@alcohol}", 'You tap', 'I could not find what you were referring to.') == 'I could not find what you were referring to.'
if @alcohol == 'alcohol' && DRCI.exists?(@alcohol)
buy_item('alcohol')
end
if ['coal nugget', 'nugget'].include?(@catalyst) && DRC.bput("tap my #{@catalyst}", 'You tap', 'I could not find what you were referring to.') == 'I could not find what you were referring to.'
if ['coal nugget', 'nugget'].include?(@catalyst) && DRCI.exists?(@catalyst)
buy_item('coal')
end
DRC.wait_for_script_to_complete('buff', ['remedy'])
Expand All @@ -132,9 +132,9 @@ class Remedy
# this is to prevent issues getting herbs if someone has less than 25 in @herb_container
# there are still issues when herbs are in a different container (not @bag or @herb_container), script will still run fine

if (name == @herb1 || name == @herb2) && @settings.herb_container && DRC.bput("tap #{name} in #{@herb_container}", 'You tap', 'I could not find what you were referring to.', 'You lightly tap') == 'You tap'
if (name == @herb1 || name == @herb2) && @settings.herb_container && DRCI.exists?(name, @herb_container)
DRCC.get_crafting_item(name, @herb_container, [name], @belt) # Look for herbs in herb_container
elsif (name == @herb1 || name == @herb2) && DRC.bput("tap #{name} in #{@bag}", 'You tap', 'I could not find what you were referring to.', 'You lightly tap') == 'You tap'
elsif (name == @herb1 || name == @herb2) && DRCI.exists?(name, @bag)
DRCC.get_crafting_item(name, @bag, [name], @belt) # Look for herbs in bag
elsif at_feet
DRCC.get_crafting_item(name, @bag, nil, @belt) # This elsif used primarily to get bowl/mortar etc. from at our feet after lowering it.
Expand Down Expand Up @@ -171,10 +171,10 @@ class Remedy
if @settings.master_crafting_book
DRCC.find_recipe2(@chapter, @recipe_name, @settings.master_crafting_book, @book_type)
else
DRCC.get_crafting_item("remed book", @bag, @bag_items, @forging_belt)
DRCC.get_crafting_item("remedy book", @bag, @bag_items, @forging_belt)
echo('*** You will need to upgrade to a journeyman or master book before 176 ranks! ***') if DRSkill.getrank('Alchemy') == 175
DRCC.find_recipe2(@chapter, @recipe_name)
DRCC.stow_crafting_item("remed book", @bag, @forging_belt)
DRCC.stow_crafting_item("remedy book", @bag, @forging_belt)
end

if ('red flower').include?(@herb1)
Expand All @@ -184,8 +184,7 @@ class Remedy
end
get_item(@container)

DRC.bput('swap', 'You move', 'You have nothing') unless DRC.right_hand =~ /#{@container}/i # lower ground only works if the container is in the right hand.
DRC.bput("lower ground", 'You lower') # lower to count and combine herbs. Switched to just lower ground so it works with all containers.
DRCI.lower_item?(@container)

# count herb, less than 25 get more herbs, otherwise stow and continue
# added to handle herb containers, and modified to combine up to 25
Expand All @@ -196,16 +195,15 @@ class Remedy
# in cases where it won't get more herbs, it takes a longer route to get herbs from other bags (not @bag nor @herb_container)
@count = DRC.bput("count my #{@herb1}", '^You count out \d+').scan(/\d+/).first.to_i
while @count < 25
DRC.bput("put my #{@herb1} in my #{@container}", 'You put', 'already has something in it.', 'you count off and place only that many inside')
DRCI.put_away_item?(@herb1, @container)
fput("stow my #{@herb1}") # in case there are extra
DRC.bput("get my #{@container}", 'You pick up', 'You get')
get_item(@container)
# stow then get, to prevent getting herbs from container (i.e. mortar)
stow_item(@container)
DRC.bput("get my #{@herb1}", 'You get', 'What were you referring to?', 'You are already holding that.') # using DRC.bput instead of get_item to keep script running when it cannot get the herb
DRCI.get_item?(@herb1) # Using the DRCI method for some reason I don't understand, but because it used this method in long form before
get_item(@container)
DRC.bput('swap', 'You move', 'You have nothing') unless DRC.right_hand =~ /#{@container}/i # lower ground only works if the container is in the right hand.
DRC.bput("lower ground", 'You lower') # lower to count and combine herbs. Switched to just lower ground so it works with all containers.
DRC.bput("get #{@herb1} from #{@container}", 'You get', 'What were you referring to?')
DRCI.lower_item?(@container)
DRCI.get_item?(@herb1, @container) # Using the DRCI method for some reason I don't understand, but because it used this method in long form before
if DRC.bput("combine my #{@herb1}", 'You combine', 'too large to add', 'You must be holding both') == 'You must be holding both'
@count = 25 # 25 used to break loops
else
Expand All @@ -218,11 +216,10 @@ class Remedy
f_stack = DRC.bput("count my first #{@herb1}", 'You count out \d+ pieces').scan(/\d+/).first.to_i
s_stack = DRC.bput("count my second #{@herb1}", 'I could not find', 'You count out \d+ pieces').scan(/\d+/).first.to_i
if f_stack == 75
DRC.bput("stow my second #{@herb1}", "You put")
DRCI.put_away_item?("second #{@herb1}")
elsif s_stack == 75
DRC.bput("stow my first #{@herb1}", "You put")
DRCI.put_away_item?("first #{@herb1}")
end
# stow_item(@herb1)
end
end
end
Expand Down Expand Up @@ -294,12 +291,13 @@ class Remedy
Flags.reset('remedy-water')
if DRC.bput("#{@water_verb} #{@water} in my #{@container}", 'Roundtime', 'You toss', 'You cannot find a way to add that as an ingredient') == 'You cannot find a way to add that as an ingredient'
stow_item(DRC.left_hand)
if DRC.bput("get water from #{@water}", 'You get', 'What were you referring to') == 'What were you referring to'
unless DRCI.get_item?("water", @water)
get_item('water')
end
DRC.bput("put water in my #{@container}", 'Roundtime', 'You toss', 'You cannot find a way to add that as an ingredient')
waitrt?
fput("put water in my #{@water}")
unless DRCI.put_away_item?("water", @container)
waitrt?
DRCI.put_away_item?("water", @water)
end
end
waitrt?
stow_item(DRC.left_hand)
Expand All @@ -313,12 +311,13 @@ class Remedy
Flags.reset('remedy-alcohol')
if DRC.bput("#{@alcohol_verb} #{@alcohol} in my #{@container}", 'Roundtime', 'You toss', 'You cannot find a way to add that as an ingredient') == 'You cannot find a way to add that as an ingredient'
stow_item(DRC.left_hand)
if DRC.bput("get alcohol from #{@alcohol}", 'You get', 'What were you referring to') == 'What were you referring to'
unless DRCI.get_item?("alcohol", @alcohol)
get_item('alcohol')
end
DRC.bput("put alcohol in my #{@container}", 'Roundtime', 'You toss', 'You cannot find a way to add that as an ingredient')
waitrt?
fput("put alcohol in my #{@alcohol}")
unless DRCI.put_away_item?("alcohol", @container)
waitrt?
DRCI.put_away_item?("alcohol", @alcohol)
end
end
waitrt?
stow_item(DRC.left_hand)
Expand Down

0 comments on commit fd0d0b0

Please sign in to comment.