Skip to content

Commit

Permalink
Merge pull request #6871 from MahtraDR/force_crafting_town-
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtraDR authored Jul 24, 2024
2 parents 3e03b3e + 412b64d commit 1a76408
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 62 deletions.
6 changes: 3 additions & 3 deletions alchemy.lic
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Alchemy
exit if args.craft && (args.forage || args.prepare)

settings = get_settings
@hometown = settings.hometown
hometown = settings.force_crafting_town || settings.hometown
@alchemy_herb_quantity = settings.alchemy_herb_quantity
@alchemy_herb_storage = settings.alchemy_herb_storage
@herb_container = settings.herb_container
Expand All @@ -36,10 +36,10 @@ class Alchemy

ingredient = get_data('ingredients').ingredients.find { |each_ingredient| each_ingredient['name'] =~ /#{args.target}/i } unless args.craft
# Set town for foraging
@forage_location = ingredient[@forage_override_room] || @forage_override_room || ingredient[@hometown]
@forage_location = ingredient[@forage_override_room] || @forage_override_room || ingredient[hometown]
echo("@forage_location = #{@forage_location}") if @debug
# Set press and grinder location
@press_location = @forage_override_town || @hometown
@press_location = @forage_override_town || hometown
echo("@press_location = #{@press_location}") if @debug
# Forage call section
forage_ingredient(ingredient) if args.forage
Expand Down
4 changes: 2 additions & 2 deletions arrows.lic
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Arrows
@bag = @settings.crafting_container
@bag_items = @settings.crafting_items_in_container
@belt = @settings.engineering_belt
@hometown = @settings.hometown
@hometown = @settings.force_crafting_town || @settings.hometown
@engineering_room = @settings.engineering_room
@hometown_data = get_data('crafting')['shaping'][@hometown]

Expand Down Expand Up @@ -48,7 +48,7 @@ class Arrows
@lumber = args.lumber
@tools = args.tools

DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
get_tools if @tools
order_lumber
check_flights
Expand Down
4 changes: 2 additions & 2 deletions bolts.lic
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Bolts
@bag = @settings.crafting_container
@bag_items = @settings.crafting_items_in_container
@belt = @settings.engineering_belt
@hometown = @settings.hometown
@hometown = @settings.force_crafting_town || @settings.hometown
@engineering_room = @settings.engineering_room
@hometown_data = get_data('crafting')['shaping'][@hometown]

Expand Down Expand Up @@ -50,7 +50,7 @@ class Bolts
@lumber = args.lumber
@tools = args.tools

DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
DRC.wait_for_script_to_complete('clerk-tools', ['engineering', 'get']) unless DRCI.exists?('shaper') if @tools
order_lumber
check_flights
Expand Down
7 changes: 4 additions & 3 deletions clean-leather.lic
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class CleanLeather
@bag = @settings.crafting_container
@bag_items = @settings.crafting_items_in_container
@belt = @settings.outfitting_belt
@hometown = @settings.force_crafting_town || @settings.hometown
engineering_room = @settings.engineering_room
outfitting_room = @settings.outfitting_room

Expand All @@ -38,12 +39,12 @@ class CleanLeather
# Set the proper stock rooms, preservative, and order number depending on whether we're
# cleaning hides or bones.
if args.hide =~ /^bones?$/i
@stock_room = get_data('crafting')['shaping'][@settings.hometown]['tool-room']
@stock_room = get_data('crafting')['shaping'][@hometown]['tool-room']
@room = engineering_room
@preservative = 'bleaching solution'
@order_number = '7'
else
@stock_room = get_data('crafting')['tailoring'][@settings.hometown]['tool-room']
@stock_room = get_data('crafting')['tailoring'][@hometown]['tool-room']
@room = outfitting_room
@preservative = 'tanning lotion'
@order_number = '8'
Expand Down Expand Up @@ -100,7 +101,7 @@ class CleanLeather

# If we lack doses to complete the job, purchase what is required before starting our project
bottles_to_purchase = ((required_doses - on_hand.to_f) / 30).ceil
DRCM.ensure_copper_on_hand(625 * bottles_to_purchase, @settings)
DRCM.ensure_copper_on_hand(625 * bottles_to_purchase, @settings, @hometown)
bottles_to_purchase.times do
DRCT.order_item(@stock_room, @order_number)
DRCI.put_away_item?(@preservative, @bag)
Expand Down
2 changes: 1 addition & 1 deletion clerk-tools.lic
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Clerk
action = args.action

settings = get_settings
hometown = settings.hometown
hometown = settings.force_crafting_town || settings.hometown
@bag = settings.crafting_container

crafting_data = get_data('crafting')
Expand Down
54 changes: 27 additions & 27 deletions craft.lic
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Craft
args = parse_args(arg_definitions)

@settings = get_settings
@hometown = @settings.hometown
@hometown = @settings.force_crafting_town || @settings.hometown
@worn_trashcan = @settings.worn_trashcan
@worn_trashcan_verb = @settings.worn_trashcan_verb
@training_room = (@settings.training_rooms || [@settings.safe_room]).sample
Expand Down Expand Up @@ -163,7 +163,7 @@ class Craft
if rank <= 25 # Tier 1 Extremely Easy
# Buy red flowers and nemoih root
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some blister cream/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb2_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
Expand All @@ -174,7 +174,7 @@ class Craft
elsif rank <= 50 # Tier 2 - Very Easy
# Buy red flowers and plovik leaf
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some moisturizing ointment/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb2_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
Expand All @@ -185,7 +185,7 @@ class Craft
elsif rank <= 100 # Tier 3 - Easy
# Buy plovik leaves
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some chest salve/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
Expand All @@ -195,7 +195,7 @@ class Craft
elsif rank <= 175 # Tier 4 - Simple
# Buy riolur leaves
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a neck potion/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
Expand All @@ -205,7 +205,7 @@ class Craft
elsif rank <= 300 # Tier 5 - Basic
# Buy jadice flower
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some limb salve/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
Expand All @@ -215,7 +215,7 @@ class Craft
elsif rank <= 425 # Tier 6 - Somewhat Challenging
# Buy plovik leaves
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some chest unguent/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
Expand All @@ -225,7 +225,7 @@ class Craft
elsif rank <= 550 # Tier 7 - Challenging
# Buy riolur leaves
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some neck tonic/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
Expand All @@ -235,7 +235,7 @@ class Craft
elsif rank <= 700 # Tier 8 - Complicated
# Buy aevaes leaves
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some eye tonic/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
Expand All @@ -245,7 +245,7 @@ class Craft
elsif rank <= 850 # Tier 9 - Intricate
# Buy ojhenik root
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a body elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
DRCC.stow_crafting_item(DRC.left_hand, @bag, @belt)
Expand All @@ -255,7 +255,7 @@ class Craft
elsif rank <= 1175 # Tier 10 - Difficult
# Forage belradi moss
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a general elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
DRC.wait_for_script_to_complete('alchemy', ['belradi', 'forage', '25'])
DRC.wait_for_script_to_complete('alchemy', ['belradi', 'prepare'])
DRCC.stow_crafting_item(DRC.right_hand, @bag, @belt)
Expand All @@ -266,7 +266,7 @@ class Craft
elsif rank <= 1400 # Tier 11 Very Difficult
# Forage blue flowers and belradi moss
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some refreshment elixir/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
DRC.wait_for_script_to_complete('alchemy', ['blue', 'forage', '25'])
DRC.wait_for_script_to_complete('alchemy', ['belradi', 'forage', '5'])
DRC.wait_for_script_to_complete('alchemy', ['blue', 'prepare'])
Expand All @@ -279,7 +279,7 @@ class Craft
else # Tier 12 - Extremely Difficult
# Buy red flowers and forage dioica sap
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /some vigor poultices/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)
DRCT.order_item(crafting_data['remedies'][@hometown]['stock-room'], recipe['herb1_stock'])
DRC.wait_for_script_to_complete('alchemy', ['dioica', 'forage', '5'])
DRC.wait_for_script_to_complete('alchemy', ['dioica', 'prepare'])
Expand All @@ -301,7 +301,7 @@ class Craft
if rank <= 25 # Tier 1 Extremely Easy
# Buy an abolition sigil and bone totem for Radiant Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a radiant trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand All @@ -328,7 +328,7 @@ class Craft
elsif rank <= 50 # Tier 2 - Very Easy
# Buy an induction sigil and bone totem for Flash Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a flash trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand All @@ -355,7 +355,7 @@ class Craft
elsif rank <= 100 # Tier 3 - Easy
# Buy an rarefaction sigil and bone totem for Wind Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a wind trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand All @@ -382,7 +382,7 @@ class Craft
elsif rank <= 175 # Tier 4 - Simple
# Buy an permutation sigil and bone totem fo Earth Trinket
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /an earth trinket/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand All @@ -409,7 +409,7 @@ class Craft
elsif rank <= 300 # Tier 5 - Basic
# Buy an abolition and congruence sigils and bone totem for Basic Holy Ritual focus
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /basic holy ritual focus/ }
DRCM.ensure_copper_on_hand(2000, @settings)
DRCM.ensure_copper_on_hand(2000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand Down Expand Up @@ -441,7 +441,7 @@ class Craft
elsif rank <= 425 # Tier 6 - Somewhat Challenging
# Buy a permutation and rarefaction sigils and basic runestone for Strange Arrow
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /strange arrow runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand Down Expand Up @@ -473,7 +473,7 @@ class Craft
elsif rank <= 550 # Tier 7 - Challenging
# Buy a abolition and induction sigils and basic runestone for Gauge Flow
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /gauge flow runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)

