diff --git a/HealBot.lua b/HealBot.lua index 06a2533..4dde5cc 100644 --- a/HealBot.lua +++ b/HealBot.lua @@ -56,6 +56,21 @@ function HealBot_SlashCmd(cmd) HealBot_TogglePanel(HealBot_Options); return end + if (cmd=="forms" or cmd=="form") then + local forms = GetNumShapeshiftForms(); + if forms and forms > 0 then + HealBot_AddChat("HealBot: Available shapeshift forms:"); + for i=1,forms do + local icon, name, active = GetShapeshiftFormInfo(i); + local actStr = "false" + if active then actStr = "true" end + HealBot_AddChat(" Form " .. i .. ": " .. (name or "nil") .. " | Icon: " .. (icon or "nil") .. " | Active: " .. actStr); + end + else + HealBot_AddChat("HealBot: No shapeshift forms found."); + end + return + end if (cmd=="reset" or cmd=="recalc" or cmd=="defaults") then InitSpells=2; diff --git a/HealBot_Controller_Events.lua b/HealBot_Controller_Events.lua index 2f8157a..0bfde31 100644 --- a/HealBot_Controller_Events.lua +++ b/HealBot_Controller_Events.lua @@ -170,6 +170,9 @@ local HealBot_EventHandlers = { ["PLAYER_ENTERING_WORLD"] = function(this) HealBot_Model:RefreshUnit("player") HealBot_Model:RefreshUnit("pet") + if HealBot_UnitClass("player") == "DRUID" then + HealBot_UpdateShapeshiftForm() + end HealBot_OnEvent_PlayerEnteringWorld(this) end, ["VARIABLES_LOADED"] = function(this) @@ -200,7 +203,9 @@ local HealBot_EventHandlers = { ["PET_BAR_SHOWGRID"] = function(this) HealBot_OnEvent_PartyMembersChanged(this) end, ["PET_BAR_HIDEGRID"] = function(this) HealBot_OnEvent_PartyMembersChanged(this) end, ["UNIT_PET"] = function(this, arg1) HealBot_OnEvent_PartyMembersChanged(this) end, - ["SPELLS_CHANGED"] = function(this, arg1) HealBot_OnEvent_SpellsChanged(this, arg1) end + ["SPELLS_CHANGED"] = function(this, arg1) HealBot_OnEvent_SpellsChanged(this, arg1) end, + ["UPDATE_SHAPESHIFT_FORM"] = function(this) HealBot_UpdateShapeshiftForm() end, + ["UPDATE_SHAPESHIFT_FORMS"] = function(this) HealBot_UpdateShapeshiftForm() end } function HealBot_OnEvent(this, event, arg1, arg2, arg3, arg4) @@ -289,6 +294,11 @@ function HealBot_OnEvent_VariablesLoaded(this) this:RegisterEvent("CHAT_MSG_ADDON"); this:RegisterEvent("CHAT_MSG_SYSTEM"); this:RegisterEvent("PLAYER_ENTERING_WORLD"); + if class == "DRUID" then + this:RegisterEvent("UPDATE_SHAPESHIFT_FORM"); + this:RegisterEvent("UPDATE_SHAPESHIFT_FORMS"); + HealBot_UpdateShapeshiftForm(); + end InitSpells = 2; end end diff --git a/HealBot_Controller_Spells.lua b/HealBot_Controller_Spells.lua index 44a00e3..9d72877 100644 --- a/HealBot_Controller_Spells.lua +++ b/HealBot_Controller_Spells.lua @@ -218,6 +218,10 @@ function HealBot_CastSpellOnFriend(spell, target) local targetEnemy = UnitCanAttack("player", "target"); local oldTarget = UnitName("target"); + if HealBot_UnitClass("player") == "DRUID" and HealBot_ActiveShapeshiftStance and HealBot_Config.AutoUnshift == 1 then + CastShapeshiftForm(HealBot_ActiveShapeshiftStance); + end + if oldTarget ~= UnitName(target) then TargetUnit(target); end @@ -365,7 +369,7 @@ function HealBot_GetHealSpell(unit, pattern) if UnitOnTaxi("player") then return nil end; if HealBot_Config.ProtectPvP == 1 and UnitIsPVP(unit) and not UnitIsPVP("player") then return nil end if HealBot_UnitClass("player") == "DRUID" then - if HealBot_GetShapeshiftForm() then return nil end; + if HealBot_ActiveShapeshiftStance and HealBot_Config.AutoUnshift ~= 1 then return nil end; end local spell = HealBot_GetSpellName(HealBot_GetSpellId(pattern)) local range = 40; @@ -641,13 +645,24 @@ function HealBot_Generic_Patten(matchStr, matchPattern) return tmpTest, _HealsMin, _HealsMax; end +HealBot_ActiveShapeshiftStance = nil; + +function HealBot_UpdateShapeshiftForm() + HealBot_ActiveShapeshiftStance = HealBot_GetShapeshiftForm(); +end + function HealBot_GetShapeshiftForm() local forms = GetNumShapeshiftForms(); if forms then local i; for i=1,forms do local icon,name,active = GetShapeshiftFormInfo(i); - if active and not string.find(icon,"HumanoidForm") then return i; end + if active then + local icon_lower = string.lower(icon); + if not string.find(icon_lower, "humanoidform") and not string.find(icon_lower, "treeoflife") and not string.find(icon_lower, "stoneclawtotem") then + return i; + end + end end end return nil; diff --git a/HealBot_Data.lua b/HealBot_Data.lua index 262bba0..6c525e3 100644 --- a/HealBot_Data.lua +++ b/HealBot_Data.lua @@ -14,6 +14,7 @@ HealBot_ConfigDefaults = { HideSolo = 0, OverHeal = 0.25, CastNotify = 1, + AutoUnshift = 1, ChatMessages = { [1] = { Spell = "None", Message = "Casting #Spell# on #Target#", Channel = "None" }, [2] = { Spell = "None", Message = "Casting #Spell# on #Target#", Channel = "None" },