Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.74 KB | None | 0 0
  1. ----------------
  2. -- INIT VARS
  3. ----------------
  4.  
  5.     -- Addon namespace
  6.     local an, ns = ...
  7.  
  8.     -- Hide a bunch of unneeded things.
  9.     MinimapBorder:Hide()
  10.     MinimapBorderTop:Hide()
  11.     MiniMapWorldMapButton:Hide()
  12.     MiniMapVoiceChatFrame:Hide()
  13.     MinimapZoomIn:Hide()
  14.     MinimapZoomOut:Hide()
  15.     MiniMapTracking:Hide()
  16.  
  17.     -- Get rid of the frame behind the clock and keep only the time.
  18.     -- Does handling the clock have to be this complicated?
  19.     if not IsAddOnLoaded("Blizzard_TimeManager") then
  20.         LoadAddOn("Blizzard_TimeManager")
  21.     end
  22.  
  23.     local ClockFrame, ClockTime = TimeManagerClockButton:GetRegions()
  24.     ClockFrame:Hide()
  25.     ClockTime:Show()
  26.  
  27.     -- Give local shorthand names to different buttons
  28.     local Calendar = GameTimeFrame
  29.     local GarrisonButton = GarrisonLandingPageMinimapButton
  30.     local Mail = MiniMapMailFrame
  31.     local LFG = QueueStatusMinimapButton
  32.     local InstanceDifficulty = MiniMapInstanceDifficulty
  33.  
  34.     -- Calculate minimap button positions
  35.     local function MinimapRadius(degree,offset)
  36.         local radius = (Minimap:GetWidth()/2)+offset
  37.         local radian = math.rad(degree)
  38.         local posX = radius * math.sin(radian)
  39.         local posY = radius * math.cos(radian)
  40.  
  41.         return posX, posY
  42.     end
  43.  
  44. ----------------
  45. -- MAIN FRAME POSITIONING
  46. ----------------
  47.  
  48.     ns.MinimapFrame = CreateFrame("Frame",an.."MinimapFrame",UIParent)
  49.     ns.MinimapFrame:SetPoint("TOPRIGHT",UIParent,"TOPRIGHT")
  50.     ns.MinimapFrame:SetSize(190,190)
  51.     ns.MinimapFrame:SetFrameStrata("LOW")
  52.     ns.MinimapFrame:SetFrameLevel(3)
  53.         local MinimapArt = ns.MinimapFrame:CreateTexture(nil,"ARTWORK")
  54.         MinimapArt:SetPoint("CENTER",Minimap,"CENTER",0,15)
  55.         MinimapArt:SetSize(225,225)
  56.         MinimapArt:SetTexture("Interface\\AddOns\\BlacksteelUI\\media\\minimap")
  57.         --MinimapArt:SetAlpha(0.6)
  58.  
  59.     -- Resize the cluster anchor. Seems all the things that appear below
  60.     -- the minimap anchor right to the bottom of this thing.
  61.     MinimapCluster:SetSize(200,230)
  62.     MinimapCluster:SetFrameLevel(1)
  63.  
  64.     -- Move and restyle the minimap itself
  65.     Minimap:ClearAllPoints()
  66.     Minimap:SetPoint("TOPRIGHT", ns.MinimapFrame, "TOPRIGHT", -15, -32)
  67.     Minimap:SetParent(ns.MinimapFrame)
  68.     Minimap:SetFrameLevel(2)
  69.     Minimap:SetMaskTexture('Textures\\MinimapMask')
  70.     Minimap:SetSize(152,152)
  71.  
  72.  
  73.  
  74. ----------------
  75. -- MINIMAP WIDGETS
  76. ----------------
  77.  
  78.     -- Holder variables for button positions
  79.     local posX, posY
  80.  
  81.     -- Zone text at the top of the minimap
  82.     MinimapZoneText:SetParent(ns.MinimapFrame)
  83.     MinimapZoneText:SetSize(155,11)
  84.     MinimapZoneText:SetPoint("CENTER", Minimap, "TOP", 0, 21)
  85.     MinimapZoneText:SetDrawLayer("OVERLAY")
  86.     MinimapZoneText:SetFont("Fonts\\FRIZQT__.ttf", 11, "THINOUTLINE")
  87.  
  88.     -- Clock at the bottom inside of the minimap
  89.     ClockTime:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, 10)
  90.     ClockTime:SetFont("Fonts\\FRIZQT__.ttf", 12, "THINOUTLINE")
  91.  
  92.     -- Calendar button
  93.     Calendar:ClearAllPoints()
  94.     posX, posY = MinimapRadius(45,7)
  95.     Calendar:SetPoint("CENTER",Minimap,"CENTER", posX, posY)
  96.  
  97.     -- Instance Difficulty flag
  98.     InstanceDifficulty:ClearAllPoints()
  99.     posX,posY = MinimapRadius(90,-5)
  100.     InstanceDifficulty:SetPoint("CENTER",Minimap,"CENTER", posX, posY)
  101.  
  102.     -- Mail button
  103.     Mail:ClearAllPoints()
  104.     posX, posY = MinimapRadius(118,7)
  105.     Mail:SetPoint("CENTER",Minimap,"CENTER", posX, posY)
  106.  
  107.     -- LFG button
  108.     LFG:ClearAllPoints()
  109.     posX, posY = MinimapRadius(220,6)
  110.     LFG:SetPoint("CENTER",Minimap,"CENTER", posX, posY)
  111.  
  112.     -- Garrison button
  113.     GarrisonButton:ClearAllPoints()
  114.     posX, posY = MinimapRadius(140,8)
  115.     GarrisonButton:SetPoint("CENTER",Minimap,"CENTER",posX,posY)
  116.     GarrisonButton:SetSize(50,50)
  117.     GarrisonButton:SetFrameLevel(6)
  118.  
  119.  
  120. ----------------
  121. -- UTILITY FUNCTIONS
  122. ----------------
  123.  
  124.     -- Mousewheel Scrolling.
  125.     Minimap:EnableMouseWheel(true)
  126.     Minimap:SetScript("OnMouseWheel", function(self, direction)
  127.         if direction > 0 then
  128.             _G.MinimapZoomIn:Click()
  129.         elseif direction < 0 then
  130.             _G.MinimapZoomOut:Click()
  131.         end
  132.     end)
  133.  
  134.     -- Click-handling for tracking dropdown
  135.     Minimap:SetScript("OnMouseUp", function(self, button)
  136.         if (button == "RightButton") then
  137.             ToggleDropDownMenu(1,nil,MiniMapTrackingDropDown,"cursor")
  138.         elseif (button == "LeftButton") then
  139.             Minimap_OnClick(self)
  140.         end
  141.     end)
  142.  
  143.     -- The cluster has a bad way of incrementally rising to really high frame levels
  144.     -- Kind of a dirty reset for it every time it is moused.
  145.     MinimapCluster:SetScript("OnEnter", function(self)
  146.         self:SetFrameLevel(1)
  147.     end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement