WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   [WIP] Adjusting bunitframes to my taste and needs, help required! (https://www.wowinterface.com/forums/showthread.php?t=45822)

Syliha 02-14-13 05:50 PM

[WIP] Adjusting bunitframes to my taste and needs, help required!
 
Hey there,

I am currently on my journey into addons in WoW again :)
I have come decently far by using my little actuall lua knowledge but depend highly on just thinking about what i am seeing in the code and adjusting it to what i understand will do stuff that i want to change.

So in total my actuall knowledge if about nonexistence but with logically thinking i get somewhat far.

I want to try to adjust bunitframes to my likings and hope you may help me with that and maybe i may learn alot from that. But please keep it simple and clear so even someone like me - a totally noob :D - may understand why and what you are doing.

So my first few things i want to have happen are the followings:

1) remove total health value only from playerframe and remove total power value only from target frame:

I have done a very simple solution by just moving these values out of the way as my out commenting on the parts i did screwed up everything.

As i do not like such "bad code" in my addons i'd like to fix it "cleanly" by removing the parts i do not like instead of moving them out of my screen.

I have done:
Code:

                if self.panel then
                        self.health.value = self.health.value or self.health:CreateFontString(fname..'healthbarvalue', 'OVERLAY', 'GameFontNormal')
                        self.health.value:SetFont(defaultfont, (NATIVE_FONT_SIZE-1) * frameScale)
                        if self.panel then
                                if self.unit =='player' then
                                        self.health.value:SetPoint('LEFT', self.panel, 'LEFT', gap*2, 5000) -- 5000 was 0
                                elseif self.unit == 'target' then
                                        self.health.value:SetPoint('RIGHT', self.panel, 'RIGHT', -gap*2, 0)
                                else
                                        self.health.value:SetPoint('RIGHT', self.panel, 'RIGHT', -gap*2, 0)
                                end
                        else
                                self.health.value:SetPoint('TOPLEFT', gap*2, 0)
                                self.health.value:SetPoint('BOTTOMRIGHT', -gap*2, 0)
                                self.health.value:SetJustifyH('RIGHT')
                        end
                end

as well as:

Code:

                        if self.panel then
                                self.power.value = self.power.value or self.power:CreateFontString(fname..'powerbarvalue', 'OVERLAY', 'GameFontNormal')
                                self.power.value:SetFont(defaultfont, NATIVE_FONT_SIZE * frameScale)
                                if self:GetHeight() > 30 then
                                        if self.panel then
                                                self.power.value:SetFont(defaultfont, (NATIVE_FONT_SIZE-1) * frameScale)
                                                if self.unit =='player' then
                                                        self.power.value:SetPoint('RIGHT', self.panel, 'RIGHT', -gap*2, 0)
                                                elseif self.unit == 'target' then
                                                        self.power.value:SetPoint('RIGHT', self.health.value, 'LEFT', -gap*2, 5000) -- 5000 was 0
                                                else
                                                        self.power.value:SetPoint('RIGHT', self.health.value, 'LEFT', -gap*2, 0)
                                                end
                                        else
                                                self.power.value:SetPoint('TOPLEFT', gap*2, 0)
                                                self.power.value:SetPoint('BOTTOMRIGHT', -gap*2, 1)
                                                self.power.value:SetJustifyH('RIGHT')
                                        end
                                end
                        end

2) I want to lift up the special power bar a bit (about 2-4 px)

