Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[script][inventory-manager]add vault book,storage book,pocket. adjust vault surface handling for container nesting data #6859

Merged
merged 15 commits into from
Jul 10, 2024

Conversation

desertkaz
Copy link
Contributor

@desertkaz desertkaz commented Jul 8, 2024

inventory-manager.lic:

  • Added storage book logic for new system
    • clean output for storage box like a vault book
  • Added vault book logic for new system
    • vault standard fails if rent is past due
  • Added logic for rummaging secret pocket containers
  • Added logic to retry the Lich::Util.issue_command when timing out
  • Update eddy method call
  • Handle empty register and storage book contents

base.yaml:

  • moved vault surfaces to separate key to handle tagging nested items
  • added pattern for storage book ignores

@desertkaz desertkaz changed the title Desertkaz patch 1 [script][inventory-manager]add vault book,storage book,pocket. adjust vault surface handling for container nesting data Jul 8, 2024
@desertkaz
Copy link
Contributor Author

output screenshots

image
image
image

@@ -223,6 +240,20 @@ class InventoryManager
else
container = item.to_s
end
elsif /vault book/.match(command)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 257 uses command == 'vault standard', the two new ones use /vault book/.match(command). I don't know this for sure, but .match does a regular expression comparison, which I suspect is more labor intensive than just doing a string compare. It's probably fairly insignificant, but I would think we're better off with consistency, in any event.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other thought, you should probably combine the vault book and storage book, since the code itself is the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial thought was just being against"read my vault book" and "read my storage book" as the matches and typically just use regex. Can change to whatever.

I was following the example of vault and family vault being unique methods when I made the updates.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, not the methods, I just mean these two elsif statements. But just my two cents!

      elsif /vault book/.match(command)
        # items in vault 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
      elsif /storage book/.match(command)
        # items in a storage book are prefixed by 6 spaces
        if line =~ /\s{6}(?:a|an|some) /
          item.concat(" (in container - #{container})")
        else
          container = item.to_s
        end

@mikejcook
Copy link
Contributor

I like the change to retry the command. I've noticed once or twice that if I get stuck in RT, it'll end up putting empty data in until run again. I wish Lich::Util.issue_command had built in support for handling RT. I wonder if it makes sense to create a helper method in common.lic that calls Lich::Util.issue_command similar to DRC.bput. I feel like there is a risk that it could get stuck in a never ending loop (such as when checking the eddy inventory, if you don't have an eddy), but I'm not sure that really needs to be handled. I guess it could do a tap portal before issuing the command.

And good catch on the method name for the eddy. No idea how I didn't notice that.

For the vault surfaces, it looks like if something is in a container on a surface, the surface will get overwritten. I started looking at this, and I realized there was a bug in the existing code with nested containers.

We could do something like this to address the issue:

Add below container = "":

sub_container = ""
      elsif /vault book/.match(command)
        # items in vault book output are prefixed by 6 spaces, nested containers are 8 spaces
        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, nested containers are 16
        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

They will then save like this:

- a canvas backpack (in container - a bottom drawer) (vault)
- an infuser stone (nested container - a canvas backpack (in container - a bottom drawer)) (vault)
- an infuser stone (nested container - a canvas backpack (in container - a bottom drawer)) (vault)
- an infuser stone (nested container - a canvas backpack (in container - a bottom drawer)) (vault)

@desertkaz
Copy link
Contributor Author

desertkaz commented Jul 9, 2024

I was going to start looking into this nested container stuff next, but there are too many things that aren't working I wanted to get the initial pull request in to resolve those errors at least.

@desertkaz
Copy link
Contributor Author

desertkaz commented Jul 9, 2024

I wasn't sure if it was my network or what on the Lich::Util call but yeah, sometimes I was seeing up to 10 timeouts before a success, even without roundtime involved. It randomly happened on any module, inventory, vault book, storage book, register, etc. This was the easiest fix to ensure actual data gets written. My last update half my characters had empty data which is what prompted these hotfixes and additions.

@desertkaz
Copy link
Contributor Author

combined into single block for the main loop. updated to use double string evaluation vs regex.

@desertkaz
Copy link
Contributor Author

Output showing nesting in character, vault and storage_box.

image

@MahtraDR
Copy link
Collaborator

MahtraDR commented Jul 9, 2024

@mrhoribu worth looking into these timeouts separately.

@desertkaz
Copy link
Contributor Author

- the head and pelt of an albino wolf with vicious fangs and claws (worn) (character)
- the horned head and hide of a storm bull (closed) (character)
- several serrated loimic horns (worn) (character)
- clusters of vibrant violets (character)
- one half of a tiny amethyst (vault)
- the head and pelt of a tawny gold gryphon (character)

- a motley cloak (in container - the horned head and hide of a storm bull (closed)) (character) brought to my attention the fact there are some outliers that will cause weird issues nested and the using the match of a|an|some.

image
Also combined shadow servant with vault book/storage book since all the output formatting is the same.

Last addition for now until we get the rest of this worked out and merged.

@MahtraDR MahtraDR merged commit b8b5dda into elanthia-online:master Jul 10, 2024
3 checks passed
@desertkaz desertkaz deleted the desertkaz-patch-1 branch July 10, 2024 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants