WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   UI Screenshots, Feedback and Design Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=144)
-   -   in progress (https://www.wowinterface.com/forums/showthread.php?t=49215)

ObbleYeah 05-11-14 10:04 AM

trying out a font


10leej 05-11-14 07:44 PM

Quote:

Originally Posted by ObbleYeah (Post 292720)
trying out a font


I like it.

ObbleYeah 05-19-14 09:41 AM

decided on a whim to try !beautycase and my texture for button skinning. Actionbar, Watchframe etc. are using !bc, buffs are not. I think the difference is clear enough visually:

just need to work out how to lower the frame strata on the !bc skins for certain objects at some point.

wish i didn't have to rely on rescaling the UI so that the frames lose their crispness, but everything becomes comically oversized at my resolution otherwise.

10leej 05-19-14 10:32 AM

Which version of !Beauty case are you using?

ObbleYeah 05-19-14 10:43 AM

the one hosted on WowI. Is there another one?

10leej 05-19-14 10:56 AM

Quote:

Originally Posted by ObbleYeah (Post 292854)
the one hosted on WowI. Is there another one?

Yeah the one in the neav ui download. Uses a different function and I believe it allows you to control the from level as well. What happened is that Neal never updated the standalone and didn't put ballagarba (current maintainer) on that project.

ObbleYeah 05-19-14 11:23 AM

hmn, i'll check his git. thanks

ObbleYeah 06-03-14 04:24 AM



finally got type-coloured debuffs working by rewriting and updating an ancient version of pBuff :roll eyes:
might host this at some point once the last few kinks are ironed out.

ObbleYeah 06-10-14 09:42 AM

me again, been skinning things


posting because I'm interested in skinning that icon in the raid warning (which is Deadly Boss Mods) but dunno if it's possible. Is there a simple way to accomplish that? I vaguely found this snippet in affli's tukui DBM skin which crops the blizz borders, but doesn't do anything beyond that.

Lua Code:
  1. local croprwicons=true          -- crops shitty blizz borders from icons in RaidWarning messages
  2. local rwiconsize=18
  3.  
  4. if (croprwicons) then
  5.     local replace=string.gsub
  6.     local old=RaidNotice_AddMessage
  7.     RaidNotice_AddMessage=function(noticeFrame, textString, colorInfo)
  8.         if textString:find(" |T") then
  9.             textString=replace(textString,"(:12:12)",":"..rwiconsize..":"..rwiconsize..":0:0:64:64:5:59:5:59")
  10.         end
  11.         return old(noticeFrame, textString, colorInfo)
  12.     end
  13. end

Phanx 06-10-14 02:05 PM

Quote:

Originally Posted by ObbleYeah (Post 293288)
... I'm interested in skinning that icon in the raid warning (which is Deadly Boss Mods) but dunno if it's possible. Is there a simple way to accomplish that? I vaguely found this snippet in affli's tukui DBM skin which crops the blizz borders, but doesn't do anything beyond that.

What do you want it to do beyond that?

Also, why bother creating a local replace upvalue to string.gsub instead of just using gsub directly? Messages aren't added to the raid warning function frequently enough for an upvalue to offer any benefit, so you're better off not cluttering up your code with one, but if you really must, at least use the correct function name... replace was an actual (and distinct from gsub) string function prior to Cataclysm (?) but is now deprecated.

ObbleYeah 06-10-14 04:35 PM

Sorry, should have been more explicit. I want - if possible - to add an overlay border texture to the icon in a raid warning; rather than just trim the edges of it. The code is not my own and I did wonder myself why the original author used that particular local.

I get the feeling it might be a tricky request because it all seems to be handled as a text string - but I'd be happy to hear otherwise.

Phanx 06-11-14 01:49 PM

Quote:

Originally Posted by ObbleYeah (Post 293297)
I want - if possible - to add an overlay border texture to the icon in a raid warning; rather than just trim the edges of it. ... I get the feeling it might be a tricky request because it all seems to be handled as a text string - but I'd be happy to hear otherwise.

It's not possible to overlap textures in a font string. You'd have to remove the embedded texture from the string, and then manually create a real texture object, anchor it to the left side of the font string, and set it to display the same texture, and then hide or update it for future messages that included no texture, or a different texture. This would require more than just hooking the AddMessage method -- you'd need to go deeper into the underlying ScrollingMessageFrame architecture of the RaidWarningFrame to access the actual font string object(s). And since those messages are animated -- the "bounce in" effect -- you'd also need to hook into the code doing the animation, and have it animate the texture in addition to the font string. This is all probably more effort than it's worth, by several orders of magnitude. :p

ObbleYeah 06-11-14 02:06 PM

yikes, yes - perhaps i'll just hide the icon!

ObbleYeah 06-12-14 11:29 AM

Alright then, how about this instead.

I work up some simple script today that gives the border round items on the character frame colour based on their rarity (a la oGlow or Fizzle), and have this:



Lua Code:
  1. local SkinButtons = CreateFrame("Frame", nil, UIParent)
  2.     SkinButtons:RegisterEvent('VARIABLES_LOADED')
  3.     SkinButtons:RegisterEvent("ADDON_LOADED")
  4.     SkinButtons:RegisterEvent('PLAYER_ENTERING_WORLD')
  5.     SkinButtons:RegisterEvent('UNIT_INVENTORY_CHANGED')
  6.  
  7.     -- Border colouring for items on the character pane
  8.     local function ColourBorders(slotID, self)
  9.         local quality = GetInventoryItemQuality("player", slotID)
  10.         if quality then
  11.                 local r, g, b, _ = GetItemQualityColor(quality)
  12.                 self:SetBeautyBorderColor(r, g, b)
  13.             else
  14.                 self:SetBeautyBorderColor(103/255, 103/255, 103/255)
  15.         end
  16.     end
  17.  
  18.     SkinButtons:SetScript("OnEvent", function(self, event, AddOn)
  19.        
  20.         for slotId, TheSlotButtons in pairs ({
  21.             -- durable
  22.             CharacterHeadSlot,
  23.             CharacterShoulderSlot,
  24.             CharacterChestSlot,
  25.             CharacterWristSlot,
  26.             CharacterMainHandSlot,
  27.             CharacterSecondaryHandSlot,
  28.             CharacterHandsSlot,
  29.             CharacterWaistSlot,
  30.             CharacterLegsSlot,
  31.             CharacterFeetSlot,
  32.             -- non durable
  33.             CharacterNeckSlot,
  34.             CharacterBackSlot,
  35.             CharacterShirtSlot,
  36.             CharacterTabardSlot,
  37.             CharacterFinger0Slot,
  38.             CharacterFinger1Slot,
  39.             CharacterTrinket0Slot,
  40.             CharacterTrinket1Slot,
  41.         }) do
  42.                 TheSlotButtons:CreateBeautyBorder(21)
  43.                 TheSlotButtons:SetBeautyBorderPadding(3, 3, 3, 3, 3, 3, 3, 3)
  44.                 TheSlotButtons:SetBeautyBorderDraw("OVERLAY")
  45.                 ColourBorders(slotId, TheSlotButtons)
  46.             end
  47.         end
  48.  
  49.     end)

Now clearly these are being coloured in the wrong order, since those non-epic colours correspond to my legendary cloak and common tshirt... but are being placed elsewhere. And the trinket gets a fallback colouring instead. What on earth is going on here?

semlar 06-12-14 11:59 AM

Firstly, you shouldn't use "pairs" when the order matters, use "ipairs".

That's not the problem here though. You have the slots in the wrong order, but rather than reordering them you should be able to just call TheSlotButtons:GetID() to get the slot id for the frame (this is lazy advice, it's more efficient to put them in the proper order).