I have done:
Code:

        if self.orbs == nil or self.orbs[vmax] == nil then
                self.orbs = self.orbs or CreateFrame('frame', 'bOrbs', self)
                local class_color = bUnitFrames.colors.class[class]
                self.orbs:SetSize(14*vmax, 16)
                for i=1, vmax do
                        local fname = 'bOrbs'..i
                        self.orbs[i] = self.orbs[i] or self.orbs:CreateTexture(fname..'tex', 'OVERLAY')
                        self.orbs[i]:SetTexture('Interface\\FriendsFrame\\StatusIcon-Offline')
                        self.orbs[i]:SetBlendMode('ADD')
                        self.orbs[i]:SetVertexColor(class_color.r, class_color.g, class_color.b)
                        if class == 'WARLOCK' then
                                local c_color = bUnitFrames.colors.WarlockPower[spec]
                                self.orbs[i]:SetVertexColor(c_color.r*1.3, c_color.g*1.3, c_color.b*1.3)
                        end
                        self.orbs[i]:SetSize(16, 16)
                        self.orbs[i].bg = self.orbs[i].bg or self.orbs:CreateTexture(fname..'texbg', 'OVERLAY')
                        self.orbs[i].bg:SetTexture('Interface\\FriendsFrame\\StatusIcon-Offline')
                        self.orbs[i].bg:SetVertexColor(.1,.1,.1)
                        self.orbs[i].bg:SetSize(16, 16)
                        if i==1 then
                                self.orbs[i]:SetPoint('LEFT')
                                self.orbs[i].bg:SetPoint('LEFT')
                        else
                                self.orbs[i]:SetPoint('LEFT', self.orbs[i-1], 'RIGHT', -2, 4) -- defaultvalue = -2, 0
                                self.orbs[i].bg:SetPoint('LEFT', self.orbs[i-1].bg, 'RIGHT', -2, 4) -- defaultvalue = -2, 0

                        end
                        self.orbs[i].bg:SetDrawLayer('OVERLAY', 6)
                        self.orbs[i]:SetDrawLayer('OVERLAY', 7)
                end
                self.orbs:SetPoint('CENTER', self.power, 'TOP')
        end

Which gives me this:


And i do not know why.

I want to change more stuff but this will take some time so please keep checking back from time to time if you are willing to help me :)

Thx alot I appreciate your help immensly!

Tim 02-14-13 07:32 PM

Your health and power issues should be fixable by setting their text to nothing.
Code:

self.health.value:SetText(' ')
self.power.value:SetText(' ')


As for your orb issues..
Code:

self.orbs[i]:SetPoint('LEFT', self.orbs[i-1], 'RIGHT', -2, 4) -- defaultvalue = -2, 0
self.orbs[i].bg:SetPoint('LEFT', self.orbs[i-1].bg, 'RIGHT', -2, 4) -- defaultvalue = -2, 0

This is basically telling the new orb to anchor itself & the bg to the previous orb as well as moving 2 to the side of it (x-axis) and 4 above it (y-axis). You will want to change 4 back to 0 and they should all be in a straight line.

Wildbreath 02-15-13 04:12 AM

sorry for the silence. my answers are short, because I do not write very well in english
Quote:

2) I want to lift up the special power bar a bit (about 2-4 px)
self.orbs:SetPoint('CENTER', self.power, 'TOP', 0, -4) (-4 - y-value for orbs bar, you was trying move every orb separately)
Quote:

1) remove total health value only from playerframe and remove total power value only from target frame:
just self.health.value:Hide() if unit equal player or target

lua Code:
  1. if self.unit =='player' or self.unit == 'target' then
  2.     self.health.value:ClearAllPoints()
  3.     self.health.value:Hide()
  4. else
  5.     self.health.value:SetPoint('RIGHT', self.panel, 'RIGHT', -gap*2, 0)
  6. end

Syliha 02-15-13 05:48 AM

Hey u 2 :)

Thx alout for your help everything worked and I have understood why so I will remember it (and if not i can still look up the thread :D).

So I have 3 more questions:

1) I want to color the target debuffs so they display an appropriated color (magic = blue, harmstring = red etc.)

I have tried setting:
debuffFrame.icon:SetBorder(1,1,1) just as a test to get at least one color around alld ebuffs, which did not work.

Also i tried to change:
Code:

self.debuffFrames[1].border:Hide()
into
Code:

self.debuffFrames[1].border = ('0.66,0.44,0.33')
With no success.

I have googled and read some pages, but alot of these changes they made there are either very complex or with other addons (e.g. ouf) and newly created layouts. As is there is a border / Backdrop used right now which i need to CHANGE and not ADD anything new. I hope i am right with that?

So how can i achieve my goal here? I either (cause that's the easiest way) want to color my debuffs with a red border or (which would be perfect) color them depending on their type (magic, physical etc.).

2) I want to adjust the size of the manabar of the targetstarget by about 1-2px.
At the moment it looks like this (ignore the circle^^):
http://img4.picload.org/image/adddor...nshot_0210.jpg
That means that the manabar for the target is about 1-2px smaller than for the player and targetframe which kinda looks bad. I have scanned thorugh all "targettarget" lines i could find but did not find anything which i could adjust like for the orbs function or anything like that. I am totally in the dark here :/

3) I have hidden all my bars (including playerbar) with ouf barfader till i got into combat or was not at 100% health.
As i do not know if and how it works here and wildbreath alread told me to "modify a statedriver values [combat]show;hide". But I have no idea how and what to do, so that's kinda up to you guys :/ Dunno if ouf_barfader is of any use here. I was using this in my old (~1year) old UI Pack but there is no way for me to really compare the code as the ouf layout is no longer supported etc. :/


