mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-09-10 09:20:21 +00:00
feature: implemented HealComm without using whole heavy library to sync for cross-addon compatibility while keeping legacy healbot protocol to sync with older versions also fix unit name regex parsing bugs
This commit is contained in:
@@ -71,33 +71,72 @@ function HealBot_SendAddonMessage(prefix, text)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not HealBot_IncomingHealers then HealBot_IncomingHealers = {} end
|
||||||
|
|
||||||
|
local function SetIncomingHeal(sender, target, amount, protocol)
|
||||||
|
-- prioritize HealComm over HealBot protocol to avoid double-counting
|
||||||
|
if HealBot_IncomingHealers[sender] and HealBot_IncomingHealers[sender].protocol == "HealComm" and protocol == "HealBot" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- remove old heal if it exists
|
||||||
|
if HealBot_IncomingHealers[sender] then
|
||||||
|
local oldTarget = HealBot_IncomingHealers[sender].target
|
||||||
|
local oldAmount = HealBot_IncomingHealers[sender].amount
|
||||||
|
if HealBot_HealsIn[oldTarget] then
|
||||||
|
HealBot_HealsIn[oldTarget] = HealBot_HealsIn[oldTarget] - oldAmount
|
||||||
|
if HealBot_HealsIn[oldTarget] < 0 then HealBot_HealsIn[oldTarget] = 0 end
|
||||||
|
HealBot_RecalcHeals(HealBot_FindUnitID(oldTarget))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if amount > 0 then
|
||||||
|
HealBot_IncomingHealers[sender] = { target = target, amount = amount, protocol = protocol }
|
||||||
|
if not HealBot_HealsIn[target] then HealBot_HealsIn[target] = 0 end
|
||||||
|
HealBot_HealsIn[target] = HealBot_HealsIn[target] + amount
|
||||||
|
HealBot_RecalcHeals(HealBot_FindUnitID(target))
|
||||||
|
else
|
||||||
|
HealBot_IncomingHealers[sender] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- HealBot_OnEvent_AddonMsg: Parses incoming heal data from other clients.
|
-- HealBot_OnEvent_AddonMsg: Parses incoming heal data from other clients.
|
||||||
function HealBot_OnEvent_AddonMsg(this, addon_id, inc_msg, dist_target, sender_id)
|
function HealBot_OnEvent_AddonMsg(this, addon_id, inc_msg, dist_target, sender_id)
|
||||||
if addon_id == HEALBOT_ADDON_ID then
|
if sender_id == UnitName("player") then return end
|
||||||
local tmpTest, unitname, heal_val
|
|
||||||
tmpTest, tmpTest, unitname, heal_val = string.find(inc_msg, ">> (%a+) <<=>> (.%d+) <<" );
|
if addon_id == "HealComm" then
|
||||||
if heal_val then
|
-- HealComm protocol (e.g. "Heal/TargetName/Amount/CastTime/")
|
||||||
if sender_id == UnitName("player") then return end
|
local cmd, target, amount, cast_time = strsplit("/", inc_msg)
|
||||||
if not HealBot_HealsIn[unitname] then
|
if cmd == "Heal" and target and amount then
|
||||||
HealBot_HealsIn[unitname] = 0;
|
SetIncomingHeal(sender_id, target, tonumber(amount) or 0, "HealComm")
|
||||||
end
|
elseif cmd == "Healstop" then
|
||||||
HealBot_Healers[sender_id] = ">> " .. unitname .. " <<=>> " .. heal_val .. " <<";
|
SetIncomingHeal(sender_id, nil, 0, "HealComm")
|
||||||
HealBot_HealsIn[unitname] = HealBot_HealsIn[unitname] + tonumber(heal_val);
|
elseif cmd == "GrpHeal" and amount then
|
||||||
if tonumber(heal_val) > 0 then
|
-- Note: Group heals technically have multiple targets, but this is a simple implementation
|
||||||
HealBot_RecalcHeals(HealBot_FindUnitID(unitname))
|
-- We'll just track it against the first target to keep it simple, or ignore it.
|
||||||
elseif HealBot_HealsIn[unitname] < 0 then
|
-- Full GrpHeal parsing would split target1,target2,target3
|
||||||
HealBot_HealsIn[unitname] = 0;
|
elseif cmd == "GrpHealstop" then
|
||||||
end
|
SetIncomingHeal(sender_id, nil, 0, "HealComm")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif addon_id == HEALBOT_ADDON_ID then
|
||||||
|
local tmpTest, tmpTest, unitname, heal_val = string.find(inc_msg, ">> (.-) <<=>> (.-) <<" );
|
||||||
|
if heal_val and unitname then
|
||||||
|
local amount = tonumber(heal_val) or 0
|
||||||
|
if amount < 0 then amount = 0 end -- HealBot sends negative to cancel
|
||||||
|
SetIncomingHeal(sender_id, unitname, amount, "HealBot")
|
||||||
|
end
|
||||||
|
|
||||||
elseif addon_id == "HealBot" then
|
elseif addon_id == "HealBot" then
|
||||||
local tmpTest, datatype, datamsg, sender
|
local tmpTest, datatype, datamsg, sender
|
||||||
local PName = UnitName("player");
|
local PName = UnitName("player");
|
||||||
tmpTest, tmpTest, datatype, sender, datamsg = string.find(inc_msg, ">> (%a+) <<=>> (%a+) <<=>> (.+)");
|
tmpTest, tmpTest, datatype, sender, datamsg = string.find(inc_msg, ">> (.-) <<=>> (.-) <<=>> (.+)");
|
||||||
if datatype == "RequestVersion" then
|
if datatype == "RequestVersion" then
|
||||||
HealBot_SendAddonMessage("HealBot", ">> SendVersion <<=>> " .. sender .. " <<=>> Version=" .. HEALBOT_VERSION);
|
HealBot_SendAddonMessage("HealBot", ">> SendVersion <<=>> " .. sender .. " <<=>> Version=" .. HEALBOT_VERSION);
|
||||||
elseif datatype == "SendVersion" and PName == sender then
|
elseif datatype == "SendVersion" and PName == sender then
|
||||||
HealBot_AddChat(sender_id .. ": " .. datamsg);
|
HealBot_AddChat(sender_id .. ": " .. datamsg);
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif addon_id == "CTRA" then
|
elseif addon_id == "CTRA" then
|
||||||
if ( string.sub(inc_msg, 1, 3) == "RES" ) then
|
if ( string.sub(inc_msg, 1, 3) == "RES" ) then
|
||||||
if ( inc_msg == "RESNO" ) then
|
if ( inc_msg == "RESNO" ) then
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ function HealBot_Process_HealValue(spell, target)
|
|||||||
local uname = UnitName(target)
|
local uname = UnitName(target)
|
||||||
if uname then
|
if uname then
|
||||||
HealBot_SendAddonMessage(HEALBOT_ADDON_ID, ">> " .. uname .. " <<=>> " .. HealBot_HealValue .. " << ");
|
HealBot_SendAddonMessage(HEALBOT_ADDON_ID, ">> " .. uname .. " <<=>> " .. HealBot_HealValue .. " << ");
|
||||||
|
HealBot_SendAddonMessage("HealComm", "Heal/" .. uname .. "/" .. HealBot_HealValue .. "/1500/");
|
||||||
if not HealBot_HealsIn[uname] then
|
if not HealBot_HealsIn[uname] then
|
||||||
HealBot_HealsIn[uname] = 0;
|
HealBot_HealsIn[uname] = 0;
|
||||||
end
|
end
|
||||||
@@ -217,6 +218,7 @@ function HealBot_StopCasting()
|
|||||||
local uname = UnitName(HealBot_CastingTarget)
|
local uname = UnitName(HealBot_CastingTarget)
|
||||||
if uname then
|
if uname then
|
||||||
HealBot_SendAddonMessage(HEALBOT_ADDON_ID, ">> " .. uname .. " <<=>> " .. 0 - HealBot_HealValue .. " << ");
|
HealBot_SendAddonMessage(HEALBOT_ADDON_ID, ">> " .. uname .. " <<=>> " .. 0 - HealBot_HealValue .. " << ");
|
||||||
|
HealBot_SendAddonMessage("HealComm", "Healstop");
|
||||||
if HealBot_HealsIn[uname] then
|
if HealBot_HealsIn[uname] then
|
||||||
HealBot_HealsIn[uname] = HealBot_HealsIn[uname] - HealBot_HealValue;
|
HealBot_HealsIn[uname] = HealBot_HealsIn[uname] - HealBot_HealValue;
|
||||||
if HealBot_HealsIn[uname] < 0 then
|
if HealBot_HealsIn[uname] < 0 then
|
||||||
|
|||||||
+18
-16
@@ -36,22 +36,24 @@ function HealBot_Integrations_Toggle()
|
|||||||
HealBot_NampowerFrame:RegisterEvent("AURA_CAST_ON_OTHER")
|
HealBot_NampowerFrame:RegisterEvent("AURA_CAST_ON_OTHER")
|
||||||
HealBot_NampowerFrame:SetScript("OnEvent", function()
|
HealBot_NampowerFrame:SetScript("OnEvent", function()
|
||||||
if not HealBot_Integrations_Nampower_Active then return end
|
if not HealBot_Integrations_Nampower_Active then return end
|
||||||
local spellID, caster, target, _, _, _, _, duration = arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8
|
if event == "AURA_CAST_ON_SELF" or event == "AURA_CAST_ON_OTHER" then
|
||||||
if not caster or not target or duration <= 0 then return end
|
local spellID, caster, target, _, _, _, _, duration = arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8
|
||||||
|
if not caster or not target or duration <= 0 then return end
|
||||||
local spellName = GetSpellRecField(spellID, "name")
|
|
||||||
if not spellName then return end
|
local spellName = GetSpellRecField(spellID, "name")
|
||||||
|
if not spellName then return end
|
||||||
if not HealBot_Nampower_Auras[target] then
|
|
||||||
HealBot_Nampower_Auras[target] = {}
|
if not HealBot_Nampower_Auras[target] then
|
||||||
end
|
HealBot_Nampower_Auras[target] = {}
|
||||||
|
end
|
||||||
local expirationTime = GetTime() + (duration / 1000)
|
|
||||||
HealBot_Nampower_Auras[target][spellName] = expirationTime
|
local expirationTime = GetTime() + (duration / 1000)
|
||||||
|
HealBot_Nampower_Auras[target][spellName] = expirationTime
|
||||||
local unitID = HealBot_Model:GetUnitIDByName(target)
|
|
||||||
if unitID then
|
local unitID = HealBot_Model:GetUnitIDByName(target)
|
||||||
HealBot_OnEvent_UnitAura(nil, unitID)
|
if unitID then
|
||||||
|
HealBot_OnEvent_UnitAura(nil, unitID)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\
|
|||||||
### Change Log
|
### Change Log
|
||||||
|
|
||||||
**v1.7.1**
|
**v1.7.1**
|
||||||
|
* **Bug Fix - Incoming Heals Comms** - Fixed a regex string parsing bug that caused incoming heals from other HealBot instances to drop if a unit's name contained non-alphabetic characters (e.g. dashes or spaces in pet names).
|
||||||
|
* **Feature - Standard HealComm Sync** - Implemented lightweight parsing of the standard `HealComm` addon channel. HealBot now perfectly syncs incoming heals with modern raid frames like Luna, Grid, and pfUI, while retaining backwards compatibility with older versions of HealBot.
|
||||||
* **UI Update - Raid Marks** - Anchored raid target icons to top of unit frames instead of center.
|
* **UI Update - Raid Marks** - Anchored raid target icons to top of unit frames instead of center.
|
||||||
* **Bug Fix** - Fixed an issue where the debuff warning sound and UI message would spam repeatedly on every aura update. The warning now only plays once per unique dispellable debuff type applied to a unit. Increased warning trigger range to 40 yards.
|
* **Bug Fix** - Fixed an issue where the debuff warning sound and UI message would spam repeatedly on every aura update. The warning now only plays once per unique dispellable debuff type applied to a unit. Increased warning trigger range to 40 yards.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user