# Check for first sigil. Purcahse if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand Down Expand Up @@ -505,7 +505,7 @@ class Craft
elsif rank <= 700 # Tier 8 - Complicated
# Buy a rarefaction and induction sigils and basic runestone for Dispel
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /dispel runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand Down Expand Up @@ -537,7 +537,7 @@ class Craft
elsif rank <= 850 # Tier 9 - Intricate
# Buy a induction and rarefaction sigils and basic runestone for Lay Ward
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /lay ward runestone/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand Down Expand Up @@ -568,7 +568,7 @@ class Craft
DRCI.dispose_trash('runestone', @worn_trashcan, @worn_trashcan_verb)
elsif rank <= 1175 # Tier 10 - Difficult - Need to use sigilhunter or similar to gather the sigils for Frost Focus
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /a frost focus/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand Down Expand Up @@ -608,7 +608,7 @@ class Craft
DRCI.dispose_trash('totem', @worn_trashcan, @worn_trashcan_verb)
else # Tier 11 Very Difficult - Need to use sigilhunter or similar to gather the sigils for Electric Focus
recipe = get_data('recipes').crafting_recipes.find { |each_recipe| each_recipe['name'] =~ /an electric focus/ }
DRCM.ensure_copper_on_hand(4000, @settings)
DRCM.ensure_copper_on_hand(4000, @settings, @hometown)

