Thread Tools Display Modes
06-04-23, 04:24 PM   #1
Paradigm
A Kobold Labourer
Join Date: Jun 2023
Posts: 1
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!

Last edited by Paradigm : 06-05-23 at 03:05 AM.
  Reply With Quote
06-05-23, 04:18 AM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Registering instant spell cast event


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off