Additionally I have hidden the minimap button by setting its size to 0,0 could this cause ony problemes?

Also i very sorry to not give you guys that are not having experience with this addon any more code but i just do not know where to look and what could help you - deeply sorry for that :/

I really hope you could help me out with that as well as that would be almost everything i need to complete my interface once again :)

Again: Much appreciation for your time! (:

Wildbreath 02-15-13 06:06 AM

look for updateAuraButton function
lua Code:
  1. icon.overlay:SetTexture(.2,.2,.2)
  2. if isDebuff then
  3.     local color = DebuffTypeColor[dtype] or { r=.1, g=.1, b=.1 }
  4.     icon.overlay:SetTexture(color.r, color.g, color.b)
  5. end
  6. icon.overlay:Show()
and a default UI DebuffTypeColor array
lua Code:
  1. DebuffTypeColor = { };
  2. DebuffTypeColor["none"] = { r = 0.80, g = 0, b = 0 };
  3. DebuffTypeColor["Magic"]    = { r = 0.20, g = 0.60, b = 1.00 };
  4. DebuffTypeColor["Curse"]    = { r = 0.60, g = 0.00, b = 1.00 };
  5. DebuffTypeColor["Disease"]  = { r = 0.60, g = 0.40, b = 0 };
  6. DebuffTypeColor["Poison"]   = { r = 0.00, g = 0.60, b = 0 };
  7. DebuffTypeColor[""] = DebuffTypeColor["none"];
visibility: add that code to layout function, as i know we can change alpha in combat, so use it
lua Code:
  1. self:SetScript('OnUpdate', function(self, elapsed)
  2.     if not self:IsShown() then return end
  3.     self.st = elapsed + (self.st or 0)
  4.     if self.st > .2 then
  5.         local h, mh = UnitHealth(self.unit) or 1, UnitMaxHealth(self.unit) or 100
  6.         local perc = h/(mh/100)
  7.         if perc < 100 or InCombatLockdown() or UnitAffectingCombat('player') then
  8.             self:SetAlpha(1)
  9.         else
  10.             self:SetAlpha(0)
  11.         end
  12.         self.st = 0
  13.     end
  14. end)

Syliha 02-15-13 06:47 AM

Hi!

The debuff thingy worked :) thx alot! Will try the hidingcode next.

I noticed a thing which i am not sure if it is cause of my changes or a general bug:

The Deathknightrunes are not indicating if they are usable or not. I noticed if i am out of runes they show the same colors as if i have them available.

I also noticed that they glow (as if an action button ability is ready again after a cooldown time) but the "shadow overlay" is missing (that what normaly is on the action bars).

They look exactly the same if used or not.

Any ideas?

Also any idea about the manabar on the target?

Love your support thx sooo much :)

Edit:

I've pasted your hiding script between these two lines:
Code:

bUnitFrames.Layout = function(self)

        local frameScale = min(self:GetHeight() / 36, self:GetWidth() / 72)

But nothing is happening? I do not get any errors but the frame is not hiding as well.

Wildbreath 02-15-13 07:18 AM

will test and post all soon from home, on job now

Syliha 02-15-13 08:09 AM

Alright thx alot :)

I have another issue:
http://picload.org/image/adcowwi/wowscrnshot_0215.jpg

As you can see here all manabars have different heights (I've edited the default values, to prevent resize errors), my values are:

Code:

        ['player'] =                                { a = 'CENTER', p = 'UIParent', pa = 'BOTTOM', x = -120, y = 160, width = 150, height = 45, panel = 1, castbar = 1 },
        ['target'] =                                { a = 'CENTER', p = 'UIParent', pa = 'BOTTOM', x = 120, y = 160, width = 150, height = 45, panel = 1, castbar = 1 },
        ['targettarget'] =                        { a = 'CENTER', p = 'UIParent', pa = 'BOTTOM', x = 240, y = 166, width = 80, height = 33 },

I will be waiting patiently, just take your time :)

Edit:
Also there seems to be a conflicht with the addon "cooldowns":
http://www.wowinterface.com/download...11871#comments

Edit2:


Sorry for discovering so many problems :O
I get a cooldwon displayed by bunitframes for Consecration:
http://picload.org/image/adclgdc/wowscrnshot_0215.jpg

