Thread Tools Display Modes
09-15-12, 02:16 PM   #1
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
Seal Tag help(Solved)

Hey fellow wowi'ers!

I used to use a tag for monitoring if i was lazy and forgot to have my seal activated.

Now when they changed the seals to stancebar this obviously does not work anymore because it doesn't seem to give me an actual buff i assume? not very good at coding im afraid so im reaching out if anyone could point me in the right direction to make my tag work.

Lua Code:
  1. oUF.Tags.Methods["seal"] = function(unit)
  2.         if(not UnitAura(unit, spells["Seal of Insight"]) and not UnitAura(unit, spells["Seal of truth"])) then
  3.             return "|cffE0E0E0NO SEAL|r"
  4.         end
  5.     end
  6.     oUF.Tags.Events["seal"] = "UNIT_AURA"

Thanks

Last edited by nin : 09-15-12 at 05:33 PM. Reason: solved
  Reply With Quote
09-15-12, 03:03 PM   #2
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
http://www.wowwiki.com/API_GetShapeshiftForm
http://www.wowwiki.com/API_GetShapeshiftFormInfo

There's all the information you would need to fiddle around with the stance stuff.

Here's something untested...
Code:
    oUF.Tags.Methods["seal"] = function(unit)
            local nStance = GetShapeshiftForm()
            if not nStance then
                return "|cffE0E0E0NO SEAL|r"
            end
        end
        oUF.Tags.Events["seal"] = "UPDATE_SHAPESHIFT_FORMS"
I'm not sure when UPDATE_SHAPESHIFT_FORMS fires but you may have to also add ACTIVE_TALENT_GROUP_CHANGED to the events as well.
__________________
AddOns: Tim @ WoWInterface
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
09-15-12, 05:11 PM   #3
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
Thanks a bunch!

Lua Code:
  1. oUF.Tags.Methods["seal"] = function(unit)
  2.      local nStance = GetShapeshiftForm() ~= 3
  3.      if nStance then
  4.      return "|cffFFAB00No Seal|r"
  5.      end
  6.      end
  7.      oUF.Tags.Events["seal"] = "UNIT_AURA UPDATE_SHAPESHIFT_FORM"


Unit_aura, GetShapeshiftForm() ~= 3, and using UPDATE_SHAPESHIFT_FORM and not UPDATE_SHAPESHIFT_FORMS made it working.

Result when i don't have seal of insight activated!
Attached Thumbnails
Click image for larger version

Name:	seal.jpg
Views:	5411
Size:	20.5 KB
ID:	7187  

Last edited by nin : 09-15-12 at 05:13 PM.
  Reply With Quote
09-15-12, 09:20 PM   #4
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
You don't need UNIT_AURA and it fires a lot. You maybe do need UPDATE_SHAPESHIFT_FORMS because it fires after login even if you don't have an active seal (stance) (that's not interesting as oUF will update your tag OnShow) and for the case where you (un)learn a stance that replaces your currently active stance as it then deactivates without firing UPDATE_SHAPESHIFT_FORM (this happens when you (un)learn Aspect of the Iron Hawk on a hunter, don't know if there is such a case for paladins).

Apart from that, you have to add the two events to oUF.Tags.SharedEvents as they fire only for the player and are thus unitless (don't have arg1 set to a unitid).

So your code would have to look something like this:

lua Code:
  1. oUF.Tags.Methods["seal"] = function(unit)
  2.     local nStance = GetShapeshiftForm() ~= 3
  3.     if nStance then
  4.         return "|cffFFAB00No Seal|r"
  5.     end
  6. end
  7. oUF.Tags.Events["seal"] = "UPDATE_SHAPESHIFT_FORMS UPDATE_SHAPESHIFT_FORM"
  8. oUF.Tags.SharedEvents.UPDATE_SHAPESHIFT_FORM = true
  9. oUF.Tags.SharedEvents.UPDATE_SHAPESHIFT_FORMS = true

Alternatively you could use just UNIT_AURA to update the tag (as you currently do, as you do not add UPDATE_SHAPESHIFT_FORM to the SharedEvents table), because it fires when you change your seal (even if you don't get a visible buff for this), but this would be more expensive I believe as oUF only updates your tag if the frame, on which the tag is and the unit, which the event has fired for, are the same. UNIT_AURA fires a lot in a raid, so oUF would have to make this decision quite often (maybe support for the new RegisterUnitEvent would alleviate this). UPDATE_SHAPESHIFT_FORM is also fired when you cast certain spells, don't know why, so I can't tell for sure which one is the better method. Using both UNIT_AURA and UPDATE_SHAPESHIFT_FORM is certainly a waste.
  Reply With Quote
09-15-12, 10:47 PM   #5
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
Thanks for the info Rainrider!

Is using a tag like this a really bad way to track this. in terms of efficiency?

Your tag worked great, i tried unit_aura just because it was the only thing i got working when trying, note to self is not to try coding at 7 in the morning.

One issue i just realized if i want to use this with offspec is that i need to assign the tag to my mainspec somehow, since prot and ret get more seals than holy.

Im guessing i can use GetSpecialization() somewhere?

Sleeptime.. i'll play around with it more later!

Thanks for the help and info, i appreciate it!

EDIT

Trying this now, and it makes it only work when im in holyspec.

Lua Code:
  1. oUF.Tags.Methods["seal"] = function(unit)
  2.     local spec = GetSpecialization() == 1
  3.     local nStance = GetShapeshiftForm() ~= 3
  4.     if nStance and spec then
  5.         return "|cffFFAB00No Seal|r"
  6.     end
  7. end
  8. oUF.Tags.Events["seal"] = "UPDATE_SHAPESHIFT_FORMS UPDATE_SHAPESHIFT_FORM"
  9. oUF.Tags.SharedEvents.UPDATE_SHAPESHIFT_FORM = true
  10. oUF.Tags.SharedEvents.UPDATE_SHAPESHIFT_FORMS = true

Last edited by nin : 09-16-12 at 05:16 AM.
  Reply With Quote
09-16-12, 07:24 AM   #6
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Using a tag for this is not bad in term of efficiency. You could squeeze out some more cpu time by increasing memory usage when you declare a local handle for the API functions that are called often. I don't think that's needed in your case as I believe this won't be noticeable.

If you only want to be warned that you forgot Seal of Insight when holy spec'd, then your code is ok.

Last edited by Rainrider : 09-16-12 at 07:31 AM. Reason: than is not then
  Reply With Quote
09-16-12, 08:41 AM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
On a somewhat-related note, you don't need to create a variable assignment to store a function's return value if you're only going to use that value once. Compare:
Code:
	local spec = GetSpecialization() == 1
	local nStance = GetShapeshiftForm() ~= 3
	if nStance and spec then
		return "|cffFFAB00No Seal|r"
	end
Code:
	if GetSpecialization() == 1 and GetShapeshiftForm() ~= 3 then
		return "|cffFFAB00No Seal|r"
	end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-16-12, 01:22 PM   #8
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
Great, thanks so much guys!
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Seal Tag help


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