Download
(334 Kb)
Download
Updated: 11/04/23 12:32 AM
Compatibility:
Endless Archive (9.2.5)
base-game patch (9.1.5)
Necrom (9.0.0)
Updated:11/04/23 12:32 AM
Created:07/03/23 10:22 PM
Monthly downloads:1,387
Total downloads:17,250
Favorites:5
MD5:
LibSeasonalEventManager  Popular! (More than 5000 hits)
Version: 1.3
by: IsJustaGhost [More]
LibSeasonalEventManager is used to detect seasonal events and send that info to registered addons.

Repository

Lua Code:
  1. -- Returns _*boolean*_
  2. local wouldTicketsExcedeMax = lib.WouldTicketsExcedeMax
  3. wouldTicketsExcedeMax(eventTickets)
  4.  
  5. -- Returns _*init*_ remainingTimeinSeconds
  6. local getDailyResetTimeRemainingSeconds = lib.GetDailyResetTimeRemainingSeconds
  7. getDailyResetTimeRemainingSeconds()
  8.  
  9. -- Returns _*boolean*_ eventAactive
  10. IJA_Seasona_Event_Manager:IsEventActive()
  11.  
  12. -- Returns _*init*_ index
  13. IJA_Seasona_Event_Manager:GetActiveEventIndex()
  14.  
  15. -- Returns _*init*_ eventType
  16. IJA_Seasona_Event_Manager:GetActiveEventType()
  17.  
  18. -- Returns _*object*_ eventObject
  19. IJA_Seasona_Event_Manager:GetCurrentEvent()
  20.  
  21. -- Returns _*string*_ eventTitle
  22. IJA_Seasona_Event_Manager:GetEventTitle()
  23.  
  24. -- Returns _*string*_ eventDescription
  25. IJA_Seasona_Event_Manager:GetEventDescription()
  26.  
  27. -- Returns _*string*_ eventTitle, _*string*_ eventDescription
  28. IJA_Seasona_Event_Manager:GetEventInfo()
  29.  
  30. -- Returns _*init*_ maxDailyRewards
  31. IJA_Seasona_Event_Manager:GetEventMaxDailyRewards()

Register the callback to get updates on event changes.
This method is used to ensure the callback is fired on registering so the addon does not have to wait for an update to get initial data.

Lua Code:
  1. -- _*boolean*_ active
  2. -- _*object*_ eventObject
  3. local function onSeasonalEventUpdate(active, eventObject)
  4.     self.currentEvent = {}
  5.     if active then
  6.         if eventObject:GetType() == VAR_EVENT_TYPE_TICKETS then
  7.             self.currentEvent = eventObject
  8.             if not eventObject:IsSameEvent(self.savedVars.eventIndex) then
  9.                 -- start new event
  10.                 self:SetupEvent(eventObject)
  11.                 self.eventActive = false
  12.                 self.savedVars.eventIndex = eventObject:GetIndex()
  13.             else
  14.                 -- reset for dailies?
  15.                 self:ResetDailyInfo(eventObject)
  16.             end
  17.         else
  18.             active = false
  19.         end
  20.     end
  21.    
  22.     self:ChangeState(active)
  23. end
  24.  
  25. IJA_Seasona Event_Manager:RegisterUpdateCallback(onSeasonalEventUpdate)

The functions available to the eventObject.
Lua Code:
  1. -- Returns _*init*_ index
  2. -- The table index of lib.events
  3. eventObject:GetIndex()
  4.  
  5. -- Returns _*init*_ eventType
  6. eventObject:GetType()
  7.  
  8. local EVENT_TYPE_NONE       = LibSeasonalEventManager.constants.eventTypeNone
  9. local EVENT_TYPE_UNKNOWN    = LibSeasonalEventManager.constants.eventTypeUnknown
  10. local EVENT_TYPE_TICKETS    = LibSeasonalEventManager.constants.eventTypeTickets
  11. local EVENT_TYPE_BG         = LibSeasonalEventManager.constants.eventTypeBG
  12.  
  13. EVENT_TYPE_NONE     = 0 --
  14. EVENT_TYPE_UNKNOWN  = 1 -- Has not yet been determined
  15. EVENT_TYPE_TICKETS  = 2 -- Event that awards event tickets
  16. EVENT_TYPE_BG       = 3 -- Weekend battlegrounds event
  17.  
  18.  
  19. -- Returns _*init*_ rewardsBy
  20. eventObject:GetRewardsBy()
  21. local  REWARDS_BY_NONE      = LibSeasonalEventManager.constants.rewardsByNone
  22. local  REWARDS_BY_UNKNOWN   = LibSeasonalEventManager.constants.rewardsByUnknown
  23. -- The event rewards, Event Tickets, are offered at quest turn in.
  24. local  REWARDS_BY_QUEST     = LibSeasonalEventManager.constants.rewardsByQuest
  25. -- The event rewards, Event Tickets, are offered loot pickup.
  26. local  REWARDS_BY_LOOT      = LibSeasonalEventManager.constants.rewardsByLoot
  27. -- The event rewards, Event Tickets, are offered by interacting with a specific target (Aniversary cake).
  28. local  REWARDS_BY_TARGET    = LibSeasonalEventManager.constants.rewardsByTarget
  29.  
  30. -- Returns _*init*_ maxDailyRewards
  31. eventObject:GetMaxDailyRewards()
  32. -- Currently, this is used for number of event tickets per day.
  33. -- Not all event have a correct max, since zos does change them sometimes.
  34.  
  35. -- Returns _*boolean*_ isSame
  36. eventObject:IsSameEvent(eventIndex)
  37. -- If the addon saves the eventIndex of events,
  38. -- it can be used to check if the event sent by update matches the saved eventIndex.
  39.  
  40. -- Returns _*string*_ eventTitle
  41. eventObject:GetTitle()
  42.  
  43. -- Returns _*string*_ eventDescription
  44. eventObject:GetDescription()
  45.  
  46. -- Returns _*string*_ eventTitle, _*string*_ eventDescription
  47. eventObject:GetInfo()
