mirror of
https://github.com/Relintai/Relintais-Enemy-Kooldown-Tracker-WotLK.git
synced 2024-11-08 10:12:11 +01:00
-Implemented the interruptbar functionality.
-Started the warn functionality. Ported from the TBC version.
This commit is contained in:
parent
caac5d2156
commit
d891eb594c
23
Rekt.lua
23
Rekt.lua
@ -27,7 +27,8 @@ Rekt.frames = {
|
||||
["focus"] = {},
|
||||
["targetdr"] = {},
|
||||
["focusdr"] = {},
|
||||
["selfdr"] = {}
|
||||
["selfdr"] = {},
|
||||
["interruptbar"] = {}
|
||||
}
|
||||
|
||||
Rekt.defaults = {
|
||||
@ -39,6 +40,7 @@ Rekt.defaults = {
|
||||
spellAuraDebug = false,
|
||||
allCDebug = false,
|
||||
selfCDRegister = false,
|
||||
selfIBCDRegister = false,
|
||||
specdetection = true,
|
||||
petcdguessing = true,
|
||||
target = {
|
||||
@ -61,6 +63,16 @@ Rekt.defaults = {
|
||||
colorframeenabled = true,
|
||||
colorframesize = 4
|
||||
},
|
||||
interruptbar = {
|
||||
enabled = true,
|
||||
size = 27,
|
||||
xPos = 350,
|
||||
yPos = 350,
|
||||
growOrder = tostring(2),
|
||||
sortOrder = tostring(5),
|
||||
colorframeenabled = true,
|
||||
colorframesize = 4
|
||||
},
|
||||
targetdr = {
|
||||
enabled = true,
|
||||
size = 27,
|
||||
@ -214,6 +226,7 @@ function Rekt:OnEnable()
|
||||
self:CreateDRFrames("targetdr");
|
||||
self:CreateDRFrames("focusdr");
|
||||
self:CreateDRFrames("selfdr");
|
||||
self:CreateInterruptBarFrames();
|
||||
self:ApplySettings();
|
||||
self.targets["self"] = UnitGUID("player");
|
||||
|
||||
@ -296,7 +309,7 @@ function Rekt:COMBAT_LOG_EVENT_UNFILTERED(_, timestamp, eventType, srcGUID, srcN
|
||||
end
|
||||
|
||||
if Rekt.spells[spellID] then
|
||||
Rekt:AddCd(srcGUID, spellID);
|
||||
Rekt:AddCd(srcGUID, spellID, srcFlags);
|
||||
end
|
||||
end
|
||||
|
||||
@ -380,15 +393,21 @@ end
|
||||
|
||||
function Rekt:ApplySettings()
|
||||
local db = Rekt.db.profile;
|
||||
|
||||
Rekt:MoveTimersStop("target");
|
||||
Rekt:MoveTimersStop("focus");
|
||||
Rekt:ReassignCds("target");
|
||||
Rekt:ReassignCds("focus");
|
||||
|
||||
Rekt:MoveTimersStop("interruptbar");
|
||||
Rekt:ReassignIBCds();
|
||||
|
||||
Rekt:MoveDRTimersStop("targetdr");
|
||||
Rekt:MoveDRTimersStop("focusdr");
|
||||
Rekt:MoveDRTimersStop("selfdr");
|
||||
Rekt:ReassignDRs("targetdr");
|
||||
Rekt:ReassignDRs("focusdr");
|
||||
Rekt:ReassignDRs("selfdr");
|
||||
|
||||
if not db["locked"] then self:ShowMovableFrames() end;
|
||||
end
|
||||
|
4
Rekt.toc
4
Rekt.toc
@ -6,7 +6,7 @@
|
||||
## DefaultState: Enabled
|
||||
## OptionalDeps: Ace3
|
||||
## SavedVariables: RektDB
|
||||
## Version: 1.05
|
||||
## Version: 1.01
|
||||
|
||||
embeds.xml
|
||||
data\global.lua
|
||||
@ -16,4 +16,6 @@ data\options.lua
|
||||
data\sorters.lua
|
||||
data\drs.lua
|
||||
data\cooldowns.lua
|
||||
data\interruptbar.lua
|
||||
data\warn.lua
|
||||
Rekt.lua
|
||||
|
@ -51,8 +51,8 @@ function Rekt:ReassignCds(which)
|
||||
end
|
||||
end
|
||||
|
||||
function Rekt:AddCd(srcGUID, spellID)
|
||||
local db = Rekt.db.profile;
|
||||
function Rekt:AddCd(srcGUID, spellID, srcFlags)
|
||||
local db = Rekt.db.profile;
|
||||
if not db["enabled"] then return end;
|
||||
|
||||
if not Rekt.cds[srcGUID] then
|
||||
@ -72,6 +72,7 @@ function Rekt:AddCd(srcGUID, spellID)
|
||||
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];
|
||||
local interrupt, warn = Rekt.spells[spellID][10], Rekt.spells[spellID][11];
|
||||
|
||||
if db["petcdguessing"] then
|
||||
if (Rekt.cds[srcGUID]["spec"][2] == "") and class then
|
||||
@ -103,6 +104,11 @@ function Rekt:AddCd(srcGUID, spellID)
|
||||
spellID,
|
||||
spellCategory
|
||||
}
|
||||
|
||||
--Interruptbar
|
||||
if interrupt and db["interruptbar"]["enabled"] then
|
||||
Rekt:AddInterruptCD(Rekt.cds[srcGUID][spellID], srcFlags);
|
||||
end
|
||||
|
||||
--add it to every class of the same type
|
||||
if db["petcdguessing"] and isPet then
|
||||
|
@ -2,7 +2,7 @@
|
||||
Rekt = LibStub("AceAddon-3.0"):NewAddon("Rekt", "AceConsole-3.0", "AceEvent-3.0")
|
||||
Rekt.appName = "Rekt"
|
||||
Rekt.dbName = "RektDB"
|
||||
Rekt.version = "1.0RC1"
|
||||
Rekt.version = "1.05"
|
||||
|
||||
function Rekt:HideFrames()
|
||||
for i = 1, 23 do
|
||||
|
242
data/interruptbar.lua
Normal file
242
data/interruptbar.lua
Normal file
@ -0,0 +1,242 @@
|
||||
|
||||
local band = bit.band
|
||||
|
||||
Rekt.interrupts = {
|
||||
["count"] = 0,
|
||||
["spells"] = {}
|
||||
}
|
||||
|
||||
function Rekt:AddInterruptCD(cooldown, srcFlags)
|
||||
local db = Rekt.db.profile;
|
||||
|
||||
if not db["selfIBCDRegister"] then
|
||||
if not (band(srcFlags, 0x00000040) == 0x00000040) then
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local ir = Rekt.interrupts;
|
||||
|
||||
ir["count"] = ir["count"] + 1;
|
||||
|
||||
if not ir["spells"] then
|
||||
ir["spells"] = {};
|
||||
end
|
||||
|
||||
ir["spells"][ir["count"]] = cooldown;
|
||||
|
||||
Rekt:ReassignIBCds();
|
||||
end
|
||||
|
||||
function Rekt:CreateInterruptBarFrames()
|
||||
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:OnInterruptBarUpdate() end)
|
||||
end
|
||||
local text = frame:CreateTexture();
|
||||
text:SetTexture("Interface\\Icons\\Spell_Arcane_Blink")
|
||||
text:SetAllPoints(frame);
|
||||
frame.texture = text;
|
||||
local CoolDown = CreateFrame("Cooldown", "RektIBCoolDown" .. i, frame);
|
||||
CoolDown:SetAllPoints()
|
||||
CoolDown:SetCooldown(GetTime(), 50);
|
||||
frame:Hide();
|
||||
|
||||
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();
|
||||
|
||||
Rekt.frames["interruptbar"][i] = {}
|
||||
Rekt.frames["interruptbar"][i]["frame"] = frame;
|
||||
Rekt.frames["interruptbar"][i]["texture"] = text;
|
||||
Rekt.frames["interruptbar"][i]["cooldown"] = CoolDown;
|
||||
Rekt.frames["interruptbar"][i]["colorframe"] = colorframe;
|
||||
end
|
||||
end
|
||||
|
||||
function Rekt:OnInterruptBarUpdate()
|
||||
if Rekt:UpdateIBCDs() then
|
||||
Rekt:ReassignIBCds();
|
||||
end
|
||||
end
|
||||
|
||||
function Rekt:UpdateIBCDs()
|
||||
if self.interrupts["count"] == 0 then
|
||||
return;
|
||||
end
|
||||
|
||||
if not self.interrupts["spells"] then
|
||||
return;
|
||||
end
|
||||
|
||||
local t = GetTime();
|
||||
local found = false;
|
||||
local count = 0;
|
||||
|
||||
--let's check if one of the cooldowns finished
|
||||
for k, v in pairs(self.interrupts["spells"]) do
|
||||
if v[2] <= t then
|
||||
self.interrupts["spells"][k] = nil;
|
||||
count = count + 1;
|
||||
found = true;
|
||||
end
|
||||
end
|
||||
|
||||
if found then
|
||||
self.interrupts["count"] = self.interrupts["count"] - count;
|
||||
self.interrupts["spells"] = Rekt.NormalizeTable(self.interrupts["spells"]);
|
||||
end
|
||||
|
||||
return found;
|
||||
end
|
||||
|
||||
--This function will remap the given table to be sequential
|
||||
--meaning: [0] = 5, [1] = nil, [2] = 4, will become [0] = 5, [1] = 4, [2] = nil
|
||||
function Rekt:NormalizeTable(table)
|
||||
|
||||
if not table then return; end
|
||||
|
||||
local tmp = {};
|
||||
|
||||
--make the tmp table
|
||||
local i = 1;
|
||||
for k, v in pairs(table) do
|
||||
if v then
|
||||
tmp[i] = v;
|
||||
end
|
||||
end
|
||||
|
||||
return tmp;
|
||||
end
|
||||
|
||||
--Refreshes the frames
|
||||
function Rekt:ReassignIBCds()
|
||||
local db = Rekt.db.profile;
|
||||
|
||||
--first hide all
|
||||
for i = 1, 23 do
|
||||
local frame = Rekt.frames["interruptbar"][i]["frame"];
|
||||
frame:Hide();
|
||||
local colorframe = Rekt.frames["interruptbar"][i]["colorframe"];
|
||||
colorframe:Hide();
|
||||
end
|
||||
|
||||
--check if frames are unlocked
|
||||
if not db["locked"] then return end;
|
||||
|
||||
if self.interrupts["count"] == 0 then
|
||||
return;
|
||||
end
|
||||
|
||||
if not self.interrupts["spells"] then
|
||||
return;
|
||||
end
|
||||
|
||||
--update cds
|
||||
Rekt:UpdateIBCDs();
|
||||
|
||||
--sort them
|
||||
local tmp = Rekt:SortIBCDs();
|
||||
|
||||
--let's fill them up
|
||||
local i = 1;
|
||||
for k, v in ipairs(tmp) do
|
||||
local frame = Rekt.frames["interruptbar"][i]["frame"];
|
||||
local text = Rekt.frames["interruptbar"][i]["texture"];
|
||||
text:SetTexture(v["spellIcon"]);
|
||||
local CoolDown = Rekt.frames["interruptbar"][i]["cooldown"];
|
||||
CoolDown:SetCooldown(v["currentTime"], v["cd"]);
|
||||
frame:Show();
|
||||
if (db["interruptbar"]["colorframeenabled"]) then
|
||||
local colorframe = Rekt.frames["interruptbar"][i]["colorframe"];
|
||||
--self:Print(v["spellID"] .. " cat: " .. v["spellCategory"]);
|
||||
|
||||
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
|
||||
i = i + 1;
|
||||
end
|
||||
end
|
||||
|
||||
function Rekt:SortIBCDs()
|
||||
if self.interrupts["count"] == 0 then
|
||||
return;
|
||||
end
|
||||
|
||||
if not self.interrupts["spells"] then
|
||||
return;
|
||||
end
|
||||
|
||||
local db = Rekt.db.profile;
|
||||
local ir = Rekt.interrupts;
|
||||
local tmp = {};
|
||||
|
||||
--make the tmp table
|
||||
local i = 1;
|
||||
for k, v in pairs(ir["spells"]) do
|
||||
if v then
|
||||
tmp[i] = {
|
||||
currentTime = v[1],
|
||||
endTime = v[2],
|
||||
cd = v[3],
|
||||
spellIcon = v[4],
|
||||
spellID = v[5],
|
||||
spellCategory = v[6]
|
||||
};
|
||||
|
||||
--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
|
||||
end
|
||||
|
||||
if not tmp then return end;
|
||||
|
||||
if not db["cdtypesortorder"]["enabled"] then
|
||||
if db["interruptbar"]["sortOrder"] == "1" then --["1"] = "Ascending (CD left)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerAscendingCDLeft(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "2" then --["2"] = "Descending (CD left)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerDescendingCDLeft(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "3" then --["3"] = "Ascending (CD total)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerAscendingCDTotal(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "4" then --["4"] = "Descending (CD total)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerDescendingCDTotal(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "5" then --["5"] = "Recent first",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerRecentFirst(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "6" then --["6"] = "Recent Last",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerRecentLast(a, b) end);
|
||||
end --["7"] = "No order"
|
||||
else
|
||||
if db["interruptbar"]["sortOrder"] == "1" then --["1"] = "Ascending (CD left)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerAscendingCDLeftT(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "2" then --["2"] = "Descending (CD left)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerDescendingCDLeftT(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "3" then --["3"] = "Ascending (CD total)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerAscendingCDTotalT(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "4" then --["4"] = "Descending (CD total)",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerDescendingCDTotalT(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "5" then --["5"] = "Recent first",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerRecentFirstT(a, b) end);
|
||||
elseif db["interruptbar"]["sortOrder"] == "6" then --["6"] = "Recent Last",
|
||||
table.sort(tmp, function(a, b) return Rekt:ComparerRecentLastT(a, b) end);
|
||||
end --["7"] = "No order"
|
||||
end
|
||||
|
||||
return tmp;
|
||||
end
|
@ -163,7 +163,7 @@ function Rekt:ShowMovableFrames()
|
||||
--Create them if they doesn't exists
|
||||
if not Rekt.MovableFrames then
|
||||
Rekt.MovableFrames = {}
|
||||
for i = 1, 5 do
|
||||
for i = 1, 6 do
|
||||
local frame = CreateFrame("Frame", nil, UIParent, nil);
|
||||
frame:SetFrameStrata("BACKGROUND");
|
||||
frame:SetScript("OnDragStart", function() self:MovableFrameDragStart() end)
|
||||
@ -188,6 +188,8 @@ function Rekt:ShowMovableFrames()
|
||||
ttext = "FDR";
|
||||
elseif i == 5 then
|
||||
ttext = "SDR";
|
||||
elseif i == 6 then
|
||||
ttext = "IB";
|
||||
end
|
||||
|
||||
t:SetText(ttext);
|
||||
@ -203,6 +205,8 @@ function Rekt:ShowMovableFrames()
|
||||
which = "focusdr";
|
||||
elseif i == 5 then
|
||||
which = "selfdr";
|
||||
elseif i == 6 then
|
||||
which = "interruptbar";
|
||||
end
|
||||
|
||||
frame.DragID = which;
|
||||
@ -417,4 +421,14 @@ function Rekt:setSelfCDRegister(v)
|
||||
db["selfCDRegister"] = v;
|
||||
Rekt:ReassignCds("target");
|
||||
Rekt:ReassignCds("focus");
|
||||
end
|
||||
|
||||
function Rekt:getIBSelfCDRegister()
|
||||
local db = Rekt.db.profile;
|
||||
return db["selfIBCDRegister"];
|
||||
end
|
||||
|
||||
function Rekt:setIBSelfCDRegister(v)
|
||||
local db = Rekt.db.profile;
|
||||
db["selfIBCDRegister"] = v;
|
||||
end
|
@ -42,6 +42,7 @@ function Rekt:GetRektOptions()
|
||||
}
|
||||
return options;
|
||||
end
|
||||
|
||||
--order 10-20
|
||||
function Rekt:getTargetandFocusOptions()
|
||||
local args = {
|
||||
@ -169,6 +170,68 @@ function Rekt:getTargetandFocusOptions()
|
||||
Rekt:setColorFrameSize("focus", v);
|
||||
end
|
||||
},
|
||||
ibHeader = {
|
||||
type = "header", name = "InterruptBar's settings", order = 30
|
||||
},
|
||||
ibtoggle = {
|
||||
type = "toggle", name = "InterruptBar", desc = "Enable/Disable showing the InterruptBar", order = 31,
|
||||
get = function() return Rekt:isPartEnabled("interruptbar") end,
|
||||
set = function(_, v)
|
||||
Rekt:SetPartEnabledOrDisabled("interruptbar", v);
|
||||
end
|
||||
},
|
||||
ibrange = {
|
||||
type = "range", name = "InterruptBar's size", order = 32, min = 10, max = 150, step = 1,
|
||||
get = function() return Rekt:getFrameSize("interruptbar") end,
|
||||
set = function(_, v)
|
||||
Rekt:setFrameSize("interruptbar", v);
|
||||
end
|
||||
},
|
||||
ibGrowSelect = {
|
||||
type = "select", style = "dropdown", name = "InterruptBarGrow",
|
||||
desc = "Change which way the InterruptBar's cooldowns will grow", order = 33,
|
||||
values = {
|
||||
["1"] = "Up",
|
||||
["2"] = "Right",
|
||||
["3"] = "Down",
|
||||
["4"] = "Left"
|
||||
},
|
||||
get = function() return Rekt:getGrowOrder("interruptbar") end,
|
||||
set = function(_, v)
|
||||
Rekt:setGrowOrder("interruptbar", v);
|
||||
end
|
||||
},
|
||||
ibSortSelect = {
|
||||
type = "select", style = "dropdown", name = "InterruptBarSortOrder",
|
||||
desc = "Change the InterruptBar's cooldowns's sort order", order = 34,
|
||||
values = {
|
||||
["1"] = "Ascending (CD left)",
|
||||
["2"] = "Descending (CD left)",
|
||||
["3"] = "Ascending (CD total)",
|
||||
["4"] = "Descending (CD total)",
|
||||
["5"] = "Recent first",
|
||||
["6"] = "Recent Last",
|
||||
["7"] = "No order"
|
||||
},
|
||||
get = function() return Rekt:getSortOrder("interruptbar") end,
|
||||
set = function(_, v)
|
||||
Rekt:setSortOrder("interruptbar", v);
|
||||
end
|
||||
},
|
||||
ibcolortoggle = {
|
||||
type = "toggle", name = "Colors", desc = "Enable/Disable showing the InterruptBar's cooldown's colors.", order = 35,
|
||||
get = function() return Rekt:getColorFrameEnabled("interruptbar") end,
|
||||
set = function(_, v)
|
||||
Rekt:setColorFrameEnabled("interruptbar", v);
|
||||
end
|
||||
},
|
||||
ibcolorrange = {
|
||||
type = "range", name = "InterruptBar's Color size", order = 36, min = 1, max = 30, step = 1,
|
||||
get = function() return Rekt:getColorFrameSize("interruptbar") end,
|
||||
set = function(_, v)
|
||||
Rekt:setColorFrameSize("interruptbar", v);
|
||||
end
|
||||
},
|
||||
}
|
||||
return args;
|
||||
end
|
||||
@ -637,9 +700,16 @@ function Rekt:getDebugOptions()
|
||||
Rekt:setSelfCDRegister(v);
|
||||
end
|
||||
},
|
||||
selfcd = {
|
||||
type = "toggle", name = "Friendly + Self Interrupts", desc = "Enable/Disable registering, and showing friendly and self interrupts at the interruptbar.", order = 54,
|
||||
get = function() return Rekt:getIBSelfCDRegister() end,
|
||||
set = function(_, v)
|
||||
Rekt:setIBSelfCDRegister(v);
|
||||
end
|
||||
},
|
||||
debugselect = {
|
||||
type = "select", style = "dropdown", name = "debuglevel",
|
||||
desc = "Change the debuglevel", order = 54,
|
||||
desc = "Change the debuglevel", order = 55,
|
||||
values = {
|
||||
["0"] = "No Messages",
|
||||
},
|
||||
|
1010
data/spells.lua
1010
data/spells.lua
File diff suppressed because it is too large
Load Diff
0
data/warn.lua
Normal file
0
data/warn.lua
Normal file
Loading…
Reference in New Issue
Block a user