diff --git a/inventory-manager.lic b/inventory-manager.lic index cd3b9e9a63..48c55e3f31 100644 --- a/inventory-manager.lic +++ b/inventory-manager.lic @@ -156,7 +156,7 @@ class InventoryManager # Counting all items in inventory capture = [] until capture != [] - capture = Lich::Util.issue_command('inv list', /^You have:/) + capture = Lich::Util.issue_command('inv list', /^You have:/, timeout: 3) end capture.each do |line| item = line.lstrip @@ -172,7 +172,7 @@ class InventoryManager # Counting items matching the description, i.e., inv count pouch capture = [] until capture != [] - capture = Lich::Util.issue_command("inv search #{desc}", /rummage about your person/) + capture = Lich::Util.issue_command("inv search #{desc}", /rummage about your person/, timeout: 3) end capture.each do |line| item = line.lstrip @@ -197,7 +197,7 @@ class InventoryManager capture = [] until capture != [] - capture = Lich::Util.issue_command(command, end_pattern) + capture = Lich::Util.issue_command(command, end_pattern, timeout: 3) end lines = capture # when rummaging, this block splits the items, including the last two that are split by and instead of a comma @@ -214,6 +214,7 @@ class InventoryManager end container = "" + sub_container = "" lines.each do |line| line.sub!(/\(\d+\)/, '') if command == 'vault standard' item = line.lstrip @@ -242,18 +243,24 @@ class InventoryManager end elsif command == "read my storage book" || command == "read my vault book" # items in vault/storage book output are prefixed by 6 spaces - if line =~ /\s{6}(?:a|an|some) / - item.concat(" (in container - #{container})") - else - container = item.to_s - end + if line =~ /\s{8,}(?:a|an|some) / + item.concat(" (nested container - #{sub_container})") + elsif line =~ /\s{6}(?:a|an|some) / + item.concat(" (in container - #{container})") + sub_container = item.to_s + else + container = item.to_s + end elsif command == 'vault standard' # items in a container are prefixed by 11 spaces once the item count is removed - if line =~ /\s{11}(?:a|an|some) / - item.concat(" (in container - #{container})") - else - container = item.to_s - end + if line =~ /\s{16,}(?:a|an|some) / + item.concat(" (nested container - #{sub_container})") + elsif line =~ /\s{11}(?:a|an|some) / + item.concat(" (in container - #{container})") + sub_container = item.to_s + else + container = item.to_s + end elsif inventory_type == 'home' if !item.start_with?("Attached:") item = clean_home_string(item) @@ -390,7 +397,7 @@ class InventoryManager spells = [] capture = [] until capture != [] - capture = Lich::Util.issue_command("flip my #{stacker.split.last}", /^You flip through the #{stacker.split.last}, checking each section before closing it.$/) + capture = Lich::Util.issue_command("flip my #{stacker.split.last}", /^You flip through the #{stacker.split.last}, checking each section before closing it.$/, timeout: 3) end capture.each do |line| if line =~ /The (.+) section has (\d+)/ @@ -434,7 +441,7 @@ class InventoryManager surfaces = Hash.new capture = [] until capture != [] - capture = Lich::Util.issue_command("shop customer", /^The following items contain goods for sale:/) + capture = Lich::Util.issue_command("shop customer", /^The following items contain goods for sale:/, timeout: 3) end capture.each do |line| line = line.lstrip @@ -450,7 +457,7 @@ class InventoryManager surfaces.each do |surface| capture = [] until capture != [] - capture = Lich::Util.issue_command(surface[1], /, you see:/) + capture = Lich::Util.issue_command(surface[1], /, you see:/, timeout: 3) end capture.each do |line| line = line.lstrip