View Single Post
12/17/14, 10:39 AM   #8
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
Just tried to unregister every event related to notifications:
Lua Code:
  1. ZO_PreHook(CHAT_SYSTEM, "OnNumNotificationsChanged", function(self, totalNumNotifications)
  2.     error("test")
  3. end)
  4.  
  5. local events = {
  6.     "EVENT_INCOMING_FRIEND_INVITE_ADDED",
  7.     "EVENT_INCOMING_FRIEND_INVITE_REMOVED",
  8.     "EVENT_INCOMING_FRIEND_INVITE_NOTE_UPDATED",
  9.     "EVENT_GUILD_INVITES_INITIALIZED",
  10.     "EVENT_GUILD_INVITE_ADDED",
  11.     "EVENT_GUILD_INVITE_REMOVED",
  12.     "EVENT_CAMPAIGN_QUEUE_JOINED",
  13.     "EVENT_CAMPAIGN_QUEUE_LEFT",
  14.     "EVENT_CAMPAIGN_QUEUE_STATE_CHANGED",
  15.     "EVENT_RESURRECT_REQUEST",
  16.     "EVENT_RESURRECT_REQUEST_REMOVED",
  17.     "EVENT_PLAYER_ALIVE",
  18.     "EVENT_GROUP_INVITE_RECEIVED",
  19.     "EVENT_GROUP_INVITE_REMOVED",
  20.     "EVENT_TRADE_INVITE_CONSIDERING",
  21.     "EVENT_TRADE_INVITE_REMOVED",
  22.     "EVENT_QUEST_SHARED",
  23.     "EVENT_QUEST_SHARE_REMOVED",
  24.     "EVENT_PLEDGE_OF_MARA_OFFER",
  25.     "EVENT_PLEDGE_OF_MARA_OFFER_REMOVED",
  26.     "EVENT_AGENT_CHAT_REQUESTED",
  27.     "EVENT_AGENT_CHAT_ACCEPTED",
  28.     "EVENT_AGENT_CHAT_DECLINED",
  29.     "EVENT_RAID_SCORE_NOTIFICATION_ADDED",
  30.     "EVENT_RAID_SCORE_NOTIFICATION_REMOVED",
  31. }
  32.  
  33. local function ReassignEvent(name)
  34.     d("unregister " .. name .. ": " .. tostring(EVENT_MANAGER:UnregisterForEvent(NOTIFICATIONS.eventNamespace, _G[name])))
  35.     EVENT_MANAGER:RegisterForEvent("test", _G[name], function() d(name) end)
  36. end
  37.  
  38. zo_callLater(function()
  39.     d(NOTIFICATIONS.eventNamespace)
  40.     for _, name in ipairs(events) do
  41.         ReassignEvent(name)
  42.     end
  43. end, 1000)

The messages that were showing up when I revived obviously were caused by EVENT_PLAYER_ALIVE.

When I join a campaign queue I get:
Code:
EVENT_CAMPAIGN_QUEUE_JOINED
user:/AddOns/test/test.lua:130: test
stack traceback:
	[C]: in function 'error'
	user:/AddOns/test/test.lua:130: in function 'hookFunction'
	EsoUI/Libraries/Utility/ZO_Hook.lua:19: in function 'OnNumNotificationsChanged'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:705: in function 'ZO_NotificationManager:BuildNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:678: in function 'ZO_NotificationManager:RefreshNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:58: in function 'ZO_NotificationProvider:PushUpdateToNotificationManager'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:34: in function '(anonymous)'
EVENT_CAMPAIGN_QUEUE_STATE_CHANGED
user:/AddOns/test/test.lua:130: test
stack traceback:
	[C]: in function 'error'
	user:/AddOns/test/test.lua:130: in function 'hookFunction'
	EsoUI/Libraries/Utility/ZO_Hook.lua:19: in function 'OnNumNotificationsChanged'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:705: in function 'ZO_NotificationManager:BuildNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:678: in function 'ZO_NotificationManager:RefreshNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:58: in function 'ZO_NotificationProvider:PushUpdateToNotificationManager'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:34: in function '(anonymous)'
EVENT_CAMPAIGN_QUEUE_LEFT
user:/AddOns/test/test.lua:130: test
stack traceback:
	[C]: in function 'error'
	user:/AddOns/test/test.lua:130: in function 'hookFunction'
	EsoUI/Libraries/Utility/ZO_Hook.lua:19: in function 'OnNumNotificationsChanged'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:705: in function 'ZO_NotificationManager:BuildNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:678: in function 'ZO_NotificationManager:RefreshNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:58: in function 'ZO_NotificationProvider:PushUpdateToNotificationManager'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:34: in function '(anonymous)'
I am not sure what I am missing here, but in my opinion this should work and not call the push function anymore...
  Reply With Quote