View Single Post
06-21-16, 02:21 PM   #25
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
I do exactly as SDPhantom says - look up PrepareForScan() and RestoreStateAfterScan(). They are called only from InitializeScan(), which in turn is called either upon PEW, or PLAYER_EQUIPMENT_CHANGED (PEC), or from ForceUpdate(). Apart from that I only acquire data for the currently viewed artifact when ARTIFACT_UPDATE fires, without interfering with the stock ui, or at ARTIFACT_XP_UPDATE, but the API I use there already returns information without ArtifactFrame beeing open.

The game behaves differently during the initial login and subsequent loading screens. I wrote a simple addon that records every event after PEW until the return value of C_ArtifactUI.GetNumObtainedArtifacts() is what I expect (2 for my test character on the beta). The game loads character data persistently at the initial login and thus it is readily available at subsequent reloads. I'll attach the addon here so you could verify my results and see why I opted for a timeout at PEW, which is somewhat hacky and I don't like it. It someone finds a better way, I'd love that.

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.

Also, if someone has an idea how to track hidden currencies, I'd love to know that. The artifact knowledge level is such a currency - see /run print(GetCurrencyLink(1171) or /dump GetCurrencyInfo(1171)).
Attached Files
File Type: zip TestEvents.zip (735 Bytes, 189 views)