WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Registering instant spell cast event (https://www.wowinterface.com/forums/showthread.php?t=59604)

Paradigm 06-04-23 04:24 PM

Registering instant spell cast event
 
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!

Kanegasi 06-05-23 04:18 AM

That addon was written for a very old version of WoW and will not work in Wrath Classic, you'll have to do more changes than the recall addition to make it work. Shaman did not have a totem recall option in vanilla Classic.

If you are using this addon in a private server, this website will not help you.


All times are GMT -6. The time now is 10:00 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI