1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
|
function KLHTM_Sunder()
if UnitClass("player") ~= "Warrior" then
return
end
-- 1) Check if the old position is fine
if GetSpellName(KLHTM_SpellBookSunderIndex, "spell") ~= "Sunder Armor" then
-- get spell number of spells
local spelltabs = GetNumSpellTabs()
local numspells = 0
local i; local temp
for i = 1, spelltabs do
_, _, _, temp = GetSpellTabInfo(i)
numspells = numspells + temp
end
-- 2) locate sunder armor in the spell book
for i = 1, numspells do
if GetSpellName(KLHTM_SpellBookSunderIndex + i, "spell") == "Sunder Armor" then
KLHTM_SpellBookSunderIndex = KLHTM_SpellBookSunderIndex + i
break
elseif i == numspells then
return -- can't find sunder
end
end
end
-- Now we've found sunder. Check the cooldown
if GetSpellCooldown(KLHTM_SpellBookSunderIndex, "spell") == 0 then
-- Cast
CastSpellByName("Sunder Armor()")
KLHTM_SubmitSunderCast()
end
end
|