/Tukui/modules/skins/bubbles.lua

http://github.com/Asphyxia/Tukui · Lua · 72 lines · 65 code · 6 blank · 1 comment · 10 complexity · 4267ef411d17f2a50c8850f2f515584d MD5 · raw file

  1. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2. if (IsAddOnLoaded("BossEncounter2")) then return end --> i don't know wtf this addon is doing but it broke my bubble script.
  3. local chatbubblehook = CreateFrame("Frame", nil, UIParent)
  4. local noscalemult = T.mult * C["general"].uiscale
  5. local tslu = 0
  6. local numkids = 0
  7. local bubbles = {}
  8. if T.eyefinity then
  9. -- hide options, disable bubbles, not compatible eyefinity
  10. InterfaceOptionsSocialPanelChatBubbles:SetScale(0.00001)
  11. InterfaceOptionsSocialPanelPartyChat:SetScale(0.00001)
  12. SetCVar("chatBubbles", 0)
  13. SetCVar("chatBubblesParty", 0)
  14. end
  15. local function skinbubble(frame)
  16. for i=1, frame:GetNumRegions() do
  17. local region = select(i, frame:GetRegions())
  18. if region:GetObjectType() == "Texture" then
  19. region:SetTexture(nil)
  20. elseif region:GetObjectType() == "FontString" then
  21. frame.text = region
  22. end
  23. end
  24. frame:SetBackdrop({
  25. bgFile = C["media"].blank,
  26. edgeFile = C["media"].blank,
  27. tile = false, tileSize = 0, edgeSize = noscalemult,
  28. insets = {left = -noscalemult, right = -noscalemult, top = -noscalemult, bottom = -noscalemult}
  29. })
  30. frame:SetBackdropBorderColor(unpack(C["media"].bordercolor))
  31. frame:SetBackdropColor(.1, .1, .1, .8)
  32. tinsert(bubbles, frame)
  33. end
  34. local function ischatbubble(frame)
  35. if frame:GetName() then return end
  36. if not frame:GetRegions() then return end
  37. return frame:GetRegions():GetTexture() == [[Interface\Tooltips\ChatBubble-Background]]
  38. end
  39. chatbubblehook:SetScript("OnUpdate", function(chatbubblehook, elapsed)
  40. tslu = tslu + elapsed
  41. if tslu > .05 then
  42. tslu = 0
  43. local newnumkids = WorldFrame:GetNumChildren()
  44. if newnumkids ~= numkids then
  45. for i=numkids + 1, newnumkids do
  46. local frame = select(i, WorldFrame:GetChildren())
  47. if ischatbubble(frame) then
  48. skinbubble(frame)
  49. end
  50. end
  51. numkids = newnumkids
  52. end
  53. for i, frame in next, bubbles do
  54. local r, g, b = frame.text:GetTextColor()
  55. frame:SetBackdropBorderColor(r, g, b, .8)
  56. -- bubbles is unfortunatly not compatible with eyefinity, we hide it event if they are enabled. :(
  57. if T.eyefinity then frame:SetScale(0.00001) end
  58. end
  59. end
  60. end)