It is definitly bunitframes, as every other addon is turned off.

Edit3:

Also i get huge errorspams in Alteracvalley e.g.:

Code:

Message: Interface\FrameXML\CompactUnitFrame.lua:858: attempt to call method 'SetVertexColor' (a nil value)
Time: 02/15/13 15:52:20
Count: 1
Stack: Interface\FrameXML\CompactUnitFrame.lua:858: in function <Interface\FrameXML\CompactUnitFrame.lua:826>
[C]: in function `CompactUnitFrame_UtilSetDebuff'
Interface\AddOns\bUnitFrames\bUnitFrames.lua:876: in function `UpdateDebuffs'
Interface\AddOns\bUnitFrames\bUnitFrames.lua:1688: in function `updateAuras'
Interface\AddOns\bUnitFrames\bUnitFrames.lua:2229: in function `updateUnit'
Interface\AddOns\bUnitFrames\bUnitFrames.lua:2708: in function <Interface\AddOns\bUnitFrames\bUnitFrames.lua:2635>
[C]: in function `SetAttribute'
Interface\FrameXML\SecureGroupHeaders.lua:195: in function <Interface\FrameXML\SecureGroupHeaders.lua:115>
Interface\FrameXML\SecureGroupHeaders.lua:458: in function `SecureGroupHeader_Update'
Interface\FrameXML\SecureGroupHeaders.lua:48: in function <Interface\FrameXML\SecureGroupHeaders.lua:46>

Locals: debuffFrame = bRaidUnitButton30Debuff {
 0 = <userdata>
 _SetSize = <function> defined =[C]:-1
 parent = bRaidUnitButton30 {
 }
 border = "0.66,0.44,0.33"
 count = bRaidUnitButton30DebuffCount {
 }
 unstable = false
 SetSize = <function> defined @Interface\AddOns\bUnitFrames\bUnitFrames.lua:75
 cooldown = bRaidUnitButton30DebuffCooldown {
 }
 icon = bRaidUnitButton30DebuffIcon {
 }
}
unit = "raid30"
index = 1
filter = nil
isBossAura = nil
isBossBuff = nil
name = "Chilled"
rank = ""
icon = "Interface\Icons\Spell_Frost_FrostArmor02"
count = 1
debuffType = "Magic"
duration = 0
expirationTime = 0
unitCaster = nil
canStealOrPurge = nil
shouldConsolidate = nil
spellId = 7321
color = <table> {
 b = 1
 g = 0.6
 r = 0.2
}
(*temporary) = nil
(*temporary) = "0.66,0.44,0.33"
(*temporary) = 0.2
(*temporary) = 0.6
(*temporary) = 1
(*temporary) = "attempt to call method 'SetVertexColor' (a nil value)"

Only bunitframe is enabled at this time.

Wildbreath 02-15-13 10:44 AM

about last error - seems you modify code and it tryes to edit raid debuffs, but raid debuffs not have a color border.

about show/hide -
Lua Code:
  1. self.uf = CreateFrame('frame', nil, self)
  2. self.uf:SetScript('OnUpdate', function(ss, elapsed)
  3.     ss = ss:GetParent()
  4.     if not ss:IsShown() then return end
  5.     ss.st = elapsed + (ss.st or 0)
  6.     if ss.st > .2 then
  7.         local h, mh = UnitHealth(ss.unit) or 1, UnitMaxHealth(ss.unit) or 100
  8.         local perc = h/(mh/100)
  9.         print(perc)
  10.         if perc < 100 or InCombatLockdown() or UnitAffectingCombat('player') then
  11.             ss:SetAlpha(1)
  12.         else
  13.             ss:SetAlpha(0)
  14.         end
  15.         ss.st = 0
  16.     end
  17. end)
paste it after
Lua Code:
  1. if self.unit == 'player' and not self.raidbutton then

Syliha 02-15-13 11:34 AM

Quote:

Originally Posted by Wildbreath (Post 273040)
about last error - seems you modify code and it tryes to edit raid debuffs, but raid debuffs not have a color border.

about show/hide -
Lua Code:
  1. self.uf = CreateFrame('frame', nil, self)
  2. self.uf:SetScript('OnUpdate', function(ss, elapsed)
  3.     ss = ss:GetParent()
  4.     if not ss:IsShown() then return end
  5.     ss.st = elapsed + (ss.st or 0)
  6.     if ss.st > .2 then
  7.         local h, mh = UnitHealth(ss.unit) or 1, UnitMaxHealth(ss.unit) or 100
  8.         local perc = h/(mh/100)
  9.         print(perc)
  10.         if perc < 100 or InCombatLockdown() or UnitAffectingCombat('player') then
  11.             ss:SetAlpha(1)
  12.         else
  13.             ss:SetAlpha(0)
  14.         end
  15.         ss.st = 0
  16.     end
  17. end)
