mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- made the threat module only display while the player is in combat or the player has some threat on his target
- added an option to only display the threat module while in a group. set by default
This commit is contained in:
@ -35,6 +35,7 @@ function IHUD_Threat.prototype:GetDefaultSettings()
|
||||
settings["enabled"] = false
|
||||
settings["aggroAlpha"] = 0.7
|
||||
settings["usesDogTagStrings"] = false
|
||||
settings["onlyShowInGroups"] = true
|
||||
return settings
|
||||
end
|
||||
|
||||
@ -81,6 +82,23 @@ function IHUD_Threat.prototype:GetOptions()
|
||||
order = 21
|
||||
}
|
||||
|
||||
opts["onlyShowInGroups"] = {
|
||||
type = 'toggle',
|
||||
name = 'Only show in groups',
|
||||
desc = 'Only show the threat bar if you are in a group or you have an active pet',
|
||||
get = function()
|
||||
return self.moduleSettings.onlyShowInGroups
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.onlyShowInGroups = v
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 22
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
@ -159,7 +177,13 @@ function IHUD_Threat.prototype:Update(unit)
|
||||
unit = self.unit
|
||||
end
|
||||
|
||||
if not UnitExists("target") or not UnitCanAttack("player", "target") or UnitIsDead("target") or UnitIsFriend("player", "target") or UnitPlayerControlled("target") then
|
||||
if self.moduleSettings.onlyShowInGroups and (GetNumPartyMembers() == 0 and not UnitExists("pet")) then
|
||||
self:Show(false)
|
||||
return
|
||||
end
|
||||
|
||||
if not UnitExists("target") or not UnitCanAttack("player", "target") or UnitIsDead("target")
|
||||
or UnitIsFriend("player", "target") or UnitPlayerControlled("target") then
|
||||
self:Show(false)
|
||||
return
|
||||
else
|
||||
@ -169,6 +193,11 @@ function IHUD_Threat.prototype:Update(unit)
|
||||
local isTanking, threatState, scaledPercent, rawPercent = UnitDetailedThreatSituation("player", "target")
|
||||
local scaledPercentZeroToOne
|
||||
|
||||
if not self.combat and scaledPercent == 0 then
|
||||
self:Show(false)
|
||||
return
|
||||
end
|
||||
|
||||
if not threatState or not scaledPercent or not rawPercent then
|
||||
scaledPercentZeroToOne = 0
|
||||
scaledPercent = 0
|
||||
|
Reference in New Issue
Block a user