Thread Tools Display Modes
01-04-10, 12:39 AM   #1
Aerials
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 92
Threat indication

Hi, was wondering if anyone could help me with this. Basically, I like oUF_Banzai, but it doesn't show when players have high threat like the default Blizz frames do, it only shows when they have aggro. what I'm trying to do is mimic the default party frame's threat indication as closely as I can.
(border = yellow when unit has high threat, red when has aggro, etc...)

this is what I have for the function so far.... it's a bit of a mess right now 'cuz I just started on it today and I'm a total noob


Code:
local updateThreat = function(self, event, unit)
	if(unit and unit ~= self.unit) then
	elseif unit == nil then
	else
		local threatSituation = UnitThreatSituation(unit)
		local Tr, Tg, Tb = GetThreatStatusColor(threatSituation)
		if (threatSituation and threatSituation > 0) then
			self.Border:SetBackdropBorderColor(Tr, Tg, Tb, 1)
		else
			self.Border:SetBackdropBorderColor(.3, .3, .3, 1)
		end
	end
--[[
Registered to:

"UNIT_THREAT_SITUATION_UPDATE"
"RAID_ROSTER_UPDATE"
"PARTY_MEMBERS_CHANGED"
--]]

end
it actually works for the most part.... just doesn't work entirely.... I'm guessing it's because I'm not checking for threat against another unit, but I didn't want it to be limited to the unit's target or player's target (whole point is for healing, good to know if someone is going to pull aggro on something durring AOE, seeing how this seems to be incredibly common now). the blizz frames actually have this functionality, but it's been a mess trying to track down exactly how it's done.

this is how the blizzard frames seem to decide what to check threat against:

Code:
		if ( indicator.feedbackUnit ~= indicator.unit ) then
			status = UnitThreatSituation(indicator.feedbackUnit, indicator.unit);
		else
			status = UnitThreatSituation(indicator.feedbackUnit);
		end
but I can't track down (entirely) where they get indicator.feedbackUnit and indicator.unit from.

anyways, this is a kinda long post... gonna stop it here, I think I gave enough info for you all to see what I'm trying to do, what i have and what I've tried.



Thanks
Aerials
  Reply With Quote
01-04-10, 03:57 AM   #2
Tekkub
A Molten Giant
 
Tekkub's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 960
If you want the Blizzard threat functionality, then just use the built in API. There's already a module in oUF that will do it for you...
__________________
I have reached enlightment.
Thank you bacon!
  Reply With Quote
01-04-10, 07:52 AM   #3
Aerials
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 92
nice to know that is there never saw it before really. haven't tried it out yet, but still only checks UnitThreatSituation(unit), so i don't see how it would do anymore than what i've done. also, without overriding it anyway, i don't think it would be able to apply the color to the edge of the border like i was doing. could easily be wrong though.

anyway, thanks for pointing it out, i'll give it a try
  Reply With Quote
01-04-10, 09:33 AM   #4
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
See oUF/elements/threat.lua:
Code:
--[[
	Elements handled: .Threat

	Functions that can be overridden from within a layout:
	 - :PreUpdateThreat(event, unit)
	 - :OverrideUpdateThreat(event, unit, status)
	 - :PostUpdateThreat(event, unit, status)
--]]
  Reply With Quote
01-04-10, 10:50 AM   #5
Aerials
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 92
i read threat.lua last night after getting the first response, i know that it can be overridden, i know how i would override it to make it color the edge instead of a .Threat element that i wouldn't have anywhere to put really and wouldn't be what i'm wanting in any situation really, I just don't see the point in that when the few lines i have do what it does on what I'd override it to already.

Anyways, what i have so far works good enough, I was just hoping to get it closer to how the default (blizzard) ones work (for example, all frames other than tank will be yellow for a itty until the tank establishes threat on all mobs, thus u can start big pew pew aoe w/o getting wtfroflpwn'd in the face by something for jumping the gun).

Last edited by Aerials : 01-04-10 at 10:52 AM.
  Reply With Quote
01-04-10, 12:05 PM   #6
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
That has only happened to me when all the players are on the threat table of some temporarily immune or talking boss. Not sure where last....

And the event and function only returns the threat if you are on a table.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
01-04-10, 03:02 PM   #7
Aerials
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 92
yah, it's working fine now.... dono which change i made fixed it, it used to sometimes not show threat at all when you do have aggro, etc.... and wouldn't ever show high threat on off targets, etc. for some reason.
  Reply With Quote
01-04-10, 06:31 PM   #8
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
You can replace the .Threat element with whatever custom object you want really. The only thing it has to implement is:
- :IsObjectType() -- Can just be a dummy func.
- :SetVertexColor()
- :Show()
- :Hide()

Quick example related to your code would be:
Re-name self.Border to self.Threat, then do:
self.Threat.SetVertexColor = self.Threat.SetBackdropBorderColor
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Threat indication


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off