-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Broker.lua
60 lines (56 loc) · 2.01 KB
/
Broker.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
54
55
56
57
58
59
60
---@class GT
local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker")
local ldb = LibStub("LibDataBroker-1.1")
local LibDBIcon = LibStub("LibDBIcon-1.0")
-- Localize global functions
local ipairs = ipairs
local math = math
local max = max
local next = next
local pairs = pairs
local select = select
local string = string
local table = table
local time = time
local tonumber = tonumber
local tostring = tostring
local type = type
local unpack = unpack
function GT:InitializeBroker()
GT.Debug("InitializeBroker", 1)
-- Create LibDataBroker data object
local dataObj = ldb:NewDataObject(GT.metaData.name, {
type = "launcher",
icon = "Interface\\Addons\\GatheringTracker\\Media\\GT_Icon",
OnClick = function(frame, button)
if button == "LeftButton" and IsShiftKeyDown() then
GT:ResetSession()
elseif button == "LeftButton" then
GT:GenerateFiltersMenu(frame)
elseif button == "RightButton" and IsShiftKeyDown() then
GT.AlertSystem:ResetAlerts()
elseif button == "RightButton" then
Settings.OpenToCategory(GT.metaData.name, true)
end
end,
OnTooltipShow = function(tooltip)
tooltip:AddLine(GT.metaData.name .. " |cffff6f00v" .. GT.metaData.version .. "|r")
tooltip:AddLine(" ")
tooltip:AddLine("|cff8080ffLeft-Click|r to open the Filter Menu")
tooltip:AddLine("|cff8080ffShift + Left-Click|r to reset Session")
tooltip:AddLine("|cff8080ffRight-Click|r to open the addon options")
tooltip:AddLine("|cff8080ffShift + Right-Click|r to reset Alert Triggers")
end,
})
-- Register with LibDBIcon
LibDBIcon:Register(GT.metaData.name, dataObj, GT.db.profile.miniMap)
LibDBIcon:Hide(GT.metaData.name)
end
function GT:MinimapHandler(key)
GT.Debug("MinimapHandler", 1, key)
if key then
LibDBIcon:Show(GT.metaData.name)
else
LibDBIcon:Hide(GT.metaData.name)
end
end