mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- made the threat module use raw threat percentages by default so that its display matches Omen's.
- added an option to the threat module to display the scaled percent (the old method) instead of raw. this will cause it to disagree with Omen, but it's displaying the same information, only in a different way
This commit is contained in:
@ -677,6 +677,10 @@ end
|
||||
|
||||
-- rounding stuff
|
||||
function IceHUD:MathRound(num, idp)
|
||||
if not num then
|
||||
return nil
|
||||
end
|
||||
|
||||
local mult = 10^(idp or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -36,6 +36,7 @@ function IHUD_Threat.prototype:GetDefaultSettings()
|
||||
settings["aggroAlpha"] = 0.7
|
||||
settings["usesDogTagStrings"] = false
|
||||
settings["onlyShowInGroups"] = true
|
||||
settings["showScaledThreat"] = false
|
||||
return settings
|
||||
end
|
||||
|
||||
@ -99,6 +100,23 @@ function IHUD_Threat.prototype:GetOptions()
|
||||
order = 27.6
|
||||
}
|
||||
|
||||
opts["showScaledThreat"] = {
|
||||
type = 'toggle',
|
||||
name = 'Show scaled threat',
|
||||
desc = 'Whether to show threat in scaled values or raw values. Scaled threat means that you will pull aggro when it hits 100%. Raw threat means you will pull aggro at either 110% (melee) or 130% (ranged). Omen uses raw threat which can cause this mod to disagree with Omen if it is in scaled mode.',
|
||||
get = function()
|
||||
return self.moduleSettings.showScaledThreat
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.showScaledThreat = v
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 27.7
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
@ -193,24 +211,38 @@ function IHUD_Threat.prototype:Update(unit)
|
||||
local isTanking, threatState, scaledPercent, rawPercent = UnitDetailedThreatSituation("player", "target")
|
||||
local scaledPercentZeroToOne
|
||||
|
||||
if not self.combat and scaledPercent == 0 then
|
||||
if not self.combat and (scaledPercent == 0 or rawPercent == 0) then
|
||||
self:Show(false)
|
||||
return
|
||||
end
|
||||
|
||||
if not rawPercent then
|
||||
rawPercent = 0
|
||||
end
|
||||
|
||||
if rawPercent < 0 then
|
||||
rawPercent = 0
|
||||
elseif isTanking then
|
||||
rawPercent = 100
|
||||
end
|
||||
|
||||
if not threatState or not scaledPercent or not rawPercent then
|
||||
scaledPercentZeroToOne = 0
|
||||
scaledPercent = 0
|
||||
|
||||
IceHUD:Debug( "Threat: nil threat on valid target" )
|
||||
else
|
||||
scaledPercentZeroToOne = scaledPercent / 100
|
||||
if self.moduleSettings.showScaledThreat then
|
||||
scaledPercentZeroToOne = scaledPercent / 100
|
||||
else
|
||||
scaledPercentZeroToOne = rawPercent / 100
|
||||
end
|
||||
|
||||
IceHUD:Debug( "isTanking="..(isTanking or "nil").." threatState="..(threatState or "nil").." scaledPercent="..(scaledPercent or "nil").." rawPercent="..(rawPercent or "nil") )
|
||||
end
|
||||
|
||||
-- set percentage text
|
||||
self:SetBottomText1( IceHUD:MathRound(scaledPercent) .. "%" )
|
||||
self:SetBottomText1( IceHUD:MathRound(self.moduleSettings.showScaledThreat and scaledPercent or rawPercent) .. "%" )
|
||||
self:SetBottomText2()
|
||||
|
||||
-- Parnic: threat lib is no longer used in wotlk
|
||||
|
Reference in New Issue
Block a user