# Check for first sigil. Purchase if required.
tally += 1 if !DRCC.check_for_existing_sigil?(recipe['enchant_stock1_name'], recipe['enchant_stock1'], quantity, @bag, @belt, stock_room)
Expand Down Expand Up @@ -650,7 +650,7 @@ class Craft
end

def money_for_training?(amount, skill)
if DRCM.ensure_copper_on_hand(amount, @settings)
if DRCM.ensure_copper_on_hand(amount, @settings, @hometown)
true
else
echo("Low on funds, removing #{skill} from training")
Expand Down Expand Up @@ -712,7 +712,7 @@ class Craft

def buy_yarn(skipcoin = false)
crafting_data = get_data('crafting')
DRCM.ensure_copper_on_hand(3000, @settings) unless skipcoin
DRCM.ensure_copper_on_hand(3000, @settings, @hometown) unless skipcoin
DRCT.order_item(crafting_data['tailoring'][@hometown]['stock-room'], 13)
DRC.bput('combine my yarn', 'You combine', 'You must be holding both')
count = DRC.bput('count my yarn', 'You count out \d+ yards').scan(/\d+/).first.to_i
Expand All @@ -722,7 +722,7 @@ class Craft

def buy_thread(skipcoin = false)
crafting_data = get_data('crafting')
DRCM.ensure_copper_on_hand(1000, @settings) unless skipcoin
DRCM.ensure_copper_on_hand(1000, @settings, @hometown) unless skipcoin
DRCT.order_item(crafting_data['tailoring'][@hometown]['stock-room'], 6)
DRCC.stow_crafting_item('thread', @bag, @belt)
end
Expand Down
Loading

0 comments on commit 1a76408

Please sign in to comment.