diff --git a/main.lua b/main.lua index 3f70bd6..7327ebc 100644 --- a/main.lua +++ b/main.lua @@ -44,6 +44,16 @@ local function isUsable(spellName) end end +local function buffIndex(spellTexture) + for i = 1, 40 do + local texturePath = UnitBuff('player', i) + if texturePath ~= nil and strfind(texturePath, spellTexture) then + return i + end + end + return 0 +end + local function debuffIndex(spellTexture) for i = 1, 40 do local texturePath = UnitDebuff('target', i) @@ -54,6 +64,16 @@ local function debuffIndex(spellTexture) return 0 end +local function getBuffTimeLeft(buffName) + local buffTexture = getTexture(buffName) + if buffTexture then + local name, _, _, _, _, duration, expirationTime = UnitBuff('player', buffIndex(buffTexture)) + return GetPlayerBuffTimeLeft(buffIndex(buffTexture)) + else + return false + end +end + local function debuffStacks(spellName) local spellTexture = getTexture(spellName) if spellTexture then @@ -64,7 +84,6 @@ local function debuffStacks(spellName) return stacks end else - print(spellName) return false end end @@ -115,6 +134,12 @@ local function target() end end +local function reshift(lt) + if isUsable('Reshift') and UnitMana('player') <= lt then + cast('Reshift') + end +end + local function dps(cp) local mana = UnitMana('player') local health = UnitHealth('player') @@ -173,10 +198,14 @@ end local function dps_st() target() + if buffed('Clearcasting', 'player') then reshift(40) end + if getBuffTimeLeft('Tiger\'s Fury') < 5 then reshift(40) end dps(5) end local function dps_trash() target() + if buffed('Clearcasting', 'player') then reshift(40) end + if getBuffTimeLeft('Tiger\'s Fury') < 5 then reshift(40) end dps(3) end