I need a code that handles tracking if a unit has an active spirit panda from the monk spell Storm, Earth, and Fire (SEF).
Here's what I got for this ability:
PHP Code:
local sef = select(4,UnitBuffID("player",137639));
if (not sef or sef<2) and UnitExists("focus") and not UnitIsUnit("target", "focus") and PQR_SpellAvailable(137639) then
CastSpellByName(GetSpellInfo(137639), "focus")
Now the problem with this is if you cast SEF on a unit with an active spirit it's just going to cancel the effect and go into an endless loop. I need something to track if the unit has an active panda spirit from SEF and because of the overall clunky design of the ability, the only way to do this is through the combat log /w totems or something.
Storm, Earth, and Fire WeakAura
Here's an MMO champion thread /w a weakaura that visually tracks your pandas and their target. I post this because it probably contains the code needed to turn it into a PQR code. If you don't have WeakAuras here's the core lua code that makes it works:
PHP Code:
-----------------------------------------------------------------------
--
-- Name: Storm, Earth, and Fire
-- Author: Ròxy@Spinebreaker-EU (Shamarox@mmo-champ)
--
-- Core for tracking targets health and SEF activation
-- Note: /cancelaura & deactivation have different timings and
-- events
-----------------------------------------------------------------------
function(event, ...)
local SEF = 137639;
local S = 138122;
local E = 138121;
local F = 138123;
local me = UnitGUID("player")
local ev,_,source,_,_,_,target,tname,_,_,spellId,spellName,_,damage,over = select(2,...)
if not WA_SEF then
WA_SEF = {
totem = {nil,nil},
active = {false,false},
last = nil,
spellName = GetSpellInfo(SEF);
get = function(self,t,b)
for i = 0,1 do
if self.totem[i] and self.totem[i][b] == t and self.active[i] then
return i;
end
end
return nil;
end,
getNext = function(self)
if not self.last then
for i = 0,1 do
if not self.active[i] then
return i;
end
end
end
return self.last;
end
}
end
-- TRACKING TOTEMS
if source == me and (spellId == SEF or spellId == S or spellId == E or spellId == F) then
if ev == "SPELL_SUMMON" then
WA_SEF.id = target
elseif ev == "SPELL_CAST_SUCCESS"then
local unit = "target";
if UnitGUID("focus") == target then unit = "focus";
elseif UnitGUID("mouseover") == target then unit = "mouseover"; end
local max = UnitHealthMax(unit);
WA_SEF.last = {
target = target,
tname = tname,
targetMaxHP = max,
targetHP = max-UnitHealth(unit),
totemMaxHP = UnitHealthMax("player")*0.1, -- 10%
totemHP = 0;
name = nil,
icon = nil,
id = WA_SEF.id,
perc = function(self,top,x)
local p = (self[top]-self[x])*100/self[top];
if p <= 0 then
p = 0;
end
return tonumber(("%.0f"):format(p))
end,
set = function(self,b,x)
self[b] = self[b]+x;
if self[b] < 0 then
self[b] = 0;
end
end
}
end
end
-- TRACKING HEALTH
local dmg = damage;
local heal = string.find(ev,"_HEAL");
if string.find(ev,"_DAMAGE") or heal then
if string.find(ev,"SWING") then
dmg = spellId;
elseif heal then
dmg = -(damage-over);
end
local t = WA_SEF:get(target,"target");
local id = WA_SEF:get(target,"id");
if dmg ~= nil then
if t then
WA_SEF.totem[t]:set("targetHP",dmg);
elseif id then
WA_SEF.totem[id]:set("totemHP",dmg);
end
end
end
return false -- JUST CORE!
end
So the info you need to get a SEF tracking code working is probably in that.
I'm a very limited coder and need someone to build the brain, in the end I want to end up with this:
PHP Code:
local sef = select(4,UnitBuffID("player",137639));
local ActiveSpirit = [brain - tracking if SEF on unitID(focus) zzz]
if not ActiveSpirit and (not sef or sef<2) and UnitExists("focus") and not UnitIsUnit("target", "focus") and PQR_SpellAvailable(137639) then
CastSpellByName(GetSpellInfo(137639), "focus")
If somebody can get me this code, I'll happily donate $20 to you via paypal.
Thanks~