Skip to content

Commit

Permalink
HealComm disabled by default in classic
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Mar 23, 2022
1 parent df3f6ea commit 95b91e5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 30 deletions.
60 changes: 30 additions & 30 deletions Aptechka.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ if apiLevel <= 2 then
UnitHasVehicleUI = dummyFalse
UnitInVehicle = dummyFalse
UnitUsingVehicle = dummyFalse
UnitGetIncomingHeals = dummy0
UnitGetTotalAbsorbs = dummy0
UnitGetTotalHealAbsorbs = dummy0
UnitPhaseReason = dummyFalse
Expand Down Expand Up @@ -140,6 +139,7 @@ local tankUnits = {}
local staggerUnits = {}
local LibTranslit = LibStub("LibTranslit-1.0")

local GetIncomingHealsCustom -- upvalue to swap based on HealComm usage
-- Classic things
local HealComm
local LibClassicDurations = LibStub("LibClassicDurations", true)
Expand All @@ -159,6 +159,7 @@ _G.BINDING_NAME_APTECHKA_DEBUFF_TOOLTIP_HOLD = L"Debuff Tooltip Toggle(Hold)"

local defaults = {
global = {
useHealComm = false,
disableBlizzardPlayer = false,
disableBlizzardParty = true,
hideBlizzardRaid = true,
Expand Down Expand Up @@ -377,7 +378,7 @@ function Aptechka.PLAYER_LOGIN(self,event,arg1)
end

if config.enableIncomingHeals then
if apiLevel <= 2 then
if apiLevel <= 2 and Aptechka.db.global.useHealComm then
HealComm = LibStub:GetLibrary("LibHealComm-4.0",true);
local incomingHealIgnoreHots = false
if HealComm then
Expand All @@ -390,6 +391,32 @@ function Aptechka.PLAYER_LOGIN(self,event,arg1)
HealComm.RegisterCallback(self, "HealComm_HealStarted", "HealUpdated");
HealComm.RegisterCallback(self, "HealComm_HealStopped", "HealUpdated");
end

function Aptechka:HealUpdated(event, casterGUID, spellID, healType, endTime, ...)
for i=1,select('#', ...) do
local targetGUID = select(i, ...)
local unit = guidMap[targetGUID]
if unit then
Aptechka:UNIT_HEAL_PREDICTION(nil, unit, targetGUID)
end
end
end

local incomingHealTimeframe = 3.5

GetIncomingHealsCustom = function (unit, excludePlayer)
local guid = UnitGUID(unit)
local heal = HealComm:GetHealAmount(guid, HealComm.AptechkaHealType, GetTime()+incomingHealTimeframe)
return heal or 0
end

function Aptechka.UNIT_HEAL_PREDICTION(self,event,unit)
self:UNIT_HEALTH(event, unit)

local heal = GetIncomingHealsCustom(unit, false)
local showHeal = (heal and heal > threshold)
SetJob(unit, config.IncomingHealStatus, showHeal, "INCOMING_HEAL", heal)
end
else
self:RegisterEvent("UNIT_HEAL_PREDICTION")
end
Expand Down Expand Up @@ -999,7 +1026,7 @@ function Aptechka:ReconfigureProtected()
Aptechka:UpdateBorder()
end

local function GetIncomingHealsCustom(unit, excludePlayer)
GetIncomingHealsCustom = function(unit, excludePlayer)
local heal = UnitGetIncomingHeals(unit)
if excludePlayer then
local myheal = UnitGetIncomingHeals(unit, "player")
Expand All @@ -1014,33 +1041,6 @@ function Aptechka.UNIT_HEAL_PREDICTION(self,event,unit)
self:UNIT_HEALTH(event, unit)
end

if apiLevel <= 2 then
function Aptechka:HealUpdated(event, casterGUID, spellID, healType, endTime, ...)
for i=1,select('#', ...) do
local targetGUID = select(i, ...)
local unit = guidMap[targetGUID]
if unit then
Aptechka:UNIT_HEAL_PREDICTION(nil, unit, targetGUID)
end
end
end

local incomingHealTimeframe = 3.5

GetIncomingHealsCustom = function (unit, excludePlayer)
local guid = UnitGUID(unit)
local heal = HealComm:GetHealAmount(guid, HealComm.AptechkaHealType, GetTime()+incomingHealTimeframe)
return heal or 0
end

function Aptechka.UNIT_HEAL_PREDICTION(self,event,unit)
self:UNIT_HEALTH(event, unit)

local heal = GetIncomingHealsCustom(unit, false)
local showHeal = (heal and heal > threshold)
SetJob(unit, config.IncomingHealStatus, showHeal, "INCOMING_HEAL", heal)
end
end
function Aptechka:GetIncomingHeals(...)
return GetIncomingHealsCustom(...)
end
Expand Down
13 changes: 13 additions & 0 deletions Options/GlobalSettings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,19 @@ function ns.MakeGlobalSettings()
Aptechka:UpdateDebuffScanningMethod()
end
},
useHealComm = {
name = L"Use LibHealComm"..newFeatureIcon,
desc = L"Gives hots in incoming healing, may cause errors",
type = "toggle",
disabled = not isClassic,
width = "full",
order = 17,
get = function(info) return Aptechka.db.global.useHealComm end,
set = function(info, v)
Aptechka.db.global.useHealComm = not Aptechka.db.global.useHealComm
Aptechka:PrintReloadUIWarning()
end
},
useCLH = {
name = L"Use LibCLHealth",
desc = L"More frequent health updates based combat log",
Expand Down

0 comments on commit 95b91e5

Please sign in to comment.