I would move that table outside of the function though, because right now you're creating a table every time the event fires and that's going to create a lot of garbage.

ObbleYeah 06-12-14 12:40 PM

Ah! Thanks, for some reason didn't think that the actual order of the table would matter. Found the right order via oGlow and pulled it out into a separate table now.

It appears that it was the tabard that was using the fallback colour when it should be epic. Is CharacterTabardSlot the wrong call to use?

semlar 06-12-14 01:02 PM

I would either do something like this..
Lua Code:
  1. local CharacterSlots = {
  2.     -- durable
  3.     CharacterHeadSlot = CharacterHeadSlot:GetID(),
  4.     CharacterShoulderSlot = CharacterShoulderSlot:GetID(),
  5.     CharacterChestSlot = CharacterChestSlot:GetID(),
  6.     CharacterWristSlot = CharacterWristSlot:GetID(),
  7.     CharacterMainHandSlot = CharacterMainHandSlot:GetID(),
  8.     CharacterSecondaryHandSlot = CharacterSecondaryHandSlot:GetID(),
  9.     CharacterHandsSlot = CharacterHandsSlot:GetID(),
  10.     CharacterWaistSlot = CharacterWaistSlot:GetID(),
  11.     CharacterLegsSlot = CharacterLegsSlot:GetID(),
  12.     CharacterFeetSlot = CharacterFeetSlot:GetID()
  13.     -- non durable
  14.     CharacterNeckSlot = CharacterNeckSlot:GetID(),
  15.     CharacterBackSlot = CharacterBackSlot:GetID(),
  16.     CharacterShirtSlot = CharacterShirtSlot:GetID(),
  17.     CharacterTabardSlot = CharacterTabardSlot:GetID(),
  18.     CharacterFinger0Slot = CharacterFinger0Slot:GetID(),
  19.     CharacterFinger1Slot = CharacterFinger1Slot:GetID(),
  20.     CharacterTrinket0Slot = CharacterTrinket0Slot:GetID(),
  21.     CharacterTrinket1Slot = CharacterTrinket1Slot:GetID(),
  22. }
  23.  
  24. -- Border colouring for items on the character pane
  25. local function ColourBorders(button, slot)
  26.     local quality = GetInventoryItemQuality('player', slot)
  27.     if quality then
  28.         local r, g, b = GetItemQualityColor(quality)
  29.         button:SetBeautyBorderColor(r, g, b)
  30.     else
  31.         button:SetBeautyBorderColor(103/255, 103/255, 103/255)
  32.     end
  33. end
  34.  
  35. local SkinButtons = CreateFrame('Frame')
  36. SkinButtons:RegisterEvent('VARIABLES_LOADED')
  37. SkinButtons:RegisterEvent('ADDON_LOADED')
  38. SkinButtons:RegisterEvent('PLAYER_ENTERING_WORLD')
  39. SkinButtons:RegisterEvent('UNIT_INVENTORY_CHANGED')
  40.  
  41. SkinButtons:SetScript('OnEvent', function(self, event, ...)
  42.     for button, slot in pairs(CharacterSlots) do
  43.         button:CreateBeautyBorder(21)
  44.         button:SetBeautyBorderPadding(3, 3, 3, 3, 3, 3, 3, 3)
  45.         button:SetBeautyBorderDraw('OVERLAY')
  46.         ColourBorders(button, slot)
  47.     end
  48. end)
