diff --git a/Categories/Status.lua b/Categories/Status.lua index 130631a..c981268 100644 --- a/Categories/Status.lua +++ b/Categories/Status.lua @@ -128,7 +128,12 @@ DogTag:AddTimerHandler(function(currentTime, num) deadTimes[guid] = GetTime() end else - deadTimes[guid] = nil + if deadTimes[guid] then + deadTimes[guid] = nil + for unit in DogTag_Unit.IterateUnitsWithGUID(guid) do + DogTag:FireEvent("DeadDuration", unit) + end + end end if UnitIsAFK(unit) then @@ -136,7 +141,12 @@ DogTag:AddTimerHandler(function(currentTime, num) afkTimes[guid] = GetTime() end else - afkTimes[guid] = nil + if afkTimes[guid] then + afkTimes[guid] = nil + for unit in DogTag_Unit.IterateUnitsWithGUID(guid) do + DogTag:FireEvent("AFKDuration", unit) + end + end end end for guid in pairs(deadTimes) do diff --git a/LibDogTag-Unit-3.0.lua b/LibDogTag-Unit-3.0.lua index ad0164d..27e0a0f 100644 --- a/LibDogTag-Unit-3.0.lua +++ b/LibDogTag-Unit-3.0.lua @@ -127,12 +127,16 @@ local function refreshGUID(unit) unitToGUID[unit] = UnitGUID(unit) end -DogTag:AddEventHandler("PARTY_MEMBERS_CHANGED", function() +local function PARTY_MEMBERS_CHANGED() for unit in pairs(IsNormalUnit) do refreshGUID(unit) DogTag:FireEvent("UnitChanged", unit) end -end) +end +DogTag:AddEventHandler("PARTY_MEMBERS_CHANGED", PARTY_MEMBERS_CHANGED) + +PARTY_MEMBERS_CHANGED() +DogTag:AddEventHandler("PLAYER_LOGIN", PARTY_MEMBERS_CHANGED) local t = {} local function IterateUnitsWithGUID(guid)