/Tukui/modules/actionbars/Others.lua

http://github.com/Asphyxia/Tukui · Lua · 65 lines · 51 code · 11 blank · 3 comment · 5 complexity · f945ec03aa8625534e31811e475b349d MD5 · raw file

  1. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2. if not C["actionbar"].enable == true then return end
  3. ---------------------------------------------------------------------------
  4. -- Manage all others stuff for actionbars
  5. ---------------------------------------------------------------------------
  6. local TukuiOnLogon = CreateFrame("Frame")
  7. TukuiOnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
  8. TukuiOnLogon:SetScript("OnEvent", function(self, event)
  9. self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  10. SetActionBarToggles(1, 1, 1, 1, 0)
  11. SetCVar("alwaysShowActionBars", 0)
  12. if C["actionbar"].showgrid == true then
  13. ActionButton_HideGrid = T.dummy
  14. for i = 1, 12 do
  15. local button = _G[format("ActionButton%d", i)]
  16. button:SetAttribute("showgrid", 1)
  17. ActionButton_ShowGrid(button)
  18. button = _G[format("BonusActionButton%d", i)]
  19. button:SetAttribute("showgrid", 1)
  20. ActionButton_ShowGrid(button)
  21. button = _G[format("MultiBarRightButton%d", i)]
  22. button:SetAttribute("showgrid", 1)
  23. ActionButton_ShowGrid(button)
  24. button = _G[format("MultiBarBottomRightButton%d", i)]
  25. button:SetAttribute("showgrid", 1)
  26. ActionButton_ShowGrid(button)
  27. button = _G[format("MultiBarLeftButton%d", i)]
  28. button:SetAttribute("showgrid", 1)
  29. ActionButton_ShowGrid(button)
  30. button = _G[format("MultiBarBottomLeftButton%d", i)]
  31. button:SetAttribute("showgrid", 1)
  32. ActionButton_ShowGrid(button)
  33. end
  34. end
  35. end)
  36. local function ModifiedBackdrop(self)
  37. local color = RAID_CLASS_COLORS[T.myclass]
  38. self:SetBackdropColor(color.r*.15, color.g*.15, color.b*.15)
  39. self:SetBackdropBorderColor(color.r, color.g, color.b)
  40. end
  41. local function OriginalBackdrop(self)
  42. self:SetTemplate("Default")
  43. end
  44. local vehicle = CreateFrame("Button", "TukuiExitVehicleButton", UIParent, "SecureHandlerClickTemplate")
  45. vehicle:CreatePanel("Default", T.buttonsize * 2, T.buttonsize + 1, "BOTTOMRIGHT", TukuiChatBackgroundRight, "BOTTOMLEFT", -3, 0)
  46. vehicle:CreateOverlay(vehicle)
  47. vehicle:RegisterForClicks("AnyUp")
  48. vehicle:SetScript("OnClick", function() VehicleExit() end)
  49. vehicle.text = T.SetFontString(vehicle, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
  50. vehicle.text:Point("CENTER", 1, 1)
  51. vehicle.text:SetText(T.datacolor.."Exit")
  52. RegisterStateDriver(vehicle, "visibility", "[target=vehicle,exists] show;hide")
  53. vehicle:HookScript("OnEnter", ModifiedBackdrop)
  54. vehicle:HookScript("OnLeave", OriginalBackdrop)