Quantcast
ouf_freeb adjustment - WoWInterface
Thread Tools Display Modes
01-31-12, 07:16 AM   #1
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
ouf_freeb adjustment

Hey I have three questions:

1) How do I remove the total health + the "|" from all frames but the targetframe?

2) How do I remove the class-role-icons from all frames? (or even better, hide them in raid/group)?

3) How do i change the size of the focus frame and have only the name displayed there?

Thanks so much I've read over all 22 pages of comments and did not found anything.

Help is much appreciated, thanks!
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
02-01-12, 06:11 PM   #2
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
/up and thanks for your help (:
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
02-01-12, 08:34 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,768
You were still at the top of this forum.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-01-12, 09:04 PM   #4
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
oh i am sorry not happening again
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
02-02-12, 08:50 PM   #5
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
So with my very little lua knowledge i finally found where to do what.

So i went to ftags.lua
got here

Code:
oUF.Tags['freeb:hp']  = function(u) 
    local min, max = UnitHealth(u), UnitHealthMax(u)
    return siValue(min).." | "..math.floor(min/max*100+.5).."%" 
end
oUF.TagEvents['freeb:hp'] = 'UNIT_HEALTH'
And if i delete
Code:
 siValue(min).." | "..
the absolute health is gone for all frames. (vica versa with the percantage part)

So what do i need now to give only the target frame this absolute number?

also how do i hide the mana text in all bars? simply deleting freebp things in the flag file did not work .. =(

Thanks again, i will try again tomorrow to figure this out (:
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
02-03-12, 04:40 AM   #6
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Instead of altering the 'freeb:hp' tag function (which is used by many frames), you should create a copy with a different tag name.

e.g.
Code:
oUF.Tags['syliha:hp']  = function(u) 
    local min, max = UnitHealth(u), UnitHealthMax(u)
    return math.floor(min/max*100+.5).."%" 
end
oUF.TagEvents['syliha:hp'] = 'UNIT_HEALTH'
You then need search for where the 'freeb:hp' tag is used, and when the unit is 'TARGET' use your new tag instead.
  Reply With Quote
02-03-12, 05:53 AM   #7
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Ok, I have insert yours to the fontflag lua file and tryed to identify the part where i change the hp flag.
I tryed this:

Code:
    if not (unit == "targettarget" or unit == "focustarget") then
        local hpp = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
        hpp:SetPoint("RIGHT", hp, -2, 0)

        if(unit == "player") then
            self:Tag(hpp, '[freeb:hp]')
	if(unit == "target") then
		self:Tag(hpp, '[syliha:hp]')
        else
            self:Tag(hpp, '[freeb:pp]  [freeb:hp]')
        end
    end
But id says:

Code:
: Interface\AddOns\oUF_Freeb\freeb.lua:976: 'end' expected (to close 'function' at line 395) near '<eof>'
Sorry for my lua noobiness I try...

Edit:
Got it! No error now, but there is no hp frame on the target now, it's empty :/

looks like this atm:

Code:
    if not (unit == "targettarget" or unit == "focustarget") then
        local hpp = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
        hpp:SetPoint("RIGHT", hp, -2, 0)

        if(unit == "player") then
            self:Tag(hpp, '[freeb:hp]')
	if(unit == "target") then
		self:Tag(hpp, '[syliha:hp]')
        else
            self:Tag(hpp, '[freeb:pp]  [freeb:hp]  [syliha:hp]')
	end
        end
    end
and

Code:
oUF.Tags['syliha:hp']  = function(u) 
    local min, max = UnitHealth(u), UnitHealthMax(u)
    return math.floor(min/max*100+.5).."%" 
end
oUF.TagEvents['syliha:hp'] = 'UNIT_HEALTH'
Hmm this 100% thingy is now displayed on my playerframe O_o

http://www.abload.de/img/wowscrnshot_020312_13pibdk.jpg
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 02-03-12 at 06:09 AM.
  Reply With Quote
02-03-12, 06:59 AM   #8
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
You've put in an 'if' statement where it should be an 'elseif', try this instead, should work.

Code:
    if not (unit == "targettarget" or unit == "focustarget") then
        local hpp = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
        hpp:SetPoint("RIGHT", hp, -2, 0)

        if(unit == "player") then
            self:Tag(hpp, '[freeb:hp]')
elseif(unit == "target") then
		self:Tag(hpp, '[syliha:hp]')
        else
            self:Tag(hpp, '[freeb:pp]  [freeb:hp]  [syliha:hp]')
	end
        end
    end
__________________
  Reply With Quote
02-03-12, 07:31 AM   #9
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Getting this again -.-

Code:
Message: Interface\AddOns\oUF_Freeb\freeb.lua:446: '<eof>' expected near 'end'
446 is the last "end" ._.
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
02-03-12, 07:33 AM   #10
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
If you are using the code Lordyfrb posted, then remove the 'end' that is in green text. It is unnecessary.



These type of errors are easily spotted if you ensure your code indentation is correct.

Last edited by yj589794 : 02-03-12 at 07:36 AM.
  Reply With Quote
02-03-12, 07:55 AM   #11
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Thanks got it working =))

Now i need to know how i remove the class role icons and how to resize only the focus frame. Any idea?

Code:
local ADDON_NAME, ns = ...

local mediaPath = "Interface\\AddOns\\oUF_Freeb\\media\\"
local texture = mediaPath.."Cabaret"
local font, fontsize, fontflag = mediaPath.."myriad.ttf", 12, "THINOUTLINE" -- "" for none

local glowTex = mediaPath.."glowTex"
local buttonTex = mediaPath.."buttontex"
local height, width = 22, 150
local scale = 1.0
local hpheight = .85 -- .70 - .90 

local overrideBlizzbuffs = false
local castbars = false	-- disable castbars
local auras = true -- disable all auras
local bossframes = true
local auraborders = false

local classColorbars = false
local powerColor = true
local powerClass = false

local portraits = FALSE
local onlyShowPlayer = false -- only show player debuffs on target

local pixelborder = false

if overrideBlizzbuffs then
    BuffFrame:Hide(d)
    TemporaryEnchantFrame:Hide()
end

local function multicheck(check, ...)
    for i=1, select('#', ...) do
        if check == select(i, ...) then return true end
    end
    return false
end

local backdrop = {
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {top = 0, left = 0, bottom = 0, right = 0},
}

local backdrop2 = {
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {top = -1, left = -1, bottom = -1, right = -1},
}

local frameBD = {
    edgeFile = glowTex, edgeSize = 5,
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {left = 3, right = 3, top = 3, bottom = 3}
}

-- Unit Menu
local dropdown = CreateFrame('Frame', ADDON_NAME .. 'DropDown', UIParent, 'UIDropDownMenuTemplate')

local function menu(self)
    dropdown:SetParent(self)
    return ToggleDropDownMenu(1, nil, dropdown, 'cursor', 0, 0)
end

local init = function(self)
    local unit = self:GetParent().unit
    local menu, name, id

    if(not unit) then
        return
    end

    if(UnitIsUnit(unit, "player")) then
        menu = "SELF"
    elseif(UnitIsUnit(unit, "vehicle")) then
        menu = "VEHICLE"
    elseif(UnitIsUnit(unit, "pet")) then
        menu = "PET"
    elseif(UnitIsPlayer(unit)) then
        id = UnitInRaid(unit)
        if(id) then
            menu = "RAID_PLAYER"
            name = GetRaidRosterInfo(id)
        elseif(UnitInParty(unit)) then
            menu = "PARTY"
        else
            menu = "PLAYER"
        end
    else
        menu = "TARGET"
        name = RAID_TARGET_ICON
    end

    if(menu) then
        UnitPopup_ShowMenu(self, menu, unit, name, id)
    end
end

UIDropDownMenu_Initialize(dropdown, init, 'MENU')

local createBackdrop = function(parent, anchor) 
    local frame = CreateFrame("Frame", nil, parent)
    frame:SetFrameStrata("LOW")

    if pixelborder then
        frame:SetAllPoints(anchor)
        frame:SetBackdrop(backdrop2)
    else
        frame:SetPoint("TOPLEFT", anchor, "TOPLEFT", -4, 4)
        frame:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 4, -4)
        frame:SetBackdrop(frameBD)
    end

    frame:SetBackdropColor(.05, .05, .05, 1)
    frame:SetBackdropBorderColor(0, 0, 0)

    return frame
end
ns.backdrop = createBackdrop

local fixStatusbar = function(bar)
    bar:GetStatusBarTexture():SetHorizTile(false)
    bar:GetStatusBarTexture():SetVertTile(false)
end

local createStatusbar = function(parent, tex, layer, height, width, r, g, b, alpha)
    local bar = CreateFrame"StatusBar"
    bar:SetParent(parent)
    if height then
        bar:SetHeight(height)
    end
    if width then
        bar:SetWidth(width)
    end
    bar:SetStatusBarTexture(tex, layer)
    bar:SetStatusBarColor(r, g, b, alpha)
    fixStatusbar(bar)

    return bar
end

local createFont = function(parent, layer, font, fontsiz, outline, r, g, b, justify)
    local string = parent:CreateFontString(nil, layer)
    string:SetFont(font, fontsiz, outline)
    string:SetShadowOffset(1, -1)
    string:SetTextColor(r, g, b)
    if justify then
        string:SetJustifyH(justify)
    end

    return string
end

local updateEclipse = function(element, unit)
    if element.hasSolarEclipse then
        element.bd:SetBackdropBorderColor(1, .6, 0)
        element.bd:SetBackdropColor(1, .6, 0)
    elseif element.hasLunarEclipse then
        element.bd:SetBackdropBorderColor(0, .4, 1)
        element.bd:SetBackdropColor(0, .4, 1)
    else
        element.bd:SetBackdropBorderColor(0, 0, 0)
        element.bd:SetBackdropColor(0, 0, 0)
    end
end

local xphide
local AltPower = function(self)
    local barType, minPower, _, _, _, hideFromOthers = UnitAlternatePowerInfo(self.unit)

    if barType and self.Experience:IsShown() then
        self.Experience:Hide()
        xphide = true
    elseif xphide  then
        self.Experience:Show()
        xphide = nil
    end

    self.AltPowerBar.Text:UpdateTag()
end