- - - 1.3
○ updated for U40

- - - 1.2
○ fixed error "core.lua:622: attempt to index a nil value" for addon registered to receive updates
○ changed how Weekend Battleground Events strings are registered
○ unknown events will now update type to match detected type

- - - 1.1
○ fixed error "core.lua:209: operator .. is not supported for string .. nil"
○ updated timeframe of initial update
Optional Files (0)


Archived Files (3)
File Name
Version
Size
Uploader
Date
1.2
15kB
IsJustaGhost
07/27/23 07:05 PM
1.1
15kB
IsJustaGhost
07/13/23 04:58 PM
1
14kB
IsJustaGhost
07/03/23 10:22 PM


Post A Reply Comment Options
Unread 07/15/23, 05:08 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4989
File comments: 6040
Uploads: 78
Thanks for the exaplantion, it's more clear now.
Hint: IJA_Seasona_Event_Manager -> Typo, should be IJA_Seasonal_Event_Manager
Last edited by Baertram : 07/15/23 at 05:09 AM.
Report comment to moderator  
Reply With Quote
Unread 07/14/23, 06:21 AM  
IsJustaGhost
AddOn Author - Click to view AddOns

Forum posts: 38
File comments: 280
Uploads: 23
Originally Posted by Baertram
Hi there,

your repository link is broken and somehow I do not understand how to use this library

The global name of the library is LibSeasonalEventManager, right? I'd add that to the description top then.
-> LibSeasonalEventManager.GetDailyResetTimeRemainingSeconds() is clear for example.

What is IJA_Seasonal_Event_Manager then, is it provided by this library too?
I didn't realize I had the repo set to private.

IJA_Seasonal_Event_Manager is the object that manages the data and updates.

The 2 functions defined using . were made for simple transposing to addons for local use.
local wouldTicketsExcedeMax = LibSeasonalEventManager.WouldTicketsExcedeMax
local getDailyResetTimeRemainingSeconds = LibSeasonalEventManager.GetDailyResetTimeRemainingSeconds

IJA_Seasonal_Event_Manager:RegisterUpdateCallback(callback) registers a callback and triggers the update to send to the addon.
That way the addon will recive the update without having to wait for daily reset.
The callback will again fire on daily reset, for when a client is connected before and after the time has passed.

IJA_Seasonal_Event_Manager functions independently from addons to store and check for current events.
It creates an object for the current event that can be used by addons to see what event is running.

If an event that awards event tickets is detected and unidentifiable on scan, it will create the object as an unknown event and register events to watch for loot and quests that will update the active event when it detects known info.
When updated, it will again fire the callback to send the updated data to addons.

It detects events by...
If Impresario is visible then it knows an event that offers tickets is active.
If not, it checks for active battlegrounds to see if one of the weekend types are active

If Impresario then it checks to see if 1 of the 4 events is running that has a map pin.
if not then it sets it as unknown ticket event and waits for updates.
However, if was unknown and was previously identified, it will load that info from saved variables so it does not need to wait for loot or quests to update it.
It will also check for active quests in the player's journal to see if they already have the quest for an unknown event

Basically, IJA_Seasonal_Event_Manager does a lot of behind the scenes work to send info, in the form of an object, to addons via the update callback.
Last edited by IsJustaGhost : 07/15/23 at 06:10 AM.
Report comment to moderator  
Reply With Quote
Unread 07/14/23, 04:51 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4989
File comments: 6040
Uploads: 78
Hi there,

your repository link is broken and somehow I do not understand how to use this library

The global name of the library is LibSeasonalEventManager, right? I'd add that to the description top then.
-> LibSeasonalEventManager.GetDailyResetTimeRemainingSeconds() is clear for example.

What is IJA_Seasona_Event_Manager then, is it provided by this library too?
Report comment to moderator  
Reply With Quote
Unread 07/13/23, 06:13 PM  
DohNotAgain

Forum posts: 1
File comments: 110
Uploads: 0
Originally Posted by IsJustaGhost
Originally Posted by DohNotAgain
Starting today I am getting this error.'
It would be helpful if you post the full error with details.
To do so, you need to go into escape > add-ons and in the top right check the box for advanced ui errors.


