WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF - Layout discussion (https://www.wowinterface.com/forums/showthread.php?t=18363)

garnerh42 10-05-08 06:11 PM

Hiding Cooldown
 
Starting with latest oUF and oUF_Ammo layout. I'm using OmniCC for cooldown numbers, but I'd prefer not to show the numbers or clock animation.

I found the block of code in aura.lua that shows or hides the cooldown on the icon, but I haven't been able to figure out what code to call in oUF_Ammo to turn it off permanently. I can, of course, comment out the block of code, but then I'd have to do that every time I get a new version.

I also tried creating my own PostUpdateAuraIcon like looked like this:

Code:

-- params omitted for brevity
local function myPostUpdateAuraIcon ( ... )
    if icon.cd then
        icon.cd:Hide()
    end
end

But that code didn't work. Can someone point me in the right direction, please?

p3lim 10-05-08 06:19 PM

Code:

local function PostCreateAuraIcon(self, button, icons, index, debuff)
        button.cd:Hide()
end

drycoded

MoonWitch 10-05-08 06:46 PM

Quote:

Originally Posted by p3lim (Post 103536)
Code:

local function PostCreateAuraIcon(self, button, icons, index, debuff)
        button.cd:Hide()
end

drycoded

That's what I have to disable omnicc cd counts.

garnerh42 10-05-08 07:43 PM

Well, phooey. I originally tried adding button.cd:Hide() to auraIcon in oUF_Ammo. That's the name of the function that overloaded PostCreateAuraIcon.

Here is what I tried for that:

Code:

local function auraIcon(self, button, icons, index, debuff)
        button.cd:SetReverse()
        button.icon:SetTexCoord(.07, .93, .07, .93) --zoom icon
        button.overlay:SetTexture(bordertexture)
        button.overlay:SetTexCoord(0,1,0,1)
        button.overlay.Hide = noHide
        button.cd:Hide()
end

All I did was add that last line. Thanks for the help!

Slakah 10-06-08 01:16 AM

Quote:

Originally Posted by MoonWitch (Post 103537)
That's what I have to disable omnicc cd counts.

If you want to disable OmniCC for a cooldown frame.

Add a "noCooldownCount" entry for it.

i.e.
Code:

<cooldownframe>.noCooldownCount = true

Caellian 10-06-08 03:46 AM

Aight, progress, by using
Code:

        self:SetScript("OnEnter", function(self)
                if(unit == 'player') then self.Experience:SetAlpha(1) end
                UnitFrame_OnEnter(self)
        end)

        self:SetScript("OnLeave", function(self)
                if(unit == 'player') then self.Experience:SetAlpha(0) end
                UnitFrame_OnLeave(self)
        end)

And then self.Experience:SetAlpha(0) in the Experience block, it's correctly hidden on login, and show/hide when i mouseover the player frame. Also, the experience tooltip shows up when i mouse over the experience bar position but the bar stays hidden, or even better have the tooltip shown when i mouse over the player frame, but i don't think it's doable.

Haste explained this
Quote:

Originally Posted by Haste
You will have to use the OnEnter/OnLeave handler on the frame if you want it to show/hide when you enter the unit frame as a whole however. The above will only work for when you hover the position for the actual frame. You should also use :Hide/:Show in that case, and not :SetAlpha.

But i'm not sure to understand it correctly. What should i change to have the experience bar shown when i mouse over it instead of the player frame ?

Kellen 10-06-08 06:46 AM

I'm setting up player auras and wanted to have them displayed with a numeric duration next to them, like Elk's BuffBars (just time, I don't care about bars).

Looking at the Blizzard API's, it seems like you're only supposed to be able to get durations for things you cast. Elk's code gets around this (I think) with the follow type of code:

Code:

local buffIndex, untilCancelled = GetPlayerBuff(index, "HELPFUL")
local name, rank = GetPlayerBuffName(buffIndex)
local timeleft = GetPlayerBuffTimeLeft(buffIndex)
local timemax = timeleft

It also looks like there's a lookup table in there for recording/comparing the maximum time. Furthermore, I'm aware that the way you get aura information and calculate duration is changing, but until it does, I'd like to do things for the Live server.

I think I can duplicate this, but I'd love two pointers:

1. Is PostUpdateAuraIcon() the hook I want to be using for this? It seems to have the information I want and is per-aura.
2. If so, why is the 'index' parameter a table?

Still noobish with this stuff.

haste 10-06-08 08:27 AM

Quote:

Originally Posted by Kellen (Post 103560)
2. If so, why is the 'index' parameter a table?

It isn't.

Code:

self:PostUpdateAuraIcon(icons, unit, icon, index, offset, filter, isDebuff)
-- is equal to:
self.PostUpdateAuraIcon(self, icons, unit, icon, index, offset, filter, isDebuff)

You're missing an argument in your function, hence to offset. Also do note that EBB only operates on your buffs, and that the index of GetPlayerBuff doesn't equal that of UnitBuff.

Kellen 10-06-08 09:07 AM

Fixing my faulty parameterization makes complete sense.

As to EBB, I suppose it's a good thing that I'm only interested in Buffs then. That code snippet was from EBB code, but likely from a incorrect context. Since I could can query the auras now *cough*, it should be easier to play with and figure out.

Slakah 10-06-08 09:11 AM

Code:


       
Quote:

       
       
               
       
       

                       

                       
                                        self:SetScript("OnEnter", function(self)
                if(unit == 'player') then self.Experience:SetAlpha(1) end
                UnitFrame_OnEnter(self)
        end)

        self:SetScript("OnLeave", function(self)
                if(unit == 'player') then self.Experience:SetAlpha(0) end
                UnitFrame_OnLeave(self)
        end)
                       
                       

               


If you want the experience to be shown when the cursor is over the exp bar as well, then I would add:

Code:

self.Experience:SetScript("OnEnter", function(self)
        self:SetAlpha(1)
end)
self.Experience:SetScript("OnLeave", function(self)
        self:SetAlpha(0)
end)


Seerah 10-06-08 11:54 AM

Quote:

Originally Posted by Kellen (Post 103560)
I'm setting up player auras and wanted to have them displayed with a numeric duration next to them, like Elk's BuffBars (just time, I don't care about bars).

Looking at the Blizzard API's, it seems like you're only supposed to be able to get durations for things you cast. Elk's code gets around this (I think) with the follow type of code:

You always have the time for auras on yourself and your pet(?). It's when the auras are on other units that you only get the time for ones you cast. That's how the API works. And EBB does work for target, but if it's something you didn't cast, it won't have a time for it.

Kellen 10-06-08 12:16 PM

Quote:

Originally Posted by Seerah (Post 103571)
You always have the time for auras on yourself and your pet(?). It's when the auras are on other units that you only get the time for ones you cast. That's how the API works. And EBB does work for target, but if it's something you didn't cast, it won't have a time for it.

My confusion stemmed from the that I'd only be able to query the duration on the auras on myself that I cast.

I was looking through the aura.lua code, saw only references to UnitBuff() and the like. Those functions only return durations on stuff cast by the player, so I thought that was the limitation. Getting information in a general way seems like the best method of doing things, so I didn't even think to search for a player specific version of those functions. GetPlayerBuffTimeLeft() is the ticket. Lesson learned. Thanks for the help!

Frayol 10-07-08 06:47 AM

Quote:

Originally Posted by p3lim (Post 103488)
You can easily do this with custom tags, but it doesnt really have anything to do with unitframes, so thats the reason haste havent implemented it.

I wasn't aware of that, but fair enough. I have been trying to wrap my head around custom tags, but keep hitting a brick wall. :confused:

Quote:

Originally Posted by Slakah (Post 103496)
You could add some custom tags:

Code:

oUF.Tags["[AFK]"] = function(u) return UnitIsAFK(u) and "AFK" or ""
oUF.Tags["[DND]"] = function(u) return UnitIsDND(u) and "DND" or ""

oUF.TagEvents["[AFK]"] = "UNIT_FLAGS"
oUF.TagEvents["[DND]"] = "UNIT_FLAGS"

(note: I'm not certain if the event is correct as I don't have access to WoW currently.)

and then use those tags as you would normally.

Quote:

Originally Posted by p3lim (Post 103497)
PLAYER_FLAGS_CHANGED is the event

(dont be fooled by the name of the event, it works for any unit)

Is there a good example of how to implement this that you know of and I could take a look at? The theory seemed simple enough, but I have failed miserably to understand it. :(

Quokka 10-07-08 08:39 AM

Is there a way to show temp enhancements (Weapon Buffs) in the aura?

p3lim 10-07-08 08:41 AM

Take a look at my raid layout (oUF Perfect), its based on pure tags for text

haste 10-08-08 09:01 AM

Quote:

Originally Posted by Quokka (Post 103642)
Is there a way to show temp enhancements (Weapon Buffs) in the aura?

Not without you doing all the work. The current weapon enchant API is _horrible_, and requires polling to even work. They are completely disconnected from the unit auras, and oUF will _never_ support them as long as that's the case/

Alanor 10-09-08 03:57 AM

I came across a bizzare situation while setting up oUF. I don't think it's strictly related to oUF, but hopefully the bright minds reading this thread will have an idea as to why it happens.

Basically I spawned the party header, and no matter what I did the party members didn't show up. Calling :Show() on the party header manually would show the party for a split second then it would be hidden again. After long time of scratching my head, I decided to disable the other addons I use, and the party showed just fine. Then I enabled my addons one by one and narrowed down the problem to ClearFont2: if I have ClearFont2 enabled, oUF party header won't show up, if I disable it, the party shows up.

This strikes me as quite a strange issue, I can't see what the link is between a secure party header and ClearFont2. Could it be that enabling CF2 loads a library that messes the header up? I'd appreciate if anybody has an idea on the cause of this, and even more how I could go about debugging this issue. What can affect the visibility of the header, generally speaking?

Thanks in advance!

haste 10-09-08 04:11 AM

A easy way to debug it is by doing the following on your header:
Code:

local Hide = party.hide
party.Hide = function(self) ChatFrame1:AddMessage(debugstack()) Hide(self) end

Then you just have to analyze the debug stack :).

Caellian 10-09-08 12:44 PM

Exp mouseover take 2
 
Aight, still on about the experience mouseover thingy, but with some progress this time.

It's now working correctly, 'almost', with the following code in the exp block of the layout, the exp bar + tooltip shows and hides on mouseover as expected.
There is one very small issue left, on login or /rl, i have to mouseover the player frame before it starts working. If i don't do that, when i mouseover the exp bar only the tooltip is shown, not the bar itself.

Code:

                        self:SetScript("OnEnter", function(self)
                                local origonenter, origonleave = self.Experience:GetScript("OnEnter"), self.Experience:GetScript("OnLeave")
                                self.Experience:SetScript('OnEnter', function(self,...) self:SetAlpha(1) origonenter(self, ...) end)
                        end)

                        self:SetScript("OnLeave", function(self)
                                local origonenter, origonleave = self.Experience:GetScript("OnEnter"), self.Experience:GetScript("OnLeave")
                                self.Experience:SetScript('OnLeave', function(self, ...) self:SetAlpha(0) origonleave(self,...) end)
                        end)


haste 10-09-08 02:56 PM

Not to be completely evil (but quite a bit). Think about exactly what you logically want to do (all the steps of hooking and calling), and what you are doing now.

Or put in another way: Explain to yourself exactly what your code does every time you execute those two functions.


All times are GMT -6. The time now is 08:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI