mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-07-27 09:44:44 +00:00
Implement auto-unshifting for druid shapeshift forms and add status command
This commit is contained in:
+15
@@ -56,6 +56,21 @@ function HealBot_SlashCmd(cmd)
|
|||||||
HealBot_TogglePanel(HealBot_Options);
|
HealBot_TogglePanel(HealBot_Options);
|
||||||
return
|
return
|
||||||
end
|
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
|
if (cmd=="reset" or cmd=="recalc" or cmd=="defaults") then
|
||||||
InitSpells=2;
|
InitSpells=2;
|
||||||
|
|||||||
@@ -170,6 +170,9 @@ local HealBot_EventHandlers = {
|
|||||||
["PLAYER_ENTERING_WORLD"] = function(this)
|
["PLAYER_ENTERING_WORLD"] = function(this)
|
||||||
HealBot_Model:RefreshUnit("player")
|
HealBot_Model:RefreshUnit("player")
|
||||||
HealBot_Model:RefreshUnit("pet")
|
HealBot_Model:RefreshUnit("pet")
|
||||||
|
if HealBot_UnitClass("player") == "DRUID" then
|
||||||
|
HealBot_UpdateShapeshiftForm()
|
||||||
|
end
|
||||||
HealBot_OnEvent_PlayerEnteringWorld(this)
|
HealBot_OnEvent_PlayerEnteringWorld(this)
|
||||||
end,
|
end,
|
||||||
["VARIABLES_LOADED"] = function(this)
|
["VARIABLES_LOADED"] = function(this)
|
||||||
@@ -200,7 +203,9 @@ local HealBot_EventHandlers = {
|
|||||||
["PET_BAR_SHOWGRID"] = function(this) HealBot_OnEvent_PartyMembersChanged(this) end,
|
["PET_BAR_SHOWGRID"] = function(this) HealBot_OnEvent_PartyMembersChanged(this) end,
|
||||||
["PET_BAR_HIDEGRID"] = 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,
|
["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)
|
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_ADDON");
|
||||||
this:RegisterEvent("CHAT_MSG_SYSTEM");
|
this:RegisterEvent("CHAT_MSG_SYSTEM");
|
||||||
this:RegisterEvent("PLAYER_ENTERING_WORLD");
|
this:RegisterEvent("PLAYER_ENTERING_WORLD");
|
||||||
|
if class == "DRUID" then
|
||||||
|
this:RegisterEvent("UPDATE_SHAPESHIFT_FORM");
|
||||||
|
this:RegisterEvent("UPDATE_SHAPESHIFT_FORMS");
|
||||||
|
HealBot_UpdateShapeshiftForm();
|
||||||
|
end
|
||||||
InitSpells = 2;
|
InitSpells = 2;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -218,6 +218,10 @@ function HealBot_CastSpellOnFriend(spell, target)
|
|||||||
local targetEnemy = UnitCanAttack("player", "target");
|
local targetEnemy = UnitCanAttack("player", "target");
|
||||||
local oldTarget = UnitName("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
|
if oldTarget ~= UnitName(target) then
|
||||||
TargetUnit(target);
|
TargetUnit(target);
|
||||||
end
|
end
|
||||||
@@ -365,7 +369,7 @@ function HealBot_GetHealSpell(unit, pattern)
|
|||||||
if UnitOnTaxi("player") then return nil end;
|
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_Config.ProtectPvP == 1 and UnitIsPVP(unit) and not UnitIsPVP("player") then return nil end
|
||||||
if HealBot_UnitClass("player") == "DRUID" then
|
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
|
end
|
||||||
local spell = HealBot_GetSpellName(HealBot_GetSpellId(pattern))
|
local spell = HealBot_GetSpellName(HealBot_GetSpellId(pattern))
|
||||||
local range = 40;
|
local range = 40;
|
||||||
@@ -641,13 +645,24 @@ function HealBot_Generic_Patten(matchStr, matchPattern)
|
|||||||
return tmpTest, _HealsMin, _HealsMax;
|
return tmpTest, _HealsMin, _HealsMax;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
HealBot_ActiveShapeshiftStance = nil;
|
||||||
|
|
||||||
|
function HealBot_UpdateShapeshiftForm()
|
||||||
|
HealBot_ActiveShapeshiftStance = HealBot_GetShapeshiftForm();
|
||||||
|
end
|
||||||
|
|
||||||
function HealBot_GetShapeshiftForm()
|
function HealBot_GetShapeshiftForm()
|
||||||
local forms = GetNumShapeshiftForms();
|
local forms = GetNumShapeshiftForms();
|
||||||
if forms then
|
if forms then
|
||||||
local i;
|
local i;
|
||||||
for i=1,forms do
|
for i=1,forms do
|
||||||
local icon,name,active = GetShapeshiftFormInfo(i);
|
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
|
||||||
end
|
end
|
||||||
return nil;
|
return nil;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ HealBot_ConfigDefaults = {
|
|||||||
HideSolo = 0,
|
HideSolo = 0,
|
||||||
OverHeal = 0.25,
|
OverHeal = 0.25,
|
||||||
CastNotify = 1,
|
CastNotify = 1,
|
||||||
|
AutoUnshift = 1,
|
||||||
ChatMessages = {
|
ChatMessages = {
|
||||||
[1] = { Spell = "None", Message = "Casting #Spell# on #Target#", Channel = "None" },
|
[1] = { Spell = "None", Message = "Casting #Spell# on #Target#", Channel = "None" },
|
||||||
[2] = { Spell = "None", Message = "Casting #Spell# on #Target#", Channel = "None" },
|
[2] = { Spell = "None", Message = "Casting #Spell# on #Target#", Channel = "None" },
|
||||||
|
|||||||
Reference in New Issue
Block a user