TicTac7x / runelite-plugins

External plugins for RuneLite
https://runelite.net/plugin-hub/
11 stars 14 forks source link

Barrows infoboxes showing 0 when worn #182

Closed Fiskmans closed 2 months ago

Fiskmans commented 4 months ago

Describe how the bug happened Worn barrows items infoboxes show a text of 0 for charge when worn The tooltip appears to be correct

Expected behavior The infobox text should match the charges of the barrows item

Screenrecording/Screenshots

While worn

image image image

While in inventory

image image image

Note: Infoboxes with yellow text is from Partial sets and is unrelated

TicTac7x commented 3 months ago

I cant make this happen from my end. Maybe you can try to provide screenrecording how u get it to happen? Start from no items on you for example.

Fiskmans commented 3 months ago

https://youtu.be/2xxVf9tAFxc The video was too big to attach directly to the comment

Fiskmans commented 3 months ago

The code paths seem to diverge in Store.getInventoryItemQuantity(itemId)

Guthans platebody 100 in inventory

image currentItems contains the item (Guthans platebody 100) so the function returns 1

Guthans platebody 100 Equipped

image currentItems is empty and the function returns 0

Fiskmans commented 3 months ago

https://github.com/TicTac7x/runelite-plugins/assets/8762029/06661666-1e20-4cb1-9c1b-705e034ea963

This bug seems to be related

If you have two items with fixed charges and the same id the charges get merged in the infobox text. As soon as the id of one of the trigger items changes (degrades to guthans 100) the charges no longer add up

TicTac7x commented 3 months ago

Thanks for all the details. It didn't happen for me, because i had faulty config value left from some previous version. Anyways, tracked it down, the same thing was causing waterskins not showing proper total value as well.

I will also add a extra check, basically if you have fixed item equipped, the infobox shows 100, but if you unequip it and you have 4 items in inventory now, it would show 400. Basically to make sure that equipment items are prioritized, otherwise you are wearing barrows item that is broken, but infobox still shows as if it was not broken. Hope this makes sense and sounds good to you as well?

image

image

If you want to do a test run with the changes, then https://github.com/TicTac7x/runelite-plugins/commit/b8efad2a562ebafd76f46cf30eb39555ebbde259 (latest commit on plugin-charges branch).

Fiskmans commented 3 months ago

Thats sounds like a good solution. The slight change in behaviour from equipped and unequipped items could be confusing to some, but I suspect it wont come up very often enough to be an issue.

May I suggest updating the tooltip in the case where the equipped item is hiding the charges of your unequipped items Something like:

Equipped: 75  </br>
Inventory: 400
TicTac7x commented 2 months ago

https://github.com/runelite/plugin-hub/pull/6486