mirror of
https://github.com/Relintai/Relintais-Enemy-Kooldown-Tracker-WotLK.git
synced 2024-11-08 10:12:11 +01:00
-Fixed a bug:
The DR Frames now properly reposition themself after the frames are locked, without the need for a relog or /reload. (I have no idea how I didn't catch this earlier). Also, when the frames are unlocked, the DR frames properly hide their contents. -Fixed a bug: On the server I tested this I noticed that SPELL_AURA_REFRESH event is sent even on the first CC apply, this made the DR frasem break, but was hard to catch in action. Ported from the TBC version.
This commit is contained in:
parent
6e932b8993
commit
6423c69476
3
Rekt.lua
3
Rekt.lua
@ -343,8 +343,7 @@ function Rekt:COMBAT_LOG_EVENT_UNFILTERED(_, timestamp, eventType, srcGUID, srcN
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
Rekt:DRDebuffFaded(spellID, dstGUID, isPlayer);
|
Rekt:DRDebuffRefreshed(spellID, dstGUID, isPlayer);
|
||||||
Rekt:DRDebuffGained(spellID, dstGUID, isPlayer);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Buff or debuff faded from an enemy
|
-- Buff or debuff faded from an enemy
|
||||||
|
118
data/drs.lua
118
data/drs.lua
@ -26,6 +26,8 @@ function Rekt:DRDebuffGained(spellID, dstGUID, isPlayer)
|
|||||||
local endTime = currentTime + cd;
|
local endTime = currentTime + cd;
|
||||||
local diminished = 1;
|
local diminished = 1;
|
||||||
local isDiminishingStarted = false;
|
local isDiminishingStarted = false;
|
||||||
|
local lastTimeApplied = GetTime();
|
||||||
|
|
||||||
Rekt.drs[dstGUID][drCat] = {
|
Rekt.drs[dstGUID][drCat] = {
|
||||||
currentTime,
|
currentTime,
|
||||||
endTime,
|
endTime,
|
||||||
@ -34,9 +36,15 @@ function Rekt:DRDebuffGained(spellID, dstGUID, isPlayer)
|
|||||||
spellID,
|
spellID,
|
||||||
diminished,
|
diminished,
|
||||||
isDiminishingStarted,
|
isDiminishingStarted,
|
||||||
drCat
|
drCat,
|
||||||
|
lastTimeApplied
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
--self:Print("asd");
|
||||||
|
if Rekt:ShouldIgnoreDRApply(Rekt.drs[dstGUID][drCat]) then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
local cd = 18;
|
local cd = 18;
|
||||||
local currentTime = GetTime();
|
local currentTime = GetTime();
|
||||||
local endTime = currentTime + cd;
|
local endTime = currentTime + cd;
|
||||||
@ -46,6 +54,7 @@ function Rekt:DRDebuffGained(spellID, dstGUID, isPlayer)
|
|||||||
Rekt.drs[dstGUID][drCat][5] = spellID;
|
Rekt.drs[dstGUID][drCat][5] = spellID;
|
||||||
Rekt.drs[dstGUID][drCat][6] = Rekt.drs[dstGUID][drCat][6] + 1;
|
Rekt.drs[dstGUID][drCat][6] = Rekt.drs[dstGUID][drCat][6] + 1;
|
||||||
Rekt.drs[dstGUID][drCat][7] = false;
|
Rekt.drs[dstGUID][drCat][7] = false;
|
||||||
|
Rekt.drs[dstGUID][drCat][9] = GetTime();
|
||||||
|
|
||||||
--reset it back to 1, x > 3 means, the server updated the dr in less than 18 sec.
|
--reset it back to 1, x > 3 means, the server updated the dr in less than 18 sec.
|
||||||
if Rekt.drs[dstGUID][drCat][6] > 3 then
|
if Rekt.drs[dstGUID][drCat][6] > 3 then
|
||||||
@ -73,7 +82,7 @@ function Rekt:DRDebuffFaded(spellID, dstGUID, isPlayer)
|
|||||||
if not db["enabled"] then return end;
|
if not db["enabled"] then return end;
|
||||||
|
|
||||||
if not Rekt.drs[dstGUID] then
|
if not Rekt.drs[dstGUID] then
|
||||||
Rekt.drs[dstGUID] = {}
|
Rekt:DRDebuffGained(spellID, dstGUID, isPlayer);
|
||||||
end
|
end
|
||||||
|
|
||||||
local drCat = libDRData:GetSpellCategory(spellID);
|
local drCat = libDRData:GetSpellCategory(spellID);
|
||||||
@ -83,21 +92,7 @@ function Rekt:DRDebuffFaded(spellID, dstGUID, isPlayer)
|
|||||||
|
|
||||||
if not Rekt.drs[dstGUID][drCat] then
|
if not Rekt.drs[dstGUID][drCat] then
|
||||||
--means we didn't see it applied
|
--means we didn't see it applied
|
||||||
local cd = 18;
|
Rekt:DRDebuffGained(spellID, dstGUID, isPlayer);
|
||||||
local currentTime = GetTime();
|
|
||||||
local endTime = currentTime + cd;
|
|
||||||
local diminished = 1;
|
|
||||||
local isDiminishingStarted = true;
|
|
||||||
Rekt.drs[dstGUID][drCat] = {
|
|
||||||
currentTime,
|
|
||||||
endTime,
|
|
||||||
cd,
|
|
||||||
spellIcon,
|
|
||||||
spellID,
|
|
||||||
diminished,
|
|
||||||
isDiminishingStarted,
|
|
||||||
drCat
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
local cd = 18;
|
local cd = 18;
|
||||||
local currentTime = GetTime();
|
local currentTime = GetTime();
|
||||||
@ -105,6 +100,7 @@ function Rekt:DRDebuffFaded(spellID, dstGUID, isPlayer)
|
|||||||
Rekt.drs[dstGUID][drCat][1] = currentTime;
|
Rekt.drs[dstGUID][drCat][1] = currentTime;
|
||||||
Rekt.drs[dstGUID][drCat][2] = endTime;
|
Rekt.drs[dstGUID][drCat][2] = endTime;
|
||||||
Rekt.drs[dstGUID][drCat][7] = true;
|
Rekt.drs[dstGUID][drCat][7] = true;
|
||||||
|
--Rekt.drs[dstGUID][drCat][9] = GetTime();
|
||||||
end
|
end
|
||||||
|
|
||||||
--self:Print(Rekt.cds[srcGUID][spellID][1] .. " " .. Rekt.cds[srcGUID][spellID][2] .. " " .. Rekt.cds[srcGUID][spellID][3]);
|
--self:Print(Rekt.cds[srcGUID][spellID][1] .. " " .. Rekt.cds[srcGUID][spellID][2] .. " " .. Rekt.cds[srcGUID][spellID][3]);
|
||||||
@ -122,17 +118,95 @@ function Rekt:DRDebuffFaded(spellID, dstGUID, isPlayer)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Rekt:DRDebuffRefreshed(spellID, dstGUID, isPlayer)
|
||||||
|
local db = Rekt.db.profile;
|
||||||
|
if not db["enabled"] then return end;
|
||||||
|
|
||||||
|
if not Rekt.drs[dstGUID] then
|
||||||
|
Rekt:DRDebuffGained(spellID, dstGUID, isPlayer);
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
local drCat = libDRData:GetSpellCategory(spellID);
|
||||||
|
local spellName, spellRank, spellIcon = GetSpellInfo(spellID);
|
||||||
|
|
||||||
|
Rekt:UpdateDRs(dstGUID);
|
||||||
|
|
||||||
|
if not Rekt.drs[dstGUID][drCat] then
|
||||||
|
--means we didn't see it applied
|
||||||
|
Rekt:DRDebuffGained(spellID, dstGUID, isPlayer);
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
local cd = 18;
|
||||||
|
local currentTime = GetTime();
|
||||||
|
local endTime = currentTime + cd;
|
||||||
|
Rekt.drs[dstGUID][drCat][1] = currentTime;
|
||||||
|
Rekt.drs[dstGUID][drCat][2] = currentTime + cd;
|
||||||
|
Rekt.drs[dstGUID][drCat][4] = spellIcon;
|
||||||
|
Rekt.drs[dstGUID][drCat][5] = spellID;
|
||||||
|
Rekt.drs[dstGUID][drCat][6] = Rekt.drs[dstGUID][drCat][6] + 1;
|
||||||
|
Rekt.drs[dstGUID][drCat][7] = false;
|
||||||
|
Rekt.drs[dstGUID][drCat][9] = GetTime();
|
||||||
|
|
||||||
|
--reset it back to 1, x > 3 means, the server updated the dr in less than 18 sec.
|
||||||
|
if Rekt.drs[dstGUID][drCat][6] > 3 then
|
||||||
|
Rekt.drs[dstGUID][drCat][6] = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--self:Print(Rekt.cds[srcGUID][spellID][1] .. " " .. Rekt.cds[srcGUID][spellID][2] .. " " .. Rekt.cds[srcGUID][spellID][3]);
|
||||||
|
|
||||||
|
if self.targets["target"] == dstGUID then
|
||||||
|
self:ReassignDRs("targetdr");
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.targets["focus"] == dstGUID then
|
||||||
|
self:ReassignDRs("focusdr");
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.targets["self"] == dstGUID then
|
||||||
|
self:ReassignDRs("selfdr");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Is the DR registered?
|
||||||
|
function Rekt:IsDRRegistered(spellID, dstGUID, isPlayer)
|
||||||
|
if not Rekt.drs[dstGUID][drCat] then
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This function is needed, because TBC servers fire SPELL_AURA_REFRESH, then SPELL_AURA_APPLIED, even if this is the first
|
||||||
|
-- time the buff is applied.
|
||||||
|
function Rekt:ShouldIgnoreDRApply(drData)
|
||||||
|
local delta = GetTime() - drData[9];
|
||||||
|
--self:Print(delta .. " " .. GetTime() .. " " .. drData[9]);
|
||||||
|
|
||||||
|
--This Might still have false positives, but I guess this is the right tradeoff
|
||||||
|
--it's still better that to just ignore refreshed alltogether if the player didn't see the first apply
|
||||||
|
if (delta < 0.1) then
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
end
|
||||||
|
|
||||||
function Rekt:ReassignDRs(which)
|
function Rekt:ReassignDRs(which)
|
||||||
local db = Rekt.db.profile;
|
local db = Rekt.db.profile;
|
||||||
--bail out early, if frames are disabled
|
--bail out early, if frames are disabled
|
||||||
if not db[which]["enabled"] or not db["enabled"] then return end;
|
if not db[which]["enabled"] or not db["enabled"] then return end;
|
||||||
|
|
||||||
--first hide all
|
--first hide all
|
||||||
for i = 1, 18 do
|
for i = 1, 18 do
|
||||||
local frame = Rekt.frames[which][i]["frame"];
|
local frame = Rekt.frames[which][i]["frame"];
|
||||||
frame:Hide();
|
frame:Hide();
|
||||||
end
|
end
|
||||||
|
|
||||||
--check if frames are unlocked
|
--check if frames are unlocked
|
||||||
if not db["locked"] then return end;
|
if not db["locked"] then return end;
|
||||||
|
|
||||||
--check if we have cooldown for that unit
|
--check if we have cooldown for that unit
|
||||||
local whichs = "";
|
local whichs = "";
|
||||||
if which == "targetdr" then
|
if which == "targetdr" then
|
||||||
@ -144,14 +218,17 @@ function Rekt:ReassignDRs(which)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not self.drs[self.targets[whichs]] then return end;
|
if not self.drs[self.targets[whichs]] then return end;
|
||||||
|
|
||||||
--update then
|
--update then
|
||||||
Rekt:UpdateDRs(self.targets[whichs]);
|
Rekt:UpdateDRs(self.targets[whichs]);
|
||||||
|
|
||||||
--sort them
|
--sort them
|
||||||
local tmp = Rekt:SortDRs(whichs);
|
local tmp = Rekt:SortDRs(whichs);
|
||||||
|
|
||||||
--let's fill them up
|
--let's fill them up
|
||||||
local i = 1;
|
local i = 1;
|
||||||
for k, v in ipairs(tmp) do
|
for k, v in ipairs(tmp) do
|
||||||
--self:Print(v["spellID"]);
|
--self:Print(v["diminished"]);
|
||||||
local frame = Rekt.frames[which][i]["frame"];
|
local frame = Rekt.frames[which][i]["frame"];
|
||||||
local text = Rekt.frames[which][i]["texture"];
|
local text = Rekt.frames[which][i]["texture"];
|
||||||
text:SetTexture(v["spellIcon"]);
|
text:SetTexture(v["spellIcon"]);
|
||||||
@ -171,6 +248,7 @@ function Rekt:ReassignDRs(which)
|
|||||||
frame:Show();
|
frame:Show();
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
end
|
end
|
||||||
|
--self:Print("--------");
|
||||||
end
|
end
|
||||||
|
|
||||||
function Rekt:SortDRs(which)
|
function Rekt:SortDRs(which)
|
||||||
@ -187,7 +265,8 @@ function Rekt:SortDRs(which)
|
|||||||
spellIcon = v[4],
|
spellIcon = v[4],
|
||||||
spellID = v[5],
|
spellID = v[5],
|
||||||
diminished = v[6],
|
diminished = v[6],
|
||||||
isDiminishingStarted = v[7]
|
isDiminishingStarted = v[7],
|
||||||
|
lastTimeApplied = v[8]
|
||||||
};
|
};
|
||||||
|
|
||||||
--self:Print(v[1] .. v[2] .. v[3] .. v[4] .. v[5])
|
--self:Print(v[1] .. v[2] .. v[3] .. v[4] .. v[5])
|
||||||
@ -213,6 +292,7 @@ function Rekt:SortDRs(which)
|
|||||||
table.sort(tmp, function(a, b) return Rekt:ComparerRecentLast(a, b) end);
|
table.sort(tmp, function(a, b) return Rekt:ComparerRecentLast(a, b) end);
|
||||||
end
|
end
|
||||||
--["7"] = "No order"
|
--["7"] = "No order"
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -136,15 +136,29 @@ end
|
|||||||
function Rekt:LockFrames()
|
function Rekt:LockFrames()
|
||||||
self:MoveTimersStop("target");
|
self:MoveTimersStop("target");
|
||||||
self:MoveTimersStop("focus");
|
self:MoveTimersStop("focus");
|
||||||
|
|
||||||
|
self:MoveDRTimersStop("targetdr");
|
||||||
|
self:MoveDRTimersStop("focusdr");
|
||||||
|
self:MoveDRTimersStop("selfdr");
|
||||||
|
|
||||||
self:HideMovableFrames()
|
self:HideMovableFrames()
|
||||||
self:ReassignCds("target");
|
self:ReassignCds("target");
|
||||||
self:ReassignCds("focus");
|
self:ReassignCds("focus");
|
||||||
|
|
||||||
|
self:ReassignDRs("targetdr");
|
||||||
|
self:ReassignDRs("focusdr");
|
||||||
|
self:ReassignDRs("selfdr");
|
||||||
end
|
end
|
||||||
|
|
||||||
function Rekt:UnlockFrames()
|
function Rekt:UnlockFrames()
|
||||||
--this will hide the frames
|
--this will hide the frames
|
||||||
self:ReassignCds("target");
|
self:ReassignCds("target");
|
||||||
self:ReassignCds("focus");
|
self:ReassignCds("focus");
|
||||||
|
|
||||||
|
self:ReassignDRs("targetdr");
|
||||||
|
self:ReassignDRs("focusdr");
|
||||||
|
self:ReassignDRs("selfdr");
|
||||||
|
|
||||||
Rekt:ShowMovableFrames();
|
Rekt:ShowMovableFrames();
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user