Index: modules/StatusHeals.lua =================================================================== --- modules/StatusHeals.lua (revision 81960) +++ modules/StatusHeals.lua (working copy) @@ -63,8 +63,28 @@ self:UnregisterMessage("Grid_RosterUpdated") self:UnregisterMessage("Grid_PetChanged") end +local playerIsCasting = false +local playerHealingTargetName = nil +local playerHealingSize = 0 +local playerEndTime = 0 function Heals:Update(event, healerName, healSize, endTime, ...) + if event == 'HealComm_DirectHealStart' then + if healerName == UnitName("player") then + playerIsCasting = true + playerHealingTargetName = ... + playerHealingSize = healSize + playerEndTime = endTime + end + else + if healerName == UnitName("player") then + playerIsCasting = false + playerHealingTargetName = nil + playerHealingSize = 0 + playerEndTime = 0 + end + end + -- @FIXME: fix self heals. for i = 1, select("#", ...) do local name = select(i, ...) @@ -74,7 +94,12 @@ end function Heals:IsActive(unit) - local heal = HealComm:UnitIncomingHealGet(rosterCache[unit], GetTime() + 100) + if playerIsCasting then + isCastingOnThisUnit = playerHealingTargetName == UnitName(unit) + end + + if isCastingOnThisUnit and playerHealingSize > 0 then return true end + local heal = HealComm:UnitIncomingHealGet(rosterCache[unit], GetTime()+100) return heal and heal > 0 end @@ -89,11 +114,29 @@ return color.r, color.g, color.b, color.a end -function Heals:GetText(unit) +function Heals:GetHealingOnUnit(unit) + if playerIsCasting then + isCastingOnThisUnit = playerHealingTargetName == UnitName(unit) + end + local name = rosterCache[unit] - local heal = HealComm:UnitIncomingHealGet(name, GetTime() + 100) + local heal = 0 + + if isCastingOnThisUnit then + heal = playerHealingSize + end + otherHeals = HealComm:UnitIncomingHealGet(name, GetTime() + 100) + if otherHeals then heal = heal + otherHeals end heal = heal * HealComm:UnitHealModifierGet(name) - return Grid2:GetShortNumber(heal, true) + return heal end -Grid2:RegisterStatus(Heals, { "color", "text" }) +function Heals:GetText(unit) + return Grid2:GetShortNumber(Heals:GetHealingOnUnit(unit), true) +end + +function Heals:GetPercent(unit) + return (Heals:GetHealingOnUnit(unit) + UnitHealth(unit)) / UnitHealthMax(unit) +end + +Grid2:RegisterStatus(Heals, { "color", "text", "percent" }) Index: GridUtils.lua =================================================================== --- GridUtils.lua (revision 81960) +++ GridUtils.lua (working copy) @@ -7,7 +7,7 @@ sign = setPlusSign and "+" or "" end if v >= 1000 then - v = ("%.1fk"):format(v) + v = ("%.1fk"):format(v/1000) end return sign..v end Index: modules.xml =================================================================== --- modules.xml (revision 81960) +++ modules.xml (working copy) @@ -3,6 +3,7 @@