WowRarity / Rarity

Collectibles and statistics tracking addon for World of Warcraft
https://www.curseforge.com/wow/addons/rarity
GNU General Public License v2.0
55 stars 35 forks source link

Pickpocketing may cause subsequent loot events to be ignored even if there are items of interest #706

Closed rdw-software closed 5 months ago

rdw-software commented 6 months ago

Source: WowAce

I've noticed when playing on my rogue that any mob that I kill is only tracked as an attempt if I have NOT attempted to pick their pockets beforehand. if I just straight up kill them, all is well and once looted the attempts are counted. anything pickpocketed may as well not exist as far as the addon is concerned

If I understand correctly, the issue may be that Rarity ignores the NPC after it's been "looted" twice (pickpocketing + on kill).

rdw-software commented 6 months ago

Looking at the code, I suspect the NPC is simply "checked off" after the pickpocket completes and the loot window is opened.

Source: https://github.com/WowRarity/Rarity/blob/62e7b13af6953db51f689430cbe3b0a7f5a3b520/Core.lua#L756

If this is the issue, then the list of "seen" NPCs could be split into two lists, one for loot and another for pickpocketing events.

rdw-software commented 5 months ago

The problem can be observed in the table inspector:

  1. Type /tinspect Rarity.guids
  2. Use Pick Pocket on the target
  3. The GUID is checked off and subsequent loot events will be ignored

The next question then is where exactly the pick pocket event leads to the GUID being checked off. I believe there is no special handling since Blizzard's UI only sends generic UNIT_SPELLCAST_SUCCEEDED and then LOOT_READY / LOOT_OPENED events when pick-pocketing an enemy. Rarity therefore can't differentiate between a regular loot attempt and Pick Pocket.

In other words, it's all the same CheckNpcInterest handling, which would be called twice in this scenario.

rdw-software commented 5 months ago

Turns out the solution is quite simple: Just don't set the guids entry if the requiresPickpocket flag is enabled. There can't be issues with duplicate attempts since the game prevents the spell from being cast twice. And looting an enemy more than once is similarly impossible. Both attempts are differentiated by the target state - if it's not dead, Rarity assumes Pick Pocket.