cleanup cd handlers
This commit is contained in:
@@ -1808,9 +1808,6 @@ do
|
||||
|
||||
local spellCds = CreateSpellCDHandler();
|
||||
local spellCdsRune = CreateSpellCDHandler();
|
||||
local spellCdsOnlyCooldown = CreateSpellCDHandler();
|
||||
local spellCdsOnlyCooldownRune = CreateSpellCDHandler();
|
||||
local spellCdsCharges = CreateSpellCDHandler();
|
||||
|
||||
local spellIds = {}
|
||||
|
||||
@@ -1866,17 +1863,9 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.GetSpellCooldown(id, ignoreRuneCD, showgcd, track)
|
||||
function WeakAuras.GetSpellCooldown(id, ignoreRuneCD, showgcd)
|
||||
local startTime, duration, gcdCooldown, readyTime
|
||||
if track == "charges" then
|
||||
startTime, duration, readyTime = spellCdsCharges:FetchSpellCooldown(id)
|
||||
elseif track == "cooldown" then
|
||||
if ignoreRuneCD then
|
||||
startTime, duration, readyTime = spellCdsOnlyCooldownRune:FetchSpellCooldown(id)
|
||||
else
|
||||
startTime, duration, readyTime = spellCdsOnlyCooldown:FetchSpellCooldown(id)
|
||||
end
|
||||
elseif (ignoreRuneCD) then
|
||||
if (ignoreRuneCD) then
|
||||
startTime, duration, readyTime = spellCdsRune:FetchSpellCooldown(id)
|
||||
else
|
||||
startTime, duration, readyTime = spellCds:FetchSpellCooldown(id)
|
||||
@@ -2036,7 +2025,7 @@ do
|
||||
end
|
||||
|
||||
-- Default to GetSpellCharges
|
||||
local unifiedCooldownBecauseRune, cooldownBecauseRune = false, false;
|
||||
local cooldownBecauseRune = false;
|
||||
if (enabled == 0) then
|
||||
startTimeCooldown, durationCooldown = 0, 0
|
||||
end
|
||||
@@ -2044,10 +2033,9 @@ do
|
||||
local onNonGCDCD = durationCooldown and startTimeCooldown and durationCooldown > 0 and (durationCooldown ~= gcdDuration or startTimeCooldown ~= gcdStart);
|
||||
if (onNonGCDCD) then
|
||||
cooldownBecauseRune = runeDuration and durationCooldown and abs(durationCooldown - runeDuration) < 0.001;
|
||||
unifiedCooldownBecauseRune = cooldownBecauseRune
|
||||
end
|
||||
|
||||
return startTimeCooldown, durationCooldown, unifiedCooldownBecauseRune, cooldownBecauseRune, GetSpellCount(id);
|
||||
return startTimeCooldown, durationCooldown, cooldownBecauseRune, GetSpellCount(id);
|
||||
end
|
||||
|
||||
function Private.CheckSpellKnown()
|
||||
@@ -2063,7 +2051,7 @@ do
|
||||
end
|
||||
|
||||
function Private.CheckSpellCooldown(id, runeDuration)
|
||||
local startTimeCooldown, durationCooldown, unifiedCooldownBecauseRune, cooldownBecauseRune, spellCount = WeakAuras.GetSpellCooldownUnified(id, runeDuration);
|
||||
local startTimeCooldown, durationCooldown, cooldownBecauseRune, spellCount = WeakAuras.GetSpellCooldownUnified(id, runeDuration);
|
||||
|
||||
local time = GetTime();
|
||||
local remaining = startTimeCooldown + durationCooldown - time;
|
||||
@@ -2079,14 +2067,10 @@ do
|
||||
chargesChanged = true
|
||||
end
|
||||
|
||||
changed = spellCds:HandleSpell(id, startTimeCooldown, durationCooldown) or changed
|
||||
if not unifiedCooldownBecauseRune then
|
||||
changed = spellCdsRune:HandleSpell(id, startTimeCooldown, durationCooldown) or changed
|
||||
end
|
||||
local cdChanged, nowReady = spellCdsOnlyCooldown:HandleSpell(id, startTimeCooldown, durationCooldown)
|
||||
local cdChanged, nowReady = spellCds:HandleSpell(id, startTimeCooldown, durationCooldown)
|
||||
changed = cdChanged or changed
|
||||
if not cooldownBecauseRune then
|
||||
changed = spellCdsOnlyCooldownRune:HandleSpell(id, startTimeCooldown, durationCooldown) or changed
|
||||
changed = spellCdsRune:HandleSpell(id, startTimeCooldown, durationCooldown) or changed
|
||||
end
|
||||
|
||||
if not WeakAuras.IsPaused() then
|
||||
@@ -2292,15 +2276,11 @@ do
|
||||
spellIds[id] = id
|
||||
spellKnown[id] = WeakAuras.IsSpellKnownIncludingPet(id);
|
||||
|
||||
local startTimeCooldown, durationCooldown, unifiedCooldownBecauseRune, cooldownBecauseRune, spellCount = WeakAuras.GetSpellCooldownUnified(id, GetRuneDuration());
|
||||
local startTimeCooldown, durationCooldown, cooldownBecauseRune, spellCount = WeakAuras.GetSpellCooldownUnified(id, GetRuneDuration());
|
||||
spellCounts[id] = spellCount
|
||||
spellCds:HandleSpell(id, startTimeCooldown, durationCooldown)
|
||||
if not unifiedCooldownBecauseRune then
|
||||
spellCdsRune:HandleSpell(id, startTimeCooldown, durationCooldown)
|
||||
end
|
||||
spellCdsOnlyCooldown:HandleSpell(id, startTimeCooldown, durationCooldown)
|
||||
if not cooldownBecauseRune then
|
||||
spellCdsOnlyCooldownRune:HandleSpell(id, startTimeCooldown, durationCooldown)
|
||||
spellCdsRune:HandleSpell(id, startTimeCooldown, durationCooldown)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+12
-92
@@ -2235,8 +2235,7 @@ Private.event_prototypes = {
|
||||
local spellname = %s
|
||||
local ignoreRuneCD = %s
|
||||
local showgcd = %s;
|
||||
local track = %q
|
||||
local startTime, duration, gcdCooldown = WeakAuras.GetSpellCooldown(spellname, ignoreRuneCD, showgcd, track);
|
||||
local startTime, duration, gcdCooldown = WeakAuras.GetSpellCooldown(spellname, ignoreRuneCD, showgcd);
|
||||
local spellCount = WeakAuras.GetSpellCharges(spellname);
|
||||
local stacks = (spellCount and spellCount > 0 and spellCount) or nil;
|
||||
local genericShowOn = %s
|
||||
@@ -2259,68 +2258,21 @@ Private.event_prototypes = {
|
||||
ret = ret:format(spellName,
|
||||
(trigger.use_matchedRune and "true" or "false"),
|
||||
(trigger.use_showgcd and "true" or "false"),
|
||||
(trigger.track or "auto"),
|
||||
showOnCheck
|
||||
);
|
||||
|
||||
if (not trigger.use_trackcharge or not trigger.trackcharge) then
|
||||
ret = ret .. [=[
|
||||
if (state.expirationTime ~= expirationTime) then
|
||||
state.expirationTime = expirationTime;
|
||||
state.changed = true;
|
||||
end
|
||||
if (state.duration ~= duration) then
|
||||
state.duration = duration;
|
||||
state.changed = true;
|
||||
end
|
||||
state.progressType = 'timed';
|
||||
]=];
|
||||
else
|
||||
local ret2 = [=[
|
||||
local trackedCharge = %s
|
||||
if (charges < trackedCharge) then
|
||||
if (state.value ~= duration) then
|
||||
state.value = duration;
|
||||
state.changed = true;
|
||||
end
|
||||
if (state.total ~= duration) then
|
||||
state.total = duration;
|
||||
state.changed = true;
|
||||
end
|
||||
ret = ret .. [=[
|
||||
if (state.expirationTime ~= expirationTime) then
|
||||
state.expirationTime = expirationTime;
|
||||
state.changed = true;
|
||||
end
|
||||
if (state.duration ~= duration) then
|
||||
state.duration = duration;
|
||||
state.changed = true;
|
||||
end
|
||||
state.progressType = 'timed';
|
||||
]=];
|
||||
|
||||
state.expirationTime = nil;
|
||||
state.duration = nil;
|
||||
state.progressType = 'static';
|
||||
elseif (charges > trackedCharge) then
|
||||
if (state.expirationTime ~= 0) then
|
||||
state.expirationTime = 0;
|
||||
state.changed = true;
|
||||
end
|
||||
if (state.duration ~= 0) then
|
||||
state.duration = 0;
|
||||
state.changed = true;
|
||||
end
|
||||
state.value = nil;
|
||||
state.total = nil;
|
||||
state.progressType = 'timed';
|
||||
else
|
||||
if (state.expirationTime ~= expirationTime) then
|
||||
state.expirationTime = expirationTime;
|
||||
state.changed = true;
|
||||
state.changed = true;
|
||||
end
|
||||
if (state.duration ~= duration) then
|
||||
state.duration = duration;
|
||||
state.changed = true;
|
||||
end
|
||||
state.value = nil;
|
||||
state.total = nil;
|
||||
state.progressType = 'timed';
|
||||
end
|
||||
]=];
|
||||
local trackedCharge = tonumber(trigger.trackcharge or 1) or 1;
|
||||
ret = ret .. ret2:format(trackedCharge - 1);
|
||||
end
|
||||
if(trigger.use_remaining and trigger.genericShowOn ~= "showOnReady") then
|
||||
local ret2 = [[
|
||||
local remaining = 0;
|
||||
@@ -2355,11 +2307,6 @@ Private.event_prototypes = {
|
||||
display = function(trigger)
|
||||
return function()
|
||||
local text = "";
|
||||
if trigger.track == "charges" then
|
||||
text = L["Tracking Charge CDs"]
|
||||
elseif trigger.track == "cooldown" then
|
||||
text = L["Tracking Only Cooldown"]
|
||||
end
|
||||
if trigger.use_showgcd then
|
||||
if text ~= "" then text = text .. "; " end
|
||||
text = text .. L["Show GCD"]
|
||||
@@ -2370,12 +2317,6 @@ Private.event_prototypes = {
|
||||
text = text ..L["Ignore Rune CDs"]
|
||||
end
|
||||
|
||||
if trigger.genericShowOn ~= "showOnReady" and trigger.track ~= "cooldown" then
|
||||
if trigger.use_trackcharge and trigger.trackcharge then
|
||||
if text ~= "" then text = text .. "; " end
|
||||
text = text .. L["Tracking Charge %i"]:format(trigger.trackcharge)
|
||||
end
|
||||
end
|
||||
if text == "" then
|
||||
return L["|cFFffcc00Extra Options:|r None"]
|
||||
end
|
||||
@@ -2384,16 +2325,6 @@ Private.event_prototypes = {
|
||||
end,
|
||||
type = "collapse",
|
||||
},
|
||||
{
|
||||
name = "track",
|
||||
display = L["Track Cooldowns"],
|
||||
type = "select",
|
||||
values = "cooldown_types",
|
||||
collapse = "extra Cooldown Progress (Spell)",
|
||||
test = "true",
|
||||
required = true,
|
||||
default = "auto"
|
||||
},
|
||||
{
|
||||
name = "showgcd",
|
||||
display = L["Show Global Cooldown"],
|
||||
@@ -2408,17 +2339,6 @@ Private.event_prototypes = {
|
||||
test = "true",
|
||||
collapse = "extra Cooldown Progress (Spell)"
|
||||
},
|
||||
{
|
||||
name = "trackcharge",
|
||||
display = L["Show CD of Charge"],
|
||||
type = "number",
|
||||
enable = function(trigger)
|
||||
return (trigger.genericShowOn ~= "showOnReady") and trigger.track ~= "cooldown"
|
||||
end,
|
||||
test = "true",
|
||||
noOperator = true,
|
||||
collapse = "extra Cooldown Progress (Spell)"
|
||||
},
|
||||
{
|
||||
name = "remaining",
|
||||
display = L["Remaining Time"],
|
||||
|
||||
Reference in New Issue
Block a user