-- ForteXorcist v1.959.6 by Xus 01-04-2010
-- Module started by Destard/Stormstalker fixes by Caleb & Xus

if FW.CLASS == "HUNTER" then
	local FW = FW;
	local FWL = FW.L;
	local HT = FW:ClassModule("Hunter");
	
	if FW.Modules.Timer then
		-- istype: FW.DEFAULT FW.SHARED FW.UNIQUE FW.PET FW.CHARM FW.COOLDOWN FW.HEAL FW.BUFF
		--spell, hastarget, duration, isdot, istype, reducedinpvp, texture, stack
		-- DON'T SET ANYTHING WITH TRAVEL TIME TO DOT YET PLX
		
		FW:RegisterDrain(27022,	6); -- Volley
		
 		FW:RegisterSpell(1543,	0,20,0,FW.UNIQUE);-- Flare
		FW:RegisterSpell(781,	0,25,0,FW.UNIQUE);-- Disengage
			FW:RegisterSpellModGlph(781,	42904, 1, -5);-- Glyph of Serpent Sting
			FW:RegisterSpellModTlnt(781,	19286, 1, -2);-- Survival Tactics
			FW:RegisterSpellModTlnt(781,	19287, 2, -4);-- Survival Tactics
		
 		FW:RegisterSpell(53338,	1,300,0,FW.UNIQUE);-- Hunter's Mark
 		FW:RegisterSpell(14327,	1,020,0,FW.UNIQUE);-- Scare Beast
			FW:RegisterSpellModRank(14327, 	1, -10);
			FW:RegisterSpellModRank(14327, 	2, -5);
		FW:RegisterSpell(48990,	0,015,0,FW.PET);-- Mend Pet
		FW:RegisterSpell(6991,	0,010,0,FW.PET);-- Feed Pet
 		FW:RegisterSpell(49001,	1,015,1,FW.SHARED);-- Serpent Sting
			FW:RegisterSpecialRefresh(49001);
			FW:RegisterSpellModGlph(49001,	57009,	1, 6); -- Glyph of Serpent Sting
		FW:RegisterSpell(3034,	1,008,0,FW.SHARED); -- Viper Sting
		FW:RegisterSpell(52604,	1,020,0,FW.SHARED); -- Scorpid Sting
		FW:RegisterSpell(60053, 1,002,0,FW.DEFAULT);	-- Explosive Shot
			FW:RegisterTickSpeed(60053, FW.DEFAULT); -- set tick speed to 1 instead of 3
		FW:RegisterSpell(2974 , 1,010,0,FW.UNIQUE); -- Wing Clip
		FW:RegisterSpell(19503, 1,004,0,FW.UNIQUE); -- scatter shot
		FW:RegisterSpell(19386, 1,030,0,FW.UNIQUE);	-- wyvern sting			
		FW:RegisterSpell(34490, 1,003,0,FW.UNIQUE);	-- silencing shot
		FW:RegisterSpell(53548, 1,004,0,FW.PET);	-- pet pin
		FW:RegisterSpell(35102, 1,004,0,FW.UNIQUE);	-- concussive barrage
		FW:RegisterSpell(63672, 1,015,1,FW.DEFAULT);	-- black arrow
		FW:RegisterSpell(49050, 1,010,0,FW.DEFAULT);	-- Aimed Shot
		FW:RegisterSpell(53238, 1,000,1,FW.DEFAULT); -- Piercing Shots
			FW:RegisterTickSpeed(53238, 2); -- set tick speed to 2 instead of 3			
		
		--[[FW:RegisterCooldown(61006,015); -- Kill Shot
			FW:RegisterCooldownModGlph(61006,64304,	1, -6); -- Glyph of Kill Shot
		FW:RegisterCooldown(49050,010); -- Aimed Shot
			FW:RegisterCooldownModGlph(49050,56869,	1, -2); -- Glyph of Aimed Shot
		FW:RegisterCooldown(49048,010); -- Multi Shot
			FW:RegisterCooldownModGlph(49048,56882,	1, -1); -- Glyph of Multi Shot
		FW:RegisterCooldown(49045,006); -- Arcane Shot]]
		
			-- hunter buffs
		FW:RegisterBuff(38373); -- The Beast Within
		FW:RegisterBuff(36828); -- Rapid Fire
		FW:RegisterBuff(56453); -- Lock and Load
		FW:RegisterBuff(35099); -- Rapid Killing
		FW:RegisterBuff(40487); -- Deadly Aim
		FW:RegisterBuff(53271); -- Master's call
		FW:RegisterBuff(19263); -- Deterrence
		FW:RegisterBuff(34477); -- Misdirection
		FW:RegisterBuff(53304); -- Sniper Training
		FW:RegisterBuff(34501); -- Expose Weakness
		FW:RegisterBuff(34839); -- Master Tactician
		FW:RegisterBuff(64495); -- Furious Howl
		FW:RegisterBuff(70728); -- Exploit Weakness (t10)
		
		FW:RegisterSpell(13809,	0,030,0,FW.UNIQUE);-- Frost Trap
 		FW:RegisterSpell(34600,	0,030,0,FW.UNIQUE);-- Snake Trap
		--FW:RegisterSpell(49067,	0,020,0,FW.UNIQUE);-- Explosive Trap
		
 		FW:RegisterSpell(49065,	1,030,0,FW.UNIQUE);-- Explosive Trap Effect -- debuff on target
			FW:RegisterSpellRename(49067,49065); --trap which triggers debuff
		
		FW:RegisterSpell(49054, 1,030,0,FW.UNIQUE); -- Immolation Trap Effect -- debuff on target
			FW:RegisterSpellRename(52606,49054); --trap which triggers debuff
		FW:RegisterSpell(60210, 1,030,0,FW.UNIQUE); -- Freezing Arrow Effect -- debuff on target
			FW:RegisterSpellRename(60192,60210); --trap which triggers debuff
		FW:RegisterSpell(14309, 1,030,0,FW.UNIQUE); -- Freezing Trap Effect -- debuff on target
			FW:RegisterSpellRename(14311,14309); --trap which triggers debuff
			
		--debuffname,mine only
 		FW:RegisterDebuff(55041); -- Freezing Trap Effect
		FW:RegisterDebuff(60210); -- Freezing Arrow Effect
		FW:RegisterDebuff(53338); -- Hunter's Mark
		
		FW:RegisterMeleeBuffs();
		FW:RegisterCasterBuffs();
	end
	if FW.Modules.Cooldown then
		tinsert(FW.Masters,{"^"..FW:SpellName(52606)}); -- immolation trap
		tinsert(FW.Masters,{"^"..FW:SpellName(14311)}); -- freezing trap
		tinsert(FW.Masters,{"^"..FW:SpellName(49045)}); -- arcane shot
		tinsert(FW.Masters,{"^"..FW:SpellName(49050)}); -- aimed shot
		
		FW:RegisterMeleePowerupCooldowns();
		FW:RegisterCasterPowerupCooldowns();
		
		FW:RegisterHiddenCooldown(nil,56453,22); -- Lock and Load
		
		local readiness = FW:SpellName(23989);
		local bestial_wrath = FW:SpellName(19574);
		
		FW:RegisterOnCooldownUsed(function(s,d)
			if s == readiness then
				local i = 1; -- needs testing, but should work in theory
				while i<=FW.CD.rows do
					if FW.CD[i][6]==1 then -- FLAG_SPELL only
						local spell = FW.CD[i][1];
						if spell ~= readiness and spell ~= bestial_wrath then
							FW:CheckCooldown(spell,GetTime(),0,"",1);
						end
					end
					i=i+1;
				end
			end
		end);
	end
end