Walkerbo

hopefully I get this right 2.0

Jul 25th, 2021 (edited)
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.70 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() or C_PvP.IsRatedMap() or C_PvP.IsBattleground() or C_PvP.IsRatedBattleground() or C_PvP.IsArena() or C_PvP.IsInBrawl() or IsWargame() then
  39.                 --show nameplates
  40.                 SetCVar("nameplateShowSelf", 1)
  41.                 SetCVar("nameplateShowEnemies", 1)
  42.                 SetCVar("UnitNameFriendlyPlayerName", 1)
  43.             else
  44.                 --toggle nameplates
  45.                 SetCVar("nameplateShowSelf", 0)
  46.                 SetCVar("nameplateShowEnemies", 0)
  47.                 SetCVar("UnitNameFriendlyPlayerName", 0)
  48.             end
  49.         elseif event == "PLAYER_ENTERING_BATTLEGROUND" then
  50.                 --show nameplates
  51.                 SetCVar("nameplateShowSelf", 1)
  52.                 SetCVar("nameplateShowEnemies", 1)
  53.                 SetCVar("UnitNameFriendlyPlayerName", 1)
  54.         end
  55.     end
  56. )
  57. -- register events to track
  58. myFrame:RegisterEvent("PLAYER_LOGIN") -- fires on login or reload
  59. myFrame:RegisterEvent("PLAYER_ENTERING_WORLD") -- fires whenever a loading screen is seen
  60. myFrame:RegisterEvent("PLAYER_ENTERING_BATTLEGROUND") -- fires whenever a player enters a battleground
Add Comment
Please, Sign In to add comment