first commit
This commit is contained in:
commit
5afd217146
152
main.lua
Normal file
152
main.lua
Normal file
@ -0,0 +1,152 @@
|
||||
local textures = {}
|
||||
|
||||
textures['Claw'] = 'Ability_Druid_Rake'
|
||||
textures['Rip'] = 'Ability_GhoulFrenzy'
|
||||
textures['Ferocious Bite'] = 'Ability_Druid_FerociousBite'
|
||||
textures['Tiger\'s Fury'] = 'Ability_Mount_JungleTiger'
|
||||
|
||||
|
||||
local function getTexture(spellName)
|
||||
if textures[spellName] ~= nil then
|
||||
return textures[spellName]
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function getSlot(spellTexture)
|
||||
for i = 1, 120, 1 do
|
||||
if GetActionTexture(i) ~= nil then
|
||||
-- print(GetActionTexture(i))
|
||||
if (strfind(GetActionTexture(i), spellTexture)) then
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
local function isUsable(spellName)
|
||||
local spellTexture = getTexture(spellName)
|
||||
if spellTexture then
|
||||
local slot = getSlot(spellTexture)
|
||||
local usable, _ = IsUsableAction(slot)
|
||||
return usable
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
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(spellName)
|
||||
local spellTexture = getTexture(spellName)
|
||||
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 comboPoints()
|
||||
return GetComboPoints('player', 'target')
|
||||
end
|
||||
|
||||
local function cast(spellName)
|
||||
CastSpellByName(spellName)
|
||||
end
|
||||
|
||||
local function gt(percent, value, max)
|
||||
if value / max > percent / 100 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function attack()
|
||||
if GetUnitName('target') == nil then
|
||||
TargetNearestEnemy()
|
||||
return
|
||||
else
|
||||
if UnitCanAttack('player', 'target') == nil then
|
||||
ClearTarget()
|
||||
return
|
||||
elseif UnitIsDead('target') == 1 then
|
||||
ClearTarget()
|
||||
return
|
||||
elseif UnitIsPlayer('target') == 1 then
|
||||
ClearTarget()
|
||||
return
|
||||
end
|
||||
|
||||
local mana = UnitMana('player')
|
||||
local health = UnitHealth('player')
|
||||
|
||||
if (not PlayerFrame.inCombat) then
|
||||
AttackTarget()
|
||||
else
|
||||
if isUsable('Tiger\'s Fury') and not buffed('Tiger\'s Fury', 'player') then
|
||||
cast('Tiger\'s Fury')
|
||||
elseif isUsable('Ferocious Bite') and comboPoints() > 1 then
|
||||
cast('Ferocious Bite')
|
||||
-- elseif isUsable('Rip') and comboPoints() > 0 and not buffed('Rip', 'target') then
|
||||
-- cast('Rip')
|
||||
elseif isUsable('Claw') then
|
||||
cast('Claw')
|
||||
-- elseif isUsable('Blood Fury') and not onCooldown('Blood Fury') then
|
||||
-- cast('Blood Fury')
|
||||
-- elseif not IsAutoRepeatAction(47) then
|
||||
-- cast('Auto Shot')
|
||||
-- elseif isUsable('Multi-Shot') and not onCooldown('Multi-Shot') then
|
||||
-- cast('Multi-Shot')
|
||||
-- elseif isUsable('Steady Shot') and not onCooldown('Steady Shot') then
|
||||
-- cast('Steady Shot')
|
||||
-- elseif isUsable('Baited Shot') and not onCooldown('Baited Shot') then
|
||||
-- cast('Baited Shot')
|
||||
-- elseif isUsable('Kill Command') and not onCooldown('Kill Command') then
|
||||
-- cast('Kill Command')
|
||||
-- elseif isUsable('Arcane Shot') and not onCooldown('Arcane Shot') then
|
||||
-- cast('Arcane Shot(Rank 1)')
|
||||
-- elseif isUsable('Serpent Sting') and not buffed('Serpent Sting', 'target') and
|
||||
-- healthGtThan(25, UnitHealth('target'), UnitHealthMax('target')) then
|
||||
-- cast('Serpent Sting')
|
||||
-- elseif isUsable('Concussive Shot') and not onCooldown('Concussive Shot') then
|
||||
-- cast('Concussive Shot')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function obd_onLoad()
|
||||
SlashCmdList['OBD'] = attack
|
||||
SLASH_OBD1 = '/obd_lvl'
|
||||
end
|
8
main.xml
Normal file
8
main.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<UI xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
|
||||
<Script file="main.lua"/>
|
||||
<Frame name="obd" enableMouse="false" parent="UIParent">
|
||||
<Scripts>
|
||||
<OnLoad>obd_onLoad();</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</UI>
|
Loading…
Reference in New Issue
Block a user