local PostAltUpdate = function(altpp, min, cur, max)
    local self = altpp.__owner

    local tPath, r, g, b = UnitAlternatePowerTextureInfo(self.unit, 2)

    if(r) then
        altpp:SetStatusBarColor(r, g, b, 1)
    else
        altpp:SetStatusBarColor(1, 1, 1, .8)
    end 
end

local GetTime = GetTime
local floor, fmod = floor, math.fmod
local day, hour, minute = 86400, 3600, 60

local FormatTime = function(s)
    if s >= day then
        return format("%dd", floor(s/day + 0.5))
    elseif s >= hour then
        return format("%dh", floor(s/hour + 0.5))
    elseif s >= minute then
        return format("%dm", floor(s/minute + 0.5))
    end

    return format("%d", fmod(s, minute))
end

local CreateAuraTimer = function(self,elapsed)
    self.elapsed = (self.elapsed or 0) + elapsed

    if self.elapsed < .2 then return end
    self.elapsed = 0

    local timeLeft = self.expires - GetTime()
    if timeLeft <= 0 then
        self.remaining:SetText(nil)
    else
        self.remaining:SetText(FormatTime(timeLeft))
    end
end

local debuffFilter = {
    --Update this
}

local auraIcon = function(auras, button)
    local count = button.count
    count:ClearAllPoints()
    count:SetPoint("BOTTOMRIGHT", 3, -3)
    count:SetFontObject(nil)
    count:SetFont(font, 12, "OUTLINE")
    count:SetTextColor(.8, .8, .8)

    auras.disableCooldown = true

    button.icon:SetTexCoord(.1, .9, .1, .9)
    button.bg = createBackdrop(button, button)

    if auraborders then
        auras.showDebuffType = true
        --auras.showBuffType = true
        button.overlay:SetTexture(buttonTex)
        button.overlay:SetPoint("TOPLEFT", button, "TOPLEFT", -2, 2)
        button.overlay:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
        button.overlay:SetTexCoord(0, 1, 0.02, 1)
    else
        button.overlay:Hide()
    end

    local remaining = createFont(button, "OVERLAY", font, 10, "THINOUTLINE", 1, 1, 1) -- bufftimeranzeige
    remaining:SetPoint("TOPLEFT", -3, 2)
    button.remaining = remaining
end

local PostUpdateIcon
do
    local playerUnits = {
        player = true,
        pet = true,
        vehicle = true,
    }

    PostUpdateIcon = function(icons, unit, icon, index, offset)
        local name, _, _, _, dtype, duration, expirationTime, unitCaster = UnitAura(unit, index, icon.filter)

        local texture = icon.icon
        if playerUnits[icon.owner] or debuffFilter[name] or UnitIsFriend('player', unit) or not icon.debuff then
            texture:SetDesaturated(false)
        else
            texture:SetDesaturated(true)
        end

        if duration and duration > 0 then
            icon.remaining:Show()
        else
            icon.remaining:Hide()
        end

        --[[if icon.debuff then
        icon.bg:SetBackdropBorderColor(.4, 0, 0)
        else
        icon.bg:SetBackdropBorderColor(0, 0, 0)
        end]]

        icon.duration = duration
        icon.expires = expirationTime
        icon:SetScript("OnUpdate", CreateAuraTimer)
    end
end

local aurafilter = {
    ["Chill of the Throne"] = true,
}

local CustomFilter = function(icons, ...)
    local _, icon, name, _, _, _, _, _, _, caster = ...

    if aurafilter[name] then
        return false
    end

    local isPlayer

    if multicheck(caster, 'player', 'vechicle') then
        isPlayer = true
    end

    if((icons.onlyShowPlayer and isPlayer) or (not icons.onlyShowPlayer and name)) then
        icon.isPlayer = isPlayer
        icon.owner = caster
        return true
    end
end

local PostCastStart = function(castbar, unit)
    if unit ~= 'player' then
        if castbar.interrupt then
            castbar.Backdrop:SetBackdropBorderColor(1, .9, .4)
            castbar.Backdrop:SetBackdropColor(1, .9, .4)
        else
            castbar.Backdrop:SetBackdropBorderColor(0, 0, 0)
            castbar.Backdrop:SetBackdropColor(0, 0, 0)
        end
    end
end

local CustomTimeText = function(castbar, duration)
    if castbar.casting then
        castbar.Time:SetFormattedText("%.1f / %.1f", duration, castbar.max)
    elseif castbar.channeling then
        castbar.Time:SetFormattedText("%.1f / %.1f", castbar.max - duration, castbar.max)
    end
end

--========================--
--  Castbars
--========================--
local castbar = function(self, unit)
    local u = unit:match('[^%d]+')
    if multicheck(u, "target", "player", "focus", "pet", "boss") then
        local cb = createStatusbar(self, texture, "OVERLAY", 16, portraits and 160 or width, 1, .25, .35, .5)
        cb:SetToplevel(true)

        cb.Spark = cb:CreateTexture(nil, "OVERLAY")
        cb.Spark:SetBlendMode("ADD")
        cb.Spark:SetAlpha(0.5)
        cb.Spark:SetHeight(48)

        local cbbg = cb:CreateTexture(nil, "BACKGROUND")
        cbbg:SetAllPoints(cb)
        cbbg:SetTexture(texture)
        cbbg:SetVertexColor(.1,.1,.1)

        cb.Time = createFont(cb, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
        cb.Time:SetPoint("RIGHT", cb, -2, 0)
        cb.CustomTimeText = CustomTimeText

        cb.Text = createFont(cb, "OVERLAY", font, fontsize, fontflag, 1, 1, 1, "LEFT")
        cb.Text:SetPoint("LEFT", cb, 2, 0)
        cb.Text:SetPoint("RIGHT", cb.Time, "LEFT")

        cb.Icon = cb:CreateTexture(nil, 'ARTWORK')
        cb.Icon:SetSize(20, 20)
        cb.Icon:SetTexCoord(.1, .9, .1, .9)

        if (unit == "player") then
            cb:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -10)
            cb.Icon:SetPoint("BOTTOMLEFT", cb, "BOTTOMRIGHT", 7, 0)

            cb.SafeZone = cb:CreateTexture(nil,'ARTWORK')
            cb.SafeZone:SetPoint('TOPRIGHT')
            cb.SafeZone:SetPoint('BOTTOMRIGHT')
            cb.SafeZone:SetTexture(texture)
            cb.SafeZone:SetVertexColor(.9,.7,0, 1)
        else
            cb:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -10)
            cb.Icon:SetPoint("BOTTOMRIGHT", cb, "BOTTOMLEFT", -7, 0)
        end

        cb.Backdrop = createBackdrop(cb, cb)
        cb.IBackdrop = createBackdrop(cb, cb.Icon)

        cb.PostCastStart = PostCastStart
        cb.PostChannelStart = PostCastStart

        cb.bg = cbbg
        self.Castbar = cb
    end
end

