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 @@
+
Index: modules/StatusHealth.lua
===================================================================
--- modules/StatusHealth.lua (revision 81960)
+++ modules/StatusHealth.lua (working copy)
@@ -3,6 +3,7 @@
local Health = Grid2.statusPrototype:new("health")
local LowHealth = Grid2.statusPrototype:new("lowhealth")
local Death = Grid2.statusPrototype:new("death")
+local HealthDeficit = Grid2.statusPrototype:new("healthdeficit");
Health.defaultDB = {
profile = {
@@ -16,6 +17,7 @@
if Health.enabled then Health:UpdateIndicators(unit) end
if LowHealth.enabled then LowHealth:UpdateIndicators(unit) end
if Death.enabled then Death:UpdateIndicators(unit) end
+ if HealthDeficit.enabled then HealthDeficit:UpdateIndicators(unit) end
end
local EnableHealthFrame
@@ -124,3 +126,27 @@
end
Grid2:RegisterStatus(Death, { "text", "color" })
+
+HealthDeficit.defaultDB = {
+ profile = {
+ threshold = 0.2,
+ }
+}
+
+function HealthDeficit:OnEnable()
+ EnableHealthFrame(true)
+end
+
+function HealthDeficit:OnDisable()
+ EnableHealthFrame(false)
+end
+
+function HealthDeficit:IsActive(unit)
+ return (1 - Health:GetPercent(unit)) > self.db.profile.threshold
+end
+
+function HealthDeficit:GetText(unit)
+ return Grid2:GetShortNumber(-(UnitHealthMax(unit) - UnitHealth(unit)))
+end
+
+Grid2:RegisterStatus(HealthDeficit, {"text"})
Index: modules/IndicatorCorner.lua
===================================================================
--- modules/IndicatorCorner.lua (revision 81960)
+++ modules/IndicatorCorner.lua (working copy)
@@ -7,7 +7,7 @@
Corner:SetHeight(cornerSize)
Corner:SetBackdrop({
bgFile = "Interface\\Addons\\Grid2\\white16x16", tile = true, tileSize = 16,
- edgeFile = "Interface\\Addons\\Grid2\\white16x16", edgeSize = 0,
+ --edgeFile = "Interface\\Addons\\Grid2\\white16x16", edgeSize = 0,
insets = {left = 0, right = 0, top = 0, bottom = 0},
})
Corner:SetBackdropBorderColor(0,0,0,1)