-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.lua
204 lines (186 loc) · 4.46 KB
/
Core.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
-- luacheck: globals BigWigs BigWigsAPI
local _, ns = ...
-------------------------------------------------------------------------------
-- Locals
--
local L = ns.L
local localeMap = {
enUS = "English",
deDE = "Deutsch",
esES = "Español (es)",
esMX = "Español (mx)",
frFR = "Français",
ruRU = "Русский",
koKR = "한국어",
itIT = "Italiano",
ptBR = "Português",
zhCN = "简体中文",
zhTW = "繁體中文",
}
local defaultLocale = GetLocale()
if not localeMap[defaultLocale] then
defaultLocale = "enUS"
end
local loaded = {}
-------------------------------------------------------------------------------
-- Options
--
local plugin = BigWigs:NewPlugin("HeroesVoices")
if not plugin then return end
plugin.defaultDB = {
locale = defaultLocale
}
plugin.subPanelOptions = {
key = "Big Wigs: Voice: Heroes of the Storm",
name = L.title,
options = {
name = L.title,
type = "group",
args = {
locale = {
name = L.language,
type = "select",
values = localeMap,
get = function()
return plugin.db.profile.locale
end,
set = function(_, value)
plugin.db.profile.locale = value
ns.RegisterVoices()
end,
order = 2,
},
notice = {
name = "\n" .. L.locale_warning,
type = "description",
hidden = function()
local count = 0
for _ in next, loaded do
count = count + 1
end
if count == 1 then
return true
end
end,
order = 3,
},
},
},
}
function plugin:OnRegister()
ns.RegisterVoices()
end
-------------------------------------------------------------------------------
-- Registration
--
local announcers = {
-- Map
Adjutant = "Adjutant",
Angel = "Angel",
Athena = "Athena",
Blackheart = "Blackheart",
Demon = "Demon",
DrekTharA = "Drek'Thar",
GardensDayAnnouncer = "Queen Nightshade",
LadyofThorns = "Lady of Thorns",
Necromancer = "Necromancer",
RavenLord = "Raven Lord",
SnakeGod = "Snake God",
SpiderQueen = "Spider Queen",
VanndarA = "Vanndar Stormpike",
VolskayaA = "Volskaya",
-- Brawl/Event
Arena = "Arena",
Commodore = "Commodore",
MiraA = "Mira Han",
Toy18A = "\"The Kid\"",
-- Warcraft
AlexstraszaA = "Alexstrasza",
AnduinA = "Anduin",
AnubarakAnnouncer = "Anub'arak",
ArthasA = "Arthas",
BrightwingA = "Brightwing",
DeathwingA = "Deathwing",
ETCA = "E.T.C.",
FalstadA = "Falstad",
GarroshA = "Garrosh",
GazloweA = "Gazlowe",
HoggerA = "Hogger",
IllidanA = "Illidan",
JainaA = "Jaina",
KelthuzadA = "Kel'Thuzad",
LiLiA = "Li Li",
MaievA = "Maiev",
MalfurionA = "Malfurion",
MalganisA = "Mal'Ganis",
MuradinA = "Muradin",
MurkyA = "Murky",
RehgarAnnouncer = "Rehgar",
StitchesA = "Stitches",
WhitemaneA = "Whitemane",
YrelA = "Yrel",
-- StarCraft
Abathur = "Abathur",
AlarakA = "Alarak",
BlazeA = "Blaze",
FenixA = "Fenix",
SiegeTankA = "Sgt. Hammer",
TassadarA = "Tassadar",
TychusA = "Tychus",
ZeratulA = "Zeratul",
-- Diablo
DiabloA = "Diablo",
DeckardA = "Deckard Cain",
ImperiusA = "Imperius",
MephistoA = "Mephisto",
WitchDoctorA = "Nazeebo",
BarbarianA = "Sonya",
TyraelA = "Tyrael",
DemonHunterA = "Valla",
-- Overwatch
DvaA = "D.Va",
GenjiA = "Genji",
HanzoA = "Hanzo",
JunkratA = "Junkrat",
MeiOWA = "Mei",
-- Skins
TyraelMechaA = "Mecha Tyrael",
-- Nexus
NexusHunterA = "Qhira",
OrpheaA = "Orphea",
}
local snowflakes = {
ButcherA = "Butcher", -- Grunts and growls
CloakenA = "Cloaken", -- English for all locales
LuchaA = "El Guapo", -- Spanish for all locales
}
function ns.RegisterVoices()
local locale = plugin.db.profile.locale
if loaded[locale] then return end
loaded[locale] = true
local lang = localeMap[locale]
local path = "Interface\\AddOns\\BigWigs_Countdown_HeroesOfTheStorm\\%s\\%s_Countdown%dsec00.ogg"
for k, v in next, announcers do
local id = ("%s: Heroes of the Storm: %s"):format(lang, v) -- should be using k but I don't want to break everything D;
local name = L.key:format(lang, L.heroes, L[k] or v)
BigWigsAPI:RegisterCountdown(id, name, {
path:format(locale, k, 1),
path:format(locale, k, 2),
path:format(locale, k, 3),
path:format(locale, k, 4),
path:format(locale, k, 5),
})
end
for k, v in next, snowflakes do
local id = ("Heroes of the Storm: %s"):format(v)
if not BigWigsAPI:HasCountdown(id) then
BigWigsAPI:RegisterCountdown(id, L.key_short:format(L.heroes, L[k] or v), {
path:format("enUS", k, 1),
path:format("enUS", k, 2),
path:format("enUS", k, 3),
path:format("enUS", k, 4),
path:format("enUS", k, 5),
})
end
end
end