--========================--
--  Shared
--========================--
local func = function(self, unit)
    self.menu = menu

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

    self:SetScript("OnEnter", UnitFrame_OnEnter)
    self:SetScript("OnLeave", UnitFrame_OnLeave)
    self:RegisterForClicks"AnyUp"

    self.FrameBackdrop = createBackdrop(self, self)

    local hp = createStatusbar(self, texture, nil, nil, nil, 0.9, 0.9, 0.9, 1)
    hp:SetPoint"TOP"
    hp:SetPoint"LEFT"
    hp:SetPoint"RIGHT"

    if(unit == "targettarget" or unit == "focustarget") then
        hp:SetHeight(height)
    else
        hp:SetHeight(height*hpheight)
    end

    hp.frequentUpdates = true
    hp.Smooth = true

    local hpbg = hp:CreateTexture(nil, "BORDER")
    hpbg:SetAllPoints(hp)
    hpbg:SetTexture(texture)

    if classColorbars then
        hp.colorClass = true
        hp.colorReaction = true
        hpbg.multiplier = .2
    else
        hpbg:SetVertexColor(0,0.0,0) -- bgcolorhintergrund
    end

    if not (unit == "targettarget" or unit == "focustarget") then
        local hpp = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
        hpp:SetPoint("RIGHT", hp, -2, 0)

        if(unit == "player") then
            self:Tag(hpp, '[syliha:hp]')
	elseif(unit == "focus") then
		self:Tag(hpp, '[syliha:hp]')
        else
            self:Tag(hpp, '[freeb:pp]  [freeb:hp]')
        end
    end

    hp.bg = hpbg
    self.Health = hp

    if not (unit == "targettarget" or unit == "focustarget") then
        local pp = createStatusbar(self, texture, nil, height*-(hpheight-.95), nil, 1, 1, 1, 1)
        pp:SetPoint"LEFT"
        pp:SetPoint"RIGHT"
        pp:SetPoint"BOTTOM" 

        pp.frequentUpdates = false
        pp.Smooth = true

        local ppbg = pp:CreateTexture(nil, "BORDER")
        ppbg:SetAllPoints(pp)
        ppbg:SetTexture(texture) 

        if powerColor then
            pp.colorPower = true
            ppbg.multiplier = .2
        elseif powerClass then
            pp.colorClass = true
            ppbg.multiplier = .2
        else
            ppbg:SetVertexColor(.3,.3,.3)
        end

        pp.bg = ppbg
        self.Power = pp
    end

    local altpp = createStatusbar(self, texture, nil, 4, nil, 1, 1, 1, .8)
    altpp:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -2)
    altpp:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -2)
    altpp.bg = altpp:CreateTexture(nil, 'BORDER')
    altpp.bg:SetAllPoints(altpp)
    altpp.bg:SetTexture(texture)
    altpp.bg:SetVertexColor(.1, .1, .1)
    altpp.bd = createBackdrop(altpp, altpp)

    altpp.Text =  createFont(altpp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
    altpp.Text:SetPoint("CENTER")
    self:Tag(altpp.Text, "[freeb:altpower]")

    altpp.PostUpdate = PostAltUpdate
    self.AltPowerBar = altpp

    local leader = hp:CreateTexture(nil, "OVERLAY")
    leader:SetSize(16, 16)
    leader:SetPoint("TOPLEFT", hp, "TOPLEFT", 5, 10)
    self.Leader = leader

    local masterlooter = hp:CreateTexture(nil, 'OVERLAY')
    masterlooter:SetSize(16, 16)
    masterlooter:SetPoint('LEFT', leader, 'RIGHT')
    self.MasterLooter = masterlooter

    local LFDRole = hp:CreateTexture(nil, 'OVERLAY')
    LFDRole:SetSize(16, 16)
    LFDRole:SetPoint('LEFT', masterlooter, 'RIGHT')
    self.LFDRole = LFDRole

    local PvP = hp:CreateTexture(nil, 'OVERLAY')
    PvP:SetSize(24, 24)
    PvP:SetPoint('TOPRIGHT', hp, 12, 8)
    self.PvP = PvP

    local Combat = hp:CreateTexture(nil, 'OVERLAY')
    Combat:SetSize(20, 20)
    Combat:SetPoint('BOTTOMLEFT', hp, -10, -10)
    self.Combat = Combat

    local Resting = hp:CreateTexture(nil, 'OVERLAY')
    Resting:SetSize(20, 20)
    Resting:SetPoint('BOTTOMLEFT', Combat, 'TOPLEFT', 0, 4)
    self.Resting = Resting

    local QuestIcon = hp:CreateTexture(nil, 'OVERLAY')
    QuestIcon:SetSize(24, 24)
    QuestIcon:SetPoint('BOTTOMRIGHT', hp, 15, -20)
    self.QuestIcon = QuestIcon

    local PhaseIcon = hp:CreateTexture(nil, 'OVERLAY')
    PhaseIcon:SetSize(24, 24)
    PhaseIcon:SetPoint('BOTTOMRIGHT', hp, 12, -15)
    self.PhaseIcon = PhaseIcon

    local name = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
    if(unit == "targettarget" or unit == "focustarget") then
        name:SetPoint("LEFT", hp)
        name:SetPoint("RIGHT", hp)

        if classColorbars then
            self:Tag(name, '[freeb:name]')
        else
            self:Tag(name, '[freeb:color][freeb:name]')
        end
    else
        name:SetPoint("LEFT", hp, 2, 0)
        name:SetPoint("RIGHT", hp, -95, 0)
        name:SetJustifyH"LEFT"

        if(unit == "player") then
            self:Tag(name, '[freeb:pp]')
        elseif classColorbars then
            self:Tag(name, '[freeb:info] [freeb:name]')
        else
            self:Tag(name, '[freeb:info] [freeb:color][freeb:name]')
        end
    end

    local ricon = hp:CreateTexture(nil, 'OVERLAY')
    ricon:SetPoint("BOTTOM", hp, "TOP", 0, -7)
    ricon:SetSize(16, 16)
    self.RaidIcon = ricon

    if castbars then
        castbar(self, unit)
    end

    self:SetSize(width, height)
    if(unit == "targettarget") then
        self:SetSize(80, height)
    end

    self:SetSize(width, height)
    if(unit == "targettarget" or unit == "focustarget") then
        self:SetSize(80, height)
    end

    self:SetScale(scale)
end

local UnitSpecific = {

    --========================--
    --  Player
    --========================--
    player = function(self, ...)
        func(self, ...)

        if portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
            self.Portrait:SetWidth(60)
            self.Portrait:SetHeight(36)
            self.Portrait:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -10)
            self.PorBackdrop = createBackdrop(self, self.Portrait)
        end

        local _, class = UnitClass("player")
        -- Runes, Shards, HolyPower
        if multicheck(class, "DEATHKNIGHT", "WARLOCK", "PALADIN") then
            local count
            if class == "DEATHKNIGHT" then 
                count = 6 
            else 
                count = 3 
            end

            local bars = CreateFrame("Frame", nil, self)
            bars:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", -2, 37)
	    bars:SetSize(160/count, 3)

            local i = count
            for index = 1, count do
                bars[i] = createStatusbar(bars, texture, nil, 14, (portraits and 160 or width)/count-5, 1, 1, 1, 1)

                if class == "WARLOCK" then
                    local color = self.colors.power["SOUL_SHARDS"]
                    bars[i]:SetStatusBarColor(color[1], color[2], color[3])
                elseif class == "PALADIN" then
                    local color = self.colors.power["HOLY_POWER"]
                    bars[i]:SetStatusBarColor(color[1], color[2], color[3])
                end 

                if i == count then
                    bars[i]:SetPoint("TOPRIGHT", bars, "TOPRIGHT")
                else
                    bars[i]:SetPoint("RIGHT", bars[i+1], "LEFT", -5, 0)
                end

                bars[i].bg = bars[i]:CreateTexture(nil, "BACKGROUND")
                bars[i].bg:SetAllPoints(bars[i])
                bars[i].bg:SetTexture(texture)
                bars[i].bg.multiplier = .2

                bars[i].bd = createBackdrop(bars[i], bars[i])
                i=i-1
            end

            if class == "DEATHKNIGHT" then
                bars[3], bars[4], bars[5], bars[6] = bars[5], bars[6], bars[3], bars[4]
                self.Runes = bars
            elseif class == "WARLOCK" then
                self.SoulShards = bars
            elseif class == "PALADIN" then
                self.HolyPower = bars
            end
        end

        if class == "DRUID" then
            local ebar = CreateFrame("Frame", nil, self)
            ebar:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, 38)
            ebar:SetSize(portraits and 160 or width, 14)
            ebar.bd = createBackdrop(ebar, ebar)

            local lbar = createStatusbar(ebar, texture, nil, 16, portraits and 160 or width, 0, .4, 1, 1)
            lbar:SetPoint("LEFT", ebar, "LEFT")
            ebar.LunarBar = lbar

            local sbar = createStatusbar(ebar, texture, nil, 16, portraits and 160 or width, 1, .6, 0, 1)
            sbar:SetPoint("LEFT", lbar:GetStatusBarTexture(), "RIGHT")
            ebar.SolarBar = sbar

            ebar.Spark = sbar:CreateTexture(nil, "OVERLAY")
            ebar.Spark:SetTexture[[Interface\CastingBar\UI-CastingBar-Spark]]
            ebar.Spark:SetBlendMode("ADD")
            ebar.Spark:SetAlpha(0.5)
            ebar.Spark:SetHeight(48)
            ebar.Spark:SetPoint("LEFT", sbar:GetStatusBarTexture(), "LEFT", -15, 0)

            self.EclipseBar = ebar
            self.EclipseBar.PostUnitAura = updateEclipse

            --EclipseBarFrame:ClearAllPoints()
            --EclipseBarFrame:SetParent(self)
            --EclipseBarFrame:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -55)
        end

        if(IsAddOnLoaded('oUF_Experience')) then
            local OnEnter = function(self)
                UnitFrame_OnEnter(self)
                self.Experience.text:UpdateTag()
                self.Experience.text:Show()	
            end

            local OnLeave = function(self)
                UnitFrame_OnLeave(self)
                self.Experience.text:Hide()	
            end

            self.Experience = createStatusbar(self, texture, nil, 4, nil, 0, .7, 1, 1)
            self.Experience:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -2)
            self.Experience:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -2)

            self.Experience.Rested = createStatusbar(self.Experience, texture, nil, nil, nil, 0, .4, 1, .6)
            self.Experience.Rested:SetAllPoints(self.Experience)
            self.Experience.Rested:SetBackdrop(backdrop)
            self.Experience.Rested:SetBackdropColor(0,1, 0, 0)

            self.Experience.bg = self.Experience.Rested:CreateTexture(nil, 'BORDER')
            self.Experience.bg:SetAllPoints(self.Experience)
            self.Experience.bg:SetTexture(texture)
            self.Experience.bg:SetVertexColor(.1, .1, .1)

            self.Experience.bd = createBackdrop(self.Experience, self.Experience)

            self.Experience.text = createFont(self.Experience, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
            self.Experience.text:SetPoint("CENTER")
            self.Experience.text:Hide()
            self:Tag(self.Experience.text, '[freeb:curxp] / [freeb:maxxp] - [freeb:perxp]%')

            self:SetScript("OnEnter", OnEnter)
            self:SetScript("OnLeave", OnLeave)

            self:RegisterEvent('UNIT_POWER_BAR_SHOW', AltPower)
            self:RegisterEvent('UNIT_POWER_BAR_HIDE', AltPower)
        end

        if overrideBlizzbuffs then
            local buffs = CreateFrame("Frame", nil, self)
            buffs:SetHeight(36)
            buffs:SetWidth(36*12)
            buffs.initialAnchor = "TOPRIGHT"
            buffs.spacing = 5
            buffs.num = 40
            buffs["growth-x"] = "LEFT"
            buffs["growth-y"] = "DOWN"
            buffs:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -10, -20)
            buffs.size = 36

            buffs.PostCreateIcon = auraIcon
            buffs.PostUpdateIcon = PostUpdateIcon

            self.Buffs = buffs
        end

        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            debuffs.spacing = 4
            debuffs.size = height+2
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon
            debuffs.CustomFilter = CustomFilter

        end
    end,

    --========================--
    --  Target
    --========================--
    target = function(self, ...)
        func(self, ...)

        if portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
            self.Portrait:SetWidth(60)
            self.Portrait:SetHeight(40)
            self.Portrait:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -10)
            self.PorBackdrop = createBackdrop(self, self.Portrait)
        end

        if auras then
            local buffs = CreateFrame("Frame", nil, self)
            buffs:SetHeight(height)
            buffs:SetWidth(180)
            buffs.initialAnchor = "TOPLEFT"
            buffs.spacing = 4
            buffs.num = 5
            buffs["growth-x"] = "RIGHT"
            buffs["growth-y"] = "DOWN"
            buffs:SetPoint("LEFT", self, "RIGHT", 4, 0)
            buffs.size = height-6

            buffs.PostCreateIcon = auraIcon
            buffs.PostUpdateIcon = PostUpdateIcon

            self.Buffs = buffs

            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 2, -18)
            debuffs.spacing = 4
            debuffs.size = height-6
            debuffs.initialAnchor = "BOTTOMLEFT"
            debuffs.onlyShowPlayer = onlyShowPlayer
            debuffs["growth-x"] = "RIGHT"
            debuffs["growth-y"] = "DOWN"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon
            debuffs.CustomFilter = CustomFilter

            self.Debuffs = debuffs
            self.Debuffs.num = 10

            local Auras = CreateFrame("Frame", nil, self)
            Auras:SetHeight(height+2)
            Auras:SetWidth(width)
            Auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            Auras.spacing = 4
            Auras.gap = true
            Auras.size = height+2
            Auras.initialAnchor = "BOTTOMLEFT"

            Auras.PostCreateIcon = auraIcon
            Auras.PostUpdateIcon = PostUpdateIcon
            Auras.CustomFilter = CustomFilter

            --self.Auras = Auras
            --self.Auras.numDebuffs = 16
            --self.Auras.numBuffs = 15
        end

        local cpoints = createFont(self, "OVERLAY", font, 24, "THINOUTLINE", 1, 0, 0)
        cpoints:SetPoint('RIGHT', self, 'LEFT', -4, 24)
        self:Tag(cpoints, '[cpoints]')
    end,

    --========================--
    --  Focus
    --========================--
    focus = function(self, ...)
        func(self, ...)

        if portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
            self.Portrait:SetWidth(60)
            self.Portrait:SetHeight(40)
            self.Portrait:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -10)
            self.PorBackdrop = createBackdrop(self, self.Portrait)
        end

        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            debuffs.spacing = 4
            debuffs.size = height-6
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon

            local buffs = CreateFrame("Frame", nil, self)
            buffs:SetHeight(height)
            buffs:SetWidth(100)
            buffs.initialAnchor = "TOPLEFT"
            buffs.spacing = 4
            buffs.num = 10
            buffs["growth-x"] = "LEFT"
            buffs["growth-y"] = "DOWN"
            buffs:SetPoint("LEFT", self, "LEFT", -19, 0)
            buffs.size = height-6

            buffs.PostCreateIcon = auraIcon
            buffs.PostUpdateIcon = PostUpdateIcon

	    self.Debuffs = debuffs

            self.Buffs = buffs
        end
    end,

    --========================--
    --  Focus Target
    --========================--
    focustarget = function(self, ...)
        func(self, ...)

    end,

    --========================--
    --  Pet
    --========================--
    pet = function(self, ...)
        func(self, ...)

        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, -27)
            debuffs.spacing = 4
            debuffs.size = height+2
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon

            self.Debuffs = debuffs
            self.Debuffs.num = 5
        end
    end,

    --========================--
    --  Target Target
    --========================--
    targettarget = function(self, ...)
        func(self, ...)
        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height-20)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            debuffs.spacing = 4
            debuffs.size = height+2
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon
            debuffs.CustomFilter = CustomFilter

        end
    end,

    --========================--
    --  Boss
    --========================--
    boss = function(self, ...)
        func(self, ...)

        local Auras = CreateFrame("Frame", nil, self)
        Auras:SetHeight(height+2)
        Auras:SetWidth(width)
        Auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 100, 200)
        Auras.spacing = 4
        Auras.gap = true
        Auras.size = height+2
        Auras.initialAnchor = "BOTTOMLEFT"

        Auras.PostCreateIcon = auraIcon
        Auras.PostUpdateIcon = PostUpdateIcon
        Auras.CustomFilter = CustomFilter

        --self.Auras = Auras
        --self.Auras.numDebuffs = 4
        --self.Auras.numBuffs = 3
    end,
}

