/
MyThreat.threatSourceHandler = nil; |
MyThreat.lastUpdate = 0; |
MyThreat.targetGuid = nil; |
MyThreat.test = false; |
MyThreat.focusMode = false; |
-- Called when the addon is enabled |
MyThreat:RegisterEvent("PLAYER_TARGET_CHANGED"); |
MyThreat:RegisterEvent("PARTY_MEMBERS_CHANGED"); |
MyThreat:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); |
MyThreat:RegisterEvent("UNIT_THREAT_LIST_UPDATE"); |
MyThreat:UpdateFontSize(); |
MyThreat:UnregisterEvent("PLAYER_TARGET_CHANGED"); |
MyThreat:UnregisterEvent("PARTY_MEMBERS_CHANGED"); |
MyThreat:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); |
MyThreat:UnregisterEvent("UNIT_THREAT_LIST_UPDATE"); |
end |
if (currentTankName ~= nil) then |
local playerThreat, _, adjusted = MyThreat:GetThreat("player", "target"); |
playerThreat, _, adjusted = MyThreat:GetThreat("player", "target"); |
if (playerThreat ~= nil) then |
if (currentTrailing ~= nil) then |
local playerThreat, _, adjusted = MyThreat:GetThreat("player", "target"); |
playerThreat, _, adjusted = MyThreat:GetThreat("player", "target"); |
if (playerThreat ~= nil) then |
if (currentLowestFocus ~= nil) then |
local playerThreat, _, adjusted = MyThreat:GetThreat("player", "target"); |
playerThreat, _, adjusted = MyThreat:GetThreat("player", "target"); |
if (playerThreat ~= nil) then |
function MyThreat:PLAYER_TARGET_CHANGED() |
MyThreat.targetGuid = UnitGUID("target"); |
MyThreat:Process(); |
end |
-------------------------------------------------------------------------- |
function MyThreat:COMBAT_LOG_EVENT_UNFILTERED(_, _, _, srcGuid, _, _, destGuid) |
function MyThreat:UNIT_THREAT_LIST_UPDATE(_, unitId) |
local cTime = GetTime(); |
if ((cTime - MyThreat.lastUpdate) > 0.250) then |
if ((cTime - MyThreat.lastUpdate) > 0.125) then |
if (MyThreat.targetGuid ~= nil and (destGuid == MyThreat.targetGuid or srcGuid == MyThreat.targetGuid)) then |
if (unitId == "target") then |
MyThreat:Process(); |
MyThreat.lastUpdate = cTime; |