Add OmenSync: addon-channel fallback for Vol'jin party threat
The CoA Vol'jin core does not push UnitDetailedThreatSituation data
for party-member units, so vanilla Omen draws only the local
player's bar in 5-mans. The same install on Bronzebeard/classic+
shows the whole party because that core does push the data. The gap
is server-side, not client-side, and there is no Omen flag that
fixes it.
OmenSync layers a tiny SendAddonMessage("OMSYNC", …, "PARTY"|"RAID")
relay on top:
- Each player's Omen broadcasts its own player+pet threat values
(throttled, ~0.4s + 5% delta) every time updatethreat() succeeds
via the API path.
- Receivers store incoming values keyed by senderGUID/mobGUID and
serve them as a fallback in updatethreat() whenever
UnitDetailedThreatSituation returns nil.
When the API does push data (Bronzebeard) the existing path still
wins; sync values are simply unused, so this is a no-op on healthy
realms. Both peers must run a fork that emits the OMSYNC prefix.
Wire format keeps each message under the 255-byte AddonMessage cap:
<subjectGUID>|<mobGUID>|<threatValue>|<isTanking 0|1>
Sender's name comes from CHAT_MSG_ADDON's sender arg. Subject GUID
distinguishes the player and pet broadcasts each Omen instance
emits.
Hook in Omen.lua's local updatethreat():
- After UnitDetailedThreatSituation returns nil for any unit, try
Omen:SyncGetThreat(guid, mobGUID).
- After it returns a value for "player" or "pet", call
Omen:SyncBroadcastThreat to relay it to peers.
This commit is contained in:
@@ -1378,6 +1378,19 @@ local function updatethreat(unitid, mobunitid)
|
||||
local guid = UnitGUID(unitid)
|
||||
if guid and not threatTable[guid] then
|
||||
local isTanking, state, scaledPercent, rawPercent, threatValue = UnitDetailedThreatSituation(unitid, mobunitid)
|
||||
-- CoA: the Vol'jin/CoA core does not push party-member threat to the
|
||||
-- client, so the API call above returns nil for everyone but us. Fall
|
||||
-- back to values broadcast by peers running OmenSync.
|
||||
if not threatValue and Omen.SyncGetThreat then
|
||||
local mobGUID = UnitGUID(mobunitid)
|
||||
if mobGUID then
|
||||
local syncVal, syncTanking = Omen:SyncGetThreat(guid, mobGUID)
|
||||
if syncVal then
|
||||
threatValue = syncVal
|
||||
isTanking = syncTanking
|
||||
end
|
||||
end
|
||||
end
|
||||
if threatValue then
|
||||
-- Threat can be negative due to temporary threat reduction effects such as Fade and Mirror Image (-410065408).
|
||||
if threatValue < 0 then
|
||||
@@ -1387,6 +1400,14 @@ local function updatethreat(unitid, mobunitid)
|
||||
if threatValue > topthreat then topthreat = threatValue end
|
||||
if isTanking then tankGUID = guid end
|
||||
threatTable[guid] = threatValue
|
||||
-- CoA: broadcast our own player/pet threat so peers' OmenSync can
|
||||
-- fill the gap left by their nil UnitDetailedThreatSituation call.
|
||||
if (unitid == "player" or unitid == "pet") and Omen.SyncBroadcastThreat then
|
||||
local mobGUID = UnitGUID(mobunitid)
|
||||
if mobGUID then
|
||||
Omen:SyncBroadcastThreat(guid, mobGUID, threatValue, isTanking)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- We use the special value -1 to indicate nil here.
|
||||
threatTable[guid] = -1
|
||||
|
||||
Reference in New Issue
Block a user