oUF:RegisterStyle("Freeb", func)
for unit,layout in next, UnitSpecific do
    oUF:RegisterStyle('Freeb - ' .. unit:gsub("^%l", string.upper), layout)
end

local spawnHelper = function(self, unit, ...)
    if(UnitSpecific[unit]) then
        self:SetActiveStyle('Freeb - ' .. unit:gsub("^%l", string.upper))
    elseif(UnitSpecific[unit:match('[^%d]+')]) then -- boss1 -> boss
        self:SetActiveStyle('Freeb - ' .. unit:match('[^%d]+'):gsub("^%l", string.upper))
    else
        self:SetActiveStyle'Freeb'
    end

    local object = self:Spawn(unit)
    object:SetPoint(...)
    return object
end

oUF:Factory(function(self)
    spawnHelper(self, "player", "CENTER", -238, -309)
    spawnHelper(self, "target", "CENTER", 238, -309)
    spawnHelper(self, "targettarget", "CENTER", 238, -285)
    spawnHelper(self, "focus", "CENTER", -238, -286)
--    spawnHelper(self, "focustarget", "RIGHT", self.units.focus, "LEFT", -10, 0)
    spawnHelper(self, "pet", "RIGHT", self.units.player, "LEFT", -10, 0)

    if bossframes then
        for i = 1, MAX_BOSS_FRAMES do
            spawnHelper(self,'boss' .. i, "CENTER", 825, 391 - (60 * i))
        end
    end
end)
Code:
local siValue = function(val)
    if(val >= 1e6) then
        return ('%.1f'):format(val / 1e6):gsub('%.', 'm')
    elseif(val >= 1e4) then
        return ("%.1f"):format(val / 1e3):gsub('%.', 'k')
    else
        return val
    end
end

local function hex(r, g, b)
    if not r then return "|cffFFFFFF" end

    if(type(r) == 'table') then
        if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
    end
    return ('|cff%02x%02x%02x'):format(r * 255, g * 255, b * 255)
end

oUF.colors.power['MANA'] = {.31,.45,.63}
oUF.colors.power['RAGE'] = {.69,.31,.31}

oUF.Tags['freeb:lvl'] = function(u) 
    local level = UnitLevel(u)
    local typ = UnitClassification(u)
    local color = GetQuestDifficultyColor(level)

    if level <= 0 then
        level = "??" 
        color.r, color.g, color.b = 1, 0, 0
    end

    if typ=="rareelite" then
        return hex(color)..level..'r+|r'
    elseif typ=="elite" then
        return hex(color)..level..'+|r'
    elseif typ=="rare" then
        return hex(color)..level..'r|r'
    else
        return hex(color)..level..'|r'
    end
end

oUF.Tags['freeb:hp']  = function(u) 
    local min, max = UnitHealth(u), UnitHealthMax(u)
    return siValue(min).." | "..math.floor(min/max*100+.5).."%" -- edit hp bar text
end
oUF.TagEvents['freeb:hp'] = 'UNIT_HEALTH'

oUF.Tags['syliha:hp']  = function(u) 
    local min, max = UnitHealth(u), UnitHealthMax(u)
    return math.floor(min/max*100+.5).."%" 
end
oUF.TagEvents['syliha:hp'] = 'UNIT_HEALTH'

oUF.Tags['freeb:pp'] = function(u) 
    local power = UnitPower(u)

    if power < 0 then -- für mana < durch > ersetzen 130 für dk (?)
        local _, str, r, g, b = UnitPowerType(u)
        local t = oUF.colors.power[str]

        if t then
            r, g, b = t[1], t[2], t[3]
        end

        return hex(r, g, b)..siValue(power).."|r"
    end
end
oUF.TagEvents['freeb:pp'] = 'UNIT_POWER'

oUF.Tags['freeb:color'] = function(u, r)
    local reaction = UnitReaction(u, "player")

    if (UnitIsTapped(u) and not UnitIsTappedByPlayer(u)) then
        return hex(oUF.colors.tapped)
    elseif (UnitIsPlayer(u)) then
        local _, class = UnitClass(u)
        return hex(oUF.colors.class[class])
    elseif reaction then
        return hex(oUF.colors.reaction[reaction])
    else
        return hex(1, 1, 1)
    end
end
oUF.TagEvents['freeb:color'] = 'UNIT_REACTION UNIT_HEALTH'

oUF.Tags['freeb:name'] = function(u, r)
    local name = UnitName(r or u)
    return name
end
oUF.TagEvents['freeb:name'] = 'UNIT_NAME_UPDATE'

oUF.Tags['freeb:info'] = function(u)
    if UnitIsDead(u) then
        return oUF.Tags['freeb:lvl'](u).."|cffCFCFCF DEAD|r"
    elseif UnitIsGhost(u) then
        return oUF.Tags['freeb:lvl'](u).."|cffCFCFCF Gho|r"
    elseif not UnitIsConnected(u) then
        return oUF.Tags['freeb:lvl'](u).."|cffCFCFCF D/C|r"
    else
        return oUF.Tags['freeb:lvl'](u)
    end
end
oUF.TagEvents['freeb:info'] = 'UNIT_HEALTH'

oUF.Tags['freebraid:info'] = function(u)
    local _, class = UnitClass(u)

    if class then
        if UnitIsDead(u) then
            return hex(oUF.colors.class[class]).."DEAD|r"
        elseif UnitIsGhost(u) then
            return hex(oUF.colors.class[class]).."Gho|r"
        elseif not UnitIsConnected(u) then
            return hex(oUF.colors.class[class]).."D/C|r"
        end
    end
end
oUF.TagEvents['freebraid:info'] = 'UNIT_HEALTH UNIT_CONNECTION'

oUF.Tags['freeb:curxp'] = function(unit)
    return siValue(UnitXP(unit))
end

oUF.Tags['freeb:maxxp'] = function(unit)
    return siValue(UnitXPMax(unit))
end

oUF.Tags['freeb:perxp'] = function(unit)
    return math.floor(UnitXP(unit) / UnitXPMax(unit) * 100 + 0.5)
end

oUF.TagEvents['freeb:curxp'] = 'PLAYER_XP_UPDATE PLAYER_LEVEL_UP'
oUF.TagEvents['freeb:maxxp'] = 'PLAYER_XP_UPDATE PLAYER_LEVEL_UP'
oUF.TagEvents['freeb:perxp'] = 'PLAYER_XP_UPDATE PLAYER_LEVEL_UP'

oUF.Tags['freeb:altpower'] = function(u)
    local cur = UnitPower(u, ALTERNATE_POWER_INDEX)
    local max = UnitPowerMax(u, ALTERNATE_POWER_INDEX)

    if max > 0 then
        local per = floor(cur/max*100)

        return format("%d", per > 0 and per or 0).."%"
    end
end
oUF.TagEvents['freeb:altpower'] = "UNIT_POWER UNIT_MAXPOWER"
Edit:
Got the classicon, now only have to resize the focus (:
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 02-03-12 at 08:14 AM.
  Reply With Quote
02-03-12, 08:03 AM   #12
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
for setting the size of the focus frame, find this part
Code:
    self:SetSize(width, height)
    if(unit == "targettarget" or unit == "focustarget") then
        self:SetSize(80, height)
    end
and add a case for if the unit is 'focus'.

===================

I'm not sure what you mean by class role icon, so I assume you mean the LFD role icon. In which case, find the following text and delete it:
Code:
    local LFDRole = hp:CreateTexture(nil, 'OVERLAY')
    LFDRole:SetSize(16, 16)
    LFDRole:SetPoint('LEFT', masterlooter, 'RIGHT')
    self.LFDRole = LFDRole

Last edited by yj589794 : 02-03-12 at 08:10 AM.
  Reply With Quote
02-03-12, 08:43 AM   #13
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Got it myself thanks =)