paste it after
Lua Code:
  1. if self.unit == 'player' and not self.raidbutton then

Yeah that was true, I had edited them and will report back once i get into AV again.

Your code produces this error:
Code:

Message: Interface\AddOns\bUnitFrames\bUnitFrames.lua:1214: attempt to call global 'UnitMaxHealth' (a nil value)
Time: 02/15/13 18:33:42
Count: 5785
Stack: Interface\AddOns\bUnitFrames\bUnitFrames.lua:1214: in function <Interface\AddOns\bUnitFrames\bUnitFrames.lua:1209>

Locals: ss = bplayerUnitFrame {
 0 = <userdata>
 shadow = bplayerUnitFrameshadow {
 }
 combat = bplayerUnitFrameiconcombat {
 }
 SmoothBar = <function> defined @Interface\AddOns\bUnitFrames\bUnitFrames.lua:1027
 elapsed = 49.708002308384
 pvptimer = playerPVPTimer {
 }
 unit = "player"
 resize = bplayerUnitFrameResizeButton {
 }
 panel = bplayerUnitFramepanel {
 }
 threat = bplayerUnitFramethreat {
 }
 power = bplayerUnitFramepowerbar {
 }
 st = 49.708002308384
 uf = <unnamed> {
 }
 smooted = true
 castbar = <unnamed> {
 }
 menu = <function> defined @Interface\AddOns\bUnitFrames\bUnitFrames.lua:2430
 portrait = bplayerUnitFrameportrait {
 }
 name = bplayerUnitFrameunitnamestring {
 }
 isCastbar = <unnamed> {
 }
 title = <unnamed> {
 }
 health = bplayerUnitFramehealthbar {
 }
}
elapsed = 0.0080000003799796
(*temporary) = 4350
(*temporary) = nil
(*temporary) = "player"
(*temporary) = "attempt to call global 'UnitMaxHealth' (a nil value)"
UnitHealth = <function> defined =[C]:-1
UnitAffectingCombat = <function> defined =[C]:-1

Edit:
No errors anymore in alterac valley, sorry for my mistake.

Wildbreath 02-16-13 03:35 AM

UnitMaxHealth is wrong, my bad, replace to UnitHealthMax

Syliha 02-17-13 04:19 AM

Hey me again^^

I've got almost everything the way I want it to be and therefore are finishing the UI off :) Thx alot for helping me, would not be possible without your help!

So there are three things left:

1) The Hiding of the playerframe gives 2 Problemes:

First it does not hide the pet frame (and i suppose it does not hide the focus and focus target as well) which i need to be hidden as well (I do not want to show anything while not in combat or at 100% HP).

Also your code gives me "100" in the chat like 3x in 1 Second (so i get a chat locking like this:)
Code:

100
100
100
100
[TRADE]: XYBLAH 1000gold
100
100
100
100

etc.

EDIT: Also I need to show the playerframe if I have a target EDIT END

Secondly I still have no clue why the powerbar for the targetframe is about 1px bigger than for the playerframes even though they both have the exact same settings.

Your hiding code for the HP on the playerframe worked really well :)

Thirdly I still get the Cooldown for my paladin spell which is kinda weird and overlaps all my buttons placed there, so that really needs a fix, too.

I really hope i do not annoy you and am really, really glad that you find the time for hepling me.

Also if anyone else knows why I am having these issues, please feel free to join the discussion, thx!

:)

Wildbreath 02-18-13 06:29 AM

ouch, remove print(perc) from code, added it for testing only
for other unit frames you should modify a unit UnitAffectingCombat('target') UnitAffectingCombat('focus') & etc

Syliha 02-20-13 09:31 AM

Hey :)

I have achieved everything i wanted now and am really thankful for your support :) thanks!

Only things left are: 1) Powerbar on the target is bigger than everywhere else 2) CD Showing as Paladin.

But these are little things that i can overlook in favor of nice and lightweighted unitframes and a supportive author, thanks again!

Though you maybe should look into that CD-Problem as Paladin.

Cheers!


All times are GMT -6. The time now is 01:24 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI