Set a player's threat to 0 (for display purposes) if the player's threat is less than 0. This occurs on Fade and Mirror Image, which gives the caster a temporary threat reduction of 410057408 (or 4.1m threat in Omen's terms). Previously Omen ignored players with negative threat.

This commit is contained in:
Xinhuan
2008-12-18 13:13:44 +08:00
parent dcf493fe7d
commit 18c0419696
+7 -5
View File
@@ -1289,7 +1289,9 @@ local function updatethreat(unitid, mobunitid)
local guid = UnitGUID(unitid)
if guid and not threatTable[guid] then
local isTanking, state, scaledPercent, rawPercent, threatValue = UnitDetailedThreatSituation(unitid, mobunitid)
threatTable[guid] = threatValue or -1
-- Threat can be negative due to temporary threat reduction effects such as Fade and Mirror Image.
-- So we cap the minimum threat to display at 0. We use the special value -1 to indicate nil here.
threatTable[guid] = (threatValue and (threatValue >= 0 and threatValue or 0)) or -1
if threatValue and threatValue > topthreat then topthreat = threatValue end
if isTanking then tankGUID = guid end
end
@@ -1442,7 +1444,7 @@ function Omen:UpdateBarsReal()
-- Sort the threatTable
local i = 1
for k, v in pairs(threatTable) do
if v >= 0 then
if v ~= -1 then
sortTable[i] = k
i = i + 1
end
@@ -1507,13 +1509,13 @@ function Omen:UpdateBarsReal()
-- Update the text on the bar
bar.Text1:SetText(guidNameLookup[guid])
if dbBar.ShowPercent and dbBar.ShowValue then
if dbBar.ShortNumbers and threat > 100000 then
if dbBar.ShortNumbers and threat >= 100000 then
bar.Text2:SetFormattedText("%2.1fk [%d%%]", threat / 100000, tankThreat == 0 and 0 or threat / tankThreat * 100)
else
bar.Text2:SetFormattedText("%d [%d%%]", threat / 100, tankThreat == 0 and 0 or threat / tankThreat * 100)
end
elseif dbBar.ShowValue then
if dbBar.ShortNumbers and threat > 100000 then
if dbBar.ShortNumbers and threat >= 100000 then
bar.Text2:SetFormattedText("%2.1fk", threat / 100000)
else
bar.Text2:SetFormattedText("%d", threat / 100)
@@ -1532,7 +1534,7 @@ function Omen:UpdateBarsReal()
-- Update the width of the bar, and animate if necessary
local width = w * threat / topthreat
if width == 0 then width = 1 end
if width <= 0 then width = 1 end
if dbBar.AnimateBars and self.Anchor.IsMovingOrSizing ~= 2 then
bar:AnimateTo(width)
else