This commit is contained in:
Олег Цветков 2025-08-07 18:36:30 +03:00
parent 88aa521360
commit cd09e395a0

250
OBWT.lua
View File

@ -16,166 +16,200 @@ textures['Overpower'] = 'Ability_MeleeDamage'
textures['Whirlwind'] = 'Ability_Whirlwind' textures['Whirlwind'] = 'Ability_Whirlwind'
textures['Bloodthirst'] = 'Spell_Nature_BloodLust' textures['Bloodthirst'] = 'Spell_Nature_BloodLust'
textures['Berserker Rage'] = 'Spell_Nature_AncestralGuardian' textures['Berserker Rage'] = 'Spell_Nature_AncestralGuardian'
textures['Berserking'] = 'Racial_Troll_Berserk'
textures['Throw'] = 'Ability_Throw'
local function getTexture(spellName) local function getTexture(spellName)
if textures[spellName] ~= nil then if textures[spellName] ~= nil then
return textures[spellName] return textures[spellName]
end end
return false return false
end end
local function getSlot(spellTexture) local function getSlot(spellTexture)
for i = 1, 120, 1 do for i = 1, 120, 1 do
if GetActionTexture(i) ~= nil then if GetActionTexture(i) ~= nil then
-- print(GetActionTexture(i)) -- print(GetActionTexture(i))
if(strfind(GetActionTexture(i), spellTexture)) then return i end if (strfind(GetActionTexture(i), spellTexture)) then
end return i
end end
return 0 end
end
return 0
end end
local function isUsable(spellName) local function isUsable(spellName)
local spellTexture = getTexture(spellName) local spellTexture = getTexture(spellName)
if spellTexture then if spellTexture then
local slot = getSlot(spellTexture) local slot = getSlot(spellTexture)
local usable, _ = IsUsableAction(slot) local usable, _ = IsUsableAction(slot)
return usable return usable
else else
print(spellName) print(spellName)
return false return false
end end
end end
local function debuffIndex(spellTexture) local function debuffIndex(spellTexture)
for i = 1, 40 do for i = 1, 40 do
local texturePath = UnitDebuff('target', i) local texturePath = UnitDebuff('target', i)
if texturePath ~= nil and strfind(texturePath, spellTexture) then return i end if texturePath ~= nil and strfind(texturePath, spellTexture) then
end return i
return 0 end
end
return 0
end end
local function debuffStacks(spellName) local function debuffStacks(spellName)
local spellTexture = getTexture(spellName) local spellTexture = getTexture(spellName)
if spellTexture then if spellTexture then
local _, stacks = UnitDebuff('target', debuffIndex(spellTexture)) local _, stacks = UnitDebuff('target', debuffIndex(spellTexture))
if stacks == nill then return 0 else return stacks end if stacks == nill then
else return 0
print(spellName) else
return false return stacks
end end
else
print(spellName)
return false
end
end end
function onCooldown(spellName) function onCooldown(spellName)
local spellID = 1 local spellID = 1
local name, _ = GetSpellName(spellID, "BOOKTYPE_SPELL") local name, _ = GetSpellName(spellID, 'BOOKTYPE_SPELL')
while (name) do while (name) do
if spellName == name then if spellName == name then
if GetSpellCooldown(spellID, "BOOKTYPE_SPELL") == 0 then if GetSpellCooldown(spellID, 'BOOKTYPE_SPELL') == 0 then
return false return false
else else
return true return true
end end
end end
spellID = spellID + 1 spellID = spellID + 1
name, _ = GetSpellName(spellID, "BOOKTYPE_SPELL") name, _ = GetSpellName(spellID, 'BOOKTYPE_SPELL')
end end
end end
local function cast(spellName) local function cast(spellName)
CastSpellByName(spellName) CastSpellByName(spellName)
end end
local function panic() local function panic()
if isUsable('Last Stand') and not onCooldown('Last Stand') then if isUsable('Last Stand') and not onCooldown('Last Stand') then
cast('Last Stand') cast('Last Stand')
elseif isUsable('Shield Wall') and not onCooldown('Shield Wall') then elseif isUsable('Shield Wall') and not onCooldown('Shield Wall') then
cast('Shield Wall') cast('Shield Wall')
end end
end end
local function tank(cmd) local function tank(cmd)
local rage = UnitMana('player') local rage = UnitMana('player')
local health = UnitHealth('player') local health = UnitHealth('player')
if UnitExists('target') and UnitCanAttack('player','target') then if UnitExists('target') and UnitCanAttack('player', 'target') then
if (not PlayerFrame.inCombat) then AttackTarget() end if (not PlayerFrame.inCombat) then
AttackTarget()
end
if health < 400 then panic() end if health < 400 then
panic()
end
if isUsable('Bloodrage') and not onCooldown('Bloodrage') and rage < 30 then if isUsable('Bloodrage') and not onCooldown('Bloodrage') and rage < 30 then
cast('Bloodrage') cast('Bloodrage')
elseif isUsable('Battle Shout') and not buffed('Battle Shout') then elseif isUsable('Battle Shout') and not buffed('Battle Shout') then
cast('Battle Shout') cast('Battle Shout')
elseif isUsable('Shield Bash') and not onCooldown('Shield Bash') then elseif isUsable('Shield Bash') and not onCooldown('Shield Bash') then
cast('Shield Bash') cast('Shield Bash')
elseif isUsable('Shield Slam') and not onCooldown('Shield Slam') then elseif isUsable('Shield Slam') and not onCooldown('Shield Slam') then
cast('Shield Slam') cast('Shield Slam')
elseif isUsable('Shield Block') and not onCooldown('Shield Block') and not buffed('Shield Block') then elseif isUsable('Shield Block') and not onCooldown('Shield Block') and not buffed('Shield Block') then
cast('Shield Block') cast('Shield Block')
elseif isUsable('Revange') and not onCooldown('Revange') then elseif isUsable('Revange') and not onCooldown('Revange') then
cast('Revange') cast('Revange')
elseif isUsable('Sunder Armor') and debuffStacks('Sunder Armor') < 5 then elseif isUsable('Sunder Armor') and debuffStacks('Sunder Armor') < 5 then
cast('Sunder Armor') cast('Sunder Armor')
elseif isUsable('Demoralizing Shout') and not buffed('Demoralizing Shout', 'target') then elseif isUsable('Demoralizing Shout') and not buffed('Demoralizing Shout', 'target') then
cast('Demoralizing Shout') cast('Demoralizing Shout')
elseif isUsable('Rend') and not buffed('Rend', 'target') and rage > 80 then elseif isUsable('Rend') and not buffed('Rend', 'target') and rage > 80 then
cast('Rend') cast('Rend')
elseif isUsable('Heroic Strike') and rage > 80 then elseif isUsable('Heroic Strike') and rage > 80 then
cast('Heroic Strike') cast('Heroic Strike')
end end
end end
end end
local function dps(cmd) local function dps(cmd)
local rage = UnitMana('player') local rage = UnitMana('player')
local health = UnitHealth('player') local health = UnitHealth('player')
if UnitExists('target') and UnitCanAttack('player','target') then if UnitExists('target') and UnitCanAttack('player', 'target') then
if (not PlayerFrame.inCombat) then AttackTarget() end if (not PlayerFrame.inCombat) then
AttackTarget()
end
if health < 400 then panic() end if health < 400 then
panic()
end
if isUsable('Bloodrage') and not onCooldown('Bloodrage') and rage < 30 then if isUsable('Bloodrage') and not onCooldown('Bloodrage') and rage < 30 then
cast('Bloodrage') cast('Bloodrage')
elseif isUsable('Execute') and not onCooldown('Execute') and rage > 30 then elseif isUsable('Execute') and not onCooldown('Execute') and rage > 30 then
cast('Execute') cast('Execute')
elseif isUsable('Berserker Rage') and not onCooldown('Berserker Rage') then elseif isUsable('Berserker Rage') and not onCooldown('Berserker Rage') then
cast('Berserker Rage') cast('Berserker Rage')
elseif isUsable('Battle Shout') and not buffed('Battle Shout') then elseif isUsable('Battle Shout') and not buffed('Battle Shout') then
cast('Battle Shout') cast('Battle Shout')
elseif isUsable('Sunder Armor') and debuffStacks('Sunder Armor') < 5 then
elseif isUsable('Sunder Armor') and debuffStacks('Sunder Armor') < 5 then cast('Sunder Armor')
cast('Sunder Armor')
elseif isUsable('Bloodthirst') and not onCooldown('Bloodthirst') then elseif isUsable('Bloodthirst') and not onCooldown('Bloodthirst') then
cast('Bloodthirst') cast('Bloodthirst')
elseif isUsable('Whirlwind') and not onCooldown('Whirlwind') then elseif isUsable('Whirlwind') and not onCooldown('Whirlwind') then
cast('Whirlwind') cast('Whirlwind')
elseif isUsable('Heroic Strike') and rage > 80 then elseif isUsable('Heroic Strike') and rage > 80 then
cast('Heroic Strike') cast('Heroic Strike')
end end
end end
end
local function throw(cmd)
local rage = UnitMana('player')
local health = UnitHealth('player')
if GetUnitName('target') == nil then
TargetNearestEnemy()
end
if GetUnitName('target') ~= nil and CheckInteractDistance('target', 4) == 1 and CheckInteractDistance('target', 1) ==
nil then
cast("Throw")
else
ClearTarget();
end
end end
function OBWT_OnLoad() function OBWT_OnLoad()
SlashCmdList["OBWT"] = tank SlashCmdList['OBWT'] = tank
SlashCmdList["OBWF"] = dps SlashCmdList['OBWF'] = dps
SLASH_OBWT1 = "/obwt" SlashCmdList['HYPE'] = throw
SLASH_OBWF1 = "/obwf" SLASH_OBWT1 = '/obwt'
end SLASH_OBWF1 = '/obwf'
SLASH_HYPE1 = '/obw_throw'
end