Fixed totemic recall reset logic.
Totemic recall needs to reset totem timers.
This commit is contained in:
Vendored
+30
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "echo",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "echo Hello"
|
||||||
|
},{
|
||||||
|
"label": "cwd",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${cwd}\\"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "localdeploy",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "Copy-Item",
|
||||||
|
"args": [
|
||||||
|
"-Force",
|
||||||
|
"-Recurse",
|
||||||
|
"-Verbose",
|
||||||
|
"-Path",
|
||||||
|
"${cwd}\\*",
|
||||||
|
"-Destination",
|
||||||
|
"D:\\Games\\Turtle WoW 1.12\\Interface\\AddOns\\CallOfElements"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+10
-8
@@ -37,20 +37,17 @@ function COE_Totem:Rescan()
|
|||||||
|
|
||||||
-- Reset all active totems
|
-- Reset all active totems
|
||||||
-- ------------------------
|
-- ------------------------
|
||||||
COE_Totem:DeactivateTimer( COE.ActiveTotems.Earth );
|
COE_Totem:ResetTimers();
|
||||||
COE_Totem:DeactivateTimer( COE.ActiveTotems.Fire );
|
|
||||||
COE_Totem:DeactivateTimer( COE.ActiveTotems.Water );
|
|
||||||
COE_Totem:DeactivateTimer( COE.ActiveTotems.Air );
|
|
||||||
COE.ActiveTotems.Earth = nil;
|
COE.ActiveTotems.Earth = nil;
|
||||||
COE.ActiveTotems.Fire = nil;
|
COE.ActiveTotems.Fire = nil;
|
||||||
COE.ActiveTotems.Water = nil;
|
COE.ActiveTotems.Water = nil;
|
||||||
COE.ActiveTotems.Air = nil;
|
COE.ActiveTotems.Air = nil;
|
||||||
|
|
||||||
COE_Totem:UpdateAllFrames();
|
COE_Totem:UpdateAllFrames();
|
||||||
COETotemFrame.Reconfigure = true;
|
COETotemFrame.Reconfigure = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[ ----------------------------------------------------------------
|
--[[ ----------------------------------------------------------------
|
||||||
METHOD: COE_Totem:ThrowTotem
|
METHOD: COE_Totem:ThrowTotem
|
||||||
|
|
||||||
@@ -681,11 +678,13 @@ end
|
|||||||
still active timer of the same element
|
still active timer of the same element
|
||||||
-------------------------------------------------------------------]]
|
-------------------------------------------------------------------]]
|
||||||
function COE_Totem:ActivatePendingTotem( totem )
|
function COE_Totem:ActivatePendingTotem( totem )
|
||||||
|
COE:DebugMessage("Method Executing: ActivatePendingTotem with totem parameter ".. totem.SpellName);
|
||||||
|
|
||||||
-- deactivate still active totem of the same element
|
-- deactivate still active totem of the same element
|
||||||
-- --------------------------------------------------
|
-- --------------------------------------------------
|
||||||
local active = COE.ActiveTotems[COE.TotemPending.Totem.Element];
|
COE:DebugMessage("Method Executing: ActivatePendingTotem - identifying active totems of type".. COE.TotemPending.Totem.Element);
|
||||||
if( active ) then
|
local active = COE.ActiveTotems[COE.TotemPending.Totem.Element];
|
||||||
|
if( active ) then
|
||||||
COE_Totem:DeactivateTimer( active );
|
COE_Totem:DeactivateTimer( active );
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -857,6 +856,7 @@ end
|
|||||||
PURPOSE: Issues an expiration warning for the specified totem
|
PURPOSE: Issues an expiration warning for the specified totem
|
||||||
-------------------------------------------------------------------]]
|
-------------------------------------------------------------------]]
|
||||||
function COESched_ExpirationWarning( timemark, totem )
|
function COESched_ExpirationWarning( timemark, totem )
|
||||||
|
COE:DebugMessage("Method Executing: COESched_ExpirationWarning with totem parameter ".. totem.SpellName);
|
||||||
|
|
||||||
if( COE_Config:GetSaved( COEOPT_ENABLETOTEMBAR ) == 1 and
|
if( COE_Config:GetSaved( COEOPT_ENABLETOTEMBAR ) == 1 and
|
||||||
COE_Config:GetSaved( COEOPT_ENABLETIMERS ) == 1 and
|
COE_Config:GetSaved( COEOPT_ENABLETIMERS ) == 1 and
|
||||||
@@ -901,6 +901,7 @@ end
|
|||||||
a notification if the totem is destroyed
|
a notification if the totem is destroyed
|
||||||
-------------------------------------------------------------------]]
|
-------------------------------------------------------------------]]
|
||||||
function COE_Totem:TotemDamage()
|
function COE_Totem:TotemDamage()
|
||||||
|
COE:DebugMessage("Method Executing: TotemDamage");
|
||||||
|
|
||||||
local num, regex, i;
|
local num, regex, i;
|
||||||
for num, regex in COESTR_TOTEMDAMAGE do
|
for num, regex in COESTR_TOTEMDAMAGE do
|
||||||
@@ -949,6 +950,7 @@ end
|
|||||||
PURPOSE: Resets all active timers to zero
|
PURPOSE: Resets all active timers to zero
|
||||||
-------------------------------------------------------------------]]
|
-------------------------------------------------------------------]]
|
||||||
function COE_Totem:ResetTimers()
|
function COE_Totem:ResetTimers()
|
||||||
|
COE:DebugMessage("Method Executing: COE_Totem:ResetTimers");
|
||||||
|
|
||||||
local k;
|
local k;
|
||||||
for k = 1, 4 do
|
for k = 1, 4 do
|
||||||
|
|||||||
+3
-2
@@ -1562,7 +1562,6 @@ end
|
|||||||
associated totem has an active timer
|
associated totem has an active timer
|
||||||
-------------------------------------------------------------------]]
|
-------------------------------------------------------------------]]
|
||||||
function COE_Totem:SetTimerText()
|
function COE_Totem:SetTimerText()
|
||||||
|
|
||||||
if( this.totem == COE.NoTotem ) then
|
if( this.totem == COE.NoTotem ) then
|
||||||
return;
|
return;
|
||||||
end;
|
end;
|
||||||
@@ -1641,7 +1640,9 @@ function COE_Totem:SetTimerText()
|
|||||||
-- if timer has just expired, deactivate it
|
-- if timer has just expired, deactivate it
|
||||||
-- if it isn't active anyway, the call doesn't hurt
|
-- if it isn't active anyway, the call doesn't hurt
|
||||||
-- -------------------------------------------------
|
-- -------------------------------------------------
|
||||||
COE_Totem:DeactivateTimer( this.totem );
|
-- TODO: I'm removing this as it appears entirely unnecessary to be done in this method
|
||||||
|
--COE:DebugMessage("Calling DeactivateTimer with totem: ".. this.totem.SpellName);
|
||||||
|
--COE_Totem:DeactivateTimer( this.totem );
|
||||||
|
|
||||||
timertext:Hide();
|
timertext:Hide();
|
||||||
overlaytex:Hide();
|
overlaytex:Hide();
|
||||||
|
|||||||
+68
-2
@@ -63,7 +63,8 @@ function COE:Init()
|
|||||||
COE.Initialized = true;
|
COE.Initialized = true;
|
||||||
|
|
||||||
this:RegisterEvent( "VARIABLES_LOADED" );
|
this:RegisterEvent( "VARIABLES_LOADED" );
|
||||||
|
this:RegisterEvent("SPELLCAST_STOP");
|
||||||
|
|
||||||
-- register shell command
|
-- register shell command
|
||||||
-- -----------------------
|
-- -----------------------
|
||||||
SlashCmdList["COE"] = COEProcessShellCommand;
|
SlashCmdList["COE"] = COEProcessShellCommand;
|
||||||
@@ -71,8 +72,25 @@ function COE:Init()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ ----------------------------------------------------------------
|
||||||
|
METHOD: COE:FindSpellId
|
||||||
|
|
||||||
|
PURPOSE: Utility function that can provide spell ID from name.
|
||||||
|
Run in client chat with '/script COE:FindSpellName("a_spell_name")'.
|
||||||
|
-------------------------------------------------------------------]]
|
||||||
|
function COE:FindSpellId(spellNameTarget)
|
||||||
|
local spellName;
|
||||||
|
for i = 1, 1000 do
|
||||||
|
spellName = GetSpellName(i, BOOKTYPE_SPELL);
|
||||||
|
if (spellName == spellNameTarget) then
|
||||||
|
print(spellName .. "is id: " .. i);
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--[[ ----------------------------------------------------------------
|
--[[ ----------------------------------------------------------------
|
||||||
METHOD: COE:OnEvent
|
METHOD: COE:OnEvent
|
||||||
@@ -85,6 +103,54 @@ function COE:OnEvent( event )
|
|||||||
-- fix saved variables if this update has to do so
|
-- fix saved variables if this update has to do so
|
||||||
-- ------------------------------------------------
|
-- ------------------------------------------------
|
||||||
COE:FixSavedVariables();
|
COE:FixSavedVariables();
|
||||||
|
|
||||||
|
elseif ( event == "SPELLCAST_STOP" ) then
|
||||||
|
COE_TotemicRecallTimerResetCount = 0;
|
||||||
|
|
||||||
|
TotemicRecallTimerReset();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[ ----------------------------------------------------------------
|
||||||
|
Totemic Recall Reset Logic
|
||||||
|
|
||||||
|
This is very janky. The return values from GetSpellCooldown for
|
||||||
|
spell ID 35 (Totemic Recall) are very inconsistent. But if a
|
||||||
|
delay is introduced, then the next call seems valid. I suspect
|
||||||
|
this might break if something has a CD of 6 seconds.
|
||||||
|
-------------------------------------------------------------------]]
|
||||||
|
COE_TotemicRecallPreviousCDExpired = true;
|
||||||
|
-- Using counter to keep track of calls to reset
|
||||||
|
COE_TotemicRecallTimerResetCount = 0;
|
||||||
|
|
||||||
|
-- Local function to change variable with Chronos scheduler
|
||||||
|
function TotemicRecallEndCountdown()
|
||||||
|
COE_TotemicRecallPreviousCDExpired = true;
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemicRecallTimerReset()
|
||||||
|
|
||||||
|
-- Get totemic recall spell cooldown information
|
||||||
|
local TRstart, TRduration = GetSpellCooldown( COESTR_TOTEMICRECALLID, BOOKTYPE_SPELL );
|
||||||
|
COE:DebugMessage("Totemic Recall spell CD values: ".. TRstart ..", ".. TRduration);
|
||||||
|
|
||||||
|
-- The first GetSpellCooldown returns the wrong information and fires for any spell cast, regardless of spell ID
|
||||||
|
-- So this will set a quick timer to recall this method and get the right GetSpellCooldown info
|
||||||
|
if ( TRstart > 0 and COE_TotemicRecallPreviousCDExpired) then
|
||||||
|
|
||||||
|
-- No more than one call is necessary to check if the cooldown is actually Totemic Recall
|
||||||
|
if (TRduration < 6 and COE_TotemicRecallTimerResetCount < 1) then
|
||||||
|
Chronos.schedule(.25, TotemicRecallTimerReset);
|
||||||
|
COE_TotemicRecallTimerResetCount = COE_TotemicRecallTimerResetCount + 1;
|
||||||
|
|
||||||
|
elseif (TRduration == 6) then
|
||||||
|
COE_TotemicRecallPreviousCDExpired = false;
|
||||||
|
COE_TotemicRecallTimerResetCount = 0;
|
||||||
|
Chronos.schedule(6, TotemicRecallEndCountdown);
|
||||||
|
COE:DebugMessage("Totemic Recall initiating reset of timers.");
|
||||||
|
COE_Totem:ResetTimers();
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -107,7 +173,7 @@ end;
|
|||||||
-------------------------------------------------------------------]]
|
-------------------------------------------------------------------]]
|
||||||
function COE:DebugMessage( msg )
|
function COE:DebugMessage( msg )
|
||||||
if( COE.DebugMode ) then
|
if( COE.DebugMode ) then
|
||||||
DEFAULT_CHAT_FRAME:AddMessage( "[COE] " .. msg, 0.5, 0.5, 0.5 );
|
DEFAULT_CHAT_FRAME:AddMessage( "[COE] " .. msg, 1, 0, 0 );
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ COESTR_MAXAMOUNT = "to (%d*)";
|
|||||||
COESTR_TRINKET = "^.*%[Enamored Water Spirit%].*$";
|
COESTR_TRINKET = "^.*%[Enamored Water Spirit%].*$";
|
||||||
|
|
||||||
|
|
||||||
|
-- Spell Names and IDs
|
||||||
|
-- ----------------
|
||||||
|
COESTR_TOTEMICRECALL = "Totemic Recall";
|
||||||
|
COESTR_TOTEMICRECALLID = 35;
|
||||||
|
|
||||||
|
|
||||||
-- Totem Advisor
|
-- Totem Advisor
|
||||||
-- --------------
|
-- --------------
|
||||||
COESTR_POISON = "Poison";
|
COESTR_POISON = "Poison";
|
||||||
|
|||||||
Reference in New Issue
Block a user