mirror of
https://github.com/Relintai/Relintais-Enemy-Kooldown-Tracker-WotLK.git
synced 2024-11-08 10:12:11 +01:00
Enable/Disable now works.
This commit is contained in:
parent
1729952a98
commit
0523a0d379
43
Vect.lua
43
Vect.lua
@ -1,6 +1,5 @@
|
||||
|
||||
--TODOS:
|
||||
--Enable/disable on frames
|
||||
--Player Entering World -> cleanup the db
|
||||
--CD Sort Order
|
||||
--Chat Command
|
||||
@ -68,7 +67,6 @@ function Vect:OnInitialize()
|
||||
self:Print(self.appName .. " v. " .. Vect.version .. ". Chat command is /vect");
|
||||
aceConfig:RegisterOptionsTable("Vect", self:GetVectOptions());
|
||||
aceCDialog:AddToBlizOptions("Vect");
|
||||
|
||||
self:RegisterChatCommand("vect", "ChatCommand");
|
||||
end
|
||||
|
||||
@ -86,7 +84,12 @@ end
|
||||
|
||||
|
||||
function Vect:OnDisable()
|
||||
self.Reset();
|
||||
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
|
||||
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||
self:UnregisterEvent("PLAYER_TARGET_CHANGED")
|
||||
self:UnregisterEvent("PLAYER_FOCUS_CHANGED")
|
||||
self.Reset();
|
||||
end
|
||||
|
||||
|
||||
@ -99,6 +102,8 @@ function Vect:COMBAT_LOG_EVENT_UNFILTERED(_, timestamp, eventType, srcGUID, srcN
|
||||
detail1, detail2, detail3)
|
||||
local db = Vect.db.profile;
|
||||
|
||||
if not db["enabled"] then return end;
|
||||
|
||||
--debugAll
|
||||
if db["allCDebug"] then
|
||||
self:Print("eventType: " .. eventType .. " id: " .. spellID .. " spellName: " .. spellName);
|
||||
@ -151,12 +156,14 @@ end
|
||||
|
||||
--gets called when a cd is finished, reassigns the cds to frames.
|
||||
function Vect:ReassignCds(which)
|
||||
local db = Vect.db.profile;
|
||||
--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
|
||||
local frame = Vect.frames[which][i]["frame"];
|
||||
frame:Hide();
|
||||
end
|
||||
local db = Vect.db.profile;
|
||||
--check if frames are unlocked
|
||||
if not db["locked"] then return end;
|
||||
--check if we need to display them for the player
|
||||
@ -245,7 +252,7 @@ function Vect:CreateFrames(which)
|
||||
local CoolDown = CreateFrame("Cooldown", "VectCoolDown" .. i, frame);
|
||||
CoolDown:SetAllPoints()
|
||||
CoolDown:SetCooldown(GetTime(), 50);
|
||||
--frame:Show();
|
||||
frame:Hide();
|
||||
Vect.frames[which][i] = {}
|
||||
Vect.frames[which][i]["frame"] = frame;
|
||||
Vect.frames[which][i]["texture"] = text;
|
||||
@ -306,6 +313,16 @@ function Vect:VOnTimerUpdate(which)
|
||||
end
|
||||
end
|
||||
|
||||
function Vect:VectDisable()
|
||||
self:Reset();
|
||||
--self:Disable();
|
||||
end
|
||||
|
||||
function Vect:VectEnable()
|
||||
self:Reset();
|
||||
self:ApplySettings();
|
||||
end
|
||||
|
||||
--Utility Functions for the options
|
||||
|
||||
--enable
|
||||
@ -315,10 +332,12 @@ function Vect:isEnabled()
|
||||
end
|
||||
|
||||
function Vect:setEnabledOrDisabled(enable)
|
||||
local db = Vect.db.profile;
|
||||
db["enabled"] = enable;
|
||||
if enable then
|
||||
Vect:Enable()
|
||||
Vect:VectEnable()
|
||||
else
|
||||
Vect:Disable()
|
||||
Vect:VectDisable()
|
||||
end
|
||||
end
|
||||
|
||||
@ -330,7 +349,15 @@ end
|
||||
function Vect:SetPartEnabledOrDisabled(which, enable)
|
||||
local db = Vect.db.profile;
|
||||
db[which]["enabled"] = enable;
|
||||
|
||||
--hide all those frames
|
||||
if not enable then
|
||||
for i = 1, 23 do
|
||||
local frame = Vect.frames[which][i]["frame"];
|
||||
frame:Hide();
|
||||
end
|
||||
else
|
||||
self:ReassignCds(which);
|
||||
end
|
||||
end
|
||||
|
||||
--lock
|
||||
|
@ -8,7 +8,7 @@ function Vect:GetVectOptions()
|
||||
args = {
|
||||
enabled = {
|
||||
type = "toggle", name = "Enabled", desc = "Enable/Disable the addon", order = 0,
|
||||
get = function() return Vect:IsEnabled() end,
|
||||
get = function() return Vect:isEnabled() end,
|
||||
set = function(_, v)
|
||||
Vect:setEnabledOrDisabled(v);
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user