A piece of code i done to manage totems being resto shaman
What this does?
+ Choose the right totem depending of group setup
+ Allow you manual place totems before join fight or do it automatically for you if already in combat
+ Remove totems auto casted before upon leaving combat
Ability name: Call of the Elements
Spell ID: 0
Code:
if UnitAffectingCombat("player") then
local _,fire = GetTotemInfo(1)
local fireid = ( not UnitBuffID("player",61316) and not UnitBuffID("player",1459) ) and 8227 or 3599
local _,earth = GetTotemInfo(2)
local earthid = not UnitBuffID("player", 465) and 8071 or 8075
local _,water = GetTotemInfo(3)
local waterid = ( not UnitBuffID("player", 19740) and not UnitBuffID("player", 54424) ) and 5675 or 5394
local _,air = GetTotemInfo(4)
local airid = ( not UnitBuffID("player", 53290) and not UnitBuffID("player", 55610) and ( UnitBuffID("player", 49868) or UnitBuffID("player", 24907) ) ) and 8512 or 3738
if fire == "" and earth == "" and water == "" and air == ""
then
SetMultiCastSpell(133,fireid)
SetMultiCastSpell(134,earthid)
SetMultiCastSpell(135,waterid)
SetMultiCastSpell(136,airid)
CastSpellByID(66842)
SmartTotems = true
return true
end
if fire == "" then SetMultiCastSpell(133,fireid) CastSpellByID(fireid) SmartTotems = true return true end
if earth == "" then SetMultiCastSpell(134,earthid) CastSpellByID(earthid) SmartTotems = true return true end
if water == "" then SetMultiCastSpell(135,waterid) CastSpellByID(waterid) SmartTotems = true return true end
if air == "" then SetMultiCastSpell(136,airid) CastSpellByID(airid) SmartTotems = true return true end
end
Ability name: Totemic Recall
Spell ID: 39936
Code:
local _,fire = GetTotemInfo(1)
local _,earth = GetTotemInfo(2)
local _,water = GetTotemInfo(3)
local _,air = GetTotemInfo(4)
if SmartTotems and not UnitAffectingCombat("player")
and fire ~= "Fire Elemental Totem"
and earth ~= "Earth Elemental Totem"
and water ~= "Mana Tide Totem"
and ( fire ~= "" or earth ~= "" or water ~= "" or air ~= "" )
then
SmartTotems = false
return true
end