Originally Posted by SDPhantom
You can unregister the event for UIParent and the ArtifactUI so you can scan in peace and reregister the event when you're done. This is similar to map scanning and unregistering WORLD_MAP_UPDATE temporarily to stop the WorldMapFrame from redrawing everything constantly while scanning.
|
That's basically what I tried. I'll have to revisit my code - it's likely something that is painfully obvious and I'll feel silly about.
Originally Posted by Rainrider
Yes, C_ArtifactUI.GetNumObtainedArtifacts() includes the bank. My scan accounts for that and it stops when all artifacts are found (see how I propagate numObtained in InitializeScan()).
I welcome further comments on the code and thank you for that. Feel free to use whatever you like from it. There is also some documentation here.
|
I really really like your code. Far cleaner than the stuff I come up with
Correct my tired mind though, but it looks like your bank scan doesn't actually activate as there is no event associated with scanning outside PEW, PEC and Force Update? Unless I'm mistaken, bank information is only available whilst the bank tabs are open, and during the first BANK_CLOSE event (neither of which you've registered).
Some info on some of your comments:
* Traits can be purchased on artifacts that are not equipped, however you must be at the forge with the UI open. ie: open forge with equipped artifact, then shift+right click on unequipped artifact to change. I don't think you can do the same with the trait respeccing, however I haven't specifically tried to break the UI in that way.
* Relics are part of the ARTIFACT_UPDATE event. Your ARTIFACT_XP_UPDATE code is redundant in calling ScanTraits(), although this may be entirely based on event order received by the client. You may want to consider shifting thr callback into the main ARTIFACT_UPDATE event as part of your relic scan. Food for thought.
Regarding your PEW delayed call:
I know that efficiency is a goal and understand the need to break out of the search loop, however if someone has an artifact in their bank you'll end up iterating over all their bag slots anyway. Have you considered using an arbitrary figure for numObtained that is purely used at login so that all bag slots are scanned only for login? Additionally, you're not unregistering your PEW event which only needs to fire once for the initial scan.
eg: local numObtained = GetNumObtainedArtifacts() or 10
Or some if then else variant.
This is basically what my code does (version currently being worked on). I'll scan everything at login, and future scans only occur if I have outstanding artifacts. I have a search function that picks up unscanned artifacts and places them into an array with bag locations, which is then passed to my scan function that processes them. I'm not terribly worried about scanning artifacts that have just been obtained (PEC), as they basically have no data to begin with and the player buys the first trait at the forge early on. Everything else will get picked up.