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');
|
|
|
|
|
|
|
|
--gets called when a cd is finished, reassigns the cds to frames.
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:ReassignCds(which)
|
|
|
|
local db = Rekt.db.profile;
|
2016-05-06 15:49:39 +02:00
|
|
|
--bail out early, if frames are disabled
|
|
|
|
if not db[which]["enabled"] or not db["enabled"] then return end;
|
|
|
|
--first hide all
|
|
|
|
for i = 1, 23 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();
|
2016-05-10 11:07:23 +02:00
|
|
|
local colorframe = Rekt.frames[which][i]["colorframe"];
|
2016-05-06 16:05:24 +02:00
|
|
|
colorframe:Hide();
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
--check if frames are unlocked
|
|
|
|
if not db["locked"] then return end;
|
|
|
|
--check if we need to display them for the player
|
|
|
|
if not db["selfCDRegister"] and self.targets[which] == UnitGUID("player") then return end;
|
|
|
|
--check if we have cooldown for that unit
|
|
|
|
if not self.cds[self.targets[which]] then return end;
|
2016-05-06 16:05:24 +02:00
|
|
|
--update cds
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt:UpdateCds(which);
|
2016-05-06 15:49:39 +02:00
|
|
|
--sort them
|
2016-05-10 11:07:23 +02:00
|
|
|
local tmp = Rekt:SortCDs(which);
|
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-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"];
|
2016-05-06 15:49:39 +02:00
|
|
|
CoolDown:SetCooldown(v["currentTime"], v["cd"]);
|
|
|
|
frame:Show();
|
2016-05-06 16:05:24 +02:00
|
|
|
if (db[which]["colorframeenabled"]) then
|
2016-05-10 11:07:23 +02:00
|
|
|
local colorframe = Rekt.frames[which][i]["colorframe"];
|
2016-05-06 16:05:24 +02:00
|
|
|
--self:Print(v["spellID"] .. " cat: " .. v["spellCategory"]);
|
2016-05-10 11:04:53 +02:00
|
|
|
|
2016-05-06 16:05:24 +02:00
|
|
|
colorframe:SetBackdropColor(db["color"][v["spellCategory"]]["r"],
|
|
|
|
db["color"][v["spellCategory"]]["g"],
|
|
|
|
db["color"][v["spellCategory"]]["b"],
|
|
|
|
db["color"][v["spellCategory"]]["a"]);
|
|
|
|
colorframe:Show();
|
|
|
|
end
|
2016-05-06 15:49:39 +02:00
|
|
|
i = i + 1;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:19:38 +02:00
|
|
|
function Rekt:AddCd(srcGUID, spellID, eventType, srcFlags)
|
2016-05-10 11:18:26 +02:00
|
|
|
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.cds[srcGUID] then
|
|
|
|
Rekt.cds[srcGUID] = {}
|
|
|
|
Rekt.cds[srcGUID]["spec"] = {};
|
|
|
|
Rekt.cds[srcGUID]["spec"][1] = 1;
|
|
|
|
Rekt.cds[srcGUID]["spec"][2] = "";
|
2016-05-06 16:04:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local specchange = false;
|
|
|
|
if db["specdetection"] then
|
2016-05-10 11:07:23 +02:00
|
|
|
if Rekt:DetectSpec(srcGUID, spellID) then
|
2016-05-06 16:04:09 +02:00
|
|
|
specchange = true;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
local spec = Rekt.cds[srcGUID]["spec"][1];
|
|
|
|
local class, isPet = Rekt.spells[spellID][7], Rekt.spells[spellID][9];
|
|
|
|
local cd, reset, spellCategory = Rekt.spells[spellID][spec], Rekt.spells[spellID][2], Rekt.spells[spellID][8];
|
2016-05-10 11:18:26 +02:00
|
|
|
local interrupt, warn = Rekt.spells[spellID][10], Rekt.spells[spellID][11];
|
2016-05-06 16:04:09 +02:00
|
|
|
|
2016-05-06 16:08:08 +02:00
|
|
|
if db["petcdguessing"] then
|
2016-05-10 11:07:23 +02:00
|
|
|
if (Rekt.cds[srcGUID]["spec"][2] == "") and class then
|
|
|
|
Rekt.cds[srcGUID]["spec"][2] = class;
|
2016-05-06 16:08:08 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-06 16:04:09 +02:00
|
|
|
if specchange and (not cd) then
|
|
|
|
if self.targets["target"] == srcGUID then
|
|
|
|
self:ReassignCds("target");
|
|
|
|
end
|
|
|
|
|
|
|
|
if self.targets["focus"] == srcGUID then
|
|
|
|
self:ReassignCds("focus");
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--means spec detection spell
|
|
|
|
if not cd then return end;
|
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
local spellName, spellRank, spellIcon = GetSpellInfo(spellID);
|
|
|
|
local currentTime = GetTime();
|
|
|
|
local endTime = currentTime + cd;
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt.cds[srcGUID][spellID] = {
|
2016-05-06 15:49:39 +02:00
|
|
|
currentTime,
|
|
|
|
endTime,
|
|
|
|
cd,
|
|
|
|
spellIcon,
|
2016-05-06 16:05:24 +02:00
|
|
|
spellID,
|
|
|
|
spellCategory
|
2016-05-06 15:49:39 +02:00
|
|
|
}
|
2016-05-10 11:18:26 +02:00
|
|
|
|
|
|
|
--Interruptbar
|
2016-05-10 11:19:38 +02:00
|
|
|
if interrupt and db["interruptbar"]["enabled"] and eventType == "SPELL_CAST_SUCCESS" then
|
2016-05-10 11:18:26 +02:00
|
|
|
Rekt:AddInterruptCD(Rekt.cds[srcGUID][spellID], srcFlags);
|
|
|
|
end
|
2016-05-06 15:49:39 +02:00
|
|
|
|
2016-05-06 16:08:08 +02:00
|
|
|
--add it to every class of the same type
|
|
|
|
if db["petcdguessing"] and isPet then
|
2016-05-10 11:07:23 +02:00
|
|
|
for k, v in pairs(Rekt.cds) do
|
2016-05-06 16:08:08 +02:00
|
|
|
if (v["spec"][2] == class) then
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt.cds[k][spellID] = {
|
2016-05-06 16:08:08 +02:00
|
|
|
currentTime,
|
|
|
|
endTime,
|
|
|
|
cd,
|
|
|
|
spellIcon,
|
|
|
|
spellID,
|
|
|
|
spellCategory
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
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 reset then
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt:CdRemoval(srcGUID, reset);
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
--self:Print(self.targets["target"]);
|
|
|
|
--self:Print(s
|
|
|
|
|
2016-05-06 16:08:08 +02:00
|
|
|
if self.targets["target"] == srcGUID or isPet then
|
2016-05-06 15:49:39 +02:00
|
|
|
self:ReassignCds("target");
|
|
|
|
end
|
|
|
|
|
2016-05-06 16:08:08 +02:00
|
|
|
if self.targets["focus"] == srcGUID or isPet then
|
2016-05-06 15:49:39 +02:00
|
|
|
self:ReassignCds("focus");
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:DetectSpec(srcGUID, spellID)
|
|
|
|
local spec = Rekt.spells[spellID][6];
|
2016-05-06 16:04:09 +02:00
|
|
|
|
|
|
|
if spec == 0 then return false end;
|
2016-05-10 11:07:23 +02:00
|
|
|
if Rekt.cds[srcGUID]["spec"][1] == spec then return false end;
|
2016-05-06 16:04:09 +02:00
|
|
|
--self:Print("spec found: " .. spec);
|
2016-05-10 11:07:23 +02:00
|
|
|
Rekt:RemapSpecCDs(srcGUID, spec);
|
2016-05-06 16:04:09 +02:00
|
|
|
return true;
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:RemapSpecCDs(srcGUID, spec)
|
2016-05-06 16:04:09 +02:00
|
|
|
if not self.cds[srcGUID] then return end
|
|
|
|
for k, v in pairs(self.cds[srcGUID]) do
|
|
|
|
if not (k == "spec") then
|
2016-05-10 11:07:23 +02:00
|
|
|
local cd = Rekt.spells[v[5]][spec];
|
2016-05-06 16:04:09 +02:00
|
|
|
v[3] = cd;
|
|
|
|
v[2] = v[1] + cd;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:CdRemoval(srcGUID, resetArray)
|
2016-05-06 15:49:39 +02:00
|
|
|
if not self.cds[srcGUID] then return end
|
|
|
|
for k, v in pairs(self.cds[srcGUID]) do
|
2016-05-06 16:04:09 +02:00
|
|
|
if not (k == "spec") then
|
|
|
|
for j, x in pairs(resetArray) do
|
|
|
|
if v[5] == x then
|
|
|
|
--self:Print("Removed cd: " .. v[5]);
|
|
|
|
self.cds[srcGUID][v[5]] = nil;
|
|
|
|
end
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:SortCDs(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.cds[self.targets[which]]) do
|
2016-05-06 16:04:09 +02:00
|
|
|
if not (k == "spec") then
|
|
|
|
tmp[i] = {
|
|
|
|
currentTime = v[1],
|
|
|
|
endTime = v[2],
|
|
|
|
cd = v[3],
|
|
|
|
spellIcon = v[4],
|
2016-05-06 16:05:24 +02:00
|
|
|
spellID = v[5],
|
|
|
|
spellCategory = v[6]
|
2016-05-06 16:04:09 +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
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if not tmp then return end;
|
|
|
|
|
2016-05-06 16:05:24 +02:00
|
|
|
if not db["cdtypesortorder"]["enabled"] then
|
|
|
|
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 16:05:24 +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 16:05:24 +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 16:05:24 +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 16:05:24 +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 16:05:24 +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 16:05:24 +02:00
|
|
|
end --["7"] = "No order"
|
|
|
|
else
|
|
|
|
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:ComparerAscendingCDLeftT(a, b) end);
|
2016-05-06 16:05:24 +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:ComparerDescendingCDLeftT(a, b) end);
|
2016-05-06 16:05:24 +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:ComparerAscendingCDTotalT(a, b) end);
|
2016-05-06 16:05:24 +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:ComparerDescendingCDTotalT(a, b) end);
|
2016-05-06 16:05:24 +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:ComparerRecentFirstT(a, b) end);
|
2016-05-06 16:05:24 +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:ComparerRecentLastT(a, b) end);
|
2016-05-06 16:05:24 +02:00
|
|
|
end --["7"] = "No order"
|
|
|
|
end
|
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
return tmp;
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:CreateFrames(which)
|
2016-05-06 15:49:39 +02:00
|
|
|
for i = 1, 23 do
|
|
|
|
local frame = CreateFrame("Frame", nil, UIParent, nil);
|
|
|
|
frame:SetFrameStrata("MEDIUM");
|
|
|
|
frame:SetWidth(150);
|
|
|
|
frame:SetHeight(150);
|
|
|
|
if i == 1 then
|
|
|
|
frame:SetScript("OnUpdate", function() self:VOnTimerUpdate(which) 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);
|
|
|
|
frame:Hide();
|
2016-05-06 16:05:24 +02:00
|
|
|
|
|
|
|
local colorframe = CreateFrame("Frame", nil, UIParent, nil);
|
|
|
|
colorframe:SetFrameStrata("BACKGROUND");
|
|
|
|
colorframe:SetWidth(150);
|
|
|
|
colorframe:SetHeight(150);
|
|
|
|
colorframe:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
|
|
|
--edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
|
|
|
edgeFile = nil,
|
|
|
|
tile = true, tileSize = 16, edgeSize = 0,
|
|
|
|
--insets = { left = 4, right = 4, top = 4, bottom = 4 }});
|
|
|
|
insets = nil});
|
|
|
|
colorframe: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]["colorframe"] = colorframe;
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:MoveTimersStop(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 16:05:24 +02:00
|
|
|
local cdbacksize = db[which]["colorframesize"];
|
2016-05-06 15:49:39 +02:00
|
|
|
|
|
|
|
for i = 1, 23 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;
|
2016-05-06 16:05:24 +02:00
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
local colorframe = Rekt.frames[which][i]["colorframe"];
|
2016-05-06 16:05:24 +02:00
|
|
|
colorframe:ClearAllPoints();
|
|
|
|
colorframe:SetFrameStrata("BACKGROUND");
|
|
|
|
colorframe:SetBackdropColor(1, 1, 1, 1);
|
|
|
|
|
2016-05-06 15:49:39 +02:00
|
|
|
--set them based on the grow type
|
|
|
|
if growOrder == "1" then --Up
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x, y + ((i - 1) * size));
|
2016-05-06 16:05:24 +02:00
|
|
|
|
|
|
|
colorframe:SetWidth(size + (2 * cdbacksize));
|
|
|
|
colorframe:SetHeight(size);
|
|
|
|
colorframe:SetPoint("BOTTOMLEFT", x - cdbacksize, y + ((i - 1) * size));
|
2016-05-06 15:49:39 +02:00
|
|
|
elseif growOrder == "2" then --Right
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x + ((i - 1) * size), y);
|
2016-05-06 16:05:24 +02:00
|
|
|
|
|
|
|
colorframe:SetWidth(size);
|
|
|
|
colorframe:SetHeight(size + (2 * cdbacksize));
|
|
|
|
colorframe:SetPoint("BOTTOMLEFT", x + ((i - 1) * size), y - cdbacksize);
|
2016-05-06 15:49:39 +02:00
|
|
|
elseif growOrder == "3" then --Down
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x, y - ((i - 1) * size));
|
2016-05-06 16:05:24 +02:00
|
|
|
|
|
|
|
colorframe:SetWidth(size + (2 * cdbacksize));
|
|
|
|
colorframe:SetHeight(size);
|
|
|
|
colorframe:SetPoint("BOTTOMLEFT", x - cdbacksize, (y - ((i - 1) * size)));
|
2016-05-06 15:49:39 +02:00
|
|
|
else --Left
|
|
|
|
frame:SetPoint("BOTTOMLEFT", x - ((i - 1) * size), y);
|
2016-05-06 16:05:24 +02:00
|
|
|
|
|
|
|
colorframe:SetWidth(size);
|
|
|
|
colorframe:SetHeight(size + (2 * cdbacksize));
|
|
|
|
colorframe:SetPoint("BOTTOMLEFT", x - ((i - 1) * size), y - cdbacksize);
|
2016-05-06 15:49:39 +02:00
|
|
|
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:VOnTimerUpdate(which)
|
|
|
|
if (Rekt:UpdateCds(which)) then
|
2016-05-06 16:05:24 +02:00
|
|
|
--we have to update both, 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:ReassignCds("target");
|
|
|
|
self:ReassignCds("focus");
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-10 11:07:23 +02:00
|
|
|
function Rekt:UpdateCds(which)
|
2016-05-06 15:49:39 +02:00
|
|
|
--check if we have cooldown for that unit
|
|
|
|
if not self.cds[self.targets[which]] then return end
|
|
|
|
local t = GetTime();
|
2016-05-06 16:05:24 +02:00
|
|
|
local found = false;
|
2016-05-06 15:49:39 +02:00
|
|
|
--let's check if one of the cooldowns finished
|
|
|
|
for k, v in pairs(self.cds[self.targets[which]]) do
|
2016-05-06 16:04:09 +02:00
|
|
|
if not (k == "spec") then
|
|
|
|
if v[2] <= t then
|
|
|
|
self.cds[self.targets[which]][v[5]] = nil;
|
2016-05-06 16:05:24 +02:00
|
|
|
found = true;
|
2016-05-06 16:04:09 +02:00
|
|
|
end
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|
|
|
|
end
|
2016-05-06 16:05:24 +02:00
|
|
|
return found;
|
2016-05-06 15:49:39 +02:00
|
|
|
end
|