init
This commit is contained in:
parent
be11b44c71
commit
228024dca4
139
main.lua
Normal file
139
main.lua
Normal file
@ -0,0 +1,139 @@
|
||||
local textures = {}
|
||||
|
||||
textures['Serpent Sting'] = 'Ability_Hunter_Quickshot'
|
||||
textures['Hunter\'s Mark'] = 'Ability_Hunter_SniperShot'
|
||||
textures['Arcane Shot'] = 'Ability_ImpalingBolt'
|
||||
textures['Concussive Shot'] = 'Spell_Frost_Stun'
|
||||
textures['Throw'] = 'Ability_Throw'
|
||||
|
||||
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 cast(spellName)
|
||||
CastSpellByName(spellName)
|
||||
end
|
||||
|
||||
local function healthGtThan(percent, health, max)
|
||||
if health / max > percent / 100 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function attack()
|
||||
if GetUnitName('target') == nil then
|
||||
PetFollow()
|
||||
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
|
||||
elseif UnitHealth('target') ~= UnitHealthMax('target') and UnitIsUnit('player', 'targettarget') == nil then
|
||||
ClearTarget()
|
||||
return
|
||||
end
|
||||
|
||||
local mana = UnitMana('player')
|
||||
local health = UnitHealth('player')
|
||||
|
||||
if not UnitIsUnit('target', 'pettarget') and UnitExists('pet') and not UnitIsDead('pet') then
|
||||
PetAttack()
|
||||
end
|
||||
if CheckInteractDistance('target', 3) and (not PlayerFrame.inCombat) then
|
||||
AttackTarget()
|
||||
else
|
||||
if isUsable('Hunter\'s Mark') and not buffed('Hunter\'s Mark', 'target') then
|
||||
cast('Hunter\'s Mark')
|
||||
elseif not IsAutoRepeatAction(47) then
|
||||
cast('Auto Shot')
|
||||
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')
|
||||
elseif isUsable('Arcane Shot') and not onCooldown('Arcane Shot') then
|
||||
cast('Arcane Shot')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function wlob_onLoad()
|
||||
SlashCmdList['WLOB'] = attack
|
||||
SLASH_WLOB1 = '/wlob'
|
||||
end
|
7
wlob.toc
Normal file
7
wlob.toc
Normal file
@ -0,0 +1,7 @@
|
||||
## Interface: 11200
|
||||
## Title: WlOB |cff808080by cvtk
|
||||
## Author: cvtk
|
||||
## Notes: One button warrior tanking.
|
||||
## Version: GIT
|
||||
wlob.xml
|
||||
main.lua
|
8
wlob.xml
Normal file
8
wlob.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="wlob" enableMouse="false" parent="UIParent">
|
||||
<Scripts>
|
||||
<OnLoad>wlob_onLoad();</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</UI>
|
Loading…
Reference in New Issue
Block a user