Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

level and multiplier is not set after ReloadUI() #16

Closed
Blazeflack opened this issue Sep 27, 2017 · 6 comments
Closed

level and multiplier is not set after ReloadUI() #16

Blazeflack opened this issue Sep 27, 2017 · 6 comments

Comments

@Blazeflack
Copy link

Blazeflack commented Sep 27, 2017

When doing a /reload the artifacts.knowledgeLevel and artifacts.knowledgeMultiplier fields are not being set. This can be fixed by adding a conditional ScanEquipped() to the PLAYER_ENTERING_WORLD event function.

function private.PLAYER_ENTERING_WORLD(event)
	frame:UnregisterEvent(event)
	frame:RegisterUnitEvent("UNIT_INVENTORY_CHANGED", "player")
	frame:RegisterEvent("BAG_UPDATE_DELAYED")
	frame:RegisterEvent("BANKFRAME_OPENED")
	frame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED")
	frame:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
	frame:RegisterEvent("ARTIFACT_CLOSE")
	frame:RegisterEvent("ARTIFACT_XP_UPDATE")
	frame:RegisterUnitEvent("PLAYER_SPECIALIZATION_CHANGED", "player")
	
	if not equippedID and HasArtifactEquipped() then
		ScanEquipped()
	end
end

This will ensure that lib.GetArtifactKnowledge() returns the proper values after a /reload.

@Rainrider
Copy link
Owner

PEW is unregistered after first use. I think the github version has a fix for this already, will test later today, I'm not sure if I have unpushed changes locally right now.

@Blazeflack
Copy link
Author

It only needs to run on the first PEW so that is fine. It is only immediately after a reload that we need to force an update, because no other event is triggering an update.

@Rainrider
Copy link
Owner

Which LAD version are you using? I can't reproduce this, neither with the current github version, nor with the released 1.2.

@Blazeflack
Copy link
Author

I was using revision 18 from GitHub. Let me see if I can figure out some steps to reproduce it for you.

@Blazeflack
Copy link
Author

Okay I did a new round of tests where I created a test addon which just embedded the necessary libraries to run LibArtifactData-1.0, and you are right, it works fine after a /reload. It must be an issue with how early I am trying to get data from it.

Sorry for the confusion, you can close this.

@Rainrider
Copy link
Owner

Rainrider commented Sep 30, 2017

Just register the lib's ARTIFACT_KNOWLEDGE_CHANGED event. With revision 18 and above you don't have to handle the ARTIFACT_DATA_MISSING event for artifact knowledge anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants