Обновить OBWT.lua

This commit is contained in:
Олег Цветков 2025-08-05 10:31:43 -04:00
parent 34c07a37f9
commit 2aab6de0a8

188
OBWT.lua
View File

@ -1,3 +1,29 @@
local textures = {}
textures['Bloodrage'] = 'Ability_Racial_BloodRage'
textures['Battle Shout'] = 'Ability_Warrior_BattleShout'
textures['Shield Bash'] = 'Ability_Warrior_ShieldBash'
textures['Shield Block'] = 'Ability_Defend'
textures['Revange'] = 'Ability_Warrior_Revenge'
textures['Sunder Armor'] = 'Ability_Warrior_Sunder'
textures['Demoralizing Shout'] = 'Ability_Warrior_WarCry'
textures['Rend'] = 'Ability_Gouge'
textures['Heroic Strike'] = 'Ability_Rogue_Ambush'
textures['Shield Slam'] = 'INV_Shield_05'
textures['Last Stand'] = 'Spell_Holy_AshesToAshes'
textures['Shield Wall'] = 'Ability_Warrior_ShieldWall'
textures['Execute'] = 'INV_Sword_48'
textures['Overpower'] = 'Ability_MeleeDamage'
textures['Whirlwind'] = 'Ability_Whirlwind'
textures['Bloodthirst'] = 'Spell_Nature_BloodLust'
textures['Berserker Rage'] = 'Spell_Nature_AncestralGuardian'
local function getTexture(spellName)
if textures[spellName] ~= nil then
return textures[spellName]
end
return false
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
@ -8,9 +34,16 @@ local function getSlot(spellTexture)
return 0 return 0
end end
local function isUsable(spellTexture) local function isUsable(spellName)
local usable, _ = IsUsableAction(getSlot(spellTexture)) local spellTexture = getTexture(spellName)
return usable if spellTexture then
local slot = getSlot(spellTexture)
local usable, _ = IsUsableAction(slot)
return usable
else
print(spellName)
return false
end
end end
local function debuffIndex(spellTexture) local function debuffIndex(spellTexture)
@ -21,69 +54,120 @@ local function debuffIndex(spellTexture)
return 0 return 0
end end
local function debuffStacks(spellTexture) local function debuffStacks(spellName)
local _, stacks = UnitDebuff('target', debuffIndex(spellTexture)) local spellTexture = getTexture(spellName)
if stacks == nill then return 0 else return stacks end if spellTexture then
local _, stacks = UnitDebuff('target', debuffIndex(spellTexture))
if stacks == nill then return 0 else return stacks end
else
print(spellName)
return false
end
end
function onCooldown(spellName)
local spellID = 1
local name, _ = GetSpellName(spellID, "BOOKTYPE_SPELL")
while (name) do
if spellName == name then
if GetSpellCooldown(spellID, "BOOKTYPE_SPELL") == 0 then
return false
else
return true
end
end
spellID = spellID + 1
name, _ = GetSpellName(spellID, "BOOKTYPE_SPELL")
end
end
local function cast(spellName)
CastSpellByName(spellName)
end
local function panic()
if isUsable('Last Stand') and not onCooldown('Last Stand') then
cast('Last Stand')
elseif isUsable('Shield Wall') and not onCooldown('Shield Wall') then
cast('Shield Wall')
end
end end
local function tank(cmd) local function tank(cmd)
local rage = UnitMana('player') local rage = UnitMana('player')
local bloodrage = 'Ability_Racial_BloodRage' local health = UnitHealth('player')
local revenge = 'Ability_Warrior_Revenge'
local sunderArmor = 'Ability_Warrior_Sunder'
local rend = 'Ability_Gouge'
local shieldBash = 'Ability_Warrior_ShieldBash'
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
if (not PlayerFrame.inCombat) then AttackTarget() end if (not PlayerFrame.inCombat) then AttackTarget() end
if rage < 15 and isUsable(bloodrage) then
CastSpellByName('Bloodrage') if health < 400 then panic() end
elseif buffed('Battle Shout') == nil and isUsable(battleShout) then
CastSpellByName('Battle Shout') if isUsable('Bloodrage') and not onCooldown('Bloodrage') and rage < 30 then
elseif isUsable(shieldBash) then cast('Bloodrage')
CastSpellByName('Shield Bash')
elseif buffed('Shield Block') == nil then elseif isUsable('Battle Shout') and not buffed('Battle Shout') then
CastSpellByName('Shield Block') cast('Battle Shout')
elseif isUsable(revenge) then
CastSpellByName('Revange') elseif isUsable('Shield Bash') and not onCooldown('Shield Bash') then
elseif isUsable(sunderArmor) and debuffStacks(sunderArmor) < 5 then cast('Shield Bash')
CastSpellByName('Sunder Armor')
elseif rage > 60 and buffed('Demoralizing Shout', 'target') == nil then elseif isUsable('Shield Slam') and not onCooldown('Shield Slam') then
CastSpellByName('Demoralizing Shout') cast('Shield Slam')
elseif rage > 80 and buffed('Rend', 'target') == nil and isUsable(rend) then
CastSpellByName('Rend') elseif isUsable('Shield Block') and not onCooldown('Shield Block') and not buffed('Shield Block') then
elseif rage > 90 and isUsable(heroicStrike) then cast('Shield Block')
CastSpellByName('Heroic Strike')
elseif isUsable('Revange') and not onCooldown('Revange') then
cast('Revange')
elseif isUsable('Sunder Armor') and debuffStacks('Sunder Armor') < 5 then
cast('Sunder Armor')
elseif isUsable('Demoralizing Shout') and not buffed('Demoralizing Shout', 'target') then
cast('Demoralizing Shout')
elseif isUsable('Rend') and not buffed('Rend', 'target') and rage > 80 then
cast('Rend')
elseif isUsable('Heroic Strike') and rage > 80 then
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 bloodrage = 'Ability_Racial_BloodRage' local health = UnitHealth('player')
local rend = 'Ability_Gouge'
local battleShout = 'Ability_Warrior_BattleShout'
local heroicStrike = 'Ability_Rogue_Ambush'
local overpower = 'Ability_MeleeDamage'
local execute = 'INV_Sword_48'
local slam = 'Ability_Warrior_DecisiveStrike_New'
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 rage < 15 and isUsable(bloodrage) then
CastSpellByName('Bloodrage') if health < 400 then panic() end
elseif buffed('Battle Shout') == nil and isUsable(battleShout) then
CastSpellByName('Battle Shout') if isUsable('Bloodrage') and not onCooldown('Bloodrage') and rage < 30 then
elseif isUsable(execute) then cast('Bloodrage')
CastSpellByName('Execute')
elseif isUsable(overpower) then elseif isUsable('Berserker Rage') and not onCooldown('Berserker Rage') then
CastSpellByName('Overpower') cast('Berserker Rage')
elseif isUsable(slam) then
CastSpellByName('Slam') elseif isUsable('Battle Shout') and not buffed('Battle Shout') then
elseif buffed('Rend', 'target') == nil and isUsable(rend) then cast('Battle Shout')
CastSpellByName('Rend')
elseif isUsable(heroicStrike) then elseif isUsable('Execute') and not onCooldown('Execute') and rage > 40 then
CastSpellByName('Heroic Strike') cast('Execute')
elseif isUsable('Sunder Armor') and debuffStacks('Sunder Armor') < 5 then
cast('Sunder Armor')
elseif isUsable('Bloodthirst') and not onCooldown('Bloodthirst') then
cast('Bloodthirst')
elseif isUsable('Whirlwind') and not onCooldown('Whirlwind') then
cast('Whirlwind')
elseif isUsable('Heroic Strike') and rage > 80 then
cast('Heroic Strike')
end end
end end
end end