So what i want to do now:



I want the pet frame to only display 100% in the middle of the petframe

I tryed to just do this:
Code:
        if(unit == "player" or unit == "pet") then
            self:Tag(hpp, '[syliha:hp]')
Which set it to 100% but on the right.

Where do i set the position of the 100% seperatly?
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 02-03-12 at 09:02 AM.
  Reply With Quote
02-03-12, 09:19 AM   #14
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Code:
    if not (unit == "targettarget" or unit == "focustarget") then
        local hpp = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)

        if(unit == "pet") then
                hpp:SetPoint("CENTER", hp, -2, 0)
        else
                hpp:SetPoint("RIGHT", hp, -2, 0)
        end

        if(unit == "player") then
            self:Tag(hpp, '[syliha:hp]')
	elseif(unit == "focus") then
		self:Tag(hpp, '[syliha:hp]')
        else
            self:Tag(hpp, '[freeb:pp]  [freeb:hp]')
        end
    end
  Reply With Quote
02-03-12, 09:32 AM   #15
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Works! =) Nice thanks, i have to learn this hehe nice to have an example.

Ok... right now two last things are bothering me:

First:


I don't know how to resize the powerbar of paladin/wl/dk etc.

I tryed to mess around with this part:
Code:
            local bars = CreateFrame("Frame", nil, self)
            bars:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", -2, 37)
	    bars:SetSize(160/count, 3)
but setting the size fom 160 to something else or trying other things did not work at all, the position however can be changed and is working... any idea?

Lastly I want to resize the Targettarget abit cause it has no powerbar and looks "fat" cause of that i want to change the size about a few pixel.

I tryed some things here:


Code:
  self:SetSize(width, height)
    if(unit == "targettarget" or unit == "focus" or unit == "pet") then
        self:SetSize(80, height)
    end
But as of now When i just copy this and insert it and make 2 pieces of code one with focus and oet and the other one with targettarget (e.g. tt is second) pet and focus get back to default values, even though the part of the code is there.
If i try with elseif(unit == tt etc. it does not work either.

Ideas?

Thanks so far! =) Really appreciate it! helps alot to learn it.


Edit: Ah yeah ! and a final question: Where is the abbreviation set? As i have hidden the absolute mana / hp on most frames i think i can set it a bit higher (:
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 02-03-12 at 09:46 AM.
  Reply With Quote
02-07-12, 09:35 AM   #16
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
I know it's double posting but yj589794 wanted me to clarify some things about the above post so I think to keep it clear i start a new one, hope you mods do not mind (:

So I want three things to change:

First:
I want to adjust the purple bar here:


This is used for holy power, dk runes and wl shards.

I want to change it in height and width etc.

I tryed to change it by this code:
Code:
            local bars = CreateFrame("Frame", nil, self)
            bars:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", -2, 37)
	    bars:SetSize(160/count, 3)
But if I change the 160 to something else (Setsize) it does nothing.
If i change the position (-2,37) at least that's working, i totally do not understand why the setsize does not while the setpoint does. How do i change the size of this bar?

Second:
I want to only resize the targettarget.

As I used this code to resize focus, pet and targettarget:
Code:
  self:SetSize(width, height)
    if(unit == "targettarget" or unit == "focus" or unit == "pet") then
        self:SetSize(80, height)
    end
I tryed to use it as well.

I tryed frist to insert elseif(unit == "targettarget") then self:SetSize(x,y) but it did not work.
Then i tryed (like in the font sylihui tag thingy) to just copy the above and change it to a new part of code looking approximalty like this:

Code:
  self:SetSize(width, height)
    if(unit == "targettarget") then
        self:SetSize(80, height)
    end
If I do that and have in there BOTH parts of code (ofc i removed the targettarget in the first one) BOTH do not affect the addon so the pet, focus and targettarget frame are sized "normaly" meaning using width and height like all other frames, e.g. playerframe.

So how do i do that, resizing the targettarget frame DIFFERENT than focus and pet but also resizing them to ANOTHER DIFFERENT size?

Thirdly:

I want to get a higher value of abbreviation set, so that more letter e.g. of the enemy name are displayed but I was unable to find a piece of code that seems to have something to do with that.

Finally:
The code I use atm:
ftags.lua
Code:
local siValue = function(val)
    if(val >= 1e6) then
        return ('%.1f'):format(val / 1e6):gsub('%.', 'm')
    elseif(val >= 1e4) then
        return ("%.1f"):format(val / 1e3):gsub('%.', 'k')
    else
        return val
    end
end

local function hex(r, g, b)
    if not r then return "|cffFFFFFF" end

    if(type(r) == 'table') then
        if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
    end
    return ('|cff%02x%02x%02x'):format(r * 255, g * 255, b * 255)
end

oUF.colors.power['MANA'] = {.31,.45,.63}
oUF.colors.power['RAGE'] = {.69,.31,.31}

oUF.Tags['freeb:lvl'] = function(u) 
    local level = UnitLevel(u)
    local typ = UnitClassification(u)
    local color = GetQuestDifficultyColor(level)

    if level <= 0 then
        level = "??" 
        color.r, color.g, color.b = 1, 0, 0
    end

    if typ=="rareelite" then
        return hex(color)..level..'r+|r'
    elseif typ=="elite" then
        return hex(color)..level..'+|r'
    elseif typ=="rare" then
        return hex(color)..level..'r|r'
    else
        return hex(color)..level..'|r'
    end
end

oUF.Tags['freeb:hp']  = function(u) 
    local min, max = UnitHealth(u), UnitHealthMax(u)
    return siValue(min).." | "..math.floor(min/max*100+.5).."%" -- edit hp bar text
end
oUF.TagEvents['freeb:hp'] = 'UNIT_HEALTH'

oUF.Tags['syliha:hp']  = function(u) 
    local min, max = UnitHealth(u), UnitHealthMax(u)
    return math.floor(min/max*100+.5).."%" 
end
oUF.TagEvents['syliha:hp'] = 'UNIT_HEALTH'

oUF.Tags['freeb:pp'] = function(u) 
    local power = UnitPower(u)

    if power < 131 then -- für mana < durch > ersetzen 130 für dk (?)
        local _, str, r, g, b = UnitPowerType(u)
        local t = oUF.colors.power[str]

        if t then
            r, g, b = t[1], t[2], t[3]
        end

        return hex(r, g, b)..siValue(power).."|r"
    end
end
oUF.TagEvents['freeb:pp'] = 'UNIT_POWER'

oUF.Tags['freeb:color'] = function(u, r)
    local reaction = UnitReaction(u, "player")

    if (UnitIsTapped(u) and not UnitIsTappedByPlayer(u)) then
        return hex(oUF.colors.tapped)
    elseif (UnitIsPlayer(u)) then
        local _, class = UnitClass(u)
        return hex(oUF.colors.class[class])
    elseif reaction then
        return hex(oUF.colors.reaction[reaction])
    else
        return hex(1, 1, 1)
    end
end
oUF.TagEvents['freeb:color'] = 'UNIT_REACTION UNIT_HEALTH'

oUF.Tags['freeb:name'] = function(u, r)
    local name = UnitName(r or u)
    return name
end
oUF.TagEvents['freeb:name'] = 'UNIT_NAME_UPDATE'

oUF.Tags['freeb:info'] = function(u)
    if UnitIsDead(u) then
        return oUF.Tags['freeb:lvl'](u).."|cffCFCFCF DEAD|r"
    elseif UnitIsGhost(u) then
        return oUF.Tags['freeb:lvl'](u).."|cffCFCFCF Gho|r"
    elseif not UnitIsConnected(u) then
        return oUF.Tags['freeb:lvl'](u).."|cffCFCFCF D/C|r"
    else
        return oUF.Tags['freeb:lvl'](u)
    end
end
oUF.TagEvents['freeb:info'] = 'UNIT_HEALTH'

oUF.Tags['freebraid:info'] = function(u)
    local _, class = UnitClass(u)

    if class then
        if UnitIsDead(u) then
            return hex(oUF.colors.class[class]).."DEAD|r"
        elseif UnitIsGhost(u) then
            return hex(oUF.colors.class[class]).."Gho|r"
        elseif not UnitIsConnected(u) then
            return hex(oUF.colors.class[class]).."D/C|r"
        end
    end
end
oUF.TagEvents['freebraid:info'] = 'UNIT_HEALTH UNIT_CONNECTION'

oUF.Tags['freeb:curxp'] = function(unit)
    return siValue(UnitXP(unit))
end

oUF.Tags['freeb:maxxp'] = function(unit)
    return siValue(UnitXPMax(unit))
end

oUF.Tags['freeb:perxp'] = function(unit)
    return math.floor(UnitXP(unit) / UnitXPMax(unit) * 100 + 0.5)
end

oUF.TagEvents['freeb:curxp'] = 'PLAYER_XP_UPDATE PLAYER_LEVEL_UP'
oUF.TagEvents['freeb:maxxp'] = 'PLAYER_XP_UPDATE PLAYER_LEVEL_UP'
oUF.TagEvents['freeb:perxp'] = 'PLAYER_XP_UPDATE PLAYER_LEVEL_UP'

oUF.Tags['freeb:altpower'] = function(u)
    local cur = UnitPower(u, ALTERNATE_POWER_INDEX)
    local max = UnitPowerMax(u, ALTERNATE_POWER_INDEX)

    if max > 0 then
        local per = floor(cur/max*100)

        return format("%d", per > 0 and per or 0).."%"
    end
end
oUF.TagEvents['freeb:altpower'] = "UNIT_POWER UNIT_MAXPOWER"
freeb.lua:
Code:
local ADDON_NAME, ns = ...

local mediaPath = "Interface\\AddOns\\oUF_Freeb\\media\\"
local texture = mediaPath.."Cabaret"
local font, fontsize, fontflag = mediaPath.."myriad.ttf", 12, "THINOUTLINE" -- "" for none

local glowTex = mediaPath.."glowTex"
local buttonTex = mediaPath.."buttontex"
local height, width = 22, 150
local scale = 1.0
local hpheight = .85 -- .70 - .90 

local overrideBlizzbuffs = false
local castbars = false	-- disable castbars
local auras = true -- disable all auras
local bossframes = true
local auraborders = false

local classColorbars = false
local powerColor = true
local powerClass = false

local portraits = FALSE
local onlyShowPlayer = false -- only show player debuffs on target

local pixelborder = false

if overrideBlizzbuffs then
    BuffFrame:Hide(d)
    TemporaryEnchantFrame:Hide()
end

local function multicheck(check, ...)
    for i=1, select('#', ...) do
        if check == select(i, ...) then return true end
    end
    return false
end

local backdrop = {
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {top = 0, left = 0, bottom = 0, right = 0},
}

local backdrop2 = {
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {top = -1, left = -1, bottom = -1, right = -1},
}

local frameBD = {
    edgeFile = glowTex, edgeSize = 5,
    bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
    insets = {left = 3, right = 3, top = 3, bottom = 3}
}

-- Unit Menu
local dropdown = CreateFrame('Frame', ADDON_NAME .. 'DropDown', UIParent, 'UIDropDownMenuTemplate')

local function menu(self)
    dropdown:SetParent(self)
    return ToggleDropDownMenu(1, nil, dropdown, 'cursor', 0, 0)
end

local init = function(self)
    local unit = self:GetParent().unit
    local menu, name, id

    if(not unit) then
        return
    end

    if(UnitIsUnit(unit, "player")) then
        menu = "SELF"
    elseif(UnitIsUnit(unit, "vehicle")) then
        menu = "VEHICLE"
    elseif(UnitIsUnit(unit, "pet")) then
        menu = "PET"
    elseif(UnitIsPlayer(unit)) then
        id = UnitInRaid(unit)
        if(id) then
            menu = "RAID_PLAYER"
            name = GetRaidRosterInfo(id)
        elseif(UnitInParty(unit)) then
            menu = "PARTY"
        else
            menu = "PLAYER"
        end
    else
        menu = "TARGET"
        name = RAID_TARGET_ICON
    end

    if(menu) then
        UnitPopup_ShowMenu(self, menu, unit, name, id)
    end
end

UIDropDownMenu_Initialize(dropdown, init, 'MENU')

local createBackdrop = function(parent, anchor) 
    local frame = CreateFrame("Frame", nil, parent)
    frame:SetFrameStrata("LOW")

    if pixelborder then
        frame:SetAllPoints(anchor)
        frame:SetBackdrop(backdrop2)
    else
        frame:SetPoint("TOPLEFT", anchor, "TOPLEFT", -4, 4)
        frame:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 4, -4)
        frame:SetBackdrop(frameBD)
    end

    frame:SetBackdropColor(.05, .05, .05, 1)
    frame:SetBackdropBorderColor(0, 0, 0)

    return frame
