All pastes #32090 Raw Edit

Untitled

public text v1 · immutable
#32090 ·published 2005-12-02 10:15 UTC
rendered paste body
---------------------------------------------------------------------------------
--	Variables
---------------------------------------------------------------------------------
inkDot_Chromaggus_SpellTypes = {
									["Frostbolt"] = 2000,

									["Fireball"] = 3000,
									["Fire Blast"] = 700,

									["Instant Poison VI"] = 400,
									["Serpent Sting"] = 300,

									["Shadow Bolt"] = 2000,

									["Arcane Missiles"] = 700,
									["Arcane Shot"] = 1000,
							   };

local hasLoadedVars;

lastWeakness = "Unknown";
lapseCount = 0;
chromTarget = "Unknown";
---------------------------------------------------------------------------------
--	Main Functions
---------------------------------------------------------------------------------

function inkDot_Chromaggus_OnEvent(event)
	local mobName = UnitName("target");

	if ( mobName == "Chromaggus" ) then
		local mobHealth = UnitHealth("target");

		if ( mobHealth == 100 or ( mobHealth > 90 and lapseCount > 2 ) ) then
			lapseCount = 0;
			chromTarget = "Unknown";
		end
	end

	if ( event == "VARIABLES_LOADED" ) then
		hasLoadedVars = 1;
	elseif ( event == "CHAT_MSG_MONSTER_EMOTE" and arg1 == "flinches as its skin shimmers." ) then
		CT_RABoss_Announce("** Resists have changed **", 1);
	elseif ( event == "CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE" and mobName == "Chromaggus" ) then
		local iStart, iEnd, sPlayer, sSpell, sType, sTarget, sDamage, sTreeType = string.find( arg1, inkDot_SpellDamage );

		if ( sPlayer ~= nil and sSpell ~= nil and sDamage ~= nil ) then
			for k1, v1 in inkDot_Chromaggus_SpellTypes do
					if ( k1 == sSpell and tonumber( sDamage ) > v1 ) then
						if ( lastWeakness ~= sTreeType ) then
							SendChatMessage( "*** WEAKNESS: " .. sTreeType, "RAID" );

							lastWeakness = sTreeType;
						end
					end
			end
		end
	elseif ( event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE" and arg1 == "Chromaggus begins to cast Time Lapse." ) then
		lapseCount = lapseCount + 1;

		SendChatMessage( "*** Lapse count: " .. lapseCount, "OFFICER" );
	end
end

function inkDot_Chromaggus_OnUpdate(elapsed)
	local mobName = UnitName("target");

	if ( mobName == "Chromaggus" ) then
		local tarName = UnitName("targettarget");

		if ( tarName ~= nil and tarName ~= chromTarget ) then
			SendChatMessage( "Chromaggus has targetted: " .. tarName, "RAID" );
			chromTarget = tarName;
		end
	end
end