Or just pull the slotID out of the frame using button:GetID() in the "ColourBorders" function.

ObbleYeah 07-04-14 08:45 AM

Alright, I'm tightening up the last few things for this - so I'll probably be posting a couple of my standing issues in the next couple of days for stuff I've yet to fix even after a lot of fiddling.

I modified the chat bubbles a while back to display names over the top (based on code from BubbleBobble) and it's all more or less working, but I have two things i'd like to fix.

Firstly, there's an issue where new bubbles that pop up will still display names from older messages. You can sort of see what I mean here. Do I need to introduce some kind of method that wipes information after the function is activated each time or something?

Secondly, how do I hide realm names? There's a small function I wrote (or more likely, "procured" then bludgeoned) but it doesn't seem to be working - though there's no errors to speak of.

Here's the code:

Lua Code:
  1. -- events table
  2.     local events = {
  3.         CHAT_MSG_SAY = "chatBubbles",
  4.         CHAT_MSG_YELL = "chatBubbles",
  5.         CHAT_MSG_PARTY = "chatBubblesParty",
  6.         CHAT_MSG_PARTY_LEADER = "chatBubblesParty",
  7.         CHAT_MSG_MONSTER_SAY = "chatBubbles",
  8.         CHAT_MSG_MONSTER_YELL = "chatBubbles",
  9.         CHAT_MSG_MONSTER_PARTY = "chatBubblesParty",
  10.     }
  11.    
  12.     -- hides realm names
  13.     local function hideRealmName(self, event, msg, sender, ...)
  14.         local realmName = string.gsub(GetRealmName(), " ", "")
  15.         if msg:find("-" .. realmName) then
  16.             return false, gsub(msg, "%-"..realmName, ""), sender, ...
  17.         end
  18.     end
  19.  
  20.     local function styleBubble(frame)
  21.         for i = 1, frame:GetNumRegions() do
  22.             local region = select(i, frame:GetRegions())
  23.             local pn = {region:GetPoint()}
  24.             if (region:GetObjectType()=="Texture") then
  25.                 region:SetDrawLayer("OVERLAY")
  26.                 region:ClearAllPoints()
  27.                 -- fix the gap between bubble and tail texture by nudging up the yoffset
  28.                 region:SetPoint(pn[1],pn[2],pn[3],pn[4], pn[5]+2)
  29.             elseif (region:GetObjectType()=="FontString") then
  30.                 frame.textstring = region
  31.             end
  32.         end
  33.            
  34.         frame:SetBackdrop({
  35.             bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
  36.             edgeFile = nil,
  37.             edgeSize = 0,
  38.             insets = {
  39.                 left = 5, right = 5, top = 5, bottom = 5;
  40.                 }
  41.         })
  42.         frame:SetBackdropColor(0, 0, 0, 0.8)
  43.         frame:CreateBeautyBorder(22)
  44.         frame:SetBeautyBorderColor(r, g, b)
  45.         frame:SetScale(.95)
  46.            
  47.         frame.sender = frame:CreateFontString()
  48.         frame.sender:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -7, 2)
  49.         frame.sender:SetFont(STANDARD_TEXT_FONT, 13)
  50.         frame.sender:SetShadowOffset(1.7,-1.2)
  51.         frame.sender:SetShadowColor(0,0,0)
  52.         frame.sender:SetJustifyH("RIGHT")
  53.     end
  54.        
  55.     local function UpdateNameBubble(frame, guid, name)
  56.         local class
  57.         if (guid~= nil) and (guid~="") then
  58.             _, class, _, _, _, _ = GetPlayerInfoByGUID(guid)
  59.         end
  60.            
  61.         if name then
  62.             local color = RAID_CLASS_COLORS[class] or { r = 1, g = .8, b = 0 }
  63.             frame.sender:SetText(("|cFF%2x%2x%2x%s|r"):format(color.r*255, color.g*255, color.b*255, name))
  64.             if (frame:GetWidth() < frame.sender:GetWidth()) then
  65.                 frame.textstring:SetWidth(frame.sender:GetWidth() + 10)
  66.             end
  67.         end
  68.     end
  69.  
  70.     local function isChatBubble(frame)
  71.         if frame:GetName() then return end
  72.         if not frame:GetRegions() then return end
  73.         return frame:GetRegions():GetTexture()==("Interface\\Tooltips\\ChatBubble-Background")
  74.     end
  75.    
  76.     local bubbleHook = CreateFrame("Frame")
  77.    
  78.     for event, cvar in pairs(events) do
  79.         bubbleHook:RegisterEvent(event)
  80.     end
  81.  
  82.     bubbleHook:SetScript("OnEvent", function(self, event, msg, sender, _, _, _, _, _, _, _, _, _, guid)
  83.         if GetCVarBool(events[event]) then
  84.             local last = 0
  85.             local numKids = 0
  86.             hideRealmName(self, event, msg, sender)
  87.             bubbleHook:SetScript("OnUpdate", function(self, elapsed)
  88.                 last = last + elapsed
  89.                 if last > .1 then
  90.                     last = 0
  91.                     local newNumKids = WorldFrame:GetNumChildren()
  92.                     if newNumKids ~= numKids then
  93.                         for i=numKids + 1, newNumKids do
  94.                             local frame = select(i, WorldFrame:GetChildren())
  95.  
  96.                             if isChatBubble(frame) then
  97.                                 styleBubble(frame)
  98.                                 UpdateNameBubble(frame, guid, sender)
  99.                             end
  100.                         end
  101.                         numKids = newNumKids
  102.                     end
  103.                 end
  104.             end)
  105.         end
  106.     end)

