Skip to content

Commit

Permalink
Merge pull request #6765 from MahtraDR/common_items_pouch_flag
Browse files Browse the repository at this point in the history
[scripts][common-items] Add flag for full pouch instead of line matching
  • Loading branch information
MahtraDR authored Feb 17, 2024
2 parents 247f9a8 + 4e62dc8 commit ba5c13c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions common-items.lic
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# This module should be 'bottom-level' and only depend on common.
# Any modules that deal with items and <something> should be somewhere else
custom_require.call(%w[common])
custom_require.call(%w[common events])

module DRCI
module_function
Expand Down Expand Up @@ -1163,6 +1163,7 @@ module DRCI
end

def fill_gem_pouch_with_container(gem_pouch_adjective, gem_pouch_noun, source_container, full_pouch_container = nil, spare_gem_pouch_container = nil, should_tie_gem_pouches = false)
Flags.add("pouch-full", /is too full to fit any more/)
case DRC.bput("fill my #{gem_pouch_adjective} #{gem_pouch_noun} with my #{source_container}",
/^You open/,
/is too full to fit/,
Expand All @@ -1171,13 +1172,6 @@ module DRCI
'What were you referring to',
"There aren't any gems",
'You fill your')
when /is too full to fit/
unless swap_out_full_gempouch?(gem_pouch_adjective, gem_pouch_noun, full_pouch_container, spare_gem_pouch_container, should_tie_gem_pouches)
DRC.message("Could not swap gem pouches.")
return
end
fill_gem_pouch_with_container(gem_pouch_adjective, gem_pouch_noun, source_container, full_pouch_container, spare_gem_pouch_container, should_tie_gem_pouches)
tie_gem_pouch(gem_pouch_adjective, gem_pouch_noun) if should_tie_gem_pouches
when /^You'd better tie it up before putting/, /You'll need to tie it up before/
# This is equivalent to a full pouch, unless we should tie pouches, in which case we tie and retry
unless should_tie_gem_pouches
Expand All @@ -1190,5 +1184,14 @@ module DRCI
tie_gem_pouch(gem_pouch_adjective, gem_pouch_noun) if should_tie_gem_pouches
fill_gem_pouch_with_container(gem_pouch_adjective, gem_pouch_noun, source_container, full_pouch_container, spare_gem_pouch_container, should_tie_gem_pouches)
end
if Flags["pouch-full"]
unless swap_out_full_gempouch?(gem_pouch_adjective, gem_pouch_noun, full_pouch_container, spare_gem_pouch_container, should_tie_gem_pouches)
DRC.message("Could not swap gem pouches.")
return
end
fill_gem_pouch_with_container(gem_pouch_adjective, gem_pouch_noun, source_container, full_pouch_container, spare_gem_pouch_container, should_tie_gem_pouches)
tie_gem_pouch(gem_pouch_adjective, gem_pouch_noun) if should_tie_gem_pouches
Flags.reset("pouch-full")
end
end
end

0 comments on commit ba5c13c

Please sign in to comment.