51 lines
1.6 KiB
Lua
51 lines
1.6 KiB
Lua
function OBWT_OnLoad()
|
|
this:RegisterEvent('PLAYER_ENTERING_WORLD')
|
|
this:RegisterEvent('ADDON_LOADED')
|
|
DEFAULT_CHAT_FRAME:AddMessage('One button warrior tanking. Type /obwt for usage.')
|
|
SlashCmdList['OBWT'] = function()
|
|
local msg = 'To use OBWT addon, create a macro and type /script obwt();'
|
|
DEFAULT_CHAT_FRAME:AddMessage(msg)
|
|
end;
|
|
SLASH_OBWT1 = '/obwt'
|
|
end
|
|
|
|
function obwt()
|
|
local rage = UnitMana('player')
|
|
local bloodthirst = 'Ability_Warrior_Bloodthirst'
|
|
local revenge = 'Ability_Warrior_Revenge'
|
|
local sunderArmor = 'Ability_Warrior_SunderArmor'
|
|
local rend = 'Ability_Warrior_Rend'
|
|
local battleShout = 'Ability_Warrior_BattleShout'
|
|
local heroicStrike = 'Ability_Warrior_HeroicStrike'
|
|
|
|
TargetNearestEnemy()
|
|
if UnitExists('target') and UnitCanAttack('player','target') then
|
|
AttackTarget()
|
|
if rage < 15 == nil and isUsable(bloodthirst) then
|
|
CastSpellByName('Bloodthirst')
|
|
elseif buffed('Battle Shout') == nil and isUsable(battleShout) then
|
|
CastSpellByName('Battle Shout')
|
|
elseif isUsable(revenge) then
|
|
CastSpellByName('Revange')
|
|
elseif isUsable(sunderArmor) then
|
|
CastSpellByName('Sunder Armor')
|
|
elseif rage > 50 and buffed('Rend', 'target') == nil and isUsable(rend) then
|
|
CastSpellByName('Rend')
|
|
elseif rage > 70 and isUsable(heroicStrike) then
|
|
CastSpellByName('Heroic Strike')
|
|
end
|
|
end
|
|
|
|
local function isUsable(spellTexture)
|
|
return IsUsableAction(getSlot(spellTexture))
|
|
end
|
|
|
|
local function getSlot(spellTexture)
|
|
for i = 1, 120, 1
|
|
do
|
|
if(GetActionTexture(i) ~= nil) then
|
|
if(strfind(GetActionTexture(i), spellTexture)) then return i end
|
|
end
|
|
end
|
|
return 0
|
|
end; |