-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinimapButton.lua
More file actions
51 lines (44 loc) · 1.57 KB
/
Copy pathMinimapButton.lua
File metadata and controls
51 lines (44 loc) · 1.57 KB
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
local LibDBIcon = LibStub("LibDBIcon-1.0")
local LDB = LibStub("LibDataBroker-1.1")
local minimapButton -- Store the button globally to prevent duplicates
local function CreateMinimapButton()
if minimapButton then
return minimapButton -- Prevent multiple creations
end
local addonName = "HappyLog"
local minimapButtonDB = {
profile = {
minimapButton = {
hide = false,
oldIcon = false,
}
}
}
local function GetIcon()
-- Return the icon based on your condition
local iconPath = "Interface\\AddOns\\HappyLog\\Media\\HappyLog.tga"
return iconPath
end
minimapButton = LDB:NewDataObject(addonName, {
type = "data source",
text = "HappyLog",
icon = GetIcon(),
OnClick = function(clickedFrame, button)
if button == "RightButton" then
OpenSettingsPanel()
elseif button == "LeftButton" then
ShowHideFrame()
end
end,
OnTooltipShow = function(tooltip)
if not tooltip or not tooltip.AddLine then return end
tooltip:AddLine("HappyLog")
tooltip:AddLine(" ")
tooltip:AddLine(GRAY_FONT_COLOR_CODE .. "Left Click:|r Toggle HappyLog")
tooltip:AddLine(GRAY_FONT_COLOR_CODE .. "Right Click:|r HappyLog Settings")
end,
})
LibDBIcon:Register(addonName, minimapButton, minimapButtonDB.profile.minimapButton)
return minimapButton
end
_G.CreateMinimapButton = CreateMinimapButton