-
Notifications
You must be signed in to change notification settings - Fork 0
/
minimap.lua
53 lines (50 loc) · 1.57 KB
/
minimap.lua
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
addon = LibStub("AceAddon-3.0"):NewAddon("MillButton", "AceConsole-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale("MillButton")
local MillButtonLDB = LibStub("LibDataBroker-1.1"):NewDataObject("MillButtonIcon", {
type = "launcher",
text = "MillButton",
icon = "Interface\\Icons\\Ability_Miling",
OnClick = function(_, button)
if button == "LeftButton" then
if InterfaceOptionsFrame:IsVisible() then
InterfaceOptionsFrame:Hide()
-- Hide the UI panel behind blizz options.
HideUIPanel(GameMenuFrame)
else
InterfaceOptionsFrame_OpenToCategory("MillButton")
Options:SetScript("OnShow", nil)
end
end
if button == "RightButton" then
MillButtonSetup()
end
end,
OnTooltipShow = function(tooltip)
tooltip:SetText("MillButton")
tooltip:AddLine(GetAddOnMetadata(ADDON, "Version"),1,1,1)
tooltip:AddLine(" ")
tooltip:AddLine(L["r_mouse1"]..": |cFFFFFFFF"..L["r_mouse2"].."|r")
tooltip:AddLine(L["l_mouse1"]..": |cFFFFFFFF"..L["l_mouse2"].."|r")
tooltip:Show()
end
})
local icon = LibStub("LibDBIcon-1.0")
function addon:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("MillButtonMinimap", {
profile = {
minimap = {
hide = false,
},
},
})
icon:Register("MillButtonIcon", MillButtonLDB, self.db.profile.minimap)
self:RegisterChatCommand("mbtnmmap", "ComMbtnMiniMapIcn")
end
function addon:ComMbtnMiniMapIcn()
self.db.profile.minimap.hide = not self.db.profile.minimap.hide
if self.db.profile.minimap.hide then
icon:Hide("MillButtonIcon")
else
icon:Show("MillButtonIcon")
end
end