-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathInit.lua
More file actions
182 lines (158 loc) · 5.14 KB
/
Init.lua
File metadata and controls
182 lines (158 loc) · 5.14 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
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
local RSA = LibStub("AceAddon-3.0"):NewAddon("RSA", "AceConsole-3.0", "LibSink-2.0", "AceEvent-3.0", "AceComm-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale("RSA")
local ACD = LibStub('AceConfigDialog-3.0')
local uClass = string.lower(select(2, UnitClass('player')))
RSA.configData = {}
RSA.monitorData = {}
RSA.Helpers = {}
local function BuildDefaults()
local defaults = {
profile = {
deathknight = RSA.configData.deathknight or {},
druid = RSA.configData.druid or {},
hunter = RSA.configData.hunter or {},
mage = RSA.configData.mage or {},
paladin = RSA.configData.paladin or {},
priest = RSA.configData.priest or {},
rogue = RSA.configData.rogue or {},
shaman = RSA.configData.shaman or {},
warlock = RSA.configData.warlock or {},
warrior = RSA.configData.warrior or {},
racials = RSA.configData.racials or {},
utilities = RSA.configData.utilities or {},
general = {
advancedConfig = false,
globalAnnouncements = {
--useGlobal = true, -- Implement as button in config to toggle this ON for all sub spells.
alwaysWhisper = false, -- Allows whispers to always be sent.
removeServerNames = true,
enableIn = {
arenas = false,
bgs = false,
warModeWorld = false, -- Enable in War Mode world zones.
nonWarWorld = false, -- Enable in world zones without war mode enabled.
dungeons = false,
raids = false,
lfg = false,
lfr = false,
scenarios = false,
},
groupToggles = { -- When true, only announce to these channels if you are in a group
emote = true,
say = true,
yell = true,
whisper = true,
},
combatState = {
inCombat = true, -- Announce only in Combat
noCombat = false, -- Announce not in Combat
},
},
replacements = {
target = {
alwaysUseName = false,
replacement = "You",
},
missType = {
useGeneralReplacement = false,
generalReplacement = "missed",
miss = "missed",
resist = "was resisted by",
absorb = "was absorbed by",
block = "was blocked by",
deflect = "was deflected by",
dodge = "was dodged by",
evade = "was evaded by",
parry = "was parried by",
immune = "is immune to",
reflect = "was reflected by",
},
},
},
},
}
if RSA.IsRetail() then
defaults.profile.evoker = RSA.configData.evoker or {}
defaults.profile.monk = RSA.configData.monk or {}
defaults.profile.demonhunter = RSA.configData.demonhunter or {}
end
return defaults
end
local function BlizzPanelOptions()
-- Register Various Options
local Options = {
type = "group",
name = "RSA [|c5500DBBDRaeli's Spell Announcer|r] - ".."|cffFFCC00"..L["Current Version: %s"]:format("|r|c5500DBBD"..RSA.db.global.version).."|r",
order = 0,
args = {
Open = {
name = L["Open Configuration Panel"],
type = "execute",
order = 0,
func = function()
if not InCombatLockdown() then
-- Ensure we don't taint the UI from 8.2 change when trying to call HideUIPanel in combat
HideUIPanel(InterfaceOptionsFrame)
HideUIPanel(GameMenuFrame)
RSA:ChatCommand()
end
end,
},
},
}
LibStub("AceConfig-3.0"):RegisterOptionsTable("RSA_Blizz", Options) -- Register Options
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("RSA_Blizz", "RSA")
end
function RSA.IsRetail()
return WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
end
function RSA.IsWrath()
return WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC
end
function RSA.IsCata()
return WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC
end
function RSA:ChatCommand(input)
if not InCombatLockdown() then
self:EnableModule('Options')
if ACD.OpenFrames['RSA'] then
ACD:Close('RSA')
else
ACD:Open('RSA')
end
else
RSA.SendMessage.ChatFrame(L["Cannot configure while in combat."])
end
end
function RSA:OnInitialize()
RSA.configData.customCategories = {
['General'] = {
},
}
RSA.monitorData.customCategories = {
['General'] = {
},
}
local defaults = BuildDefaults()
self.db = LibStub("AceDB-3.0"):New("RSA5", defaults, UnitClass('player')) -- Setup Saved Variables
self:SetSinkStorage(self.db.profile) -- Setup Saved Variables for LibSink
RSA.monitorData['racials'] = RSA.PrepareDataTables(self.db.profile['racials'], 'racials')
RSA.monitorData['utilities'] = RSA.PrepareDataTables(self.db.profile['utilities'], 'utilities')
RSA.monitorData[uClass] = RSA.PrepareDataTables(self.db.profile[uClass], uClass)
-- project-revision
local GetAddOnMetadata = GetAddOnMetadata or (C_AddOns and C_AddOns.GetAddOnMetadata)
self.db.global.version = GetAddOnMetadata("RSA","Version")
if not RSA.db.global.personalID then
RSA.db.global.personalID = RSA.GetPersonalID() --RSA.GetGetMyRandomNumber()
end
local LibDualSpec = LibStub('LibDualSpec-1.0')
LibDualSpec:EnhanceDatabase(self.db, "RSA")
self:RegisterChatCommand("RSA", "ChatCommand")
BlizzPanelOptions()
-- Profile Management
self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig")
self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig")
self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig")
RSA.Comm.Registry()
RSA.Monitor.Start()
end