Originally Posted by circonian
Oh, yeah your right it is local.
No I hadn't looked at it, but I see you were all ready doing what I suggested.
Looks like it would work to me. Although I think you could get rid of one of the loops by doing this:
Warning: Spoiler
Lua Code:
function TI.HookNotifications() ZO_PreHook(NOTIFICATIONS.providers[10], "BuildNotificationList", function(self) for index = 1, GetNumRaidScoreNotifications() do local notificationId = GetRaidScoreNotificationId(index) local numMembers = GetNumRaidScoreNotificationMembers(notificationId) local showNotification = false local guildMembers = {} for memberIndex = 1, numMembers do local displayName, _, _, isGuildMember = GetRaidScoreNotificationMemberInfo(notificationId, memberIndex) if isGuildMember then -- Change this: -- table.insert(guildMembers, displayName) -- To something like this: table.insert(guildMembers, {["NAME"] = displayName, ["MEMBERINDEX"] = memberIndex}) end end -- change this: --for _, name in ipairs(guildMembers) do -- To this, because were now getting a table: for _, tPlayerInfo in ipairs(guildMembers) do for guildIndex = 1, GetNumGuilds() do if not showNotification and TI.GetGuildSetting(guildIndex) and TI.GetRaidScoreNotifySetting(guildIndex) then local guildId = GetGuildId(guildIndex) -- And I think you could then avoid doing this loop: --for memberIndex = 1, GetNumGuildMembers(guildId) do -- change this: --local displayName = GetGuildMemberInfo(guildId, memberIndex) -- to this: local displayName = GetGuildMemberInfo(guildId, tPlayerInfo["MEMBERINDEX"]) -- and last change this: --if displayName == name then -- to this: if displayName == tPlayerInfo["NAME"] then --d(zo_strformat("RL notify hit: <<1>> from <<2>>", displayName, GetGuildName(guildId))) showNotification = true break end --end end end end if not showNotification then --d(zo_strformat("Removed RL notification! (i: <<1>>, id: <<2>>)", index, notificationId)) RemoveRaidScoreNotification(notificationId) end end end) end
EDIT:
Or I may have spoke to soon. I've never done any pvp/raid stuff. I have no idea how any of it even works. I may be wrong about what I said above...I thought this memberIndex:
Lua Code:
local numMembers = GetNumRaidScoreNotificationMembers(notificationId) local hasFriend = false local hasGuildMember = false for memberIndex = 1, numMembers do local displayName, characterName, isFriend, isGuildMember = GetRaidScoreNotificationMemberInfo(notificationId, memberIndex)
was refering to the same memberIndex used for a guild members index,
Lua Code:
local displayName = GetGuildMemberInfo(guildId, memberIndex)
but I read it again and think they might not be the same? Does the first one refer to memberIndex as the "memberIndex" for members of a raid party (people involved in that notification)? If so what I said would not work.
|
The first member index is in the raid group and it's not the same as member index in guild.
Originally Posted by circonian
Sorry for the jumble of 1,000 different ideas :P and I still see nothing wrong with what you did, but another option is that you could also hook: NOTIFICATIONS:BuildMasterList().
It would be the same result as what you did so this may not be useful for what your doing, but I saw it & thought I would point it out in case you (or anyone else reading this post later) had any reason to hook any other notifications it might be easier to grab them all in one place:
Lua Code:
-- hook this: function ZO_NotificationManager:BuildMasterList() for i = 1, #self.providers do self.providers[i]:BuildNotificationList() end end -- with this: --function NOTIFICATIONS:BuildMasterList()
and just intercept self.providers[10] (or whatever provider is needed).
|
ZO_NotificationManager is a local name, so if I want to do it this way I will have to hook NOTIFICATIONS
(global instance of ZO_NotificationManager). But I think that for my purpose is better to hook directly instance of ZO_LeaderboardRaidProvider which is NOTIFICATIONS.providers[10].