-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGatherMate2_NoCircle.lua
More file actions
108 lines (94 loc) · 3.41 KB
/
Copy pathGatherMate2_NoCircle.lua
File metadata and controls
108 lines (94 loc) · 3.41 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
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
-- GatherMate2_NoCircle
--
-- GatherMate2 swaps a node's map icon for a colored "tracking circle" once you
-- come within its Tracking Distance. This addon suppresses that circle for the
-- node types you choose: the map icon stays while you're at range, and once
-- GatherMate would turn it into the circle the pin simply hides so the in-game
-- minimap node shows in its place.
--
-- It lives as its own addon and wraps GatherMate2's pin function at login, so a
-- GatherMate2 update can never wipe the change. All settings live here too, so
-- GatherMate2's own files are never touched.
local ADDON = "GatherMate2_NoCircle"
local TITLE = "GatherMate2 No Circle"
-- nothing is suppressed by default; the player picks which circles to hide in
-- the options panel
local defaults = {
profile = {
suppress = {},
},
}
local db
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
local AceAddon = LibStub and LibStub("AceAddon-3.0", true)
local GatherMate = AceAddon and AceAddon:GetAddon("GatherMate2", true)
if not GatherMate then return end
local Display = GatherMate:GetModule("Display", true)
if not Display then return end
-- reuse the Ace libraries GatherMate2 already loaded; nothing is bundled here
local AceDB = LibStub("AceDB-3.0", true)
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0", true)
local AceConfigDialog = LibStub("AceConfigDialog-3.0", true)
db = AceDB:New("GatherMate2NoCircleDB", defaults, true)
-- the override: once GatherMate marks a node close enough to become the
-- tracking circle (pin.isCircle == true), hide it for any suppressed type
-- and let the in-game tracking node take over. Sits cleanly on top of
-- GatherMate2Marker if that addon already wrapped the same function.
local original = Display.addMiniPin
Display.addMiniPin = function(self, pin, refresh)
original(self, pin, refresh)
if pin and pin.isCircle and db.profile.suppress[pin.nodeType] then
pin:Hide()
end
end
-- force a minimap refresh so a toggle takes effect immediately
local function refresh()
Display:UpdateMiniMap(true)
end
-- build the options panel: one on/off toggle per node type GatherMate tracks
local options = {
type = "group",
name = TITLE,
args = {
desc = {
type = "description",
order = 1,
fontSize = "medium",
name = "Hide GatherMate2's proximity \"tracking circle\" for the node types ticked below.\n\nThe normal map icon still shows while you're at range. It just hands off to the in-game minimap node once you get close, instead of turning into the colored circle.\n",
},
header = {
type = "header",
order = 2,
name = "Hide circle for:",
},
},
}
local order = 10
for _, nodeType in ipairs(GatherMate.db_types) do
options.args["suppress_" .. nodeType] = {
type = "toggle",
order = order,
width = "full",
name = nodeType,
desc = "Hide the tracking circle for " .. nodeType .. " nodes.",
get = function() return db.profile.suppress[nodeType] == true end,
set = function(_, val)
db.profile.suppress[nodeType] = val or nil
refresh()
end,
}
order = order + 1
end
if AceConfigRegistry and AceConfigDialog then
AceConfigRegistry:RegisterOptionsTable(ADDON, options)
AceConfigDialog:AddToBlizOptions(ADDON, TITLE)
SLASH_GM2NOCIRCLE1 = "/nocircle"
SLASH_GM2NOCIRCLE2 = "/gm2nc"
SlashCmdList["GM2NOCIRCLE"] = function()
AceConfigDialog:Open(ADDON)
end
end
refresh()
end)