View Single Post
07/19/23, 01:15 AM   #28
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 185
Originally Posted by ZOS_DanBatson View Post
Note about the trigger twice thing:

"The client will raise two consecutive kill events to Lua when the victim dies within two detection cells. The reason is that both our local trigger - detected via the Unit's SetDead method - and the server-based "crossed swords" trigger (sent via Region->Client message) fire that kill event.

Rather than having the client try to determine whether the kill occurred within the larger, 10-ish detection radius of any in-range crossed swords or having the server try to determine whether the kill was within the client's two detection cell range... the server just sends the event regardless, as does the Unit::SetDead "local" logic.

To safeguard against this, ChatHandlers.lua creates a singleton:
Code:
g_pvpKillFeedDeathRecurrenceTracker = ZO_RecurrenceTracker:New(EXPIRATION_MS, EXTENSION_MS)
which suppresses the redundant message, if any, when received:
Code:
local numOccurrences = g_pvpKillFeedDeathRecurrenceTracker:AddValue(messageKey)
if numOccurrences > 1 then
    -- Suppress redundant notifications that would otherwise result
    -- from duplicate client- and server-sourced death events.
    return nil
end
Thanks Dan, I will work on this.
  Reply With Quote