Skip to content

Commit

Permalink
Fix #724 , #716
Browse files Browse the repository at this point in the history
  • Loading branch information
Aviana committed Jul 9, 2020
1 parent cc60628 commit 7709eb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 36 deletions.
18 changes: 1 addition & 17 deletions modules/incheal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,33 +233,17 @@ function IncHeal:Update(frame)
self:PositionBar(frame)
end

function IncHeal:UpdateMod(frame)
frame.healValues.mod = HealComm:GetHealModifier(frame.unitGUID) or 1

if( not frame.visibility.incHeal or not frame.visibility.healthBar ) then return end
self:PositionBar(frame)
end

function IncHeal:UpdateIncoming(...)
for frame in pairs(frames) do
for i=1, select("#", ...) do
if( select(i, ...) == frame.unitGUID ) and (UnitPlayerOrPetInParty(frame.unit) or UnitPlayerOrPetInRaid(frame.unit) or UnitIsUnit("player",frame.unit) or UnitIsUnit("pet",frame.unit)) then
if select(i, ...) == frame.unitGUID then
self:Update(frame)
break
end
end
end
end

function IncHeal:UpdateModifier(guid)
for frame in pairs(frames) do
if( guid == frame.unitGUID ) and (UnitPlayerOrPetInParty(frame.unit) or UnitPlayerOrPetInRaid(frame.unit) or UnitIsUnit("player",frame.unit) or UnitIsUnit("pet",frame.unit)) then
self:UpdateMod(frame)
break
end
end
end

-- Handle callbacks from HealComm
function IncHeal:HealComm_HealUpdated(event, casterGUID, spellID, healType, endTime, ...)
IncHeal:UpdateIncoming(...)
Expand Down
25 changes: 6 additions & 19 deletions modules/units.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,6 @@ function Units:CheckUnitStatus(frame)
end
end

-- The argument from UNIT_PET is the pets owner, so the player summoning a new pet gets "player", party1 summoning a new pet gets "party1" and so on
function Units:CheckPetUnitUpdated(frame, event, unit)
if( unit == frame.unitRealOwner and UnitExists(frame.unit) ) then
frame.unitGUID = UnitGUID(frame.unit)
frame:FullUpdate()
end
end

function Units:CheckGroupedUnitStatus(frame)
frame.unitGUID = UnitGUID(frame.unit)
frame:FullUpdate()
Expand Down Expand Up @@ -402,18 +394,10 @@ OnAttributeChanged = function(self, name, unit)

-- Pet changed, going from pet -> vehicle for one
if( self.unitType == "pet" or self.unitType == "partypet" ) then
self.unitRealOwner = self.unit == "pet" and "player" or self.unitID and ("party"..self.unitID)
self:RegisterNormalEvent("UNIT_PET", Units, "CheckPetUnitUpdated")
self:RegisterNormalEvent("UNIT_PET", Units, "CheckUnitStatus")

elseif( self.unitType == "raidpet" ) then
if self.unit == "pet" then
self.unitRealOwner = "player"
elseif strmatch(self.unit,"^party.*") then
self.unitRealOwner = "party"..self.unitID
else
self.unitRealOwner = "raid"..self.unitID
end
self:RegisterNormalEvent("UNIT_PET", Units, "CheckPetUnitUpdated")
self:RegisterNormalEvent("UNIT_PET", Units, "CheckUnitStatus")

-- Automatically do a full update on target change
elseif( self.unitType == "target" ) then
Expand Down Expand Up @@ -441,6 +425,9 @@ OnAttributeChanged = function(self, name, unit)
self:RegisterUnitEvent("UNIT_OTHER_PARTY_CHANGED", self, "FullUpdate")
self:RegisterUnitEvent("UNIT_CONNECTION", self, "FullUpdate")

elseif( string.match(self.unitType, "^maintank.*") or string.match(self.unitType, "^mainassist.*") ) then
self:RegisterNormalEvent("PLAYER_ROLES_ASSIGNED", Units, "CheckGroupedUnitStatus")

end
-- *target units are not real units, thus they do not receive events and must be polled for data
if( LunaUF.fakeUnits[self.unitType] ) then
Expand All @@ -452,7 +439,7 @@ OnAttributeChanged = function(self, name, unit)
self:RegisterNormalEvent("PLAYER_TARGET_CHANGED", Units, "CheckUnitStatus")
end

self:RegisterNormalEvent("UNIT_TARGET", Units, "CheckPetUnitUpdated")
self:RegisterNormalEvent("UNIT_TARGET", Units, "CheckUnitStatus")
end

self:CheckModules()
Expand Down

0 comments on commit 7709eb4

Please sign in to comment.