end
ns.backdrop = createBackdrop

local fixStatusbar = function(bar)
    bar:GetStatusBarTexture():SetHorizTile(false)
    bar:GetStatusBarTexture():SetVertTile(false)
end

local createStatusbar = function(parent, tex, layer, height, width, r, g, b, alpha)
    local bar = CreateFrame"StatusBar"
    bar:SetParent(parent)
    if height then
        bar:SetHeight(height)
    end
    if width then
        bar:SetWidth(width)
    end
    bar:SetStatusBarTexture(tex, layer)
    bar:SetStatusBarColor(r, g, b, alpha)
    fixStatusbar(bar)

    return bar
end

local createFont = function(parent, layer, font, fontsiz, outline, r, g, b, justify)
    local string = parent:CreateFontString(nil, layer)
    string:SetFont(font, fontsiz, outline)
    string:SetShadowOffset(1, -1)
    string:SetTextColor(r, g, b)
    if justify then
        string:SetJustifyH(justify)
    end

    return string
end

local updateEclipse = function(element, unit)
    if element.hasSolarEclipse then
        element.bd:SetBackdropBorderColor(1, .6, 0)
        element.bd:SetBackdropColor(1, .6, 0)
    elseif element.hasLunarEclipse then
        element.bd:SetBackdropBorderColor(0, .4, 1)
        element.bd:SetBackdropColor(0, .4, 1)
    else
        element.bd:SetBackdropBorderColor(0, 0, 0)
        element.bd:SetBackdropColor(0, 0, 0)
    end
end

local xphide
local AltPower = function(self)
    local barType, minPower, _, _, _, hideFromOthers = UnitAlternatePowerInfo(self.unit)

    if barType and self.Experience:IsShown() then
        self.Experience:Hide()
        xphide = true
    elseif xphide  then
        self.Experience:Show()
        xphide = nil
    end

    self.AltPowerBar.Text:UpdateTag()
end

local PostAltUpdate = function(altpp, min, cur, max)
    local self = altpp.__owner

    local tPath, r, g, b = UnitAlternatePowerTextureInfo(self.unit, 2)

    if(r) then
        altpp:SetStatusBarColor(r, g, b, 1)
    else
        altpp:SetStatusBarColor(1, 1, 1, .8)
    end 
end

local GetTime = GetTime
local floor, fmod = floor, math.fmod
local day, hour, minute = 86400, 3600, 60

local FormatTime = function(s)
    if s >= day then
        return format("%dd", floor(s/day + 0.5))
    elseif s >= hour then
        return format("%dh", floor(s/hour + 0.5))
    elseif s >= minute then
        return format("%dm", floor(s/minute + 0.5))
    end

    return format("%d", fmod(s, minute))
end

local CreateAuraTimer = function(self,elapsed)
    self.elapsed = (self.elapsed or 0) + elapsed

    if self.elapsed < .2 then return end
    self.elapsed = 0

    local timeLeft = self.expires - GetTime()
    if timeLeft <= 0 then
        self.remaining:SetText(nil)
    else
        self.remaining:SetText(FormatTime(timeLeft))
    end
end

local debuffFilter = {
    --Update this
}

local auraIcon = function(auras, button)
    local count = button.count
    count:ClearAllPoints()
    count:SetPoint("BOTTOMRIGHT", 3, -3)
    count:SetFontObject(nil)
    count:SetFont(font, 12, "OUTLINE")
    count:SetTextColor(.8, .8, .8)

    auras.disableCooldown = true

    button.icon:SetTexCoord(.1, .9, .1, .9)
    button.bg = createBackdrop(button, button)

    if auraborders then
        auras.showDebuffType = true
        --auras.showBuffType = true
        button.overlay:SetTexture(buttonTex)
        button.overlay:SetPoint("TOPLEFT", button, "TOPLEFT", -2, 2)
        button.overlay:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
        button.overlay:SetTexCoord(0, 1, 0.02, 1)
    else
        button.overlay:Hide()
    end

    local remaining = createFont(button, "OVERLAY", font, 10, "THINOUTLINE", 1, 1, 1) -- bufftimeranzeige
    remaining:SetPoint("TOPLEFT", -3, 2)
    button.remaining = remaining
end

local PostUpdateIcon
do
    local playerUnits = {
        player = true,
        pet = true,
        vehicle = true,
    }

    PostUpdateIcon = function(icons, unit, icon, index, offset)
        local name, _, _, _, dtype, duration, expirationTime, unitCaster = UnitAura(unit, index, icon.filter)

        local texture = icon.icon
        if playerUnits[icon.owner] or debuffFilter[name] or UnitIsFriend('player', unit) or not icon.debuff then
            texture:SetDesaturated(false)
        else
            texture:SetDesaturated(true)
        end

        if duration and duration > 0 then
            icon.remaining:Show()
        else
            icon.remaining:Hide()
        end

        --[[if icon.debuff then
        icon.bg:SetBackdropBorderColor(.4, 0, 0)
        else
        icon.bg:SetBackdropBorderColor(0, 0, 0)
        end]]

        icon.duration = duration
        icon.expires = expirationTime
        icon:SetScript("OnUpdate", CreateAuraTimer)
    end
end

local aurafilter = {
    ["Chill of the Throne"] = true,
}

local CustomFilter = function(icons, ...)
    local _, icon, name, _, _, _, _, _, _, caster = ...

    if aurafilter[name] then
        return false
    end

    local isPlayer

    if multicheck(caster, 'player', 'vechicle') then
        isPlayer = true
    end

    if((icons.onlyShowPlayer and isPlayer) or (not icons.onlyShowPlayer and name)) then
        icon.isPlayer = isPlayer
        icon.owner = caster
        return true
    end
end

local PostCastStart = function(castbar, unit)
    if unit ~= 'player' then
        if castbar.interrupt then
            castbar.Backdrop:SetBackdropBorderColor(1, .9, .4)
            castbar.Backdrop:SetBackdropColor(1, .9, .4)
        else
            castbar.Backdrop:SetBackdropBorderColor(0, 0, 0)
            castbar.Backdrop:SetBackdropColor(0, 0, 0)
        end
    end
end

local CustomTimeText = function(castbar, duration)
    if castbar.casting then
        castbar.Time:SetFormattedText("%.1f / %.1f", duration, castbar.max)
    elseif castbar.channeling then
        castbar.Time:SetFormattedText("%.1f / %.1f", castbar.max - duration, castbar.max)
    end
end

--========================--
--  Castbars
--========================--
local castbar = function(self, unit)
    local u = unit:match('[^%d]+')
    if multicheck(u, "target", "player", "focus", "pet", "boss") then
        local cb = createStatusbar(self, texture, "OVERLAY", 16, portraits and 160 or width, 1, .25, .35, .5)
        cb:SetToplevel(true)

        cb.Spark = cb:CreateTexture(nil, "OVERLAY")
        cb.Spark:SetBlendMode("ADD")
        cb.Spark:SetAlpha(0.5)
        cb.Spark:SetHeight(48)

        local cbbg = cb:CreateTexture(nil, "BACKGROUND")
        cbbg:SetAllPoints(cb)
        cbbg:SetTexture(texture)
        cbbg:SetVertexColor(.1,.1,.1)

        cb.Time = createFont(cb, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
        cb.Time:SetPoint("RIGHT", cb, -2, 0)
        cb.CustomTimeText = CustomTimeText

        cb.Text = createFont(cb, "OVERLAY", font, fontsize, fontflag, 1, 1, 1, "LEFT")
        cb.Text:SetPoint("LEFT", cb, 2, 0)
        cb.Text:SetPoint("RIGHT", cb.Time, "LEFT")

        cb.Icon = cb:CreateTexture(nil, 'ARTWORK')
        cb.Icon:SetSize(20, 20)
        cb.Icon:SetTexCoord(.1, .9, .1, .9)

        if (unit == "player") then
            cb:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -10)
            cb.Icon:SetPoint("BOTTOMLEFT", cb, "BOTTOMRIGHT", 7, 0)

            cb.SafeZone = cb:CreateTexture(nil,'ARTWORK')
            cb.SafeZone:SetPoint('TOPRIGHT')
            cb.SafeZone:SetPoint('BOTTOMRIGHT')
            cb.SafeZone:SetTexture(texture)
            cb.SafeZone:SetVertexColor(.9,.7,0, 1)
        else
            cb:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -10)
            cb.Icon:SetPoint("BOTTOMRIGHT", cb, "BOTTOMLEFT", -7, 0)
        end

        cb.Backdrop = createBackdrop(cb, cb)
        cb.IBackdrop = createBackdrop(cb, cb.Icon)

        cb.PostCastStart = PostCastStart
        cb.PostChannelStart = PostCastStart

        cb.bg = cbbg
        self.Castbar = cb
    end
