Advertisement
Walkerbo

hopefully I get this right

Jul 23rd, 2021
1,394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.47 KB | None | 0 0
  1. -- must create a anonymous frame so we can track events
  2. local myFrame = CreateFrame("Frame")
  3. myFrame:SetScript(
  4.     "OnEvent",
  5.     function(self, event, ...)
  6.         if event =="PLAYER_LOGIN" then -- fires on login or reload
  7.             -- set all your bars
  8.             MainMenuBarArtFrameBackground:Hide()
  9.             MainMenuBarArtFrame.LeftEndCap:Hide()
  10.             MainMenuBarArtFrame.RightEndCap:Hide()
  11.             ActionBarUpButton:Hide()
  12.             ActionBarDownButton:Hide()
  13.             StatusTrackingBarManager:Hide()
  14.             MainMenuBarArtFrame.PageNumber:Hide()
  15.             -- hide tooltip
  16.             GameTooltip:SetScript("OnShow", GameTooltip.Hide)
  17.             -- set your local r
  18.             local r = {"MultiBarBottomLeft", "Action"}
  19.             -- first loop left action bar buttons
  20.             for b = 1, #r do
  21.                 for i = 1, 12 do
  22.                     -- hide your current button
  23.                      _G[r [b] .. "Button" .. i .. "Name"]:SetAlpha(0)
  24.                 end
  25.             end
  26.             -- second loop left action bar buttons
  27.             for i = 1, 12 do
  28.                  _G["MultiBarBottomLeftButton" .. i .. "HotKey"]:SetAlpha(0)
  29.             end
  30.             -- third loop action buttons
  31.             for i = 1, 12 do
  32.                 -- hide current action button
  33.                 _G["ActionButton" .. i .. "HotKey"]:SetAlpha(0)
  34.             end        
  35.  
  36.         elseif event == "PLAYER_ENTERING_WORLD" then -- fires whenever a loading screen is seen
  37.             -- check to see if you are in a pvp map
  38.             if C_PvP.IsPVPMap() then
  39.                 --toggle nameplates
  40.                 SetCVar("nameplateShowSelf", GetCVar("nameplateShowSelf") == "0" and 1 or 0)
  41.                 SetCVar("nameplateShowEnemies", 1 - GetCVar("nameplateShowEnemies"))
  42.                 SetCVar("UnitNameFriendlyPlayerName", 1 - GetCVar("UnitNameFriendlyPlayerName"))
  43.             elseif not C_PvP.IsPVPMap() then
  44.                 --toggle nameplates
  45.                 SetCVar("nameplateShowSelf", GetCVar"nameplateShowSelf"=="0" and 1 or 0)
  46.                 SetCVar("nameplateShowEnemies", 1-GetCVar("nameplateShowEnemies"))
  47.                 SetCVar("UnitNameFriendlyPlayerName", 1-GetCVar("UnitNameFriendlyPlayerName"))
  48.             end
  49.         end
  50.     end
  51. )
  52. -- register events to track
  53. myFrame:RegisterEvent("PLAYER_LOGIN") -- fires on login or reload
  54. myFrame:RegisterEvent("PLAYER_ENTERING_WORLD") -- fires whenever a loading screen is seen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement