Simple dogtag to pull data from Threatlib:GetTPS and throw it on your unitframe for people with Threat-2.0 and the pb player threat module. I found this handy because I spend about 90% of my time staring at my unit frames watching my HP while tanking.
in:
$Wowroot$\Interface\Addons\Pitbull\libs\LibDogTag-Unit-3.0\Categories\Threat.lua
Modifications:
After:
local function HasThreat_func(unit) return nil end
Insert:
local function TPS_func(unit) return nil end
-----------------------------------------------------------------------------------------------------------------
After:
function HasThreat_func(unit)
if UnitIsFriend("player", unit) then
if UnitExists("target") then
return ThreatLib:GetThreat(UnitGUID(unit), UnitGUID("target")) > 0
else
return false
end
else
return ThreatLib:GetThreat(playerGuid, UnitGUID(unit)) > 0
end
end
Insert:
function TPS_func(unit)
if UnitIsFriend("player", unit) then
if UnitExists("target") then
return math.floor(ThreatLib:GetTPS(UnitGUID(unit), UnitGUID("target")) + 0.5)
else
return 0
end
else
return math.floor(ThreatLib:GetTPS(playerGuid, UnitGUID(unit)) + 0.5)
end
end
-----------------------------------------------------------------------------------------------------------------
After:
DogTag:AddTag("Unit", "HasThreat", {
code = function(args)
return HasThreat_func
end,
dynamicCode = true,
arg = {
'unit', 'string;undef', 'player'
},
ret = "boolean",
events = "Threat#$unit",
doc = L["Return True if you have threat against enemy unit or friendly unit has threat against your target and if ThreatLib is available"],
example = ('[HasThreat] => %q; [HasThreat] => ""'):format(L["True"]),
category = L["Threat"]
})
Insert:
DogTag:AddTag("Unit", "TPS", {
code = function(args)
return TPS_func
end,
dynamicCode = true,
arg = {
'unit', 'string;undef', 'player'
},
ret = "nil;number",
events = "Threat#$unit",
doc = L["Threat Per Second"],
example = '[TPS] => "950"',
category = L["Threat"]
})
OR:
Threat.lua
TAG:
TPS: [Outline] [(if TPS = 0 then
nil
elseif TPS > 1500 then
TPS:Color("FF3300")
elseif TPS > 1000 then
TPS:Color("3366FF")
elseif TPS < 1000 then
TPS:Green
end)]
colors threat by
green: >1000tps
blue: <1000tps
orange: <1500tps