end

--========================--
--  Shared
--========================--
local func = function(self, unit)
    self.menu = menu

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

    self:SetScript("OnEnter", UnitFrame_OnEnter)
    self:SetScript("OnLeave", UnitFrame_OnLeave)
    self:RegisterForClicks"AnyUp"

    self.FrameBackdrop = createBackdrop(self, self)

    local hp = createStatusbar(self, texture, nil, nil, nil, 0.9, 0.9, 0.9, 1)
    hp:SetPoint"TOP"
    hp:SetPoint"LEFT"
    hp:SetPoint"RIGHT"

    if(unit == "targettarget" or unit == "focustarget") then
        hp:SetHeight(height)
    else
        hp:SetHeight(height*hpheight)
    end

    hp.frequentUpdates = true
    hp.Smooth = true

    local hpbg = hp:CreateTexture(nil, "BORDER")
    hpbg:SetAllPoints(hp)
    hpbg:SetTexture(texture)

    if classColorbars then
        hp.colorClass = true
        hp.colorReaction = true
        hpbg.multiplier = .2
    else
        hpbg:SetVertexColor(0,0.0,0) -- bgcolorhintergrund
    end

    if not (unit == "targettarget" or unit == "focustarget") then
        local hpp = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)

        if(unit == "pet") then
                hpp:SetPoint("CENTER", hp, 0, 0)
        else
                hpp:SetPoint("RIGHT", hp, -2, 0)
        end

        if(unit == "player" or unit == "pet") then
            self:Tag(hpp, '[syliha:hp]')
	elseif(unit == "focus") then
		self:Tag()
        else
            self:Tag(hpp, '[freeb:pp]  [freeb:hp]')
        end
    end

    hp.bg = hpbg
    self.Health = hp

    if not (unit == "targettarget" or unit == "focustarget") then
        local pp = createStatusbar(self, texture, nil, height*-(hpheight-.95), nil, 1, 1, 1, 1)
        pp:SetPoint"LEFT"
        pp:SetPoint"RIGHT"
        pp:SetPoint"BOTTOM" 

        pp.frequentUpdates = false
        pp.Smooth = true

        local ppbg = pp:CreateTexture(nil, "BORDER")
        ppbg:SetAllPoints(pp)
        ppbg:SetTexture(texture) 

        if powerColor then
            pp.colorPower = true
            ppbg.multiplier = .2
        elseif powerClass then
            pp.colorClass = true
            ppbg.multiplier = .2
        else
            ppbg:SetVertexColor(.3,.3,.3)
        end

        pp.bg = ppbg
        self.Power = pp
    end

    local altpp = createStatusbar(self, texture, nil, 4, nil, 1, 1, 1, .8)
    altpp:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -2)
    altpp:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -2)
    altpp.bg = altpp:CreateTexture(nil, 'BORDER')
    altpp.bg:SetAllPoints(altpp)
    altpp.bg:SetTexture(texture)
    altpp.bg:SetVertexColor(.1, .1, .1)
    altpp.bd = createBackdrop(altpp, altpp)

    altpp.Text =  createFont(altpp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
    altpp.Text:SetPoint("CENTER")
    self:Tag(altpp.Text, "[freeb:altpower]")

    altpp.PostUpdate = PostAltUpdate
    self.AltPowerBar = altpp

    local leader = hp:CreateTexture(nil, "OVERLAY")
    leader:SetSize(16, 16)
    leader:SetPoint("TOPLEFT", hp, "TOPLEFT", 5, 10)
    self.Leader = leader

    local masterlooter = hp:CreateTexture(nil, 'OVERLAY')
    masterlooter:SetSize(16, 16)
    masterlooter:SetPoint('LEFT', leader, 'RIGHT')
    self.MasterLooter = masterlooter

--    local PvP = hp:CreateTexture(nil, 'OVERLAY')
--    PvP:SetSize(24, 24)
--    PvP:SetPoint('TOPRIGHT', hp, 12, 8)
--    self.PvP = PvP

    local Combat = hp:CreateTexture(nil, 'OVERLAY')
    Combat:SetSize(20, 20)
    Combat:SetPoint('BOTTOMLEFT', hp, -10, -10)
    self.Combat = Combat

    local QuestIcon = hp:CreateTexture(nil, 'OVERLAY')
    QuestIcon:SetSize(24, 24)
    QuestIcon:SetPoint('BOTTOMRIGHT', hp, 15, -20)
    self.QuestIcon = QuestIcon

    local PhaseIcon = hp:CreateTexture(nil, 'OVERLAY')
    PhaseIcon:SetSize(24, 24)
    PhaseIcon:SetPoint('BOTTOMRIGHT', hp, 12, -15)
    self.PhaseIcon = PhaseIcon

    local name = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
    if(unit == "targettarget" or unit == "focus") then
        name:SetPoint("LEFT", hp)
        name:SetPoint("RIGHT", hp)


        if classColorbars then
            self:Tag(name, '[freeb:name]')
        else
            self:Tag(name, '[freeb:color][freeb:name]')
        end
    else
        name:SetPoint("LEFT", hp, 2, 0)
        name:SetPoint("RIGHT", hp, -95, 0)
        name:SetJustifyH"LEFT"

        if(unit == "player") then
            self:Tag(name, '[freeb:pp]')
        elseif classColorbars then
            self:Tag(name, '[freeb:info] [freeb:name]')
        else
            self:Tag(name, '[freeb:info] [freeb:color][freeb:name]')
        end
    end

    local ricon = hp:CreateTexture(nil, 'OVERLAY')
    ricon:SetPoint("BOTTOM", hp, "TOP", 0, -7)
    ricon:SetSize(16, 16)
    self.RaidIcon = ricon

    if castbars then
        castbar(self, unit)
    end

    self:SetSize(width, height)
    if(unit == "targettarget" or unit == "focus" or unit == "pet") then
        self:SetSize(80, height)
    end

    self:SetScale(scale)
end

local UnitSpecific = {

    --========================--
    --  Player
    --========================--
    player = function(self, ...)
        func(self, ...)

        if portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
            self.Portrait:SetWidth(60)
            self.Portrait:SetHeight(36)
            self.Portrait:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -10)
            self.PorBackdrop = createBackdrop(self, self.Portrait)
        end

        local _, class = UnitClass("player")
        -- Runes, Shards, HolyPower
        if multicheck(class, "DEATHKNIGHT", "WARLOCK", "PALADIN") then
            local count
            if class == "DEATHKNIGHT" then 
                count = 6 
            else 
                count = 3 
            end

            local bars = CreateFrame("Frame", nil, self)
            bars:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", -2, 37)
	    bars:SetSize(160/count, 3)

            local i = count
            for index = 1, count do
                bars[i] = createStatusbar(bars, texture, nil, 14, (portraits and 160 or width)/count-5, 1, 1, 1, 1)

                if class == "WARLOCK" then
                    local color = self.colors.power["SOUL_SHARDS"]
                    bars[i]:SetStatusBarColor(color[1], color[2], color[3])
                elseif class == "PALADIN" then
                    local color = self.colors.power["HOLY_POWER"]
                    bars[i]:SetStatusBarColor(color[1], color[2], color[3])
                end 

                if i == count then
                    bars[i]:SetPoint("TOPRIGHT", bars, "TOPRIGHT")
                else
                    bars[i]:SetPoint("RIGHT", bars[i+1], "LEFT", -5, 0)
                end

                bars[i].bg = bars[i]:CreateTexture(nil, "BACKGROUND")
                bars[i].bg:SetAllPoints(bars[i])
                bars[i].bg:SetTexture(texture)
                bars[i].bg.multiplier = .2

                bars[i].bd = createBackdrop(bars[i], bars[i])
                i=i-1
            end

            if class == "DEATHKNIGHT" then
                bars[3], bars[4], bars[5], bars[6] = bars[5], bars[6], bars[3], bars[4]
                self.Runes = bars
            elseif class == "WARLOCK" then
                self.SoulShards = bars
            elseif class == "PALADIN" then
                self.HolyPower = bars
            end
        end

        if class == "DRUID" then
            local ebar = CreateFrame("Frame", nil, self)
            ebar:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, 38)
            ebar:SetSize(portraits and 160 or width, 14)
            ebar.bd = createBackdrop(ebar, ebar)

            local lbar = createStatusbar(ebar, texture, nil, 16, portraits and 160 or width, 0, .4, 1, 1)
            lbar:SetPoint("LEFT", ebar, "LEFT")
            ebar.LunarBar = lbar

            local sbar = createStatusbar(ebar, texture, nil, 16, portraits and 160 or width, 1, .6, 0, 1)
            sbar:SetPoint("LEFT", lbar:GetStatusBarTexture(), "RIGHT")
            ebar.SolarBar = sbar

            ebar.Spark = sbar:CreateTexture(nil, "OVERLAY")
            ebar.Spark:SetTexture[[Interface\CastingBar\UI-CastingBar-Spark]]
            ebar.Spark:SetBlendMode("ADD")
            ebar.Spark:SetAlpha(0.5)
            ebar.Spark:SetHeight(48)
            ebar.Spark:SetPoint("LEFT", sbar:GetStatusBarTexture(), "LEFT", -15, 0)

            self.EclipseBar = ebar
            self.EclipseBar.PostUnitAura = updateEclipse

            --EclipseBarFrame:ClearAllPoints()
            --EclipseBarFrame:SetParent(self)
            --EclipseBarFrame:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -55)
        end

        if(IsAddOnLoaded('oUF_Experience')) then
            local OnEnter = function(self)
                UnitFrame_OnEnter(self)
                self.Experience.text:UpdateTag()
                self.Experience.text:Show()	
            end

            local OnLeave = function(self)
                UnitFrame_OnLeave(self)
                self.Experience.text:Hide()	
            end

            self.Experience = createStatusbar(self, texture, nil, 4, nil, 0, .7, 1, 1)
            self.Experience:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -2)
            self.Experience:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -2)

            self.Experience.Rested = createStatusbar(self.Experience, texture, nil, nil, nil, 0, .4, 1, .6)
            self.Experience.Rested:SetAllPoints(self.Experience)
            self.Experience.Rested:SetBackdrop(backdrop)
            self.Experience.Rested:SetBackdropColor(0,1, 0, 0)

            self.Experience.bg = self.Experience.Rested:CreateTexture(nil, 'BORDER')
            self.Experience.bg:SetAllPoints(self.Experience)
            self.Experience.bg:SetTexture(texture)
            self.Experience.bg:SetVertexColor(.1, .1, .1)

            self.Experience.bd = createBackdrop(self.Experience, self.Experience)

            self.Experience.text = createFont(self.Experience, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
            self.Experience.text:SetPoint("CENTER")
            self.Experience.text:Hide()
            self:Tag(self.Experience.text, '[freeb:curxp] / [freeb:maxxp] - [freeb:perxp]%')

            self:SetScript("OnEnter", OnEnter)
            self:SetScript("OnLeave", OnLeave)

            self:RegisterEvent('UNIT_POWER_BAR_SHOW', AltPower)
            self:RegisterEvent('UNIT_POWER_BAR_HIDE', AltPower)
        end

        if overrideBlizzbuffs then
            local buffs = CreateFrame("Frame", nil, self)
            buffs:SetHeight(36)
            buffs:SetWidth(36*12)
            buffs.initialAnchor = "TOPRIGHT"
            buffs.spacing = 5
            buffs.num = 40
            buffs["growth-x"] = "LEFT"
            buffs["growth-y"] = "DOWN"
            buffs:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -10, -20)
            buffs.size = 36

            buffs.PostCreateIcon = auraIcon
            buffs.PostUpdateIcon = PostUpdateIcon

            self.Buffs = buffs
        end

        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            debuffs.spacing = 4
            debuffs.size = height+2
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon
            debuffs.CustomFilter = CustomFilter

        end
    end,

    --========================--
    --  Target
    --========================--
    target = function(self, ...)
        func(self, ...)

        if portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
            self.Portrait:SetWidth(60)
            self.Portrait:SetHeight(40)
            self.Portrait:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -10)
            self.PorBackdrop = createBackdrop(self, self.Portrait)
        end

        if auras then
            local buffs = CreateFrame("Frame", nil, self)
            buffs:SetHeight(height)
            buffs:SetWidth(180)
            buffs.initialAnchor = "TOPLEFT"
            buffs.spacing = 4
            buffs.num = 5
            buffs["growth-x"] = "RIGHT"
            buffs["growth-y"] = "DOWN"
            buffs:SetPoint("LEFT", self, "RIGHT", 4, 0)
            buffs.size = height-6

            buffs.PostCreateIcon = auraIcon
            buffs.PostUpdateIcon = PostUpdateIcon

            self.Buffs = buffs

            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 3, -18)
            debuffs.spacing = 4
            debuffs.size = height-6
            debuffs.initialAnchor = "BOTTOMLEFT"
            debuffs.onlyShowPlayer = onlyShowPlayer
            debuffs["growth-x"] = "RIGHT"
            debuffs["growth-y"] = "DOWN"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon
            debuffs.CustomFilter = CustomFilter

            self.Debuffs = debuffs
            self.Debuffs.num = 10

            local Auras = CreateFrame("Frame", nil, self)
            Auras:SetHeight(height+2)
            Auras:SetWidth(width)
            Auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            Auras.spacing = 4
            Auras.gap = true
            Auras.size = height+2
            Auras.initialAnchor = "BOTTOMLEFT"

            Auras.PostCreateIcon = auraIcon
            Auras.PostUpdateIcon = PostUpdateIcon
            Auras.CustomFilter = CustomFilter

            --self.Auras = Auras
            --self.Auras.numDebuffs = 16
            --self.Auras.numBuffs = 15
        end

        local cpoints = createFont(self, "OVERLAY", font, 24, "THINOUTLINE", 1, 0, 0)
        cpoints:SetPoint('RIGHT', self, 'LEFT', -4, 24)
        self:Tag(cpoints, '[cpoints]')
    end,

    --========================--
    --  Focus
    --========================--
    focus = function(self, ...)
        func(self, ...)

        if portraits then
            self.Portrait = CreateFrame("PlayerModel", nil, self)
            self.Portrait:SetWidth(60)
            self.Portrait:SetHeight(40)
            self.Portrait:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -10)
            self.PorBackdrop = createBackdrop(self, self.Portrait)
        end

        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            debuffs.spacing = 4
            debuffs.size = height-6
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon

            local buffs = CreateFrame("Frame", nil, self)
            buffs:SetHeight(height)
            buffs:SetWidth(100)
            buffs.initialAnchor = "TOPLEFT"
            buffs.spacing = 4
            buffs.num = 10
            buffs["growth-x"] = "LEFT"
            buffs["growth-y"] = "DOWN"
            buffs:SetPoint("LEFT", self, "LEFT", -19, 0)
            buffs.size = height-6

            buffs.PostCreateIcon = auraIcon
            buffs.PostUpdateIcon = PostUpdateIcon

	    self.Debuffs = debuffs

            self.Buffs = buffs
        end
    end,

    --========================--
    --  Focus Target
    --========================--
    focustarget = function(self, ...)
        func(self, ...)

    end,

    --========================--
    --  Pet
    --========================--
    pet = function(self, ...)
        func(self, ...)

        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height+2)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, -27)
            debuffs.spacing = 4
            debuffs.size = height+2
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon

            self.Debuffs = debuffs
            self.Debuffs.num = 5
        end
    end,

    --========================--
    --  Target Target
    --========================--
    targettarget = function(self, ...)
        func(self, ...)
        if auras then 
            local debuffs = CreateFrame("Frame", nil, self)
            debuffs:SetHeight(height-20)
            debuffs:SetWidth(width)
            debuffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 4)
            debuffs.spacing = 4
            debuffs.size = height+2
            debuffs.initialAnchor = "BOTTOMLEFT"

            debuffs.PostCreateIcon = auraIcon
            debuffs.PostUpdateIcon = PostUpdateIcon
            debuffs.CustomFilter = CustomFilter

        end
    end,

    --========================--
    --  Boss
    --========================--
    boss = function(self, ...)
        func(self, ...)

        local Auras = CreateFrame("Frame", nil, self)
        Auras:SetHeight(height+2)
        Auras:SetWidth(width)
        Auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 100, 200)
        Auras.spacing = 4
        Auras.gap = true
        Auras.size = height+2
        Auras.initialAnchor = "BOTTOMLEFT"

        Auras.PostCreateIcon = auraIcon
        Auras.PostUpdateIcon = PostUpdateIcon
        Auras.CustomFilter = CustomFilter

        --self.Auras = Auras
        --self.Auras.numDebuffs = 4
        --self.Auras.numBuffs = 3
    end,
}