Altho, with that being said, I have no Idea why it's trying to setup for a weekend battleground event. Is one going on?

Oh. Capture the relic.
Oh, I'll have to go check that out.
Sorry, didn't realize there was an option like that.
I thought it just dumped everything it got by default.

And thanks for fixing it.
Report comment to moderator  
Reply With Quote
Unread 07/13/23, 03:31 PM  
IsJustaGhost
AddOn Author - Click to view AddOns

Forum posts: 38
File comments: 280
Uploads: 23
details would look like this
I'll see what I can do.

Lua Code:
  1. user:/AddOns/LibSeasonalEventManager/core.lua:209: operator .. is not supported for string .. nil
  2. |rstack traceback:
  3. user:/AddOns/LibSeasonalEventManager/core.lua:209: in function 'updateBattelgroundStrings'
  4. |caaaaaa<Locals> title = "Solo Relic PVP Weekend", description = "This queue group includes the ...", strings = [table:1]{} </Locals>|r
  5. user:/AddOns/LibSeasonalEventManager/core.lua:544: in function 'lib:UpdateBattleGroundInfoById'
  6. |caaaaaa<Locals> self = [table:2]{isUpdating = T}, bgId = 99, title = "Solo Relic PVP Weekend", description = "This queue group includes the ..." </Locals>|r
  7. user:/AddOns/LibSeasonalEventManager/core.lua:384: in function 'lib:CheckForActiveEvent'
  8. |caaaaaa<Locals> self = [table:2], activeType = 3 </Locals>|r
  9. user:/AddOns/LibSeasonalEventManager/core.lua:429: in function 'lib:Refresh'
  10. |caaaaaa<Locals> self = [table:2] </Locals>|r
  11. user:/AddOns/LibSeasonalEventManager/core.lua:250: in function 'callback'
  12. /EsoUI/Libraries/Utility/ZO_CallbackObject.lua:132: in function 'ZO_CallbackObjectMixin:FireCallbacks'
  13. |caaaaaa<Locals> self = [table:3]{numSelected = 0, groupSize = 0, fireCallbackDepth = 1, dataDirty = T}, eventName = "OnUpdateLocationData", registry = [table:4]{}, callbackInfoIndex = 7, callbackInfo = [table:5]{4 = F}, callback = user:/AddOns/LibSeasonalEventManager/core.lua:249, deleted = F </Locals>|r
  14. /EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:420: in function 'ActivityFinderRoot_Manager:UpdateLocationData'
  15. |caaaaaa<Locals> self = [table:3], inAGroup = F, isLeader = F, tributeLockText = "Requires completion of |cfffff..." </Locals>|r
  16. /EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:470: in function 'ActivityFinderRoot_Manager:ClearAndUpdate'
  17. |caaaaaa<Locals> self = [table:3] </Locals>|r
  18. /EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:308: in function 'ActivityFinderRoot_Manager:OnUpdate'
  19. |caaaaaa<Locals> self = [table:3] </Locals>|r
  20. /EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:237: in function '(anonymous)'
Report comment to moderator  
Reply With Quote
Unread 07/13/23, 03:25 PM  
IsJustaGhost
AddOn Author - Click to view AddOns

Forum posts: 38
File comments: 280
Uploads: 23
Originally Posted by DohNotAgain
Starting today I am getting this error.'
It would be helpful if you post the full error with details.
To do so, you need to go into escape > add-ons and in the top right check the box for advanced ui errors.


Altho, with that being said, I have no Idea why it's trying to setup for a weekend battleground event. Is one going on?

Oh. Capture the relic.
Last edited by IsJustaGhost : 07/13/23 at 03:30 PM.
Report comment to moderator  
Reply With Quote
Unread 07/13/23, 02:13 PM  
DohNotAgain

Forum posts: 1
File comments: 110
Uploads: 0
Starting today I am getting this error.
Could it be related to the new PVP event that just started?

-----------------------

user:/AddOns/LibSeasonalEventManager/core.lua:209: operator .. is not supported for string .. nil
stack traceback:
user:/AddOns/LibSeasonalEventManager/core.lua:209: in function 'updateBattelgroundStrings'
user:/AddOns/LibSeasonalEventManager/core.lua:544: in function 'lib:UpdateBattleGroundInfoById'
user:/AddOns/LibSeasonalEventManager/core.lua:384: in function 'lib:CheckForActiveEvent'
user:/AddOns/LibSeasonalEventManager/core.lua:429: in function 'lib:Refresh'
user:/AddOns/LibSeasonalEventManager/core.lua:250: in function 'callback'
/EsoUI/Libraries/Utility/ZO_CallbackObject.lua:132: in function 'ZO_CallbackObjectMixin:FireCallbacks'
/EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:420: in function 'ActivityFinderRoot_Manager:UpdateLocationData'
/EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:470: in function 'ActivityFinderRoot_Manager:ClearAndUpdate'
/EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:308: in function 'ActivityFinderRoot_Manager:OnUpdate'
/EsoUI/Ingame/LFG/ZO_ActivityFinderRoot_Manager.lua:237: in function '(anonymous)'
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: