Skip to content

Commit

Permalink
Make use of LibHealComm-4.0 optional (can be loaded/used if installed…
Browse files Browse the repository at this point in the history
… standalone other wise use game api)

Due to LibHealComm-4.0 not being consistently updated only use LibHealComm-4.0 if the user installs it on their own.
  • Loading branch information
doadin committed May 31, 2024
1 parent ff3ecab commit 6c5ab70
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 58 deletions.
3 changes: 0 additions & 3 deletions .pkgmeta-cata
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ externals:
url: https://repos.curseforge.com/wow/libstub/trunk
tag: 1.0
Libs/UTF8: https://repos.curseforge.com/wow/utf8/trunk
Libs/LibHealComm-4.0:
url: https://github.com/doadin/LibHealComm-4.0.git
tag: main
Libs/LibDeflate:
url: https://github.com/doadin/LibDeflate.git
tag: main
Expand Down
3 changes: 0 additions & 3 deletions .pkgmeta-classic
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ externals:
url: https://repos.curseforge.com/wow/libstub/trunk
tag: 1.0
Libs/UTF8: https://repos.curseforge.com/wow/utf8/trunk
Libs/LibHealComm-4.0:
url: https://github.com/doadin/LibHealComm-4.0.git
tag: main
Libs/LibDeflate:
url: https://github.com/doadin/LibDeflate.git
tag: main
Expand Down
3 changes: 0 additions & 3 deletions .pkgmeta-tbc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ externals:
Libs/LibDeflate:
url: https://github.com/doadin/LibDeflate.git
tag: main
Libs/LibHealComm-4.0:
url: https://github.com/doadin/LibHealComm-4.0.git
tag: main

ignore:
- .luacheckrc
Expand Down
3 changes: 0 additions & 3 deletions .pkgmeta-wrath
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ externals:
url: https://repos.curseforge.com/wow/libstub/trunk
tag: 1.0
Libs/UTF8: https://repos.curseforge.com/wow/utf8/trunk
Libs/LibHealComm-4.0:
url: https://github.com/doadin/LibHealComm-4.0.git
tag: main
Libs/LibDeflate:
url: https://github.com/doadin/LibDeflate.git
tag: main
Expand Down
9 changes: 4 additions & 5 deletions Plexus.toc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
## X-Website: https://wow.curseforge.com/projects/plexus/
## X-Curse-Project-ID: 338710

## OptionalDeps: Clique, Ace3, LibDBIcon-1.0, LibDualSpec-1.0, LibResInfo-1.0, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, NickTag-1.0, UTF8
## OptionalDeps: Clique, Ace3, LibDBIcon-1.0, LibDualSpec-1.0, LibResInfo-1.0, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, NickTag-1.0, UTF8, LibHealComm-4.0
## SavedVariables: PlexusDB

## AddonCompartmentFunc: PlexusOnAddonCompartmentClick
Expand Down Expand Up @@ -56,10 +56,9 @@ Libs\LibDualSpec-1.0\LibDualSpec-1.0.lua
#@version-wrath@
Libs\LibDualSpec-1.0\LibDualSpec-1.0.lua
#@end-version-wrath@
#@non-retail@
Libs\LibHealComm-4.0\ChatThrottleLib.lua
Libs\LibHealComm-4.0\LibHealComm-4.0.lua
#@end-non-retail@
#@version-cata@
Libs\LibDualSpec-1.0\LibDualSpec-1.0.lua
#@end-version-cata@
Libs\LibSharedMedia-3.0\LibSharedMedia-3.0.lua
Libs\AceGUI-3.0-SharedMediaWidgets\widget.xml
Libs\UTF8\utf8.lua
Expand Down
70 changes: 29 additions & 41 deletions Statuses/Heals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,21 @@ function PlexusStatusHeals:OnStatusEnable(status)
self:RegisterEvent("UNIT_HEAL_PREDICTION", "UpdateUnit")
end
if Plexus:IsClassicWow() or Plexus:IsTBCWow() or Plexus:IsWrathWow() or Plexus:IsCataWow() then
--local HealComm
assert(_G.LibStub, "Heals Status requires LibStub")
assert(_G.LibStub:GetLibrary("LibHealComm-4.0", true), "Heals Status requires LibHealComm-4.0(which should be included)")
HealComm = _G.LibStub:GetLibrary("LibHealComm-4.0", true) --luacheck: ignore 111
local function HealComm_Heal_Update()
self:UpdateAllUnits()
if HealComm then
local function HealComm_Heal_Update()
self:UpdateAllUnits()
end
local function HealComm_Modified()
self:UpdateAllUnits()
end
HealComm.RegisterCallback(self, 'HealComm_HealStarted', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_HealUpdated', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_HealDelayed', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_HealStopped', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_ModifierChanged', HealComm_Modified)
HealComm.RegisterCallback(self, 'HealComm_GUIDDisappeared', HealComm_Modified)
end

local function HealComm_Modified()
self:UpdateAllUnits()
end

HealComm.RegisterCallback(self, 'HealComm_HealStarted', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_HealUpdated', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_HealDelayed', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_HealStopped', HealComm_Heal_Update)
HealComm.RegisterCallback(self, 'HealComm_ModifierChanged', HealComm_Modified)
HealComm.RegisterCallback(self, 'HealComm_GUIDDisappeared', HealComm_Modified)
end
self:UpdateAllUnits()
end
Expand All @@ -114,17 +111,15 @@ function PlexusStatusHeals:OnStatusDisable(status)
self:UnregisterEvent("UNIT_HEAL_PREDICTION")
end
if Plexus:IsClassicWow() or Plexus:IsTBCWow() or Plexus:IsWrathWow() or Plexus:IsCataWow() then
--local HealComm
assert(_G.LibStub, "Heals Status requires LibStub")
assert(_G.LibStub:GetLibrary("LibHealComm-4.0", true), "Heals Status requires LibHealComm-4.0(which should be included)")
HealComm = _G.LibStub:GetLibrary("LibHealComm-4.0", true) --luacheck: ignore 111

HealComm.UnregisterCallback(self, 'HealComm_HealStarted')
HealComm.UnregisterCallback(self, 'HealComm_HealUpdated')
HealComm.UnregisterCallback(self, 'HealComm_HealDelayed')
HealComm.UnregisterCallback(self, 'HealComm_HealStopped')
HealComm.UnregisterCallback(self, 'HealComm_ModifierChanged')
HealComm.UnregisterCallback(self, 'HealComm_GUIDDisappeared')
if HealComm then
HealComm.UnregisterCallback(self, 'HealComm_HealStarted')
HealComm.UnregisterCallback(self, 'HealComm_HealUpdated')
HealComm.UnregisterCallback(self, 'HealComm_HealDelayed')
HealComm.UnregisterCallback(self, 'HealComm_HealStopped')
HealComm.UnregisterCallback(self, 'HealComm_ModifierChanged')
HealComm.UnregisterCallback(self, 'HealComm_GUIDDisappeared')
end
end
self.core:SendStatusLostAllUnits("alert_heals")
end
Expand All @@ -149,30 +144,23 @@ function PlexusStatusHeals:UpdateUnit(event, unit)

if UnitIsVisible(unit) and not UnitIsDeadOrGhost(unit) then
local incoming = 0
if Plexus:IsRetailWow() then
if Plexus:IsRetailWow() or (not HealComm and not Plexus:IsRetailWow()) then
incoming = UnitGetIncomingHeals(unit) or 0
end
if Plexus:IsClassicWow() or Plexus:IsTBCWow() or Plexus:IsWrathWow() or Plexus:IsCataWow() then
if HealComm and (not Plexus:IsRetailWow()) then
local myIncomingHeal = (HealComm:GetHealAmount(guid, HealComm.ALL_HEALS) or 0) * (HealComm:GetHealModifier(guid) or 1)
incoming = (incoming + myIncomingHeal) or 0
end
--if Plexus:IsTBCWow() or Plexus:IsWrathWow() then
-- local myIncomingHeal = (HealComm:GetHealAmount(guid, HealComm.OVERTIME_AND_BOMB_HEALS) or 0) * (HealComm:GetHealModifier(guid) or 1) + (UnitGetIncomingHeals(unit) or 0)
-- incoming = myIncomingHeal or 0
--if incoming > 0 then
-- if Plexus:IsRetailWow() or Plexus:IsTBCWow() or Plexus:IsWrathWow() then
-- self:Debug("UpdateUnit", unit, incoming, UnitGetIncomingHeals(unit, "player") or 0, format("%.2f%%", incoming / UnitHealthMax(unit) * 100))
-- end
--end
if incoming > 0 then
if Plexus:IsRetailWow() or Plexus:IsTBCWow() or Plexus:IsWrathWow() then
self:Debug("UpdateUnit", unit, incoming, UnitGetIncomingHeals(unit, "player") or 0, format("%.2f%%", incoming / UnitHealthMax(unit) * 100))
end
end
if settings.ignore_self then
if Plexus:IsClassicWow() or Plexus:IsTBCWow() or Plexus:IsWrathWow() or Plexus:IsCataWow() then
if HealComm and (not Plexus:IsRetailWow()) then
incoming = HealComm:GetOthersHealAmount(guid, HealComm.ALL_HEALS) or 0
end
--if Plexus:IsTBCWow() or Plexus:IsWrathWow() then
-- incoming = (HealComm:GetOthersHealAmount(guid, HealComm.OVERTIME_AND_BOMB_HEALS) or 0) + (UnitGetIncomingHeals(unit) - (UnitGetIncomingHeals(unit, "player") or 0))
--end
if Plexus:IsRetailWow() then
if Plexus:IsRetailWow() or (not HealComm and not Plexus:IsRetailWow()) then
incoming = incoming - (UnitGetIncomingHeals(unit, "player") or 0)
end
end
Expand Down

0 comments on commit 6c5ab70

Please sign in to comment.