fix(main): исправлены названия текстур

This commit is contained in:
ovc 2024-09-11 11:58:51 +03:00
parent fc8c55e1cc
commit 83aef914c9

View File

@ -1,33 +1,50 @@
function OBWT_OnLoad() local function getSlot(spellTexture)
this:RegisterEvent('PLAYER_ENTERING_WORLD') for i = 1, 120, 1 do
this:RegisterEvent('ADDON_LOADED') if GetActionTexture(i) ~= nil then
DEFAULT_CHAT_FRAME:AddMessage('One button warrior tanking. Type /obwt for usage.') print(GetActionTexture(i))
SlashCmdList['OBWT'] = function() if(strfind(GetActionTexture(i), spellTexture)) then return i end
local msg = 'To use OBWT addon, create a macro and type /script obwt();' end
DEFAULT_CHAT_FRAME:AddMessage(msg) end
end; return 0
SLASH_OBWT1 = '/obwt'
end end
function obwt() local function isUsable(spellTexture)
local rage = UnitMana('player') local usable, _ = IsUsableAction(getSlot(spellTexture))
local bloodthirst = 'Ability_Warrior_Bloodthirst' return usable
local revenge = 'Ability_Warrior_Revenge' end
local sunderArmor = 'Ability_Warrior_SunderArmor'
local rend = 'Ability_Warrior_Rend'
local battleShout = 'Ability_Warrior_BattleShout'
local heroicStrike = 'Ability_Warrior_HeroicStrike'
TargetNearestEnemy() local function debuffIndex(spellTexture)
for i = 1, 40 do
local texturePath = UnitDebuff('target', i)
if texturePath ~= nil and strfind(texturePath, spellTexture) then return i end
end
return 0
end
local function debuffStacks(spellTexture)
local _, stacks = UnitDebuff('target', debuffIndex(spellTexture))
if stacks == nill then return 0 else return stacks end
end
SLASH_OBWT1 = "/obwt"
SlashCmdList.OBWT = function(cmd)
local rage = UnitMana('player')
local bloodrage = 'Ability_Racial_BloodRage'
local revenge = 'Ability_Warrior_Revenge'
local sunderArmor = 'Ability_Warrior_Sunder'
local rend = 'Ability_Gouge'
local battleShout = 'Ability_Warrior_BattleShout'
local heroicStrike = 'Ability_Rogue_Ambush'
if UnitExists('target') and UnitCanAttack('player','target') then if UnitExists('target') and UnitCanAttack('player','target') then
AttackTarget() if (not PlayerFrame.inCombat) then AttackTarget() end
if rage < 15 == nil and isUsable(bloodthirst) then if rage < 15 and isUsable(bloodrage) then
CastSpellByName('Bloodthirst') CastSpellByName('Bloodrage')
elseif buffed('Battle Shout') == nil and isUsable(battleShout) then elseif buffed('Battle Shout') == nil and isUsable(battleShout) then
CastSpellByName('Battle Shout') CastSpellByName('Battle Shout')
elseif isUsable(revenge) then elseif isUsable(revenge) then
CastSpellByName('Revange') CastSpellByName('Revange')
elseif isUsable(sunderArmor) then elseif isUsable(sunderArmor) and debuffStacks(sunderArmor) < 5 then
CastSpellByName('Sunder Armor') CastSpellByName('Sunder Armor')
elseif rage > 50 and buffed('Rend', 'target') == nil and isUsable(rend) then elseif rage > 50 and buffed('Rend', 'target') == nil and isUsable(rend) then
CastSpellByName('Rend') CastSpellByName('Rend')
@ -35,17 +52,4 @@ function obwt()
CastSpellByName('Heroic Strike') CastSpellByName('Heroic Strike')
end end
end 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;