Phanx 07-05-14 10:08 PM

Well, your realm name hiding function doesn't work because it just returns some values, and you're not actually doing anything with those values. You're not even calling the function in the same function that sets the sender text. Also, since there's only one place you need to call it, you may as well save yourself the overhead of creating and calling a function, and just include the code there directly:

Code:

local function UpdateNameBubble(frame, guid, name)               
        if not name then return end -- check this first since everything depends on it

        local class, _ -- global _ is bad, mmkay
        if (guid) and (guid~="") then -- no need to explicitly check against nil
                _, class = GetPlayerInfoByGUID(guid) -- no need to assign all the values to _, just stop after the last one you want
        end

        local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class] or { r = 1, g = .8, b = 0 } -- supporting custom class colors is trivial, so just do it

        -- just strip the realm name directly here:
        name = string.match(name, "^([^%-]+)")

        frame.sender:SetText(("|cFF%2x%2x%2x%s|r"):format(color.r*255, color.g*255, color.b*255, name))

        local senderWidth = frame.sender:GetStringWidth() -- use a variable to avoid repeated function calls
        if (frame:GetWidth() < senderWidth) then
                frame.textstring:SetWidth(senderWidth + 10)
        end
end

I didn't look through the rest of the code for leaked globals etc. but you may want to do that yourself, since leaking globals with generic names like _ is the #1 way to guarantee that your addon causes UI taint.

Also, recreating your OnUpdate script inside every run of the OnUpdate script is really inefficient. Set the OnUpdate script once -- not inside the OnEvent script -- and then just use Hide() and Show() on the frame to stop/start the OnUpdate script running as needed.

ObbleYeah 07-06-14 05:54 AM

Yikes, I hadn't realised just how off-piste I was with that code. I'll see if it clears up issues with the wrong names being displayed too. Could leaked globals also be the cause of an occasional c stack overflow error? Get one now and then and have to reload the ui.


Thanks, as ever!


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

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