FO01tjFi4cCKHTf4Xi3wG changeset

Changeset323030366433 (b)
ParentNone (a)
ab
0+setfenv(1, select(2, ...))
0+local Minimap, MinimapCluster, MinimapBackdrop = Minimap, MinimapCluster, MinimapBackdrop
0+local MiniMapMailFrame, MiniMapTracking = MiniMapMailFrame, MiniMapTracking
0+local MiniMapLFGFrame, MiniMapVoiceChatFrame, MiniMapBattlefieldFrame = MiniMapLFGFrame, MiniMapVoiceChatFrame, MiniMapBattlefieldFrame
0+
0+-- Drag ability
0+MinimapCluster:SetPoint("TOPRIGHT", -10, -10)
0+MinimapCluster:SetClampedToScreen(true)
0+MinimapCluster:SetMovable(true)
0+
0+MinimapZoneTextButton:SetScript("OnMouseDown", function(_, button)
0+        if button == "LeftButton" and IsAltKeyDown() then
0+                MinimapCluster:StartMoving()
0+        end
0+end)
0+
0+MinimapZoneTextButton:SetScript("OnMouseUp", function()
0+        MinimapCluster:StopMovingOrSizing()
0+end)
0+
0+-- Hide zoom buttons, mousewheel zooming
0+MinimapZoomIn:Hide()
0+MinimapZoomOut:Hide()
0+
0+Minimap:SetScript("OnMouseWheel", function(self, delta)
0+        local zoom = Minimap:GetZoom()
0+        if delta == 1 and zoom < Minimap:GetZoomLevels() then
0+                if IsShiftKeyDown() then
0+                        Minimap:SetZoom(Minimap:GetZoomLevels())
0+                else
0+                        Minimap:SetZoom(zoom + 1)
0+                end
0+        elseif delta == -1 and zoom > 0 then
0+                if IsShiftKeyDown() then
0+                        Minimap:SetZoom(0)
0+                else
0+                        Minimap:SetZoom(zoom - 1)
0+                end
0+        end
0+end)
0+
0+-- Hide map button
0+MiniMapWorldMapButton:Hide()
0+
0+-- Hide compass
0+hooksecurefunc("Minimap_UpdateRotationSetting", function()
0+        MinimapNorthTag:Hide()
0+        MinimapCompassTexture:Hide()
0+end)
0+
0+-- Hide calendar
0+GameTimeFrame:Hide()
0+
0+-- Hide time manager
0+local dummy = CreateFrame("Frame")
0+dummy:RegisterEvent("ADDON_LOADED")
0+dummy:SetScript("OnEvent", function(_, event, ...)
0+        if event == "ADDON_LOADED" then
0+                if ... == "Blizzard_TimeManager" then
0+                        TimeManagerClockButton:Hide()
0+                end
0+        end
0+end)
0+
0+-- Hide LFG button
0+local showLFGMenu = MiniMapLFGFrame:IsShown()
0+hooksecurefunc("MiniMapLFG_UpdateIsShown", function()
0+        showLFGMenu = MiniMapLFGFrame:IsShown()
0+        MiniMapLFGFrame:Hide()
0+end)
0+
0+-- Hide voice chat button
0+local showVoiceMenu = MiniMapVoiceChatFrame:IsShown()
0+hooksecurefunc("MiniMapVoiceChat_Update", function()
0+        showVoiceMenu = MiniMapVoiceChatFrame:IsShown()
0+        MiniMapVoiceChatFrame:Hide()
0+end)
0+
0+-- Hide PvP button
0+local showPvPMenu = MiniMapBattlefieldFrame:IsShown()
0+hooksecurefunc("PVP_UpdateStatus", function()
0+        showPvPMenu = MiniMapBattlefieldFrame:IsShown()
0+        --MiniMapBattlefieldFrame:Hide()
0+end)
0+
0+-- Skin minimap
0+Minimap:SetPoint("CENTER", MinimapCluster, 0, -10)
0+Minimap:SetMaskTexture(media.background["Flat"])
0+Minimap:SetFrameLevel(3)
0+
0+MinimapBackdrop:SetFrameLevel(2)
0+MinimapBackdrop:SetPoint("TOPLEFT", Minimap, -11, 11)
0+MinimapBackdrop:SetPoint("BOTTOMRIGHT", Minimap, 11, -11)
0+MinimapBackdrop:SetBackdrop({
0+        bgFile = media.background["Flat"],
0+        edgeFile = media.border["hankui: Thin Glow"],
0+        edgeSize = 16,
0+        insets = { left = 4, right = 4, top = 4, bottom = 4 }
0+})
0+MinimapBackdrop:SetBackdropColor(unpack(colors["Background"].applyAlpha(1)))
0+MinimapBackdrop:SetBackdropBorderColor(unpack(colors["Background"].applyAlpha(0.8)))
0+MinimapBorder:Hide()
0+
0+local glow = MinimapBackdrop:CreateTexture("MinimapGlow", "BACKGROUND", nil, -8)
0+glow:SetPoint("TOPLEFT", MinimapBackdrop, -110, 110)
0+glow:SetPoint("BOTTOMRIGHT", MinimapBackdrop, 110, -110)
0+glow:SetBlendMode("ADD")
0+glow:SetTexture(media.background["hankui: Minimap glow"])
0+glow:SetVertexColor(unpack(colors["Signature color"].applyAlpha(1)))
0+
0+MinimapBorderTop:Hide()
0+fonts.overrides["hMinimapZone"] = {"Tahoma Bold", 14, "OUTLINE"}
0+MinimapZoneText:SetFontObject("hMinimapZone")
0+
0+-- Skin buttons
0+local MiniMapBin = CreateFrame("Button", "MiniMapBin", Minimap)
0+local MiniMapBinIcon = MiniMapBin:CreateTexture("MiniMapBinIcon", "ARTWORK")
0+local MiniMapBinBorder =  MiniMapBin:CreateTexture("MiniMapBinBorder", "BORDER")
0+
0+for i, v in ipairs({ "MiniMapMail", "MiniMapTracking", "MiniMapBin" }) do
0+        local frame = _G[v .. "Frame"] or _G[v]
0+        local btn = _G[v .. "Button"]
0+        local ico = _G[v .. "Icon"]
0+        local bd = _G[v .. "Border"] or _G[v .. "ButtonBorder"]
0+       
0+        frame:SetSize(32, 32)
0+        frame:ClearAllPoints()
0+        frame:SetAlpha(0)
0+       
0+        if btn then
0+                btn:SetAllPoints()
0+                btn:SetHighlightTexture(nil)
0+                btn:SetScript("OnMouseDown", nil)
0+                btn:SetScript("OnMouseUp", nil)
0+        end
0+       
0+        local scriptRef = btn or frame
0+        scriptRef:HookScript("OnEnter", function(_, motion)
0+                ico:SetVertexColor(unpack(colors["Signature color"].applyAlpha(1)))
0+                bd:SetVertexColor(unpack(colors["Signature color"].applyAlpha(1)))
0+        end)
0+        scriptRef:HookScript("OnLeave", function(_, motion)
0+                ico:SetVertexColor(unpack(colors["Background light"].applyAlpha(1)))
0+                bd:SetVertexColor(unpack(colors["Background"].applyAlpha(1)))
0+        end)
0+       
0+        ico:SetAllPoints()
0+        ico:SetTexture(media.button["Minimap"])
0+        ico:SetTexCoord((i - 1) * 0.25, i * 0.25, 0, 0.5)
0+        ico:SetVertexColor(unpack(colors["Background light"].applyAlpha(1)))
0+       
0+        bd:SetAllPoints()
0+        bd:SetTexture(media.button["Minimap"])
0+        bd:SetTexCoord((i - 1) * 0.25, i * 0.25, 0.5, 1)
0+        bd:SetVertexColor(unpack(colors["Background"].applyAlpha(1)))
0+end
0+
0+MiniMapTracking:SetPoint("BOTTOM", 0, 10)
0+MiniMapMailFrame:SetPoint("RIGHT", MiniMapTracking, "LEFT", -5, 0)
0+MiniMapBin:SetPoint("LEFT", MiniMapTracking, "RIGHT", 5, 0)
0+
0+-- Show buttons on mouseover
0+local function showBtns()
0+        MiniMapBin:SetAlpha(1)
0+        MiniMapTracking:SetAlpha(1)
0+        MiniMapMailFrame:SetAlpha(1)
0+end
0+
0+local function hideBtns()
0+        if not Minimap:IsMouseOver() then
0+                MiniMapBin:SetAlpha(0)
0+                MiniMapTracking:SetAlpha(0)
0+                MiniMapMailFrame:SetAlpha(0)
0+        end
0+end
0+
0+for _, v in ipairs({ "Minimap", "MiniMapBin", "MiniMapTrackingButton", "MiniMapMailFrame" }) do
0+        _G[v]:HookScript("OnEnter", showBtns)
0+        _G[v]:HookScript("OnLeave", hideBtns)
0+end
0+
0+hideBtns()
0+
0+-- Button bin: Try to get all external addon buttons off the map
0+local external = {
0+        frames = {},
0+        factoryFrames = {
0+                "MinimapZoneTextButton",
0+                "MiniMapBattlefieldFrame",
0+                "GameTimeFrame",
0+                "MiniMapVoiceChatFrame",
0+                "MiniMapBin",
0+                "TimeManagerClockButton",
0+                "MiniMapWorldMapButton",
0+                "MiniMapLFGFrame",
0+                "MinimapZoomIn",
0+                "MinimapZoomOut",
0+                "MiniMapRecordingButton"
0+        },
0+        filteredStrings = {
0+                "Minimap",
0+                "Icon",
0+                "Button",
0+                "Frame",
0+                "LibDB[%d]*",
0+                "_"
0+        }
0+}
0+
0+Minimap:RegisterEvent("PLAYER_LOGIN")
0+Minimap:HookScript("OnEvent", function(_, event)
0+        if event == "PLAYER_LOGIN" then
0+                local externalButtons = {}
0+                for _, frame in ipairs({ "MinimapCluster", "Minimap", "MinimapBackdrop" }) do
0+                        if _G[frame]:GetChildren() then
0+                                for i = 1, select("#", _G[frame]:GetChildren()) do
0+                                        local child = select(i, _G[frame]:GetChildren())
0+                                        if child:GetObjectType() == "Button" and not tContains(external.factoryFrames, child:GetName()) then
0+                                                table.insert(external.frames, child)
0+                                                child:Hide()
0+                                        end
0+                                end
0+                        end
0+                end
0+        end
0+end)
0+
0+-- Button bin: Dropdown
0+local dropdown = CreateFrame("Frame", "MiniMapBinDropDown", MiniMapBin, "UIDropDownMenuTemplate")
0+local tblDropDown = {}
0+
0+local function showDropDown(self, level)
0+        -- Root menu
0+        if level == 1 then
0+                -- Calendar
0+                tblDropDown = {
0+                        text = "Calendar" .. (CalendarGetNumPendingInvites() > 0 and (" (" .. CalendarGetNumPendingInvites() .. " pending)") or ""),
0+                        notCheckable = true,
0+                        tooltipOnButton = true,
0+                        func = function() GameTimeFrame_OnClick(GameTimeFrame) end
0+                }
0+                UIDropDownMenu_AddButton(tblDropDown)
0+               
0+                -- Voice chat
0+                if showVoiceMenu then
0+                        tblDropDown = {
0+                                text = "Voice chat",
0+                                notCheckable = true,
0+                                hasArrow = true,
0+                                value = "Voice",
0+                                func = function() ToggleFriendsFrame(3) end
0+                        }
0+                        UIDropDownMenu_AddButton(tblDropDown)
0+                end
0+               
0+                -- LFG root menu
0+                if showLFGMenu then
0+                        tblDropDown = {
0+                                text = "Dungeon finder",
0+                                notCheckable = true,
0+                                hasArrow = true,
0+                                value = "LFG",
0+                                func = function()
0+                                        mode, submode = GetLFGMode()
0+                                        if mode == "proposal" and not LFDDungeonReadyPopup:IsShown() then
0+                                                PlaySound("igCharacterInfoTab");
0+                                StaticPopupSpecial_Show(LFDDungeonReadyPopup)
0+                                        elseif mode == "queued" or mode == "rolecheck" then
0+                                                ToggleLFDParentFrame()
0+                                        elseif mode == "listed" then
0+                                                ToggleLFRParentFrame()
0+                                        end
0+                                end
0+                        }
0+                       
0+                        local mode, submode = GetLFGMode()
0+                       
0+                        if mode == "queued" then
0+                                tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
0+                                tblDropDown.tooltipText = LFDSearchStatusStatistic:GetText()
0+                                tblDropDown.tooltipOnButton = true
0+                        elseif mode == "proposal" then
0+                                tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
0+                                tblDropDown.tooltipText = DUNGEON_GROUP_FOUND_TOOLTIP
0+                                tblDropDown.tooltipOnButton = true
0+                        elseif mode == "rolecheck" then
0+                                tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
0+                                tblDropDown.tooltipText = ROLE_CHECK_IN_PROGRESS_TOOLTIP
0+                                tblDropDown.tooltipOnButton = true
0+                        elseif mode == "listed" then
0+                                tblDropDown.tooltipTitle = LOOKING_FOR_RAID
0+                                tblDropDown.tooltipText = YOU_ARE_LISTED_IN_LFR
0+                                tblDropDown.tooltipOnButton = true
0+                        elseif mode == "lfgparty" then
0+                                tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
0+                                tblDropDown.tooltipText = YOU_ARE_IN_DUNGEON_GROUP
0+                                tblDropDown.tooltipOnButton = true
0+                        end
0+                       
0+                        UIDropDownMenu_AddButton(tblDropDown)
0+                end
0+               
0+                -- PvP root menu
0+                if showPvPMenu then
0+                        tblDropDown = {
0+                                text = "PvP",
0+                                notCheckable = true,
0+                                hasArrow = true,
0+                                value = "PvP",
0+                                tooltipTitle = "lolol",
0+                                tooltipText = string.gsub(MiniMapBattlefieldFrame.tooltip, RIGHT_CLICK_MESSAGE, ""),
0+                                tooltipOnButton = true,
0+                                func = function()
0+                                end
0+                        }
0+                        UIDropDownMenu_AddButton(tblDropDown)
0+                end
0+               
0+               
0+                -- External addons
0+                if #external.frames > 0 then
0+                        tblDropDown = { notCheckable = true, notClickable = true }
0+                        UIDropDownMenu_AddButton(tblDropDown)
0+                        tblDropDown = { isTitle = true, text = "Addons", notCheckable = true }
0+                        UIDropDownMenu_AddButton(tblDropDown)
0+                       
0+                        for i = 1, #external.frames do
0+                                local caption
0+                                if external.frames[i]:GetName() then
0+                                        caption = external.frames[i]:GetName()
0+                                        -- Filter out all the crap
0+                                        for _, filter in ipairs(external.filteredStrings) do
0+                                                caption = string.gsub(caption, filter, "")
0+                                        end
0+                                else
0+                                        caption = "Unknown addon"
0+                                end
0+                                tblDropDown = {
0+                                        text = caption,
0+                                        notCheckable = true,
0+                                        func = function()
0+                                                external.frames[i]:GetScript("OnClick")(external.frames[i], "LeftButton", true)
0+                                        end
0+                                }
0+                                UIDropDownMenu_AddButton(tblDropDown)
0+                        end
0+                end
0+        end
0+       
0+        -- Voice submenu
0+        if level == 2 and UIDROPDOWNMENU_MENU_VALUE == "Voice" then
0+                for id = 1, GetNumVoiceSessions() do
0+                        local name, active = GetVoiceSessionInfo(id);
0+                        tblDropDown = {
0+                                text = name,
0+                                checked = active,
0+                                func = function (self, id)
0+                                        SetActiveVoiceChannelBySessionID(id)
0+                                end,
0+                                arg1 = id
0+                        }
0+                        UIDropDownMenu_AddButton(tblDropDown, 2)
0+                end
0+         
0+                tblDropDown = {
0+                        text = NONE,
0+                        checked = not GetVoiceCurrentSessionID() and 1 or nil,
0+                        func = function (self, id)
0+                                SetActiveVoiceChannelBySessionID(id)
0+                        end,
0+                        arg1 = 0
0+                }
0+                UIDropDownMenu_AddButton(tblDropDown, 2)
0+        end
0+       
0+        -- LFG submenu
0+        if level == 2 and UIDROPDOWNMENU_MENU_VALUE == "LFG" then
0+                local mode, submode = GetLFGMode()
0+
0+                -- Teleport
0+                if IsPartyLFG() then
0+                        local addButton = false
0+                        if IsInLFGDungeon() then
0+                                tblDropDown = {
0+                                        text = TELEPORT_OUT_OF_DUNGEON,
0+                                        notCheckable = true,
0+                                        func = function()
0+                                                MiniMapLFGFrame_TeleportOut()
0+                                                ToggleDropDownMenu(1, nil, dropdown)
0+                                        end
0+                                }
0+                                UIDropDownMenu_AddButton(tblDropDown, 2)
0+                        elseif GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 then
0+                                tblDropDown = {
0+                                        text = TELEPORT_TO_DUNGEON,
0+                                        notCheckable = true,
0+                                        func = function()
0+                                                MiniMapLFGFrame_TeleportIn()
0+                                                ToggleDropDownMenu(1, nil, dropdown)
0+                                        end
0+                                }
0+                                UIDropDownMenu_AddButton(tblDropDown, 2)
0+                        end
0+                end
0+               
0+                -- Proposals, list grp / player
0+                if mode == "proposal" and submode == "unaccepted" then
0+                        tblDropDown = {
0+                                text = ENTER_DUNGEON,
0+                                notCheckable = true,
0+                                func = function()
0+                                        AcceptProposal()
0+                                        ToggleDropDownMenu(1, nil, dropdown)
0+                                end
0+                        }
0+                        UIDropDownMenu_AddButton(tblDropDown, 2)
0+                        tblDropDown = {
0+                                text = LEAVE_QUEUE,
0+                                notCheckable = true,
0+                                func = function()
0+                                        RejectProposal()
0+                                        ToggleDropDownMenu(1, nil, dropdown)
0+                                end
0+                        }
0+                        UIDropDownMenu_AddButton(tblDropDown, 2)
0+                elseif mode == "queued" then
0+                        tblDropDown = {
0+                                text = LEAVE_QUEUE,
0+                                notCheckable = true,
0+                                func = function()
0+                                        LeaveLFG()
0+                                        ToggleDropDownMenu(1, nil, dropdown)
0+                                end,
0+                                disabled = submode == "unempowered"
0+                        }
0+                        UIDropDownMenu_AddButton(tblDropDown, 2)
0+                elseif mode == "listed" then
0+                        tblDropDown = {
0+                                text = (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0) and UNLIST_MY_GROUP or UNLIST_ME,
0+                                notCheckable = true,
0+                                func = function()
0+                                        LeaveLF()
0+                                        ToggleDropDownMenu(1, nil, dropdown)
0+                                end,
0+                                disabled = submode == "unempowered"
0+                        }
0+                        UIDropDownMenu_AddButton(tblDropDown, 2)
0+                end
0+        end
0+       
0+        -- PvP submenu
0+        if level == 2 and UIDROPDOWNMENU_MENU_VALUE == "PvP" then
0+                -- ##2DO##
0+                -- **************************************************************************
0+                -- * http://wowprogramming.com/utils/xmlbrowser/live/FrameXML/PVPFrame.lua  *
0+                -- * MiniMapBattlefieldDropDown_Initialize()                                                            *
0+                -- **************************************************************************
0+                for i = 1, MAX_BATTLEFIELD_QUEUES do
0+                        local status, mapName, instanceID, levelRangeMin, levelRangeMax, teamSize, registeredMatch = GetBattlefieldStatus(i)
0+                        if status == "queued" or status == "confirm" then
0+                                if teamSize ~= 0 then
0+                                        tblDropDown = {
0+                                                text = ARENA_RATED_MATCH .. " " .. format(PVP_TEAMSIZE, teamSize, teamSize),
0+                                                isTitle = 1,
0+                                                notCheckable = 1
0+                                        }
0+                                else
0+                                        tblDropDown = {
0+                                                text = ARENA_RATED_MATCH .. " " .. format(PVP_TEAMSIZE, teamSize, teamSize),
0+                                                isTitle = 1,
0+                                                notCheckable = 1
0+                                        }
0+                                end
0+                               
0+                                UIDropDownMenu_AddButton(tblDropDown)
0+                        end
0+                end
0+        end
0+       
0+end
0+
0+UIDropDownMenu_Initialize(dropdown, showDropDown, "MENU")
0+dropdown.noResize = true
0+
0+MiniMapBin:SetScript("OnClick", function()
0+        PlaySound("igMainMenuOptionCheckBoxOn")
0+        ToggleDropDownMenu(1, nil, dropdown, "MiniMapBin", 0, -5)
0+end)
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
--- Revision None
+++ Revision 323030366433
@@ -0,0 +1,488 @@
+setfenv(1, select(2, ...))
+local Minimap, MinimapCluster, MinimapBackdrop = Minimap, MinimapCluster, MinimapBackdrop
+local MiniMapMailFrame, MiniMapTracking = MiniMapMailFrame, MiniMapTracking
+local MiniMapLFGFrame, MiniMapVoiceChatFrame, MiniMapBattlefieldFrame = MiniMapLFGFrame, MiniMapVoiceChatFrame, MiniMapBattlefieldFrame
+
+-- Drag ability
+MinimapCluster:SetPoint("TOPRIGHT", -10, -10)
+MinimapCluster:SetClampedToScreen(true)
+MinimapCluster:SetMovable(true)
+
+MinimapZoneTextButton:SetScript("OnMouseDown", function(_, button)
+ if button == "LeftButton" and IsAltKeyDown() then
+ MinimapCluster:StartMoving()
+ end
+end)
+
+MinimapZoneTextButton:SetScript("OnMouseUp", function()
+ MinimapCluster:StopMovingOrSizing()
+end)
+
+-- Hide zoom buttons, mousewheel zooming
+MinimapZoomIn:Hide()
+MinimapZoomOut:Hide()
+
+Minimap:SetScript("OnMouseWheel", function(self, delta)
+ local zoom = Minimap:GetZoom()
+ if delta == 1 and zoom < Minimap:GetZoomLevels() then
+ if IsShiftKeyDown() then
+ Minimap:SetZoom(Minimap:GetZoomLevels())
+ else
+ Minimap:SetZoom(zoom + 1)
+ end
+ elseif delta == -1 and zoom > 0 then
+ if IsShiftKeyDown() then
+ Minimap:SetZoom(0)
+ else
+ Minimap:SetZoom(zoom - 1)
+ end
+ end
+end)
+
+-- Hide map button
+MiniMapWorldMapButton:Hide()
+
+-- Hide compass
+hooksecurefunc("Minimap_UpdateRotationSetting", function()
+ MinimapNorthTag:Hide()
+ MinimapCompassTexture:Hide()
+end)
+
+-- Hide calendar
+GameTimeFrame:Hide()
+
+-- Hide time manager
+local dummy = CreateFrame("Frame")
+dummy:RegisterEvent("ADDON_LOADED")
+dummy:SetScript("OnEvent", function(_, event, ...)
+ if event == "ADDON_LOADED" then
+ if ... == "Blizzard_TimeManager" then
+ TimeManagerClockButton:Hide()
+ end
+ end
+end)
+
+-- Hide LFG button
+local showLFGMenu = MiniMapLFGFrame:IsShown()
+hooksecurefunc("MiniMapLFG_UpdateIsShown", function()
+ showLFGMenu = MiniMapLFGFrame:IsShown()
+ MiniMapLFGFrame:Hide()
+end)
+
+-- Hide voice chat button
+local showVoiceMenu = MiniMapVoiceChatFrame:IsShown()
+hooksecurefunc("MiniMapVoiceChat_Update", function()
+ showVoiceMenu = MiniMapVoiceChatFrame:IsShown()
+ MiniMapVoiceChatFrame:Hide()
+end)
+
+-- Hide PvP button
+local showPvPMenu = MiniMapBattlefieldFrame:IsShown()
+hooksecurefunc("PVP_UpdateStatus", function()
+ showPvPMenu = MiniMapBattlefieldFrame:IsShown()
+ --MiniMapBattlefieldFrame:Hide()
+end)
+
+-- Skin minimap
+Minimap:SetPoint("CENTER", MinimapCluster, 0, -10)
+Minimap:SetMaskTexture(media.background["Flat"])
+Minimap:SetFrameLevel(3)
+
+MinimapBackdrop:SetFrameLevel(2)
+MinimapBackdrop:SetPoint("TOPLEFT", Minimap, -11, 11)
+MinimapBackdrop:SetPoint("BOTTOMRIGHT", Minimap, 11, -11)
+MinimapBackdrop:SetBackdrop({
+ bgFile = media.background["Flat"],
+ edgeFile = media.border["hankui: Thin Glow"],
+ edgeSize = 16,
+ insets = { left = 4, right = 4, top = 4, bottom = 4 }
+})
+MinimapBackdrop:SetBackdropColor(unpack(colors["Background"].applyAlpha(1)))
+MinimapBackdrop:SetBackdropBorderColor(unpack(colors["Background"].applyAlpha(0.8)))
+MinimapBorder:Hide()
+
+local glow = MinimapBackdrop:CreateTexture("MinimapGlow", "BACKGROUND", nil, -8)
+glow:SetPoint("TOPLEFT", MinimapBackdrop, -110, 110)
+glow:SetPoint("BOTTOMRIGHT", MinimapBackdrop, 110, -110)
+glow:SetBlendMode("ADD")
+glow:SetTexture(media.background["hankui: Minimap glow"])
+glow:SetVertexColor(unpack(colors["Signature color"].applyAlpha(1)))
+
+MinimapBorderTop:Hide()
+fonts.overrides["hMinimapZone"] = {"Tahoma Bold", 14, "OUTLINE"}
+MinimapZoneText:SetFontObject("hMinimapZone")
+
+-- Skin buttons
+local MiniMapBin = CreateFrame("Button", "MiniMapBin", Minimap)
+local MiniMapBinIcon = MiniMapBin:CreateTexture("MiniMapBinIcon", "ARTWORK")
+local MiniMapBinBorder = MiniMapBin:CreateTexture("MiniMapBinBorder", "BORDER")
+
+for i, v in ipairs({ "MiniMapMail", "MiniMapTracking", "MiniMapBin" }) do
+ local frame = _G[v .. "Frame"] or _G[v]
+ local btn = _G[v .. "Button"]
+ local ico = _G[v .. "Icon"]
+ local bd = _G[v .. "Border"] or _G[v .. "ButtonBorder"]
+
+ frame:SetSize(32, 32)
+ frame:ClearAllPoints()
+ frame:SetAlpha(0)
+
+ if btn then
+ btn:SetAllPoints()
+ btn:SetHighlightTexture(nil)
+ btn:SetScript("OnMouseDown", nil)
+ btn:SetScript("OnMouseUp", nil)
+ end
+
+ local scriptRef = btn or frame
+ scriptRef:HookScript("OnEnter", function(_, motion)
+ ico:SetVertexColor(unpack(colors["Signature color"].applyAlpha(1)))
+ bd:SetVertexColor(unpack(colors["Signature color"].applyAlpha(1)))
+ end)
+ scriptRef:HookScript("OnLeave", function(_, motion)
+ ico:SetVertexColor(unpack(colors["Background light"].applyAlpha(1)))
+ bd:SetVertexColor(unpack(colors["Background"].applyAlpha(1)))
+ end)
+
+ ico:SetAllPoints()
+ ico:SetTexture(media.button["Minimap"])
+ ico:SetTexCoord((i - 1) * 0.25, i * 0.25, 0, 0.5)
+ ico:SetVertexColor(unpack(colors["Background light"].applyAlpha(1)))
+
+ bd:SetAllPoints()
+ bd:SetTexture(media.button["Minimap"])
+ bd:SetTexCoord((i - 1) * 0.25, i * 0.25, 0.5, 1)
+ bd:SetVertexColor(unpack(colors["Background"].applyAlpha(1)))
+end
+
+MiniMapTracking:SetPoint("BOTTOM", 0, 10)
+MiniMapMailFrame:SetPoint("RIGHT", MiniMapTracking, "LEFT", -5, 0)
+MiniMapBin:SetPoint("LEFT", MiniMapTracking, "RIGHT", 5, 0)
+
+-- Show buttons on mouseover
+local function showBtns()
+ MiniMapBin:SetAlpha(1)
+ MiniMapTracking:SetAlpha(1)
+ MiniMapMailFrame:SetAlpha(1)
+end
+
+local function hideBtns()
+ if not Minimap:IsMouseOver() then
+ MiniMapBin:SetAlpha(0)
+ MiniMapTracking:SetAlpha(0)
+ MiniMapMailFrame:SetAlpha(0)
+ end
+end
+
+for _, v in ipairs({ "Minimap", "MiniMapBin", "MiniMapTrackingButton", "MiniMapMailFrame" }) do
+ _G[v]:HookScript("OnEnter", showBtns)
+ _G[v]:HookScript("OnLeave", hideBtns)
+end
+
+hideBtns()
+
+-- Button bin: Try to get all external addon buttons off the map
+local external = {
+ frames = {},
+ factoryFrames = {
+ "MinimapZoneTextButton",
+ "MiniMapBattlefieldFrame",
+ "GameTimeFrame",
+ "MiniMapVoiceChatFrame",
+ "MiniMapBin",
+ "TimeManagerClockButton",
+ "MiniMapWorldMapButton",
+ "MiniMapLFGFrame",
+ "MinimapZoomIn",
+ "MinimapZoomOut",
+ "MiniMapRecordingButton"
+ },
+ filteredStrings = {
+ "Minimap",
+ "Icon",
+ "Button",
+ "Frame",
+ "LibDB[%d]*",
+ "_"
+ }
+}
+
+Minimap:RegisterEvent("PLAYER_LOGIN")
+Minimap:HookScript("OnEvent", function(_, event)
+ if event == "PLAYER_LOGIN" then
+ local externalButtons = {}
+ for _, frame in ipairs({ "MinimapCluster", "Minimap", "MinimapBackdrop" }) do
+ if _G[frame]:GetChildren() then
+ for i = 1, select("#", _G[frame]:GetChildren()) do
+ local child = select(i, _G[frame]:GetChildren())
+ if child:GetObjectType() == "Button" and not tContains(external.factoryFrames, child:GetName()) then
+ table.insert(external.frames, child)
+ child:Hide()
+ end
+ end
+ end
+ end
+ end
+end)
+
+-- Button bin: Dropdown
+local dropdown = CreateFrame("Frame", "MiniMapBinDropDown", MiniMapBin, "UIDropDownMenuTemplate")
+local tblDropDown = {}
+
+local function showDropDown(self, level)
+ -- Root menu
+ if level == 1 then
+ -- Calendar
+ tblDropDown = {
+ text = "Calendar" .. (CalendarGetNumPendingInvites() > 0 and (" (" .. CalendarGetNumPendingInvites() .. " pending)") or ""),
+ notCheckable = true,
+ tooltipOnButton = true,
+ func = function() GameTimeFrame_OnClick(GameTimeFrame) end
+ }
+ UIDropDownMenu_AddButton(tblDropDown)
+
+ -- Voice chat
+ if showVoiceMenu then
+ tblDropDown = {
+ text = "Voice chat",
+ notCheckable = true,
+ hasArrow = true,
+ value = "Voice",
+ func = function() ToggleFriendsFrame(3) end
+ }
+ UIDropDownMenu_AddButton(tblDropDown)
+ end
+
+ -- LFG root menu
+ if showLFGMenu then
+ tblDropDown = {
+ text = "Dungeon finder",
+ notCheckable = true,
+ hasArrow = true,
+ value = "LFG",
+ func = function()
+ mode, submode = GetLFGMode()
+ if mode == "proposal" and not LFDDungeonReadyPopup:IsShown() then
+ PlaySound("igCharacterInfoTab");
+ StaticPopupSpecial_Show(LFDDungeonReadyPopup)
+ elseif mode == "queued" or mode == "rolecheck" then
+ ToggleLFDParentFrame()
+ elseif mode == "listed" then
+ ToggleLFRParentFrame()
+ end
+ end
+ }
+
+ local mode, submode = GetLFGMode()
+
+ if mode == "queued" then
+ tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
+ tblDropDown.tooltipText = LFDSearchStatusStatistic:GetText()
+ tblDropDown.tooltipOnButton = true
+ elseif mode == "proposal" then
+ tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
+ tblDropDown.tooltipText = DUNGEON_GROUP_FOUND_TOOLTIP
+ tblDropDown.tooltipOnButton = true
+ elseif mode == "rolecheck" then
+ tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
+ tblDropDown.tooltipText = ROLE_CHECK_IN_PROGRESS_TOOLTIP
+ tblDropDown.tooltipOnButton = true
+ elseif mode == "listed" then
+ tblDropDown.tooltipTitle = LOOKING_FOR_RAID
+ tblDropDown.tooltipText = YOU_ARE_LISTED_IN_LFR
+ tblDropDown.tooltipOnButton = true
+ elseif mode == "lfgparty" then
+ tblDropDown.tooltipTitle = LOOKING_FOR_DUNGEON
+ tblDropDown.tooltipText = YOU_ARE_IN_DUNGEON_GROUP
+ tblDropDown.tooltipOnButton = true
+ end
+
+ UIDropDownMenu_AddButton(tblDropDown)
+ end
+
+ -- PvP root menu
+ if showPvPMenu then
+ tblDropDown = {
+ text = "PvP",
+ notCheckable = true,
+ hasArrow = true,
+ value = "PvP",
+ tooltipTitle = "lolol",
+ tooltipText = string.gsub(MiniMapBattlefieldFrame.tooltip, RIGHT_CLICK_MESSAGE, ""),
+ tooltipOnButton = true,
+ func = function()
+ end
+ }
+ UIDropDownMenu_AddButton(tblDropDown)
+ end
+
+
+ -- External addons
+ if #external.frames > 0 then
+ tblDropDown = { notCheckable = true, notClickable = true }
+ UIDropDownMenu_AddButton(tblDropDown)
+ tblDropDown = { isTitle = true, text = "Addons", notCheckable = true }
+ UIDropDownMenu_AddButton(tblDropDown)
+
+ for i = 1, #external.frames do
+ local caption
+ if external.frames[i]:GetName() then
+ caption = external.frames[i]:GetName()
+ -- Filter out all the crap
+ for _, filter in ipairs(external.filteredStrings) do
+ caption = string.gsub(caption, filter, "")
+ end
+ else
+ caption = "Unknown addon"
+ end
+ tblDropDown = {
+ text = caption,
+ notCheckable = true,
+ func = function()
+ external.frames[i]:GetScript("OnClick")(external.frames[i], "LeftButton", true)
+ end
+ }
+ UIDropDownMenu_AddButton(tblDropDown)
+ end
+ end
+ end
+
+ -- Voice submenu
+ if level == 2 and UIDROPDOWNMENU_MENU_VALUE == "Voice" then
+ for id = 1, GetNumVoiceSessions() do
+ local name, active = GetVoiceSessionInfo(id);
+ tblDropDown = {
+ text = name,
+ checked = active,
+ func = function (self, id)
+ SetActiveVoiceChannelBySessionID(id)
+ end,
+ arg1 = id
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ end
+
+ tblDropDown = {
+ text = NONE,
+ checked = not GetVoiceCurrentSessionID() and 1 or nil,
+ func = function (self, id)
+ SetActiveVoiceChannelBySessionID(id)
+ end,
+ arg1 = 0
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ end
+
+ -- LFG submenu
+ if level == 2 and UIDROPDOWNMENU_MENU_VALUE == "LFG" then
+ local mode, submode = GetLFGMode()
+
+ -- Teleport
+ if IsPartyLFG() then
+ local addButton = false
+ if IsInLFGDungeon() then
+ tblDropDown = {
+ text = TELEPORT_OUT_OF_DUNGEON,
+ notCheckable = true,
+ func = function()
+ MiniMapLFGFrame_TeleportOut()
+ ToggleDropDownMenu(1, nil, dropdown)
+ end
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ elseif GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 then
+ tblDropDown = {
+ text = TELEPORT_TO_DUNGEON,
+ notCheckable = true,
+ func = function()
+ MiniMapLFGFrame_TeleportIn()
+ ToggleDropDownMenu(1, nil, dropdown)
+ end
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ end
+ end
+
+ -- Proposals, list grp / player
+ if mode == "proposal" and submode == "unaccepted" then
+ tblDropDown = {
+ text = ENTER_DUNGEON,
+ notCheckable = true,
+ func = function()
+ AcceptProposal()
+ ToggleDropDownMenu(1, nil, dropdown)
+ end
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ tblDropDown = {
+ text = LEAVE_QUEUE,
+ notCheckable = true,
+ func = function()
+ RejectProposal()
+ ToggleDropDownMenu(1, nil, dropdown)
+ end
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ elseif mode == "queued" then
+ tblDropDown = {
+ text = LEAVE_QUEUE,
+ notCheckable = true,
+ func = function()
+ LeaveLFG()
+ ToggleDropDownMenu(1, nil, dropdown)
+ end,
+ disabled = submode == "unempowered"
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ elseif mode == "listed" then
+ tblDropDown = {
+ text = (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0) and UNLIST_MY_GROUP or UNLIST_ME,
+ notCheckable = true,
+ func = function()
+ LeaveLF()
+ ToggleDropDownMenu(1, nil, dropdown)
+ end,
+ disabled = submode == "unempowered"
+ }
+ UIDropDownMenu_AddButton(tblDropDown, 2)
+ end
+ end
+
+ -- PvP submenu
+ if level == 2 and UIDROPDOWNMENU_MENU_VALUE == "PvP" then
+ -- ##2DO##
+ -- **************************************************************************
+ -- * http://wowprogramming.com/utils/xmlbrowser/live/FrameXML/PVPFrame.lua *
+ -- * MiniMapBattlefieldDropDown_Initialize() *
+ -- **************************************************************************
+ for i = 1, MAX_BATTLEFIELD_QUEUES do
+ local status, mapName, instanceID, levelRangeMin, levelRangeMax, teamSize, registeredMatch = GetBattlefieldStatus(i)
+ if status == "queued" or status == "confirm" then
+ if teamSize ~= 0 then
+ tblDropDown = {
+ text = ARENA_RATED_MATCH .. " " .. format(PVP_TEAMSIZE, teamSize, teamSize),
+ isTitle = 1,
+ notCheckable = 1
+ }
+ else
+ tblDropDown = {
+ text = ARENA_RATED_MATCH .. " " .. format(PVP_TEAMSIZE, teamSize, teamSize),
+ isTitle = 1,
+ notCheckable = 1
+ }
+ end
+
+ UIDropDownMenu_AddButton(tblDropDown)
+ end
+ end
+ end
+
+end
+
+UIDropDownMenu_Initialize(dropdown, showDropDown, "MENU")
+dropdown.noResize = true
+
+MiniMapBin:SetScript("OnClick", function()
+ PlaySound("igMainMenuOptionCheckBoxOn")
+ ToggleDropDownMenu(1, nil, dropdown, "MiniMapBin", 0, -5)
+end)