From d0e027ec12f107c437f394a00d33e4ea53cce237 Mon Sep 17 00:00:00 2001 From: Bluewhale1337 <295648290+Bluewhale1337@users.noreply.github.com> Date: Tue, 18 Aug 2026 18:11:54 +0200 Subject: [PATCH] added ClassicAPI integration for enhanced distance checking, healing bonuses, and Focus unit support - overrides some functionality of other integrations --- HealBot_Controller_Range.lua | 8 ++++++++ HealBot_Controller_Spells.lua | 7 ++++++- HealBot_Data.lua | 1 + HealBot_Integrations.lua | 26 ++++++++++++++++++++++++++ HealBot_Model.lua | 10 +++++----- HealBot_Options_Integrations.lua | 1 + HealBot_Options_Integrations.xml | 19 +++++++++++++++++++ HealBot_View_Layout.lua | 29 +++++++++++++++++++++++++++++ README.md | 1 + 9 files changed, 96 insertions(+), 6 deletions(-) diff --git a/HealBot_Controller_Range.lua b/HealBot_Controller_Range.lua index 2a95219..aff7caf 100644 --- a/HealBot_Controller_Range.lua +++ b/HealBot_Controller_Range.lua @@ -14,6 +14,14 @@ function HealBot_Range_Check(unit, range) end if ( unit == "player" ) then return_val = 1; + elseif HealBot_Integrations_ClassicAPI_Active and UnitDistanceSquared and UnitInLineOfSight then + local inSight = UnitInLineOfSight("player", unit) + if inSight then + local distSq = UnitDistanceSquared(unit) + if distSq and distSq <= (range * range) then + return_val = 1; + end + end elseif HealBot_Integrations_UnitXP_Active then local inSight = UnitXP("inSight", "player", unit) if inSight then diff --git a/HealBot_Controller_Spells.lua b/HealBot_Controller_Spells.lua index 2205af4..e819867 100644 --- a/HealBot_Controller_Spells.lua +++ b/HealBot_Controller_Spells.lua @@ -564,7 +564,12 @@ function HealBot_SpiBonus(spell) end function HealBot_GetBonus() - local HealBonus = HealBot_BonusScanner:GetBonus() or 0; + local HealBonus = 0; + if HealBot_Integrations_ClassicAPI_Active and GetSpellBonusHealing then + HealBonus = GetSpellBonusHealing() or 0; + else + HealBonus = HealBot_BonusScanner:GetBonus() or 0; + end if UnitClass("player") == "PALADIN" then local ironRank = HealBot_GetTalentRank("Ironclad") if ironRank > 0 then diff --git a/HealBot_Data.lua b/HealBot_Data.lua index 7737148..15fac96 100644 --- a/HealBot_Data.lua +++ b/HealBot_Data.lua @@ -258,6 +258,7 @@ HealBot_ConfigDefaults = { HealBot_Integrations_UnitXP = 0, HealBot_Integrations_Nampower = 0, HealBot_Integrations_SuperWoW = 0, + HealBot_Integrations_ClassicAPI = 0, }; HealBot_Config = {}; diff --git a/HealBot_Integrations.lua b/HealBot_Integrations.lua index d1926a9..0a1a24b 100644 --- a/HealBot_Integrations.lua +++ b/HealBot_Integrations.lua @@ -1,5 +1,17 @@ HealBot_Integrations_UnitXP_Active = false; HealBot_Integrations_Nampower_Active = false; +HealBot_Integrations_SuperWoW_Active = false; +HealBot_Integrations_ClassicAPI_Active = false; + +function HealBot_GetUnitGUID(unit) + if not unit then return nil end + if HealBot_Integrations_ClassicAPI_Active and UnitGUID then + return UnitGUID(unit) + elseif HealBot_Integrations_SuperWoW_Active and GetUnitGUID then + return GetUnitGUID(unit) + end + return nil +end function HealBot_Integrations_Toggle() -- UnitXP @@ -94,4 +106,18 @@ end HealBot_Integrations_SuperWoW_Active = false; HealBot_AddDebug("SuperWoW Integration: DISABLED"); end + + -- ClassicAPI + if HealBot_Config.HealBot_Integrations_ClassicAPI == 1 then + if UnitGUID then + HealBot_Integrations_ClassicAPI_Active = true; + HealBot_AddDebug("ClassicAPI Integration: ENABLED"); + else + HealBot_Integrations_ClassicAPI_Active = false; + HealBot_AddDebug("ClassicAPI Integration: DISABLED (Mod Not Found)"); + end + else + HealBot_Integrations_ClassicAPI_Active = false; + HealBot_AddDebug("ClassicAPI Integration: DISABLED"); + end end diff --git a/HealBot_Model.lua b/HealBot_Model.lua index 259a52b..ac3dc17 100644 --- a/HealBot_Model.lua +++ b/HealBot_Model.lua @@ -144,8 +144,8 @@ function HealBot_Model:UpdateUnitIdentity(unit) self.units[unit].englishClass = englishClass self.units[unit].class = UnitClass(unit) - if HealBot_Integrations_SuperWoW_Active and GetUnitGUID then - local guid = GetUnitGUID(unit) + if (HealBot_Integrations_SuperWoW_Active or HealBot_Integrations_ClassicAPI_Active) and HealBot_GetUnitGUID then + local guid = HealBot_GetUnitGUID(unit) if guid then self.unitGUIDs[unit] = guid self.guidUnits[guid] = unit @@ -170,7 +170,7 @@ function HealBot_Model:GetUnitIDByName(name) end function HealBot_Model:PreserveStateByGUID() - if not HealBot_Integrations_SuperWoW_Active or not GetUnitGUID then return end + if not (HealBot_Integrations_SuperWoW_Active or HealBot_Integrations_ClassicAPI_Active) or not HealBot_GetUnitGUID then return end local oldGUIDs = {} for unit, guid in pairs(self.unitGUIDs) do @@ -180,7 +180,7 @@ function HealBot_Model:PreserveStateByGUID() local newUnitForGUID = {} -- Scan the new roster for _, unit in ipairs(self.partyMembers) do - local guid = GetUnitGUID(unit) + local guid = HealBot_GetUnitGUID(unit) if guid then newUnitForGUID[guid] = unit self.unitGUIDs[unit] = guid @@ -188,7 +188,7 @@ function HealBot_Model:PreserveStateByGUID() end end for _, unit in ipairs(self.raidMembers) do - local guid = GetUnitGUID(unit) + local guid = HealBot_GetUnitGUID(unit) if guid then newUnitForGUID[guid] = unit self.unitGUIDs[unit] = guid diff --git a/HealBot_Options_Integrations.lua b/HealBot_Options_Integrations.lua index 31f23b2..e8a6ecd 100644 --- a/HealBot_Options_Integrations.lua +++ b/HealBot_Options_Integrations.lua @@ -2,4 +2,5 @@ function HealBot_Options_Integrations_OnShow(this) HealBot_Options_Integrations_UnitXP:SetChecked(HealBot_Config.HealBot_Integrations_UnitXP); HealBot_Options_Integrations_Nampower:SetChecked(HealBot_Config.HealBot_Integrations_Nampower); HealBot_Options_Integrations_SuperWoW:SetChecked(HealBot_Config.HealBot_Integrations_SuperWoW); + HealBot_Options_Integrations_ClassicAPI:SetChecked(HealBot_Config.HealBot_Integrations_ClassicAPI); end diff --git a/HealBot_Options_Integrations.xml b/HealBot_Options_Integrations.xml index a990483..00d73d3 100644 --- a/HealBot_Options_Integrations.xml +++ b/HealBot_Options_Integrations.xml @@ -61,6 +61,25 @@ + + + + + + + + + + + getglobal(this:GetName().."Text"):SetText("Enable ClassicAPI Integration (+Healing/Focus/Distance)"); + + + HealBot_Config.HealBot_Integrations_ClassicAPI = this:GetChecked() and 1 or 0; + HealBot_Integrations_Toggle(); + + + + diff --git a/HealBot_View_Layout.lua b/HealBot_View_Layout.lua index d73562b..4f20b39 100644 --- a/HealBot_View_Layout.lua +++ b/HealBot_View_Layout.lua @@ -12,7 +12,9 @@ HealBot_Action_HealGroup = { "party4", }; +HealBot_Action_HealGroup = {}; HealBot_Action_HealTarget = {}; +HealBot_Action_HealFocus = {}; HealBot_Action_HealButtons = {}; HealBot_Action_UnitButtons = {}; @@ -589,6 +591,32 @@ function HealBot_Action_PartyChanged() numBars = numBars + 1; numHeaders = numHeaders + 1; end + + -- Focus + local FocusValid = numBars; + if HealBot_Integrations_ClassicAPI_Active and FocusUnit then + if HealBot_Config.ShowHeader[HealBot_Config.Current_Skin] == 1 then + HeaderPos[i + 1] = "Focus" + end + if HealBot_MayHeal("focus") then + i = i + 1; + h = h + 1; + if h < 61 then + HealBot_Action_SetHealButton(h, "focus"); + local check = getglobal("HealBot_Action_HealUnit" .. h .. "Check"); + check:SetChecked(0); + check.unit = "focus"; + check:Show(); + else + HealBot_Action_SetHealButton(i, "focus"); + end + numBars = numBars + 1; + end + end + if numBars > FocusValid and HealBot_Config.ShowHeader[HealBot_Config.Current_Skin] == 1 then + numBars = numBars + 1; + numHeaders = numHeaders + 1; + end last = last + 40 local ExtraValid = numBars; @@ -985,6 +1013,7 @@ function HealBot_Action_Reset() HealBot_Action:ClearAllPoints(); HealBot_Action:SetPoint("TOP", "MinimapCluster", "BOTTOM", 7, 10); HealBot_Action_HealTarget = {}; + HealBot_Action_HealFocus = {}; HealBot_Action_PartyChanged(); end diff --git a/README.md b/README.md index c4393b9..296e20f 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\ * **UnitXP_SP3 Integration** - Added optional support for UnitXP's API to provide ultra-precise 3D range finding and strict Line of Sight (LoS) checks. This completely bypasses the limitations of Vanilla's 2D map coordinate distance checks. * **Nampower Integration** - Implemented background aura tracking to map explicit HoT expiration timestamps directly from nampower. This allows for accurate real-time heal and buff tracking instead of estimating based on cast times. * **SuperWoW Integration** - Added robust GUID-based state tracking leveraging SuperWoW's enhanced API. This tracks players by their unique IDs rather than volatile unit strings. +* **ClassicAPI Integration** - Added support for ClassicAPI to natively inject accurate +Healing bonuses, ultra-fast 3D distance checks (`UnitDistanceSquared`), and a dedicated Focus frame for pinning Main Tanks without requiring additional memory-heavy addons. * **UI Layout** - Widened the Options UI and neatly centered elements to accommodate the new integrations tab. * **Bug Fix - Class Colors** - Fixed a bug where class colors failed to apply to new units due to a delayed server response. * **Bug Fix - Combat Updates** - Fixed an issue where new party members joining mid-combat failed to append to the grid without dropping combat.