-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIPAConfig.lua
132 lines (108 loc) · 5.19 KB
/
IPAConfig.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
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
local addonName, IPA = ...
IPA.DefaultSettings = {
options = {
pinsOnContinentMap = true,
useWaypointsContient = true,
useWaypointsZone = true,
useTomTomZone = false,
useTomTomContinent = false,
},
version = 4,
}
local eventFrame = CreateFrame("FRAME")
eventFrame:RegisterEvent("PLAYER_LOGIN")
local SettingsRegistered = false
function CreateSettings()
if SettingsRegistered then return end
IPASettings = IPASettings and IPASettings.options and IPASettings or IPA.DefaultSettings
local categoryMain = Settings.RegisterVerticalLayoutCategory("Instance Portals |cff0080ffAdvanced|r");
categoryMain.ID = addonName
local function OnSettingChanged(setting, value)
-- This callback will be invoked whenever a setting is modified.
local variable = setting:GetVariable();
IPASettings["options"][variable] = value;
end
-- pinsOnContinentMap
do
local name = "Pins on Continent Map"
local tooltip = "Enable or Disable Dungeon Entrance Pins on the Continent Map"
local variableTbl = IPASettings["options"]
local variableKey = "pinsOnContinentMap"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
-- useWaypointsZone
do
local name = "Waypoints on Zone Map"
local tooltip = "Enable or Disable Waypoint Feature on Zone Maps\n\n|r|cffff0000Warning!|r\nThis will also disable the \"native\" Waypoint function added in TWW!"
local variableTbl = IPASettings["options"]
local variableKey = "useWaypointsZone"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
-- useWaypointsContient
do
local name = "Waypoints on Continent Map"
local tooltip = "Enable or Disable the Feature to add a Waypoint when click on a Dungeon Entrace Pin on the Contient Map"
local variableTbl = IPASettings["options"]
local variableKey = "useWaypointsContient"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
if C_AddOns and C_AddOns.IsAddOnLoaded("TomTom") then
-- useTomTomZone
do
local name = "Use TomTom for Zone Map"
local tooltip = "Enable or Disable TomTom as Waypoint System for Zone Map\n\n\Enabled: Use TomTom\nDisabled: Use Native"
local variableTbl = IPASettings["options"]
local variableKey = "useTomTomZone"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or false
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
-- useTomTomContinent
do
local name = "Use TomTom for Continent Map"
local tooltip = "Enable or Disable TomTom as Waypoint System for Continent Map\n\n\Enabled: Use TomTom\nDisabled: Use Native"
local variableTbl = IPASettings["options"]
local variableKey = "useTomTomContinent"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or false
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
end
-- debug
--[[
do
local name = "Debug Mode"
local tooltip = "Enable or Disable Dubug Mode\n\n\|r|cffff0000Warning!|r\nThis can overload your Chat!"
local variableTbl = IPASettings["options"]
local variableKey = "debug"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
]]
Settings.RegisterAddOnCategory(categoryMain)
_G['SLASH_' .. addonName .. 'Options' .. 1] = '/ipa'
_G['SLASH_' .. addonName .. 'Options' .. 2] = '/ipadv'
SlashCmdList[addonName .. 'Options'] = function(msg)
Settings.OpenToCategory(categoryMain.ID)
end
SettingsRegistered = true
end
eventFrame:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then
-- Create Settings on "PLAYER_LOGIN" because of TomTom Support (TomTom needs to be loaded first)
CreateSettings()
end
end)