2016-05-06 15:49:39 +02:00
|
|
|
|
|
|
|
--"Globals"
|
|
|
|
local aceDB = LibStub("AceDB-3.0");
|
|
|
|
local aceCDialog = LibStub("AceConfigDialog-3.0");
|
|
|
|
local aceConfig = LibStub("AceConfig-3.0");
|
|
|
|
local libSharedMedia = LibStub("LibSharedMedia-3.0");
|
|
|
|
local libDRData = LibStub('DRData-1.0');
|
|
|
|
|
|
|
|
--DR db functions
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:DRDebuffGained(spellID, dstGUID, isPlayer)
|
|
|
|
local db = Rekt.db.profile;
|
2016-05-06 15:49:39 +02:00
|
|
|
if not db["enabled"] then return end;
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
if not Rekt.drs[dstGUID] then
|
|
|
|
Rekt.drs[dstGUID] = {}
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local drCat = libDRData:GetSpellCategory(spellID);
|
|
|
|
local spellName, spellRank, spellIcon = GetSpellInfo(spellID);
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt:UpdateDRs(dstGUID);
|
2016-05-06 16:08:47 +02:00
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
if not Rekt.drs[dstGUID][drCat] then
|
2016-05-11 12:03:03 +02:00
|
|
|
local cd = Rekt:getDRTime();
|
2016-05-06 15:49:39 +02:00
|
|
|
local currentTime = GetTime();
|
|
|
|
local endTime = currentTime + cd;
|
|
|
|
local diminished = 1;
|
|
|
|
local isDiminishingStarted = false;
|
2016-05-11 11:51:55 +02:00
|
|
|
local lastTimeApplied = GetTime();
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt.drs[dstGUID][drCat] = {
|
2016-05-06 15:49:39 +02:00
|
|
|
currentTime,
|
|
|
|
endTime,
|
|
|
|
cd,
|
|
|
|
spellIcon,
|
|
|
|
spellID,
|
|
|
|
diminished,
|
|
|
|
isDiminishingStarted,
|
2016-05-11 11:51:55 +02:00
|
|
|
drCat,
|
|
|
|
lastTimeApplied
|
2016-05-06 15:49:39 +02:00
|
|
|
}
|
|
|
|
else
|
2016-05-11 11:51:55 +02:00
|
|
|
--self:Print("asd");
|
|
|
|
if Rekt:ShouldIgnoreDRApply(Rekt.drs[dstGUID][drCat]) then
|
|
|
|
return;
|
|
|
|
end
|
|
|
|
|
2016-05-11 12:03:03 +02:00
|
|
|
local cd = Rekt:getDRTime();
|
2016-05-06 15:49:39 +02:00
|
|
|
local currentTime = GetTime();
|
|
|
|
local endTime = currentTime + cd;
|
2016-05-10 11:07:23 +02:00
|
|
|
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;
|
2016-05-11 11:51:55 +02:00
|
|
|
Rekt.drs[dstGUID][drCat][9] = GetTime();
|
2016-05-06 16:07:10 +02:00
|
|
|
|
2016-05-11 12:03:03 +02:00
|
|
|
--reset it back to 1, x > 3 means, the server updated the dr in less than Rekt:getDRTime() sec.
|
2016-05-10 11:07:23 +02:00
|
|
|
if Rekt.drs[dstGUID][drCat][6] > 3 then
|
|
|
|
Rekt.drs[dstGUID][drCat][6] = 1;
|
2016-05-06 16:07:10 +02:00
|
|
|
end
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
--self:Print(Rekt.cds[srcGUID][spellID][1] .. " " .. Rekt.cds[srcGUID][spellID][2] .. " " .. Rekt.cds[srcGUID][spellID][3]);
|
2016-05-06 15:49:39 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:DRDebuffFaded(spellID, dstGUID, isPlayer)
|
|
|
|
local db = Rekt.db.profile;
|
2016-05-06 15:55:37 +02:00
|
|
|
if not db["enabled"] then return end;
|
2016-05-06 15:49:39 +02:00
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
if not Rekt.drs[dstGUID] then
|
2016-05-11 11:51:55 +02:00
|
|
|
Rekt:DRDebuffGained(spellID, dstGUID, isPlayer);
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local drCat = libDRData:GetSpellCategory(spellID);
|
|
|
|
local spellName, spellRank, spellIcon = GetSpellInfo(spellID);
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt:UpdateDRs(dstGUID);
|
2016-05-06 16:08:47 +02:00
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
if not Rekt.drs[dstGUID][drCat] then
|
2016-05-06 15:49:39 +02:00
|
|
|
--means we didn't see it applied
|
2016-05-11 11:51:55 +02:00
|
|
|
Rekt:DRDebuffGained(spellID, dstGUID, isPlayer);
|
|
|
|
else
|
2016-05-11 12:03:03 +02:00
|
|
|
local cd = Rekt:getDRTime();
|
2016-05-06 15:49:39 +02:00
|
|
|
local currentTime = GetTime();
|
|
|
|
local endTime = currentTime + cd;
|
2016-05-11 11:51:55 +02:00
|
|
|
Rekt.drs[dstGUID][drCat][1] = currentTime;
|
|
|
|
Rekt.drs[dstGUID][drCat][2] = endTime;
|
|
|
|
Rekt.drs[dstGUID][drCat][7] = true;
|
|
|
|
--Rekt.drs[dstGUID][drCat][9] = GetTime();
|
|
|
|
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
|
|
|
|
|
|
|
|
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;
|
2016-05-06 15:49:39 +02:00
|
|
|
else
|
2016-05-11 12:03:03 +02:00
|
|
|
local cd = Rekt:getDRTime();
|
2016-05-06 15:49:39 +02:00
|
|
|
local currentTime = GetTime();
|
|
|
|
local endTime = currentTime + cd;
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt.drs[dstGUID][drCat][1] = currentTime;
|
2016-05-11 11:51:55 +02:00
|
|
|
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();
|
|
|
|
|
2016-05-11 12:03:03 +02:00
|
|
|
--reset it back to 1, x > 3 means, the server updated the dr in less than Rekt:getDRTime() sec.
|
2016-05-11 11:51:55 +02:00
|
|
|
if Rekt.drs[dstGUID][drCat][6] > 3 then
|
|
|
|
Rekt.drs[dstGUID][drCat][6] = 1;
|
|
|
|
end
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
--self:Print(Rekt.cds[srcGUID][spellID][1] .. " " .. Rekt.cds[srcGUID][spellID][2] .. " " .. Rekt.cds[srcGUID][spellID][3]);
|
2016-05-06 15:49:39 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2016-05-11 11:51:55 +02:00
|
|
|
-- 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
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:ReassignDRs(which)
|
|
|
|
local db = Rekt.db.profile;
|
2016-05-06 15:49:39 +02:00
|
|
|
--bail out early, if frames are disabled
|
2016-05-06 15:55:37 +02:00
|
|
|
if not db[which]["enabled"] or not db["enabled"] then return end;
|
2016-05-11 11:51:55 +02:00
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
--first hide all
|
|
|
|
for i = 1, 18 do
|
2016-05-10 11:07:23 +02:00
|
|
|
local frame = Rekt.frames[which][i]["frame"];
|
2016-05-06 15:49:39 +02:00
|
|
|
frame:Hide();
|
|
|
|
end
|
2016-05-11 11:51:55 +02:00
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
--check if frames are unlocked
|
|
|
|
if not db["locked"] then return end;
|
2016-05-11 11:51:55 +02:00
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
--check if we have cooldown for that unit
|
|
|
|
local whichs = "";
|
|
|
|
if which == "targetdr" then
|
|
|
|
whichs = "target";
|
|
|
|
elseif which == "focusdr" then
|
|
|
|
whichs = "focus";
|
|
|
|
else
|
|
|
|
whichs = "self";
|
|
|
|
end
|
|
|
|
|
|
|
|
if not self.drs[self.targets[whichs]] then return end;
|
2016-05-11 11:51:55 +02:00
|
|
|
|
2016-05-06 16:06:20 +02:00
|
|
|
--update then
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt:UpdateDRs(self.targets[whichs]);
|
2016-05-11 11:51:55 +02:00
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
--sort them
|
2016-05-10 11:07:23 +02:00
|
|
|
local tmp = Rekt:SortDRs(whichs);
|
2016-05-11 11:51:55 +02:00
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
--let's fill them up
|
|
|
|
local i = 1;
|
|
|
|
for k, v in ipairs(tmp) do
|
2016-05-11 11:51:55 +02:00
|
|
|
--self:Print(v["diminished"]);
|
2016-05-10 11:07:23 +02:00
|
|
|
local frame = Rekt.frames[which][i]["frame"];
|
|
|
|
local text = Rekt.frames[which][i]["texture"];
|
2016-05-06 15:49:39 +02:00
|
|
|
text:SetTexture(v["spellIcon"]);
|
2016-05-10 11:07:23 +02:00
|
|
|
local CoolDown = Rekt.frames[which][i]["cooldown"];
|
|
|
|
local t = Rekt.frames[which][i]["text"];
|
2016-05-06 15:49:39 +02:00
|
|
|
if v["isDiminishingStarted"] then
|
|
|
|
CoolDown:SetCooldown(v["currentTime"], v["cd"]);
|
|
|
|
else
|
|
|
|
CoolDown:SetCooldown(v["currentTime"], 0);
|
|
|
|
end
|
2016-05-06 15:54:25 +02:00
|
|
|
|
|
|
|
--print it out, if we need to
|
|
|
|
if db[which]["drnumsize"] > 0 then
|
|
|
|
t:SetText(v["diminished"]);
|
|
|
|
end
|
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
frame:Show();
|
|
|
|
i = i + 1;
|
|
|
|
end
|
2016-05-11 11:51:55 +02:00
|
|
|
--self:Print("--------");
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:SortDRs(which)
|
|
|
|
local db = Rekt.db.profile;
|
2016-05-06 15:49:39 +02:00
|
|
|
local tmp = {};
|
|
|
|
|
|
|
|
--make the tmp table
|
|
|
|
local i = 1;
|
|
|
|
for k, v in pairs(self.drs[self.targets[which]]) do
|
|
|
|
tmp[i] = {
|
|
|
|
currentTime = v[1],
|
|
|
|
endTime = v[2],
|
|
|
|
cd = v[3],
|
|
|
|
spellIcon = v[4],
|
|
|
|
spellID = v[5],
|
|
|
|
diminished = v[6],
|
2016-05-11 11:51:55 +02:00
|
|
|
isDiminishingStarted = v[7],
|
|
|
|
lastTimeApplied = v[8]
|
2016-05-06 15:49:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
--self:Print(v[1] .. v[2] .. v[3] .. v[4] .. v[5])
|
|
|
|
--self:Print(tmp[i]["currentTime"] .. " " .. tmp[i]["endTime"] .. " " .. tmp[i]["cd"] .. " " .. tmp[i][4] .. " " .. tmp[i][5])
|
|
|
|
i = i + 1;
|
|
|
|
end
|
|
|
|
|
|
|
|
if not tmp then return end;
|
|
|
|
|
|
|
|
if which == "self" then which = "selfdr" end
|
|
|
|
|
|
|
|
if db[which]["sortOrder"] == "1" then --["1"] = "Ascending (CD left)",
|
2016-05-10 11:07:23 +02:00
|
|
|
table.sort(tmp, function(a, b) return Rekt:ComparerAscendingCDLeft(a, b) end);
|
2016-05-06 15:49:39 +02:00
|
|
|
elseif db[which]["sortOrder"] == "2" then --["2"] = "Descending (CD left)",
|
2016-05-10 11:07:23 +02:00
|
|
|
table.sort(tmp, function(a, b) return Rekt:ComparerDescendingCDLeft(a, b) end);
|
2016-05-06 15:49:39 +02:00
|
|
|
elseif db[which]["sortOrder"] == "3" then --["3"] = "Ascending (CD total)",
|
2016-05-10 11:07:23 +02:00
|
|
|
table.sort(tmp, function(a, b) return Rekt:ComparerAscendingCDTotal(a, b) end);
|
2016-05-06 15:49:39 +02:00
|
|
|
elseif db[which]["sortOrder"] == "4" then --["4"] = "Descending (CD total)",
|
2016-05-10 11:07:23 +02:00
|
|
|
table.sort(tmp, function(a, b) return Rekt:ComparerDescendingCDTotal(a, b) end);
|
2016-05-06 15:49:39 +02:00
|
|
|
elseif db[which]["sortOrder"] == "5" then --["5"] = "Recent first",
|
2016-05-10 11:07:23 +02:00
|
|
|
table.sort(tmp, function(a, b) return Rekt:ComparerRecentFirst(a, b) end);
|
2016-05-06 15:49:39 +02:00
|
|
|
elseif db[which]["sortOrder"] == "6" then --["6"] = "Recent Last",
|
2016-05-10 11:07:23 +02:00
|
|
|
table.sort(tmp, function(a, b) return Rekt:ComparerRecentLast(a, b) end);
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
--["7"] = "No order"
|
2016-05-11 11:51:55 +02:00
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
return tmp;
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:CreateDRFrames(which)
|
2016-05-06 15:49:39 +02:00
|
|
|
for i = 1, 18 do
|
|
|
|
local frame = CreateFrame("Frame", nil, UIParent, nil);
|
|
|
|
frame:SetFrameStrata("MEDIUM");
|
|
|
|
frame:SetWidth(150);
|
|
|
|
frame:SetHeight(150);
|
|
|
|
|
|
|
|
local wh = "";
|
|
|
|
if which == "targetdr" then
|
|
|
|
wh = "target";
|
|
|
|
elseif which == "focusdr" then
|
|
|
|
wh = "focus";
|
|
|
|
else
|
|
|
|
wh = "self";
|
|
|
|
end
|
|
|
|
|
|
|
|
if i == 1 then
|
|
|
|
frame:SetScript("OnUpdate", function() self:VOnDRTimerUpdate(wh) end)
|
|
|
|
end
|
|
|
|
local text = frame:CreateTexture();
|
|
|
|
text:SetTexture("Interface\\Icons\\Spell_Arcane_Blink")
|
|
|
|
text:SetAllPoints(frame);
|
|
|
|
frame.texture = text;
|
2016-05-10 11:07:23 +02:00
|
|
|
local CoolDown = CreateFrame("Cooldown", "RektCoolDown" .. i, frame);
|
2016-05-06 15:49:39 +02:00
|
|
|
CoolDown:SetAllPoints()
|
|
|
|
CoolDown:SetCooldown(GetTime(), 50);
|
|
|
|
local t = frame:CreateFontString(nil, "OVERLAY");
|
|
|
|
t:SetNonSpaceWrap(false);
|
|
|
|
t:SetPoint("CENTER", frame, "CENTER", 0, 0);
|
|
|
|
t:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE, MONOCHROME")
|
|
|
|
--frame:Hide();
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt.frames[which][i] = {}
|
|
|
|
Rekt.frames[which][i]["frame"] = frame;
|
|
|
|
Rekt.frames[which][i]["texture"] = text;
|
|
|
|
Rekt.frames[which][i]["cooldown"] = CoolDown;
|
|
|
|
Rekt.frames[which][i]["text"] = t;
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:MoveDRTimersStop(which)
|
|
|
|
local db = Rekt.db.profile;
|
2016-05-06 15:49:39 +02:00
|
|
|
local x = db[which]["xPos"];
|
|
|
|
local y = db[which]["yPos"];
|
|
|
|
local size = db[which]["size"];
|
|
|
|
local growOrder = db[which]["growOrder"];
|
2016-05-06 15:54:25 +02:00
|
|
|
local drNumSize = db[which]["drnumsize"];
|
|
|
|
local drNumPos = db[which]["drnumposition"];
|
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
for i = 1, 18 do
|
2016-05-10 11:07:23 +02:00
|
|
|
local frame = Rekt.frames[which][i]["frame"];
|
2016-05-06 15:49:39 +02:00
|
|
|
frame:ClearAllPoints();
|
|
|
|
frame:SetFrameStrata("MEDIUM");
|
|
|
|
frame:SetWidth(size);
|
|
|
|
frame:SetHeight(size);
|
2016-05-10 11:07:23 +02:00
|
|
|
local text = Rekt.frames[which][i]["texture"];
|
2016-05-06 15:49:39 +02:00
|
|
|
text:SetAllPoints(frame);
|
|
|
|
frame.texture = text;
|
|
|
|
--set them based on the grow type
|
|
|
|
if growOrder == "1" then --Up
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x, y + ((i - 1) * size));
|
|
|
|
elseif growOrder == "2" then --Right
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x + ((i - 1) * size), y);
|
|
|
|
elseif growOrder == "3" then --Down
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x, y - ((i - 1) * size));
|
|
|
|
else --Left
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x - ((i - 1) * size), y);
|
|
|
|
end
|
2016-05-06 15:54:25 +02:00
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
local t = Rekt.frames[which][i]["text"];
|
2016-05-06 15:54:25 +02:00
|
|
|
t:ClearAllPoints();
|
|
|
|
|
|
|
|
--check if we need numbers
|
|
|
|
if (drNumSize > 0) then
|
|
|
|
local xOSet = 0;
|
|
|
|
local yOSet = 0;
|
|
|
|
|
|
|
|
t:SetFont("Fonts\\FRIZQT__.TTF", drNumSize, "OUTLINE, MONOCHROME")
|
|
|
|
|
|
|
|
--position it
|
|
|
|
if (drNumPos == "1") then --["1"] = "Up",
|
|
|
|
yOSet = ((drNumSize / 2) + (size / 2) + 2);
|
|
|
|
elseif (drNumPos == "2") then --["2"] = "Right",
|
|
|
|
xOSet = ((size / 2) + 5);
|
|
|
|
elseif (drNumPos == "3") then --["3"] = "Down",
|
|
|
|
yOSet = -((drNumSize / 2) + (size / 2) + 2);
|
|
|
|
elseif (drNumPos == "4") then --["4"] = "Left",
|
|
|
|
xOSet = -((size / 2) + 5);
|
|
|
|
end --["5"] = "Middle"
|
|
|
|
|
|
|
|
t:SetPoint("CENTER", frame, "CENTER", xOSet, yOSet);
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
local CoolDown = Rekt.frames[which][i]["cooldown"];
|
2016-05-06 15:49:39 +02:00
|
|
|
CoolDown:SetAllPoints();
|
|
|
|
--frame:Show();
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:VOnDRTimerUpdate(which)
|
|
|
|
if Rekt:UpdateDRs(self.targets[which]) then
|
2016-05-06 16:06:20 +02:00
|
|
|
--we have to update every three, because if somebody is targeted and focused since sorting is
|
|
|
|
--implemented it triggers only one update, probably it had bugs before too, but got unnoticed
|
|
|
|
self:ReassignDRs("targetdr");
|
|
|
|
self:ReassignDRs("focusdr");
|
|
|
|
self:ReassignDRs("selfdr");
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:UpdateDRs(unitGUID)
|
2016-05-06 16:06:20 +02:00
|
|
|
if not unitGUID then return end;
|
2016-05-06 15:49:39 +02:00
|
|
|
--check if we have dr for that unit
|
2016-05-06 16:06:20 +02:00
|
|
|
if not self.drs[unitGUID] then return end
|
2016-05-06 15:49:39 +02:00
|
|
|
local t = GetTime();
|
2016-05-06 16:06:20 +02:00
|
|
|
local found = false;
|
2016-05-06 15:49:39 +02:00
|
|
|
--let's check if one of the cooldowns finished
|
2016-05-06 16:06:20 +02:00
|
|
|
for k, v in pairs(self.drs[unitGUID]) do
|
2016-05-06 16:07:10 +02:00
|
|
|
if (v[7] == true and v[2] <= t) or (v[2] + 25 <= t) then
|
2016-05-06 16:06:20 +02:00
|
|
|
self.drs[unitGUID][v[8]] = nil;
|
2016-05-06 16:07:10 +02:00
|
|
|
found = true;
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
end
|
2016-05-06 16:06:20 +02:00
|
|
|
return found;
|
2016-05-06 15:54:25 +02:00
|
|
|
end
|
2016-05-06 16:12:06 +02:00
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:HideSelfDRFrames()
|
|
|
|
if not Rekt.frames["selfdr"][1] then return end;
|
2016-05-06 16:12:06 +02:00
|
|
|
|
|
|
|
for i = 1, 18 do
|
2016-05-10 11:07:23 +02:00
|
|
|
local frame = Rekt.frames["selfdr"][i]["frame"];
|
2016-05-06 16:12:06 +02:00
|
|
|
frame:Hide();
|
|
|
|
end
|
|
|
|
end
|