Hi all!
I am trying to edit an existing addon. This addon creates a frame with currently active Shaman Totems.
What I am trying to add is to reset the frame on a successful, instant spell cast. Spell is called "Totemic Recall" and costs 0 mana.
The addon does reset the frame upon event of player death. I was wondering if I could copy that outcome and paste it for a mentioned above spell cast? If yes, could You give me a hint on how to do it? Can i add it as a statement for the existing funtion below or do I need a new function and checker of some sort? I have one week of lua experience but trying to improve.
Here is the function with PLAYER_DEAD event:
Code:
function TotemTimers_OnEvent(event)
-- DEFAULT_CHAT_FRAME:AddMessage("Got Event:"..event);
local match = { };
if ( event == "VARIABLES_LOADED" ) then
TotemTimers_SetupVariables();
elseif ( event == "PLAYER_DEAD" ) then
--DEFAULT_CHAT_FRAME:AddMessage(TT_PLAYERDEATH);
data.duration = 0;
for num, totem in TTActiveTotems do
totem.active = nil;
end
TotemTimers_UpdateButtons();
elseif ( event == "PLAYER_ENTERING_WORLD" ) then
TotemTimers_SetupGlobals();
--TotemTimers_SetupHooks();
elseif ( event == "PLAYER_LEVEL_UP" ) then
--TotemTimers_AdjustTotemDurations(arg1);
elseif ( event == "SPELLCAST_STOP" ) then
if( TTState == 1 ) then
TotemTimers_CreateTotem();
end
TTState = 0;
--DEFAULT_CHAT_FRAME:AddMessage("[TT] Finished Cast");
--[[
elseif ( event == "CHAT_MSG_SPELL_SELF_BUFF" ) then
--TotemTimers_AdjustTotemDurations(UnitLevel("player"));
match = { string.gfind(arg1, TT_CAST_REGEX)() };
if ( table.getn( match ) >= 1 ) then
TotemTimers_CreateTotem(match);
end
]]--
elseif ( event == "CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE" or
event == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS" or
event == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE" or
event == "CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS" ) then
for num, regex in TT_DAMAGE_REGEX do
match = { string.gfind(arg1, regex)() };
if ( table.getn(match) >= 1 ) then
match[1] = TotemTimers_ProcessAlias(match[1]);
TotemTimers_TotemDamage(match[1], match[3]);
break;
end
end
end
end
And here is the full lua file:
https://github.com/MOUZU/TotemTimers...otemTimers.lua
I would be very greatful for any tips.
Thank You!