|
07/08/19, 08:53 PM | #1 |
|
Collectible Unlocked Event?
I'm trying to get my addon to trigger when a collectible is unlocked, specifically when a house is purchased so that I can update my data. However I can't seem to find the event that I thought was there a while back. The event "EVENT_COLLECTIBLE_UPDATED" doesn't seem to fire when I think it should and the "EVENT_COLLECTION_UPDATED" doesn't have any other parameters that it passes to detect what was going on. Anyone have some insight here? Even just tell me where to look in the source code. I looked there but the event that is listed in the source code doesn't exist anymore.
Thanks in advance! |
07/08/19, 10:59 PM | #2 |
I only did a quick search, and you might have found this already:
Code:
--[[ EVENT_COLLECTIBLE_UPDATED fires when a nickname changes or a collectible is set as active/inactive. It does not encompass unlock state changes. EVENT_COLLECTION_UPDATED happens on init or when a command forces all collectibles to lock/unlock (re-init). Those cases don't use dirty unlock mappings from C, so we do that delta work here while we refresh everything. EVENT_ESO_PLUS_FREE_TRIAL_STATUS_CHANGED can happen at any time, and is an event that tells us to re-evaluate unlock status for everything because anything could be based on that. Like with EVENT_COLLECTION_UPDATED, we handle the delta here, not in C. EVENT_COLLECTIBLES_UNLOCK_STATE_CHANGED happens when the client maps out dirty unlock states (collectibles go on trial or ownership changes like crown store or rewards). We consume the dirty mapping from C and broadcast it out. The later 3 all fire the same callback ("OnCollectionUpdated") to all systems registering with the callback manager with info to help determine what happened: collectionUpdateType (ZO_COLLECTION_UPDATE_TYPE), collectiblesByNewUnlockState --]] EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_COLLECTION_UPDATED, function(_, ...) self:OnCollectionUpdated(...) end) EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_ESO_PLUS_FREE_TRIAL_STATUS_CHANGED, function(_, ...) self:OnESOPlusFreeTrialStatusChanged(...) end) EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_COLLECTIBLES_UNLOCK_STATE_CHANGED, function(_, ...) self:OnCollectiblesUnlockStateChanged(...) end) EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_COLLECTIBLE_NEW_STATUS_CLEARED, function(_, ...) self:OnCollectibleNewStatusCleared(...) end) EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_COLLECTIBLE_CATEGORY_NEW_STATUS_CLEARED, function(_, ...) self:OnCollectibleCategoryNewStatusCleared(...) end) EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_COLLECTIBLE_NOTIFICATION_NEW, function(_, ...) self:OnCollectibleNotificationNew(...) end) EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_COLLECTIBLE_NOTIFICATION_REMOVED, function(_, ...) self:OnCollectibleNotificationRemoved(...) end) EVENT_MANAGER:RegisterForEvent("ZO_CollectibleDataManager", EVENT_HOUSING_PRIMARY_RESIDENCE_SET, function(_, ...) self:OnPrimaryResidenceSet(...) end) https://github.com/esoui/esoui/blob/...atamanager.lua Maybe you can use EVENT_COLLECTIBLES_UNLOCK_STATE_CHANGED (if this is not the one which you meant was removed). Or you use the callback function "function ZO_CollectibleDataManager:OnCollectiblesUnlockStateChanged()" with a ZO_PreHook. As the are no parameter you might need to rebuild the code in there yourself to get the colelctibleIds unlocked: Lua Code:
Edit: Please check if the PreHook will break the function GetNextDirtyUnlockStateCollectibleId somehow so that the original code won't get any new collectibelids after your prehook anymore. Last edited by Baertram : 07/08/19 at 11:55 PM. |
|
07/09/19, 07:57 PM | #3 |
|
I actually ended up using EVENT_COLLECTIBLE_NOTIFICATION_NEW because I realised that every time you unlock a collectible you get a notification and the collectible id is one of the parameters. Works perfectly. Thanks for looking into it though!
|
ESOUI » Developer Discussions » General Authoring Discussion » Collectible Unlocked Event? |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|