-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathInitialization.lua
219 lines (172 loc) · 7.16 KB
/
Initialization.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
local VERSION_TEXT = "v1.5.8";
local VERSION_DATE = 1737460000;
local addonName, addon = ...
local L = {}; --Locale
local API = {}; --Custom APIs used by this addon
local DB;
addon.L = L;
addon.API = API;
addon.VERSION_TEXT = VERSION_TEXT;
local CallbackRegistry = {};
CallbackRegistry.events = {};
addon.CallbackRegistry = CallbackRegistry;
local tinsert = table.insert;
local type = type;
local ipairs = ipairs;
--[[
callbackType:
1. Function func(owner)
2. Method owner:func()
--]]
function CallbackRegistry:Register(event, func, owner)
if not self.events[event] then
self.events[event] = {};
end
local callbackType;
if type(func) == "string" then
callbackType = 2;
else
callbackType = 1;
end
tinsert(self.events[event], {callbackType, func, owner})
end
function CallbackRegistry:Trigger(event, ...)
if self.events[event] then
for _, cb in ipairs(self.events[event]) do
if cb[1] == 1 then
if cb[3] then
cb[2](cb[3], ...);
else
cb[2](...);
end
else
cb[3][cb[2]](cb[3], ...);
end
end
end
end
function CallbackRegistry:RegisterSettingCallback(dbKey, func, owner)
self:Register("SettingChanged."..dbKey, func, owner);
end
local function GetDBValue(dbKey)
return DB[dbKey]
end
addon.GetDBValue = GetDBValue;
local function SetDBValue(dbKey, value, userInput)
DB[dbKey] = value;
addon.CallbackRegistry:Trigger("SettingChanged."..dbKey, value, userInput);
end
addon.SetDBValue = SetDBValue;
local function GetDBBool(dbKey)
return DB[dbKey] == true
end
addon.GetDBBool = GetDBBool;
local DefaultValues = {
AutoJoinEvents = true,
BackpackItemTracker = true,
HideZeroCountItem = true,
ConciseTokenTooltip = true,
TrackItemUpgradeCurrency = true,
TrackHolidayItem = true,
TrackerBarInsideSeparateBag = false,
GossipFrameMedal = true,
EmeraldBountySeedList = true, --Show a list of Dreamseed when appoaching Emarad Bounty Soil
WorldMapPinSeedPlanting = true, --Aditional Map Pin: Dreamseed
AlternativePlayerChoiceUI = true, --Revamp PlayerChoiceFrame for Dreamseed Nurturing
HandyLockpick = true, --Right-click to lockpick inventory items (Rogue/Mechagnome)
Technoscryers = true, --Show Technoscryers on QuickSlot (Azerothian Archives World Quest)
TooltipChestKeys = true, --Show keys that unlocked the current chest or door
TooltipRepTokens = true, --Show faction info for items that grant rep
TooltipSnapdragonTreats = true, --Show info on Snapdragon Treats (An item that changes this mount's color)
TooltipItemReagents = false, --For items with "use to combine": show the reagent count
PlayerChoiceFrameToken = true, --Add owned token count to PlayerChoiceFrame
ExpansionLandingPage = true, --Display extra info on the ExpansionLandingPage
Delves_SeasonProgress = true, --Display Seaonal Journey changes on a progress bar
WoWAnniversary = true, --QuickSlot for Mount Maniac Event
VotingResultsExpanded = true,
BlizzFixFishingArtifact = true, --Fix Fishing Artifact Traits Not Showing bug
QuestItemDestroyAlert = true, --Show related quest info when destroying a quest-starting item
SpellcastingInfo = false, --Show the spell info when hovering over target/focus cast bars. Logging target spells and displayed it on UnitPopupMenu
ChatOptions = true, --Add Leave button to Channel Context Menu
NameplateWidget = true, --Show required items on nameplate widget set
PartyInviterInfo = false, --Show the inviter's level and class
PartyInviter_Race = false,
PartyInviter_Faction = false,
PlayerTitleUI = false, --Add search box and filter to TitleManagerPane
Plunderstore = true,
Plunderstore_HideCollected = true,
BlizzardSuperTrack = false, --Add timer to the SuperTrackedFrame when tracking a POI with time format
--Custom Loot Window
LootUI = false,
LootUI_FontSize = 14,
LootUI_FadeDelayPerItem = 0.25,
LootUI_ItemsPerPage = 6,
LootUI_ShowItemCount = false,
LootUI_NewTransmogIcon = true,
LootUI_ForceAutoLoot = true,
LootUI_LootUnderMouse = false;
LootUI_UseHotkey = true,
LootUI_HotkeyName = "E",
LootUI_ReplaceDefaultAlert = false,
LootUI_UseStockUI = false,
--Unified Map Pin System
WorldMapPin_TWW = true, --Master Switch for TWW Map Pins
WorldMapPin_Size = 1, --1: Default
WorldMapPin_TWW_Delve = true, --Show Bountiful Delves on continent map
WorldMapPin_TWW_Quest = true, --Show Special Assignment on continent map
--Modify default interface behavior:
BlizzFixEventToast = true, --Make Toast non-interactable
MerchantPrice = false; --Merchant Price (Alt Currency) Overview, gray insufficient items
--In-game Navigation: Use waypoint (Super Tracking) to navigate players. Generally default to false, since it will mute WoW's own SuperTrackedFrame
Navigator_MasterSwitch = true, --Decide if using our SuperTrackedFrame or the default one
Navigator_Dreamseed = false,
--Talking Head Revamp
TalkingHead_MasterSwitch = false,
TalkingHead_FontSize = 100, --% Multiply default QuestFont Height
TalkingHead_InstantText = false,
TalkingHead_TextOutline = false,
TalkingHead_HideInInstance = false,
TalkingHead_HideWorldQuest = false,
TalkingHead_BelowWorldMap = false,
--QuickSlot
QuickSlotHighContrastMode = false,
--Declared elsewhere:
--DreamseedChestABTesting = math.random(100) >= 50
--Deprecated:
--DruidModelFix = true, --Fixed by Blizzard in 10.2.0
--BlizzFixWardrobeTrackingTip = true, --Hide Wardrobe tip that cannot be disabled --Tip removed by Blizzard
};
local function LoadDatabase()
PlumberDB = PlumberDB or {};
PlumberStorage = PlumberStorage or {}; --Save large data (Spell)
DB = PlumberDB;
for dbKey, value in pairs(DefaultValues) do
if DB[dbKey] == nil then
DB[dbKey] = value;
end
end
for dbKey, value in pairs(DB) do
addon.CallbackRegistry:Trigger("SettingChanged."..dbKey, value);
end
if not DB.installTime or type(DB.installTime) ~= "number" then
DB.installTime = VERSION_DATE;
end
DefaultValues = nil;
end
local EL = CreateFrame("Frame");
EL:RegisterEvent("ADDON_LOADED");
EL:SetScript("OnEvent", function(self, event, ...)
local name = ...
if name == addonName then
self:UnregisterEvent(event);
LoadDatabase();
end
end);
do
local tocVersion = select(4, GetBuildInfo());
tocVersion = tonumber(tocVersion or 0);
local function IsToCVersionEqualOrNewerThan(targetVersion)
return tocVersion >= targetVersion
end
addon.IsToCVersionEqualOrNewerThan = IsToCVersionEqualOrNewerThan;
end