Fixes #4 - missing totems

Added formatter file, removed whitespaces, fixed issue with tremor totem missing.
This commit is contained in:
MDGitHubRepo
2024-12-08 22:35:22 -05:00
parent f68fb493a4
commit 3076660609
3 changed files with 824 additions and 799 deletions
+7
View File
@@ -0,0 +1,7 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"[lua]": {
"editor.defaultFormatter": "Koihik.vscode-lua-format"
}
}
+548 -516
View File
File diff suppressed because it is too large Load Diff
+143 -157
View File
@@ -5,11 +5,7 @@
by Wyverex (2006) by Wyverex (2006)
]] ]] if (not COE) then COE = {}; end
if( not COE ) then
COE = {};
end
COE_VERSION = 2.6 COE_VERSION = 2.6
@@ -40,7 +36,6 @@ COE["EventPrintMode"] = false;
COE["UpdateInterval"] = 0.1; COE["UpdateInterval"] = 0.1;
COE["ForceUpdate"] = COE.UpdateInterval * 2; COE["ForceUpdate"] = COE.UpdateInterval * 2;
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
The AdvisorInterval controls how often the party/raid is The AdvisorInterval controls how often the party/raid is
scanned for debuffs that are curable by totems scanned for debuffs that are curable by totems
@@ -50,33 +45,32 @@ COE["ForceUpdate"] = COE.UpdateInterval * 2;
COE["AdvisorInterval"] = 1; COE["AdvisorInterval"] = 1;
COE["AdvisorWarningInterval"] = 7; COE["AdvisorWarningInterval"] = 7;
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
METHOD: COE:Init METHOD: COE:Init
PURPOSE: Loads submodules and initializes data PURPOSE: Loads submodules and initializes data
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:Init() function COE:Init()
COE:Message( "Call of Elements v" .. COE_VERSION ); COE:Message("Call of Elements v" .. COE_VERSION);
-- load only for shamans -- load only for shamans
-- ---------------------- -- ----------------------
local _, EnglishClass = UnitClass( "player" ); local _, EnglishClass = UnitClass("player");
if( EnglishClass ~= "SHAMAN" ) then if (EnglishClass ~= "SHAMAN") then
COE:Message( COESTR_NOTASHAMAN ); COE:Message(COESTR_NOTASHAMAN);
COE.Initialized = false; COE.Initialized = false;
else else
COE.Initialized = true; COE.Initialized = true;
this:RegisterEvent( "VARIABLES_LOADED" ); this:RegisterEvent("VARIABLES_LOADED");
this:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF"); this:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF");
-- register shell command -- register shell command
-- ----------------------- -- -----------------------
SlashCmdList["COE"] = COEProcessShellCommand; SlashCmdList["COE"] = COEProcessShellCommand;
SLASH_COE1="/coe"; SLASH_COE1 = "/coe";
end end
end end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
@@ -85,15 +79,15 @@ end
PURPOSE: Utility function that can provide spell ID from name. PURPOSE: Utility function that can provide spell ID from name.
Run in client chat with '/script COE:FindSpellName("a_spell_name")'. Run in client chat with '/script COE:FindSpellName("a_spell_name")'.
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:FindSpellId(spellNameTarget) function COE:FindSpellId(spellNameTarget)
local spellName; local spellName;
for i = 1, 1000 do for i = 1, 1000 do
spellName = GetSpellName(i, BOOKTYPE_SPELL); spellName = GetSpellName(i, BOOKTYPE_SPELL);
if (spellName == spellNameTarget) then if (spellName == spellNameTarget) then
print(spellName .. "is id: " .. i); print(spellName .. "is id: " .. i);
end end
end end
end end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
@@ -101,23 +95,23 @@ end
PURPOSE: Handles frame events PURPOSE: Handles frame events
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:OnEvent( event ) function COE:OnEvent(event)
if( event == "VARIABLES_LOADED" ) then if (event == "VARIABLES_LOADED") then
-- 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 == "CHAT_MSG_SPELL_SELF_BUFF") then elseif (event == "CHAT_MSG_SPELL_SELF_BUFF") then
if (string.find(arg1, "Mana from Totemic Recall")) then if (string.find(arg1, "Mana from Totemic Recall")) then
COE:DebugMessage("Totemic Recall initiating reset of timers."); COE:DebugMessage("Totemic Recall initiating reset of timers.");
COE_Totem:ResetTimers(); COE_Totem:ResetTimers();
end end
elseif (COE.EventPrintMode) then elseif (COE.EventPrintMode) then
COE:DebugMessage(event); COE:DebugMessage(event);
end end
end end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
@@ -125,10 +119,9 @@ end
PURPOSE: Adds a message to the default chat frame PURPOSE: Adds a message to the default chat frame
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:Message( msg ) function COE:Message(msg)
DEFAULT_CHAT_FRAME:AddMessage( "[COE] " .. msg, 0.93, 0.83, 0.45 ); DEFAULT_CHAT_FRAME:AddMessage("[COE] " .. msg, 0.93, 0.83, 0.45);
end; end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
METHOD: COE:DebugMessage METHOD: COE:DebugMessage
@@ -136,12 +129,11 @@ end;
PURPOSE: Adds a debug message to the default chat frame if PURPOSE: Adds a debug message to the default chat frame if
debug mode is enabled debug mode is enabled
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:DebugMessage( msg ) function COE:DebugMessage(msg)
if( COE.DebugMode ) then if (COE.DebugMode) then
DEFAULT_CHAT_FRAME:AddMessage( "[COE] " .. msg, 1, 0, 0 ); DEFAULT_CHAT_FRAME:AddMessage("[COE] " .. msg, 1, 0, 0);
end end
end; end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
METHOD: COE:Notification METHOD: COE:Notification
@@ -149,28 +141,27 @@ end;
PURPOSE: Adds a message to the error frame in the upper PURPOSE: Adds a message to the error frame in the upper
screen center screen center
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:Notification( msg, color ) function COE:Notification(msg, color)
local col; local col;
-- choose color -- choose color
-- ------------- -- -------------
if( color == COECOL_TOTEMWARNING ) then if (color == COECOL_TOTEMWARNING) then
col = { r = 0, g = 0.6, b = 1 }; col = {r = 0, g = 0.6, b = 1};
elseif( color == COECOL_TOTEMDESTROYED ) then elseif (color == COECOL_TOTEMDESTROYED) then
col = { r = 1, g = 0.4, b = 0 }; col = {r = 1, g = 0.4, b = 0};
elseif( color == COECOL_TOTEMCLEANSING ) then elseif (color == COECOL_TOTEMCLEANSING) then
col = { r = 0, g = 1, b = 0.4 }; col = {r = 0, g = 1, b = 0.4};
else else
col = { r = 1, g = 1, b = 1 }; col = {r = 1, g = 1, b = 1};
end end
-- add message -- add message
-- ------------ -- ------------
UIErrorsFrame:AddMessage( msg, col.r, col.g, col.b, 1.0, UIERRORS_HOLD_TIME ); UIErrorsFrame:AddMessage(msg, col.r, col.g, col.b, 1.0, UIERRORS_HOLD_TIME);
end;
end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
METHOD: COE:ToggleConfigFrame METHOD: COE:ToggleConfigFrame
@@ -179,74 +170,70 @@ end;
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:ToggleConfigFrame() function COE:ToggleConfigFrame()
if( COE_ConfigFrame:IsVisible() ) then if (COE_ConfigFrame:IsVisible()) then
COE_Config:CloseDialog() COE_Config:CloseDialog()
else else
COE_ConfigFrame:Show(); COE_ConfigFrame:Show();
end end
PlaySound( "igMainMenuOption" ); PlaySound("igMainMenuOption");
end end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
METHOD: COEProcessShellCommand METHOD: COEProcessShellCommand
PURPOSE: Executes the entered shell command PURPOSE: Executes the entered shell command
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COEProcessShellCommand( msg ) function COEProcessShellCommand(msg)
if( msg == "" or msg == "config" ) then if (msg == "" or msg == "config") then
COE:ToggleConfigFrame(); COE:ToggleConfigFrame();
elseif( msg == "list" ) then elseif (msg == "list") then
COE:DisplayShellCommands(); COE:DisplayShellCommands();
elseif( msg == "nextset" ) then elseif (msg == "nextset") then
COE_Totem:SwitchToNextSet(); COE_Totem:SwitchToNextSet();
elseif( msg == "priorset" ) then elseif (msg == "priorset") then
COE_Totem:SwitchToPriorSet(); COE_Totem:SwitchToPriorSet();
elseif( msg == "throwset" ) then elseif (msg == "throwset") then
COE_Totem:ThrowSet(); COE_Totem:ThrowSet();
elseif( msg == "restartset" ) then elseif (msg == "restartset") then
COE_Totem:ResetSetCycle(); COE_Totem:ResetSetCycle();
elseif( msg == "reset" ) then elseif (msg == "reset") then
COE_Totem:ResetTimers(); COE_Totem:ResetTimers();
elseif( msg == "reload" ) then elseif (msg == "reload") then
COE_Totem:Rescan(); COE_Totem:Rescan();
elseif( msg == "resetframes" ) then elseif (msg == "resetframes") then
COE_Totem:ResetFrames(); COE_Totem:ResetFrames();
elseif( msg == "advised" ) then elseif (msg == "advised") then
COE_Totem:ThrowAdvisedTotem(); COE_Totem:ThrowAdvisedTotem();
elseif( msg == "resetordering" ) then elseif (msg == "resetordering") then
COE_DisplayedTotems = {}; COE_DisplayedTotems = {};
COE_Totem:Rescan(); COE_Totem:Rescan();
elseif( msg == "bestheal" ) then elseif (msg == "bestheal") then
COE_Heal:BestHeal(); COE_Heal:BestHeal();
elseif( msg == "battleheal" ) then elseif (msg == "battleheal") then
COE_Heal:BattleHeal(); COE_Heal:BattleHeal();
else else
local _,_,arg = string.find( msg, "set (.*)" ); local _, _, arg = string.find(msg, "set (.*)");
if( arg ) then if (arg) then COE_Totem:SwitchToSet(arg); end
COE_Totem:SwitchToSet( arg ); end
end
end
end end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
METHOD: COE:DisplayShellCommands METHOD: COE:DisplayShellCommands
@@ -254,24 +241,23 @@ end
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:DisplayShellCommands() function COE:DisplayShellCommands()
COE:Message( COESHELL_INTRO ); COE:Message(COESHELL_INTRO);
COE:Message( COESHELL_CONFIG ); COE:Message(COESHELL_CONFIG);
COE:Message( COESHELL_LIST ); COE:Message(COESHELL_LIST);
COE:Message( COESHELL_NEXTSET ); COE:Message(COESHELL_NEXTSET);
COE:Message( COESHELL_PRIORSET ); COE:Message(COESHELL_PRIORSET);
COE:Message( COESHELL_SET ); COE:Message(COESHELL_SET);
COE:Message( COESHELL_RESTARTSET ); COE:Message(COESHELL_RESTARTSET);
COE:Message( COESHELL_RESET ); COE:Message(COESHELL_RESET);
COE:Message( COESHELL_RESETFRAMES ); COE:Message(COESHELL_RESETFRAMES);
COE:Message( COESHELL_RESETORDERING ); COE:Message(COESHELL_RESETORDERING);
COE:Message( COESHELL_RELOAD ); COE:Message(COESHELL_RELOAD);
COE:Message( COESHELL_MACRONOTE ); COE:Message(COESHELL_MACRONOTE);
COE:Message( COESHELL_THROWSET ); COE:Message(COESHELL_THROWSET);
COE:Message( COESHELL_ADVISED ); COE:Message(COESHELL_ADVISED);
end end
--[[ ---------------------------------------------------------------- --[[ ----------------------------------------------------------------
METHOD: COE:FixSavedVariables METHOD: COE:FixSavedVariables
@@ -281,39 +267,39 @@ end
-------------------------------------------------------------------]] -------------------------------------------------------------------]]
function COE:FixSavedVariables() function COE:FixSavedVariables()
-- is the version stored in the saved variables? -- is the version stored in the saved variables?
-- ---------------------------------------------- -- ----------------------------------------------
if( not COE_Config:GetSaved( COEOPT_VERSION ) ) then if (not COE_Config:GetSaved(COEOPT_VERSION)) then
-- this is version <= v1.6 -- this is version <= v1.6
-- ------------------------ -- ------------------------
COE_Config:SetOption( COEOPT_VERSION, 1.6 ); COE_Config:SetOption(COEOPT_VERSION, 1.6);
end end
local version = COE_Config:GetSaved( COEOPT_VERSION ); local version = COE_Config:GetSaved(COEOPT_VERSION);
if( version == 1.6 ) then if (version == 1.6) then
-- fix localized cast order in 1.7 -- fix localized cast order in 1.7
-- -------------------------------- -- --------------------------------
COE:Fix_CastOrderLocalization(); COE:Fix_CastOrderLocalization();
COE:Message( COESTR_UDATEDSAVED .. "1.7" ); COE:Message(COESTR_UDATEDSAVED .. "1.7");
COE_Config:SetOption( COEOPT_VERSION, 1.7 ); COE_Config:SetOption(COEOPT_VERSION, 1.7);
version = COE_Config:GetSaved( COEOPT_VERSION ); version = COE_Config:GetSaved(COEOPT_VERSION);
end end
if( version == 1.7 ) then if (version == 1.7) then
-- fix cast order again to due to a typo -- fix cast order again to due to a typo
-- -------------------------------------- -- --------------------------------------
COE:Fix_CastOrderLocalization(); COE:Fix_CastOrderLocalization();
COE:Message( COESTR_UDATEDSAVED .. "1.8" ); COE:Message(COESTR_UDATEDSAVED .. "1.8");
COE_Config:SetOption( COEOPT_VERSION, 1.8 ); COE_Config:SetOption(COEOPT_VERSION, 1.8);
version = COE_Config:GetSaved( COEOPT_VERSION ); version = COE_Config:GetSaved(COEOPT_VERSION);
end end
-- fix totem set element strings -- fix totem set element strings
-- ------------------------------ -- ------------------------------
COE:Fix_CastOrderLocalization2(); COE:Fix_CastOrderLocalization2();
COE_Config:SetOption( COEOPT_VERSION, 2.1 ); COE_Config:SetOption(COEOPT_VERSION, 2.1);
end end