All pastes #87289 Raw Edit

Stuff

public text v1 · immutable
·published 2006-07-13 20:55 UTC
rendered paste body
--
-- La Vendetta Instructor Razuvious Raid Warning AddOn
-- (c) by Nitram from La Vendetta on DE-Azshara
--
-- DE-INFO:
-- Damit dieses Addon Funktioniert muss beim Pull ein PET oder 
-- ein Spieler in Sichtlinie zu dem Instructor sein und den
-- Disrupting Shout abbekommen. (einmalig)
-- Dieses Addon gibt den Manaklassen die Möglichkeit ähnlich wie
-- bei Chromagus aus Sicht zu laufen und damit zu überleben.
--
-- EN-INFO:
-- To get this Addon working, a Pet or Player needs to be in 
-- Line of Side to the Instructor and afflicted by his spell
-- Disruptiog Shout. (one Time)
-- This Addon allows the Mana Classes to be in LOS to the 
-- Inspector and running out at the right Time like Chromagus.
--

IR_Options = {
	["Version"] = "1.1",
	["Enabled"] = true,
	["Lastshout"] = 0;
	["OnLoop"] = false;
}

if (GetLocale() == "enGB") or (GetLocale() == "enUS") then
	IR_SPELL_1 = "Disrupting Shout"; 
end

IR_Events = {
	"CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE",		-- Disrupting Shout on YOU
	"CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE",		-- on Party
	"CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE",		-- on Raid / Pet
	"PLAYER_REGEN_ENABLED",					-- Automatik Stop the LOOP
}

function IR_OnLoad()
	SLASH_LVINSTRUCTORRAZUVIOUS1 = "/ir";
	SLASH_LVINSTRUCTORRAZUVIOUS2 = "/instructor";
	SlashCmdList["LVINSTRUCTORRAZUVIOUS"] = IR_SlashCmd;

	if (IR_Options.Enabled) then
		IR_Register();
	end
	
	IR_AddMsg("Instructor Razuvious AddOn v"..IR_Options.Version.." by La Vendetta|Nitram @ EU-Azshara");
	IR_AddMsg("/ir on|off");
end


function IR_SlashCmd(msg)
	if (string.lower(msg) == "on") then
		IR_Register();
		IR_Options.Enabled = true;
		IR_AddMsg("raid warning enabled!");
	elseif (string.lower(msg) == "off") then
		IR_Unregister();
		IR_Options.Enabled = false;
		IR_AddMsg("raid warning disabled!");

	elseif (string.lower(msg) == "stop") then
		CT_RABoss_UnSchedule("IR_OnEvent", "StartNewDShoutTimer");
		CT_RABoss_UnSchedule("IR_OnEvent", "DShout10SecWarning");
		CT_RABoss_UnSchedule("IR_OnEvent", "DShout5SecWarning");
		CT_RABoss_UnSchedule("IR_OnEvent", "DShout3SecWarning");
		IR_Options.OnLoop = false;
		IR_AddMsg("Loop Stopped!");

	else
		IR_AddMsg("AddOn v"..IR_Options.Version.." by La Vendetta|Nitram @ EU-Azshara");
		IR_AddMsg("/ir on|off");	
		IR_AddMsg("/ir stop - Stops the Loop");	
	end
end


function IR_OnEvent(event)
	if (IR_Options.Enabled) then
		if ( event == "PLAYER_REGEN_ENABLED" and IR_Options.OnLoop ) then
			IR_SlashCmd("stop");
		end

		if ( event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE" or 				
		     event == "CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE" or
		     event == "CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE" ) then

			if( string.find(arg1, IR_SPELL_1) )then
				if( IR_Options.Lastshout > 0 and math.floor(time() - IR_Options.Lastshout) > 0 ) then

					SendChatMessage("*** TIMER UPDATE DONE ***", "RAID");		-- To see that the Loop is Sync to the Shout

					IR_AddMsg("Time since last D-Shout : ".. (time() - IR_Options.Lastshout) );
					IR_OnEvent("StartNewDShoutTimer");
					IR_Options.Lastshout = time();
				else
					IR_OnEvent("StartNewDShoutTimer");
					IR_Options.Lastshout = time();
				end
			end
		end

		if (event == "StartNewDShoutTimer") then
			if( math.floor(time() - IR_Options.Lastshout) < 2 ) then return true; end	-- Don't need Spam

			CT_RABoss_UnSchedule("IR_OnEvent", "StartNewDShoutTimer");			-- Don't need the Loop

			CT_RABoss_UnSchedule("IR_OnEvent", "DShout10SecWarning");			-- Don't need Warnings anymore
			CT_RABoss_UnSchedule("IR_OnEvent", "DShout5SecWarning");
			CT_RABoss_UnSchedule("IR_OnEvent", "DShout3SecWarning");

			SendChatMessage("*** Disrupting Shout in 25 Sek ***", "RAID_WARNING");		-- Callout Warning

			CT_RABoss_Schedule("IR_OnEvent", 15, "DShout10SecWarning");			-- Shedule Warnings
			CT_RABoss_Schedule("IR_OnEvent", 20, "DShout5SecWarning");
			CT_RABoss_Schedule("IR_OnEvent", 22, "DShout3SecWarning");

			IR_Options.OnLoop = true;

		elseif (event == "DShout10SecWarning") then
			SendChatMessage("*** Disrupting Shout in 10 Sek ***", "RAID_WARNING");

		elseif (event == "DShout5SecWarning") then
			SendChatMessage("*** Disrupting Shout in 5 Sek ***", "RAID_WARNING");

		elseif (event == "DShout3SecWarning") then
			SendChatMessage("*** Disrupting Shout in 3 Sek ***", "RAID_WARNING");

			CT_RABoss_Schedule("IR_OnEvent", 4, "StartNewDShoutTimer");			-- Shedule Loop
		end
	end
end

function IR_Register(event)
	for index, value in IR_Events do
		LVInstructor:RegisterEvent(value);
	end	
end

function IR_Unregister(event)
	for index, value in IR_Events do
		LVInstructor:UnregisterEvent(value);
	end
end

function IR_AddMsg(msg)
	if (DEFAULT_CHAT_FRAME) then
		DEFAULT_CHAT_FRAME:AddMessage("[Instructor Razuvious]: "..msg, 0.0, 0.8, 0.0, 0.3);
	end	
end