oUF:RegisterStyle("Freeb", func)
for unit,layout in next, UnitSpecific do
    oUF:RegisterStyle('Freeb - ' .. unit:gsub("^%l", string.upper), layout)
end

local spawnHelper = function(self, unit, ...)
    if(UnitSpecific[unit]) then
        self:SetActiveStyle('Freeb - ' .. unit:gsub("^%l", string.upper))
    elseif(UnitSpecific[unit:match('[^%d]+')]) then -- boss1 -> boss
        self:SetActiveStyle('Freeb - ' .. unit:match('[^%d]+'):gsub("^%l", string.upper))
    else
        self:SetActiveStyle'Freeb'
    end

    local object = self:Spawn(unit)
    object:SetPoint(...)
    return object
end

oUF:Factory(function(self)
    spawnHelper(self, "player", "CENTER", -236, -368)
    spawnHelper(self, "target", "CENTER", 236, -368)
    spawnHelper(self, "targettarget", "CENTER", 271, -345)
    spawnHelper(self, "focus", "CENTER", -352, -368)
--    spawnHelper(self, "focustarget", "RIGHT", self.units.focus, "LEFT", -10, 0)
    spawnHelper(self, "pet", "CENTER", -352, -391)

    if bossframes then
        for i = 1, MAX_BOSS_FRAMES do
            spawnHelper(self,'boss' .. i, "CENTER", 825, 391 - (60 * i))
        end
    end
end)
Thanks again for any help =)
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
02-07-12, 05:40 PM   #17
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
For the 3rd part, there is no explicit concatenation of the target name. Instead the concatenation will be done based upon the anchor points assigned to the name tag.
Look at this part:
Code:
        name:SetPoint("LEFT", hp, 2, 0)
        name:SetPoint("RIGHT", hp, -95, 0)
I've not looked into it too much, so altering the anchor points may cause some overlap with other elements.
  Reply With Quote
02-07-12, 05:51 PM   #18
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
for the second part, change:
Code:
    self:SetSize(width, height)
    if(unit == "targettarget" or unit == "focus" or unit == "pet") then
        self:SetSize(80, height)
    end
to be like this...
Code:
    if(unit == "targettarget") then
    	self:SetSize(x, y)
    else if (unit == "focus" or unit == "pet") then
        self:SetSize(80, height)
    else
    	self:SetSize(width, height)
    end
  Reply With Quote
02-07-12, 06:40 PM   #19
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
I'll need to play with the code to understand the size and positioning of the soul shards/holy power/runes. Just staring at the code I can't quite grasp how it all fits together.
I've got raiding tomorrow, so it may take a while until I can get time to play around with the code.
  Reply With Quote
02-07-12, 06:43 PM   #20
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Alright no problem thanks so far again! =)

I will test it tomorrow and tell you if that worked out!


Edit: Both worked! Thanks alot again!
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 02-08-12 at 08:06 PM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » ouf_freeb adjustment

Thread Tools
Display Modes

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