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)

Waverian 09-16-09 07:00 AM

Quote:

Originally Posted by Dawn (Post 159043)
Mhm, why not simply put the [raidcolor] tag in before the [name] tag? :rolleyes:

Well, isn't that neat. Knowing that existed would have saved me a bunch of effort in my layout. :X

haste 09-16-09 07:18 AM

Feel free to write/update some docs! :3

Dawn 09-16-09 10:16 AM

Well, when working with tags, checking tags.lua first seems logical. :D

Icerat 09-16-09 12:07 PM

After alot of messing about i finally figured out through trial and error lol that if i use:

Code:

--        RESTING ICON       
        if(unit == "player") then
                if UnitLevel("player") ~= MAX_PLAYER_LEVEL then
                        self.Resting = self.Health:CreateTexture(nil, "OVERLAY")
                        self.Resting:SetHeight(6)
                        self.Resting:SetWidth(6)
                        self.Resting:SetPoint("BOTTOMLEFT", 10, -15)
                        self.Resting:SetTexture(0, 1, 0)
                end       
        end

It gives me what i want, a small green square the same size as my pvp one (http://www.wowinterface.com/forums/s...ad.php?t=27256) and beside it.

I'm now trying to figure out how do i go about putting a very think black boarder around my small green square?

I very much a nub but its fun learning, looking forward to the reply's

Dawn 09-16-09 01:13 PM

Just do it the same way one would add a background to the health/power bar.

like this:
Code:

        self.Resting.bg = self.Resting:CreateTexture(nil, "BACKGROUND")
        self.Resting.bg:SetPoint("TOPLEFT",self.Health,"TOPLEFT",-1,1)
        self.Resting.bg:SetPoint("BOTTOMRIGHT",self.Health,"BOTTOMRIGHT",1,-1)       
        self.Resting.bg:SetVertexColor(0, 0, 0, 1)

The idea is creating a second square that's behind yours and make it 1pixel (see red offsets), larger.

Waverian 09-16-09 05:14 PM

or

Code:

self.Resting:SetBackdrop({
        bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
        insets = {top = -1, left = -1, bottom = -1, right = -1}
})
self.Resting:SetBackdropColor(0, 0, 0)


Icerat 09-16-09 05:36 PM

Hi and many thanks for the reply

If i add what you sugested i get an error and at this time my knowladge is not there to fix it.

I have:
Code:

--        RESTING ICON       
        if(unit == "player") then
                if UnitLevel("player") ~= MAX_PLAYER_LEVEL then
                        self.Resting = self.Health:CreateTexture(nil, "OVERLAY")
                        self.Resting:SetHeight(6)
                        self.Resting:SetWidth(6)
                        self.Resting:SetPoint("BOTTOMLEFT", 13, -15)
                        self.Resting:SetTexture(1, 1, 0)
                       
                        self.Resting.bg = self.Resting:CreateTexture(nil, "BACKGROUND")
                        self.Resting.bg:SetPoint("TOPLEFT",self.Health,"TOPLEFT",-1,1)
                        self.Resting.bg:SetPoint("BOTTOMRIGHT",self.Health,"BOTTOMRIGHT",1,-1)       
                        self.Resting.bg:SetVertexColor(0, 0, 0, 1)
                       

                end       
        end

Which give error:
Code:

[2009/09/17 00:19:34-5479-x1]: oUF_Harpz-1.1h\oUF_Harpz.lua:575: attempt to call method 'CreateTexture' (a nil value)
oUF-1.3.21\ouf.lua:250: in function <Interface\AddOns\oUF\ouf.lua:242>
oUF-1.3.21\ouf.lua:318: in function <Interface\AddOns\oUF\ouf.lua:315>
oUF-1.3.21\ouf.lua:368: in function `Spawn'
oUF_Harpz-1.1h\oUF_Harpz.lua:755: in main chunk

  ---

What you said did get me thinking though be it in a nub way
Code:

--        RESTING ICON       
        if(unit == "player") then
                if UnitLevel("player") ~= MAX_PLAYER_LEVEL then
                        self.Resting = self.Health:CreateTexture(nil, "OVERLAY")
                        self.Resting:SetHeight(6)
                        self.Resting:SetWidth(6)
                        self.Resting:SetPoint("BOTTOMLEFT", 13, -15)
                        self.Resting:SetTexture(1, 1, 0)
                       
                        self.Resting.bg = self.Health:CreateTexture(nil, "BACKGROUND")
                        self.Resting.bg:SetPoint("BOTTOMLEFT", 10, -19)
                        self.Resting.bg:SetHeight(13)
                        self.Resting.bg:SetWidth(13)
                        self.Resting.bg:SetTexture(0, 0, 0, 1)
                       
                end       
        end

It generates a block i can move to behind my rested square, your way looks alot better then my nub attempts why didn't it work :(

Also another nub question why are there 2 set points
Code:

self.Resting.bg:SetPoint("TOPLEFT",self.Health,"TOPLEFT",-1,1)
self.Resting.bg:SetPoint("BOTTOMRIGHT",self.Health,"BOTTOMRIGHT",1,-1)

Once again i thank you for the help I'm learning alot, if this isn't the place to ask these question please direct me in the right direction

Dawn 09-16-09 06:30 PM

Code:

self.Health:CreateTexture
is right, this was just meant to be an example and I copy and pasted some code where I replaced all instances of "health" with "resting" to match your example. It however replaced also one wrong instance. :D

These 2 set points tell the game to start drawing the first edge of the rectangle at the first set point to the "last" edge of the rectangle at the second set point. It only needs to know 2 edges out of 4 because the others are defined by being logic (don't know how to describe it better in English, sorry).

Code:

1---X
|  |
|  |
X---2


NeverD1e 09-18-09 12:57 AM

Quote:

Originally Posted by NeverD1e (Post 159036)
Hello everyone, I'm bad know Lua.
Help bring the code with this:

local function truncate(value)
if(value >= 1e6) then
return gsub(format('%.2fm', value / 1e6), '%.?0+([km])$', '%1')
elseif(value >= 1e5) then
return gsub(format('%.1fk', value / 1e3), '%.?0+([km])$', '%1')
else
return value
end
end

Such:

1603022>1,603k
725622>725,6k
11813>11,8k
9156>9,1k
937>937


And with this:

oUF.TagEvents['[customstatus]'] = 'UNIT_HEALTH'
oUF.Tags['[customstatus]'] = function(unit)
return not UnitIsConnected(unit) and PLAYER_OFFLINE or UnitIsGhost(unit) and 'Ghost' or UnitIsDead(unit) and DEAD
end

oUF.TagEvents['[customhp]'] = 'UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['[customhp]'] = function(unit)
local status = oUF.Tags['[customstatus]'](unit)
local min, max = UnitHealth(unit), UnitHealthMax(unit)

local r,g,b = ColourGradient(min/max)

return status and status or
(unit ~= 'player' and unit ~= 'target' and min-max ~= 0) and format('|cff%02x%02x%02x%s|r', r, g, b, truncate(min-max)) or
(unit == 'target' and min - max == 0) and format('|cff%02x%02x%02x%s|r', r, g, b, truncate(max)) or
(min - max == 0) and format('%s', '') or
(unit == 'target' or unit == 'player') and format('|cff00FF00%s|r . |cff%02x%02x%02x%s|r %d%%', truncate(max), r, g, b, truncate(min), floor(min/max*100)) or
(min~=max) and format('%s |cff0090ff/|r %s', truncate(min), truncate(max)) or max
end


Such:

If player or target then
If min~=max then
show max
If max<100% then
show min | max

If targettarget or pet or focus then

If min~=max then
show max
If max<100% then
show min

If party or raid then

If min~=max then
show max
If max<100% then
show -(min-max)

I suffer for a long time, help me please.

This realy worked?

local function truncate(value)
if(value >= 1e7) then
return gsub(format('%.1fm', value / 1e6), '%.?0([km])$', '%1')
elseif(value >= 1e6) then
return gsub(format('%.2fm', value / 1e6), '%.?0+([km])$', '%1')
elseif(value >= 1e5) then
return format('%.0fk', value / 1e3)
elseif (value >= 1e3) or (value <= -1e3) then
return gsub(format('%.1fk', value / 1e3), '%.?0([km])$', '%1')
else
return value
end
end


And:

oUF.TagEvents['[customstatus]'] = 'UNIT_HEALTH'
oUF.Tags['[customstatus]'] = function(unit)
return not UnitIsConnected(unit) and 'Off' or UnitIsGhost(unit) and 'Ghost' or UnitIsDead(unit) and 'Dead'
end

oUF.TagEvents['[customhp]'] = 'UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['[customhp]'] = function(unit)
local status = oUF.Tags['[customstatus]'](unit)
local min, max = UnitHealth(unit), UnitHealthMax(unit)

local r,g,b = ColourGradient(min/max)

return status and status or
(unit ~= 'player' and unit ~= 'target' and min-max ~= 0) and format('|cff%02x%02x%02x%s|r', r, g, b, truncate(min-max)) or
(unit ~= 'player' and unit ~= 'target' and min-max == 0) and format('|cff%02x%02x%02x%s|r', r, g, b, truncate(max)) or
(unit == 'target' and unit == 'player' and min-max ~=0) and format('|cff%02x%02x%02x%s|r | |cff%02x%02x%02x%s|r', truncate(min), r, g, b, truncate(max)) or
(unit == 'target' and unit == 'player' and min-max ==0) and format('|cff%02x%02x%02x%s|r', r, g, b, truncate(max))
end

Icerat 09-25-09 01:12 PM

Currently using the following to show a small yellow square to indicate if my toon is resting or not.

Code:

--        RESTING ICON --
        if(unit == "player") then
                if UnitLevel("player") ~= MAX_PLAYER_LEVEL then
                        self.Resting = self.Health:CreateTexture(nil, "OVERLAY")
                        self.Resting:SetHeight(6)
                        self.Resting:SetWidth(6)
                        self.Resting:SetPoint("BOTTOMLEFT", 13, -15)
                        self.Resting:SetTexture(1, 1, 0)
                       
                        self.Resting.bg = self.Health:CreateTexture(nil, "BACKGROUND")
                        self.Resting.bg:SetPoint("TOPLEFT",self.Resting,"TOPLEFT", -2, 2)
                        self.Resting.bg:SetPoint("BOTTOMRIGHT",self.Resting,"BOTTOMRIGHT",2,-2)       
                        self.Resting.bg:SetTexture(0, 0, 0)
                end       
        end

The problem I'm having is with the background part, when i leave a city or inn the rested icon vanishes as expected but I'm left with the small black square for the border.

How can i make the background square disappear also?

Thanks in advance for helping a nub out

haste 09-25-09 01:30 PM

Code:

--- 1        2009-09-25 21:28:37.678699761 +0000
+++ 2        2009-09-25 21:29:45.950873460 +0000
@@ -11,5 +11,6 @@
                        self.Resting.bg:SetPoint("TOPLEFT",self.Resting,"TOPLEFT", -2, 2)
                        self.Resting.bg:SetPoint("BOTTOMRIGHT",self.Resting,"BOTTOMRIGHT",2,-2)       
                        self.Resting.bg:SetTexture(0, 0, 0)
+                        self.Resting.bg:SetParent(self.Resting)
                end       
        end


Wimpface 09-25-09 03:33 PM

So I've been trying to add Auras to my target frame for some time now but I must be doing something terribly wrong as it just won't show them.

My aura code is based on oUF_ALZA, however my layout code is based on oUF_P3lim. Here's the code I try to spawn my auras with.
Code:

                if(unit == 'target') then
                        local auras = CreateFrame("Frame", nil, self)
                auras:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -2, -3)
                auras.initialAnchor = "TOPLEFT"
                auras["growth-x"] = "RIGHT"
                auras["growth-y"] = "DOWN"
                auras.numDebuffs = 16
                auras:SetHeight(500)
                auras:SetWidth(180 + 30 / 2)
                auras.spacing = 1
                auras.size = 30
                auras.gap = true
                --auras.onlyShowPlayer = true
                self.Auras = auras
                        self.PostCreateAuraIcon = PostCreateAuraIcon
                end

Here's my entire layout, sorry for the long paste.
Code:

--[[

  Adrian L Lange grants anyone the right to use this work for any purpose,
  without any conditions, unless such conditions are required by law.

--]]

local max = math.max
local floor = math.floor

local barTex = [=[Interface\AddOns\!media\textures\statusbar.tga]=]
local backdrop = {
        bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
        insets = {top = -1, bottom = -1, left = -1, right = -1}
}

local bordertex = "Interface\\AddOns\\!media\\textures\\gloss"  -- border for aura icons
local debufftex = "Interface\\AddOns\\!media\\textures\\dh"    -- for oUF_DebuffHighlight

-- Configure font settings here.                                                                                                                        http://www.wowwiki.com/API_FontInstance_SetFont
local font = [=[Interface\AddOns\!media\fonts\Semplice Regular.ttf]=]
local fsize = 8
local fstyle = 'THINOUTLINE'
local removeShadows = true

local MyUnits = { -- used for hiding cooldowns on target frame
    player = true,
    pet = true,
    vehicle = true,
}

local _, class = UnitClass('player')
r = RAID_CLASS_COLORS[class].r
g = RAID_CLASS_COLORS[class].g
b = RAID_CLASS_COLORS[class].b

local colors = setmetatable({
        power = setmetatable({
                MANA = {0, 144/255, 1}
        }, {__index = oUF.colors.power}),
        runes = setmetatable({
                [1] = {0.8, 0, 0},
                [3] = {0, 0.4, 0.7},
                [4] = {0.8, 0.8, 0.8}
        }, {__index = oUF.colors.runes})
}, {__index = oUF.colors})

local buffFilter = {
        [GetSpellInfo(62600)] = true,
        [GetSpellInfo(61336)] = true,
        [GetSpellInfo(52610)] = true,
        [GetSpellInfo(22842)] = true,
        [GetSpellInfo(22812)] = true,
        [GetSpellInfo(16870)] = true
}

local function menu(self)
        local drop = _G[string.gsub(self.unit, '(.)', string.upper, 1) .. 'FrameDropDown']
        if(drop) then
                ToggleDropDownMenu(1, nil, drop, 'cursor')
        end
end

--[[ Font creation func ]]
MakeFS = function(parent, justify)
    local f = parent:CreateFontString(nil, "OVERLAY")
    f:SetFont(font, fsize, fstyle)
    f:SetShadowColor(0, 0, 0, 0)
    if(justify) then f:SetJustifyH(justify) end
    return f
end

--[[ Background creation func ]]
MakeBG = function(parent)
    local bg = parent:CreateTexture(nil, "BACKGROUND")
    bg:SetPoint("TOPLEFT", parent, -2, 2)
    bg:SetPoint("BOTTOMRIGHT", parent, 2, -2)
    bg:SetTexture(0, 0, 0)
end

local function updateCombo(self, event, unit)
        if(unit == PlayerFrame.unit and unit ~= self.CPoints.unit) then
                self.CPoints.unit = unit
        end
end

local function updatePower(self, event, unit, bar, minVal, maxVal)
        if(unit ~= 'target') then return end

        if(maxVal ~= 0) then
                self.Health:SetHeight(22)
                bar:Show()
        else
                self.Health:SetHeight(27)
                bar:Hide()
        end
end

local function castIcon(self, event, unit)
        local castbar = self.Castbar
        if(castbar.interrupt) then
                castbar.Button:SetBackdropColor(0, 0.9, 1)
        else
                castbar.Button:SetBackdropColor(0, 0, 0)
        end
end

local function castTime(self, duration)
        if(self.channeling) then
                self.Time:SetFormattedText('%.1f ', duration)
        elseif(self.casting) then
                self.Time:SetFormattedText('%.1f ', self.max - duration)
        end
end

local function updateTime(self, elapsed)
        self.remaining = max(self.remaining - elapsed, 0)
        self.time:SetText(self.remaining < 90 and floor(self.remaining) or '')
end

local noHide = function(self)
    self:SetVertexColor(0, 0, 0)
end

local PostCreateAuraIcon = function(self, button, icons, index, isDebuff)
    button.cd:SetReverse()

    button.count:ClearAllPoints()
    button.count:SetPoint("TOP")
    button.count:SetJustifyH("CENTER")
    button.count:SetFont(font, fsize, fstyle)
    button.count:SetTextColor(.8, .8, .8)

    button.icon:SetTexCoord(0, 1, 0, 1)

    button.overlay:SetTexture(bordertex)
    button.overlay:SetTexCoord(0, 1, 0, 1) 
    button.overlay.Hide = noHide
end

local PostUpdateAuraIcon = function(self, icons, unit, icon, index, offset, filter, isDebuff)
    if(icon.cd:IsShown() and isDebuff and not MyUnits[icon.owner] and not UnitIsPlayer(self.unit)) then
        icon.cd:Hide()
    end
end

local function customFilter(icons, unit, icon, name, rank, texture, count, dtype, duration, expiration, caster)
        if(buffFilter[name] and caster == 'player') then
                return true
        end
end

--[[ Disabling default buff frames ]]
_G["BuffFrame"]:Hide()
_G["BuffFrame"]:UnregisterAllEvents()
_G["BuffFrame"]:SetScript("OnUpdate", nil)

--[[ Temporary enchant stuff ]]
for i = 1, 2 do
    _G["TempEnchant"..i.."Icon"]:Hide()
    _G["TempEnchant"..i.."Count"]:Hide()
    _G["TempEnchant"..i.."Border"]:Hide()
    _G["TempEnchant"..i.."Duration"] = MakeFS(UIParent)
    _G["TempEnchant"..i]:ClearAllPoints()
    _G["TempEnchant"..i]:SetAllPoints(_G["TempEnchant"..i.."Duration"])
end

local function style(self, unit)
        self.colors = colors
        self.menu = menu

        self:RegisterForClicks('AnyUp')
        self:SetAttribute('type2', 'menu')

        self:SetScript('OnEnter', UnitFrame_OnEnter)
        self:SetScript('OnLeave', UnitFrame_OnLeave)

        self:SetBackdrop(backdrop)
        self:SetBackdropColor(0, 0, 0)

        self.Health = CreateFrame('StatusBar', nil, self)
        self.Health:SetPoint('TOPRIGHT')
        self.Health:SetPoint('TOPLEFT')
        self.Health:SetStatusBarTexture(barTex)
        self.Health.colorClass = false
        self.Health.colorReaction = false
        self.Health:SetStatusBarColor(0.2, 0.2, 0.2)
        self.Health:SetHeight((unit == 'focus' or unit == 'targettarget') and 20 or 22)
        self.Health.frequentUpdates = true

        self.Health.bg = self.Health:CreateTexture(nil, 'BORDER')
        self.Health.bg:SetAllPoints(self.Health)
        self.Health.bg:SetTexture(0.3, 0.3, 0.3)

        local health = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight')
        health:SetPoint('RIGHT', self.Health, -2, -1)
        health.frequentUpdates = 0.25
        self:Tag(health, '[phealth]')       
       
        local power = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallLeft')
        power:SetPoint('LEFT', self.Health, 2, -1)
        power.frequentUpdates = 0.1
        self:Tag(power, '[ppower]')       
       
        local info = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallLeft')
        info:SetPoint('LEFT', self.Health, 2, -1)
        info:SetPoint('RIGHT', health, 'LEFT')
        self:Tag(info, '[raidcolor][name]')       
       
        if removeShadows == true then
                info:SetShadowOffset(0, 0)
                power:SetShadowOffset(0, 0)
                health:SetShadowOffset(0, 0)
        end
       
        self.RaidIcon = self.Health:CreateTexture(nil, 'OVERLAY')
        self.RaidIcon:SetPoint('TOP', self, 0, 8)
        self.RaidIcon:SetHeight(16)
        self.RaidIcon:SetWidth(16)

        if(unit == 'focus' or unit == 'targettarget') then
        else
                self.Power = CreateFrame('StatusBar', nil, self)
                self.Power:SetPoint('BOTTOMRIGHT')
                self.Power:SetPoint('BOTTOMLEFT')
                self.Power:SetPoint('TOP', self.Health, 'BOTTOM', 0, -1)
                self.Power:SetStatusBarTexture(barTex)
                self.Power.frequentUpdates = true

                self.Power.colorClass = false
                self.Power.colorTapping = false
                self.Power.colorDisconnected = false
                self.Power.colorReaction = false
                self.Power.colorHappiness = unit == 'pet'
                self.Power.colorPower = true

                self.Power.bg = self.Power:CreateTexture(nil, 'BORDER')
                self.Power.bg:SetAllPoints(self.Power)
                self.Power.bg:SetTexture([=[Interface\ChatFrame\ChatFrameBackground]=])
                self.Power.bg.multiplier = 0.3
        end

        if(unit == 'player') then
                if IsAddOnLoaded("oUF_Experience") and UnitLevel("Player") < 80 then
                        self.Experience = CreateFrame('StatusBar', nil, self)
                        --self.Experience:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -20)
                        --self.Experience:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -20)
                        self.Experience:SetPoint('CENTER', self, 'CENTER', 0, -19)
                        self.Experience:SetHeight(4)
                        self.Experience:SetWidth(180)
                        self.Experience:SetStatusBarTexture(barTex)
                        self.Experience:SetStatusBarColor(0.15, 0.7, 0.1)
                        self.Experience.Tooltip = true

                        self.Experience.Rested = CreateFrame('StatusBar', nil, self)
                        self.Experience.Rested:SetAllPoints(self.Experience)
                        self.Experience.Rested:SetStatusBarTexture(barTex)
                        self.Experience.Rested:SetStatusBarColor(0, 0.4, 1, 0.6)
                        self.Experience.Rested:SetBackdrop(backdrop)
                        self.Experience.Rested:SetBackdropColor(0, 0, 0)

                        self.Experience.Text = self.Experience:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
                        self.Experience.Text:SetPoint('CENTER', self.Experience, 'CENTER', 0, -15)
                        self.Experience.Text:SetFont(font, fsize, fstyle)

                        self.Experience.bg = self.Experience.Rested:CreateTexture(nil, 'BORDER')
                        self.Experience.bg:SetAllPoints(self.Experience)
                        self.Experience.bg:SetTexture(0.2, 0.2, 0.2)
                end
        end
        if(unit == 'player') then
                if IsAddOnLoaded('oUF_Reputation') and UnitLevel("player") == 80 then
                        self.Reputation = CreateFrame('StatusBar', nil, self)
                        --self.Reputation:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -20)
                        --self.Reputation:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -20)
                        self.Reputation:SetPoint('CENTER', self, 'CENTER', 0, -116)
                        self.Reputation:SetHeight(11)
                        self.Reputation:SetWidth(417)
                        self.Reputation:SetStatusBarTexture(barTex)
                        self.Reputation:SetStatusBarColor(0.15, 0.7, 0.1)
                        self.Reputation.Tooltip = true
                       
                        self.Reputation:SetBackdrop(backdrop)
                        self.Reputation:SetBackdropColor(0, 0, 0)
                       
                        self.Reputation.Text = self.Reputation:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
                        self.Reputation.Text:SetPoint('CENTER', self.Reputation)
                       
                        self.Reputation.bg = self.Reputation:CreateTexture(nil, 'BORDER')
                        self.Reputation.bg:SetAllPoints(self.Reputation)
                        self.Reputation.bg:SetTexture(0.2, 0.2, 0.2)
                end
               
            local buffs = CreateFrame("Frame", nill, self)
        buffs:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -25, -25)
        buffs.initialAnchor = "TOPRIGHT"
        buffs["growth-y"] = "DOWN"
        buffs["growth-x"] = "LEFT"
        buffs:SetHeight(500)
        buffs:SetWidth((30 + 3) * 10)
        buffs.spacing = 3
        buffs.size = 30
        self.Buffs = buffs

        local debuffs = CreateFrame("Frame", nill, self)
        debuffs:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 2, -23)
        debuffs.initialAnchor = "TOPRIGHT"
        debuffs["growth-x"] = "LEFT"
        debuffs["growth-y"] = "DOWN"
        debuffs:SetHeight(500)
        debuffs:SetWidth(180 + 30 / 2)
        debuffs.spacing = 3
        debuffs.size = 30
        self.Debuffs = debuffs
               
                local dur1 = _G["TempEnchant1Duration"]
        local dur2 = _G["TempEnchant2Duration"]
        if(self.RuneBar or self.DruidPower) then
            dur2:SetPoint("TOPRIGHT", ppp or hpp, "TOPLEFT")
            dur1:SetPoint("TOPRIGHT", dur2, "TOPLEFT")
        else
            dur1:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -2, 3)
            dur2:SetPoint("TOPLEFT", dur1, "TOPRIGHT")
        end
        dur1:SetVertexColor(1, 1, 1)
        dur2:SetVertexColor(1, 1, 1)
        dur1.SetVertexColor = function() end
        dur2.SetVertexColor = function() end
               
                self.PostCreateAuraIcon = PostCreateAuraIcon
                self.PostUpdateAuraIcon = PostUpdateAuraIcon
        end

        if(unit == 'pet') then
                self.Auras = CreateFrame('Frame', nil, self)
                self.Auras:SetPoint('TOPRIGHT', self, 'TOPLEFT', -4, 0)
                self.Auras:SetHeight(4)
                self.Auras:SetWidth(256)
                self.Auras.size = 22
                self.Auras.spacing = 4
                self.Auras.initialAnchor = 'TOPRIGHT'
                self.Auras['growth-x'] = 'LEFT'
                self.PostCreateAuraIcon = PostCreateAuraIcon
        end

        if(unit == 'player' or unit == 'target') then
                if(unit == 'target') then
                        local auras = CreateFrame("Frame", nil, self)
                auras:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -2, -3)
                auras.initialAnchor = "TOPLEFT"
                auras["growth-x"] = "RIGHT"
                auras["growth-y"] = "DOWN"
                auras.numDebuffs = 16
                auras:SetHeight(500)
                auras:SetWidth(180 + 30 / 2)
                auras.spacing = 1
                auras.size = 30
                auras.gap = true
                --auras.onlyShowPlayer = true
                self.Auras = auras
                        self.PostCreateAuraIcon = PostCreateAuraIcon
                end

                self.Castbar = CreateFrame('StatusBar', nil, self)
                self.Castbar:SetHeight(16)
                self.Castbar:SetStatusBarTexture(barTex)
                self.Castbar:SetBackdrop(backdrop)
                self.Castbar:SetBackdropColor(0, 0, 0)

                self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
                self.Castbar.bg:SetAllPoints(self.Castbar)
                self.Castbar.bg:SetTexture(barTex)

                self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallLeft')

                self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight')
                self.Castbar.CustomTimeText = castTime

                self.Castbar.Button = CreateFrame('Frame', nil, self.Castbar)
                self.Castbar.Button:SetHeight(16)
                self.Castbar.Button:SetWidth(16)
                self.Castbar.Button:SetBackdrop(backdrop)
                self.Castbar.Button:SetBackdropColor(0, 0, 0)

                self.Castbar.Icon = self.Castbar.Button:CreateTexture(nil, 'ARTWORK')
                self.Castbar.Icon:SetAllPoints(self.Castbar.Button)
                self.Castbar.Icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
                self.Castbar.Time:SetFont(font, fsize, fstyle)
                self.Castbar.Text:SetFont(font, fsize, fstyle)

                if(unit == 'target') then
                        self.PostCastStart = castIcon
                        self.PostChannelStart = castIcon
                        self.Castbar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -60)
                        self.Castbar.Button:SetPoint('LEFT', self.Castbar, 'RIGHT', 4, 0)
                        self.Castbar:SetStatusBarColor(1, 0, 0)
                        self.Castbar.bg:SetVertexColor(0.3, 0.3, 0,3)
                        self.Castbar.Text:SetPoint('LEFT', 2, 1)
                        self.Castbar.Time:SetPoint('RIGHT', -2, 1)
                        self.Castbar:SetWidth(230)
                else
                        self.Castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, 50)
                        --self.Castbar.Button:SetPoint('BOTTOMRIGHT', self.Castbar, 'BOTTOMLEFT', -3, 0)
                        self.Castbar:SetStatusBarColor(r, g, b)
                        self.Castbar.bg:SetVertexColor(0.3, 0.3, 0,3)
                        self.Castbar.Text:SetPoint('LEFT', 0, 17)
                        self.Castbar.Time:SetPoint('RIGHT', 0, 17)
                        self.Castbar:SetWidth(180)
                end

                self.PostUpdatePower = updatePower
        end
       
        if(unit == 'player') then
                self:SetAttribute('initial-height', 22)
                self:SetAttribute('initial-width', 180)
               
                self.Health:SetHeight(17)
                self.Power:SetHeight(5)
               
                power:SetFont(font, fsize, fstyle)
                health:SetFont(font, fsize, fstyle)
               
                info:Hide()
        elseif(unit == 'target') then
                self:SetAttribute('initial-height', 27)
                self:SetAttribute('initial-width', 230)
               
                health:SetFont(font, fsize, fstyle)
                info:SetFont(font, fsize, fstyle)
               
                power:Hide()
        elseif(unit == 'focus') then
                self:SetAttribute('initial-height', 15)
                self:SetAttribute('initial-width', 180)
               
                self.Health:SetHeight(15)
                --self.Power:Hide()
               
                health:SetFont(font, fsize, fstyle)
                info:SetFont(font, fsize, fstyle)
               
                health:SetPoint('RIGHT', self.Health, -2, 0)
                info:SetPoint('LEFT', self.Health, 2, 0)
               
                power:Hide()
        elseif(unit == 'targettarget') then
                self:SetAttribute('initial-height', 15)
                self:SetAttribute('initial-width', 230)
               
                self.Health:SetHeight(15)
               
                health:SetFont(font, fsize, fstyle)
                info:SetFont(font, fsize, fstyle)
               
                health:SetPoint('RIGHT', self.Health, -2, 0)
                info:SetPoint('LEFT', self.Health, 2, 0)
               
                power:Hide()
        elseif(unit == 'pet') then
                self:SetAttribute('initial-height', 22)
                self:SetAttribute('initial-width', 140)
               
                self.Health:SetHeight(17)
                self.Power:SetHeight(5)
               
                power:SetFont(font, fsize, fstyle)
                health:SetFont(font, fsize, fstyle)
               
                info:Hide()
        end

        if(unit == 'target') then
                self.CPoints = self:CreateFontString(nil, 'OVERLAY', 'SubZoneTextFont')
                self.CPoints:SetPoint('RIGHT', self, 'LEFT', -9, 0)
                self.CPoints:SetTextColor(1, 1, 1)
                self.CPoints:SetJustifyH('RIGHT')
                self.CPoints.unit = PlayerFrame.unit
                self:RegisterEvent('UNIT_COMBO_POINTS', updateCombo)
                self.CustomAuraFilter = customFilter
        end

        if(unit == 'player') then
                if(select(2, UnitClass('player')) == 'DEATHKNIGHT') then
                        self.Runes = CreateFrame('Frame', nil, self)
                        self.Runes:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -1)
                        self.Runes:SetHeight(4)
                        self.Runes:SetWidth(180)
                        self.Runes:SetBackdrop(backdrop)
                        self.Runes:SetBackdropColor(0, 0, 0)
                        self.Runes.anchor = 'TOPLEFT'
                        self.Runes.growth = 'RIGHT'
                        self.Runes.height = 4
                        self.Runes.width = 180 / 6 - 0.85

                        for index = 1, 6 do
                                self.Runes[index] = CreateFrame('StatusBar', nil, self.Runes)
                                self.Runes[index]:SetStatusBarTexture(barTex)

                                self.Runes[index].bg = self.Runes[index]:CreateTexture(nil, 'BACKGROUND')
                                self.Runes[index].bg:SetAllPoints(self.Runes[index])
                                self.Runes[index].bg:SetTexture(0.2, 0.2, 0,2)
                        end
                end

                self.Leader = self.Health:CreateTexture(nil, 'OVERLAY')
                self.Leader:SetPoint('TOPLEFT', self, 0, 8)
                self.Leader:SetHeight(16)
                self.Leader:SetWidth(16)

                self.Assistant = self.Health:CreateTexture(nil, 'OVERLAY')
                self.Assistant:SetPoint('TOPLEFT', self, 0, 8)
                self.Assistant:SetHeight(16)
                self.Assistant:SetWidth(16)

        end

        self.DebuffHighlightBackdrop = true
        self.DebuffHighlightFilter = true
       
end

oUF:RegisterStyle('Hariyama', style)
oUF:SetActiveStyle('Hariyama')

oUF:Spawn('player', 'oUF_Player'):SetPoint('CENTER', UIParent, 0, -350)
oUF:Spawn('target', 'oUF_Target'):SetPoint('CENTER', UIParent, 220, -100)
oUF:Spawn('targettarget', 'oUF_ToT'):SetPoint('BOTTOMRIGHT', oUF.units.target, 'TOPRIGHT', 0, 3)
oUF:Spawn('focus', 'oUF_Focus'):SetPoint('BOTTOMLEFT', oUF.units.player, 'TOPLEFT', 0, 5)
oUF:Spawn('pet', 'oUF_Pet'):SetPoint('RIGHT', oUF.units.player, 'LEFT', -25, 0)

Thanks in advance.
- Wimpzter.

wurmfood 09-25-09 05:38 PM

Your PostUpdateAuraIcon seems a little strange. If I'm reading it right, it's basically saying:

If the icon is supposed to be shown and the icon is for a debuff that is not created by me, my pet, or my vehicle, and the unit is not a player, then hide the icon.

I think it may be the last part tripping you up. You're saying to hide the icon if your target is not a player, so any NPC will have the icons hidden.

Wimpface 09-25-09 05:46 PM

Quote:

Originally Posted by wurmfood (Post 160133)
Your PostUpdateAuraIcon seems a little strange. If I'm reading it right, it's basically saying:

If the icon is supposed to be shown and the icon is for a debuff that is not created by me, my pet, or my vehicle, and the unit is not a player, then hide the icon.

I think it may be the last part tripping you up. You're saying to hide the icon if your target is not a player, so any NPC will have the icons hidden.

Problem is, it doesn't show it for players OR NPC's. :(

Icerat 09-26-09 02:35 AM

Quote:

Originally Posted by haste (Post 160110)
Code:

--- 1        2009-09-25 21:28:37.678699761 +0000
+++ 2        2009-09-25 21:29:45.950873460 +0000
@@ -11,5 +11,6 @@
                        self.Resting.bg:SetPoint("TOPLEFT",self.Resting,"TOPLEFT", -2, 2)
                        self.Resting.bg:SetPoint("BOTTOMRIGHT",self.Resting,"BOTTOMRIGHT",2,-2)       
                        self.Resting.bg:SetTexture(0, 0, 0)
+                        self.Resting.bg:SetParent(self.Resting)
                end       
        end


Many thanks for the reply Haste I've added the self.Resting.bg:SetParent(self.Resting) line but it throws an error.

Code:

--        RESTING ICON --
        if(unit == "player") then
                if UnitLevel("player") ~= MAX_PLAYER_LEVEL then
                        self.Resting = self.Health:CreateTexture(nil, "OVERLAY")
                        self.Resting:SetHeight(6)
                        self.Resting:SetWidth(6)
                        self.Resting:SetPoint("BOTTOMLEFT", 13, -15)
                        self.Resting:SetTexture(1, 1, 0)
                       
                        self.Resting.bg = self.Health:CreateTexture(nil, "BACKGROUND")
                        self.Resting.bg:SetParent(self.Resting)
                        self.Resting.bg:SetPoint("TOPLEFT",self.Resting,"TOPLEFT", -2, 2)
                        self.Resting.bg:SetPoint("BOTTOMRIGHT",self.Resting,"BOTTOMRIGHT",2,-2)       
                        self.Resting.bg:SetTexture(0, 0, 0)
                end       
        end

the error:
Code:

[2009/09/26 09:24:28-5601-x1]: oUF_Harpz-1.1h\oUF_Harpz.lua:576: <unnamed>:SetParent(): Wrong parent object type, expected Frame
oUF_Harpz-1.1h\oUF_Harpz.lua:576: in function `style'
oUF-1.3.21\ouf.lua:250: in function <Interface\AddOns\oUF\ouf.lua:242>
oUF-1.3.21\ouf.lua:318: in function <Interface\AddOns\oUF\ouf.lua:315>
oUF-1.3.21\ouf.lua:368: in function `Spawn'
oUF_Harpz-1.1h\oUF_Harpz.lua:761: in main chunk

  ---

I know I've done something stupid wrong but i cant figure out what yet.

I look forward to the reply's, learnings fun :)

Waverian 09-26-09 03:32 AM

lua Code:
  1. self.Resting.bg:SetPoint("TOPLEFT",self.Resting,"TOPLEFT", -2, 2)

self.Resting is a texture. You can't anchor an object to a texture.

Icerat 09-26-09 04:41 AM

Quote:

Originally Posted by Waverian (Post 160164)
lua Code:
  1. self.Resting.bg:SetPoint("TOPLEFT",self.Resting,"TOPLEFT", -2, 2)

self.Resting is a texture. You can't anchor an object to a texture.

How do i fix it then :) ?

haste 09-26-09 05:24 AM

I actually believed you could parent textures to other textures, but since that isn't the case you have to create a container frame and handle it through that. Another options would be to insert your own OnShow/OnHide, or use a OnShow/OnHide script to toggle the other textures.

Wimpface 09-27-09 02:22 PM

I've yet to find a solution to this, please point me in the right direction anyone. :)

Icerat 09-28-09 06:32 AM

Back again sorry:

I have the following to show my experience bar and it works great does all i expected it to do, hide until mouse over and show a tooltip on my player.

For some reason though it wont show a bar for my hunters pet (pets not max lvl nor is me hunter)

Code:

-- EXPERIENCE BAR --
        if(IsAddOnLoaded('oUF_Experience') and (unit == 'player' or unit == 'pet')) then
                        self.Experience = CreateFrame('StatusBar', nil, self)
                        self.Experience:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 5)
                        self.Experience:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', 0, 5)
                                if(unit == "pet") then
                                        self.Experience:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -25)
                                        self.Experience:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -25)
                                end
                        self.Experience:SetHeight(3)
                        self.Experience:SetStatusBarTexture(texture2)
                        self.Experience:SetStatusBarColor(0.15, 0.7, 0.1)
                        self.Experience.Tooltip = true
                       
                        self.Experience.Rested = CreateFrame('StatusBar', nil, self)
                        self.Experience.Rested:SetParent(self.Experience)  -- Parent to the Experiance bar to get it to hide
                        self.Experience.Rested:SetAllPoints(self.Experience)
                        self.Experience.Rested:SetStatusBarTexture(texture2)
                        self.Experience.Rested:SetStatusBarColor(0, 0.4, 1, 0.6)
                        self.Experience.Rested:SetBackdrop(backdrop)
                        self.Experience.Rested:SetBackdropColor(0, 0, 0)

--                        self.Experience.Text = self.Experience:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallOutline')
--                        self.Experience.Text:SetPoint('CENTER', self.Experience)

                        self.Experience.bg = self.Experience.Rested:CreateTexture(nil, 'BORDER')
                        self.Experience.bg:SetAllPoints(self.Experience)
                        self.Experience.bg:SetTexture(0.3, 0.3, 0.3)
                       
                        self.Experience:SetScript ('OnEnter', function(self) self:SetAlpha(1) end)
                        self.Experience:SetScript ('OnLeave', function(self) self:SetAlpha(0) end)
                        self.Experience:SetAlpha(0)
                end

What am i doing wrong? bets its something stupid, thanks in advance


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

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