Rarity

Rarity

17M Downloads

Add some documentation for potential contributors (and for posterity/archival purposes)

rdw-software opened this issue · 3 comments

commented

Since some people have expressed confusion as to what's going on inside the code, I figured I might as well give a brief overview that can be used to understand the addon better.

It'll also be helpful in case I ever get abducted by aliens, or something. You never know, right? I wouldn't count on the original author coming back, so maybe it'll allow someone else to take over maintenance of the addon at some point, or enable others to contribute.

I'm not really sure what's needed exactly, though.

commented

QNA taken from an archived mail in my inbox:

Q: What is the chief difference between methods BOSS and NPC? I saw BOSS would scan for UNIT_DEAD combat events, but then most use kill statistic IDs anyway. NPC seems to be scanning regular loot windows, where BOSS can be either loot window or push personal loot (toasts)? Also, is there a rule when to use the SPECIAL loot method for a given item?

A: BOSS watches for a unit to die. NPC waits for you to loot. It’s a very big distinction because in a group, you may never open a loot window on a boss. NPC mode requires that loot window. Over time, we did transition to mostly use stats for boss detection, but older bosses don’t have stats.

SPECIAL is only used for items that use custom code to detect the attempt, such as world objects, mouseovers, or anything really weird (I think mining might be one? would have to check). I think SPECIAL also lets the tooltip display a custom string for detection method, instead of one of the built-in strings.


Q: Currently, Rarity detects attempts made from skinning, pickpocketing, and fishing (sometimes? not sure) as regular loot attempts (similar to the NPC method). This is clearly a bug, but I wonder if the detection for those activities is simply broken or if it always had issues/inaccuracies. Some users have reported a similar problem with fishing, where they would fish for the Darkmoon faire pet and get attempts on another fishing mount (in a different zone), but only sometimes/very rarely. It's been difficult to reproduce, as it seemed pretty random.
Is it possible to detect herbalism and skinning correctly, by the way? There are two pets added in Legion that can drop off any skinning/herb gathering in a given zone, which I haven't managed to add yet (since I didn't know how to reliably detect attempts for these things).

A: Fishing detection is really really tricky and the game client doesn’t really like you doing that. It mostly works, with some caveats. Have a look at the FAQ posted on the Rarity project for some detail there. When I left the addon, Fishing detection was working correctly. If it has drifted since then, it would need to be investigated. It’s very, very, very weird code because again, the client doesn’t like us doing this. I borrowed the technique from GatherMate2.

You can extend Fishing detection, kind of, to any kind of “cast” detection. I already do this with Mining. It can be extended to Herbalism, but it can be weird and tricky. Have a look at the top for some spell arrays, first. Trace through anything we’re doing for Mining detection, that should give you the general idea. I would have to review everything again, I don’t remember it very well. I don’t think we support zone-wide “cast” detection though, so that code would have to be added. All of this happens during loot detection, I think at the top, so look there for where to put new stuff like this.

I think skinning works the same way, but haven’t tried it.

Note: Skinning/herbalism/lockpicking/fishing all use the same code, with a different spell ID.


Q: Do I need to change the equalOdds flag only if the item can be looted and rolled for? E.g., Garn Nighthowl is a BOE item, but the Solar Spirehawk will be given via Personal Loot after killing Rukhmar... Actually, everything is Personal Loot now, so is it still required to flag items this way? I believe some raid and dungeon mounts will have a lower probability when there are multiple people despite this, but I'm not sure how exactly the system works. If it reduces the probability for Personal Loot drops my guess would be to flag it as equalOdds still, regardless of everything in the game being Personal Loot. There isn't really any reliable source for which items would be affected in such a way, though.

A: Equal Odds is for personal loot, so everything should use it now. Equal Odds OFF causes Rarity to multiply your odds out by the group size, making it much less likely for you to obtain an item. If they changed the drop rate of mounts due to Personal Loot, every single odds in Rarity would have to be re-researched and updated by hand. Good luck with that, haha. Again, Equal Odds should be ON for every item that uses Personal Loot. If that’s the entire game, then just hardcode it to ON in the code that checks it. (Should just be tooltip related code, it’s used for calculating Likelihood/Luckiness.)


Lockouts vs Defeat detection:

Lockouts control the “Undefeated” tooltip item, and for that we have to scan your Raid panel, using tooltip scanning. When I wrote this, you had to have a localized boss name to do this. This has nothing to do with detecting a kill, and ENCOUNTER_END wouldn’t even help you for this. “Undefeated/Defeated” supports kills that occurred previously, when Rarity wasn’t even running, because it uses either lockout scanning or quest completed checks.


Kill statistics overriding manual attemts:

doNotUpdateToHighestStat was a relatively newer thing I added, so not every item had it put on. You are right that it should be on more items (probably a lot of pets)—it’s an oversight. However, it should not be on wasGuaranteed items, because the player does have all those lifetime attempts. The mount always existed—it’s not our fault they didn’t obtain it when they killed it at 100% drop rate. Those are attempts, too.


Fallback detection (items from mailbox etc):

Oh, also: Rarity does not detect loot toasts. But it does detect an item magically appearing in your bag, which is the exact same thing. Detecting an item magically appearing happens for any item as a last-ditch effort, exactly for situations like this where I couldn’t foresee future methods. So for personal loot, if you never see a loot window, we’ll still notice the item in your bag and it will still work. But if you never loot, and the item is set to NPC mode, you will not get an attempt! (Unless the item is set to use a Statistic.)

So again, just think of it this way: NPC is for seeing a loot window appear. BOSS is for UNIT_DIED in the CLEU event. We don’t detect toasts. Just ask yourself how you want the attempt being counted and use the appropriate one. If you have a Statistic, however, put that in, pick whichever mode you want, and set the NPC ID to 99999 so we don’t double count.

commented

WIP/draft can be found at: https://github.com/SacredDuckwhale/Rarity/tree/task/224-documentation-contributors

Not sure if it's helpful or not, but more info can be added later I guess.

commented

Need to find some time to review this.