forked from AzureeDev/Sora-HUD-Reborn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.lua
341 lines (302 loc) · 9.61 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
if not ModCore then
log("[NepgearsyHUDReborn] ERROR : ModCore from BeardLib is not present! Is BeardLib installed?")
return
end
NepgearsyHUDReborn = NepgearsyHUDReborn or ModCore:new(ModPath .. "config.xml", true, true)
function NepgearsyHUDReborn:Init()
self.Dev = false
self.Version = NepgearsyHUDReborn.update_module_data.module.version
self.ModPath = ModPath
self.WaifuSend = false
self:InitCollabs()
self:InitTweakData()
self:InitChangelog()
self:InitLocalization()
self.Initialized = true;
self:Log("Initialized.")
end
function NepgearsyHUDReborn:InitCollabs()
self.Creators = {
[1] = {
name = "Nepgearsy",
steam_id = "76561198045788203",
action = "Made the code. If you have issues, contact me."
},
[2] = {
name = "Matthelzor",
steam_id = "76561198084015153",
action = "Made the awesome background of the Control Panel."
},
[3] = {
name = "Luffy",
steam_id = "76561198075720845",
action = "Helped with LUA stuff when I needed. He also made the HUD scaling options."
},
[4] = {
name = "=PDTC= Splat",
steam_id = "76561198085683005",
action = "Helped with testing stuff."
},
[5] = {
name = "Babyforce",
steam_id = "76561198053887800",
action = "Giving me his thoughts and helping."
},
[6] = {
name = "sydch pasha",
steam_id = "76561198063913184",
action = "Made the Turkish localization"
},
[7] = {
name = "AldoRaine",
steam_id = "76561198079386949",
action = "Made the Portuguese localization"
},
[8] = {
name = "ElReyZero",
steam_id = "76561198143859174",
action = "Made the Spanish localization"
},
[9] = {
name = "Blake Langermann",
steam_id = "76561198015483064",
action = "Made the Russian localization"
},
[10] = {
name = "=PDTC= Dobby Senpai",
steam_id = "76561198040053543",
action = "Helped with finding a sock."
},
[11] = {
name = "Anthony",
steam_id = "76561198164452807",
action = "Made the French localization"
},
[12] = {
name = "freaky",
steam_id = "76561198376903915",
action = "Made the Romanian localization"
},
[13] = {
name = "Commander Neru",
steam_id = "76561198090284682",
action = "Helped with testing."
},
[14] = {
name = "DreiPixel",
steam_id = "76561197998773513",
action = "Made the German localization"
},
[15] = {
name = "Hinaomi",
steam_id = "76561198027102120",
action = "Made the Thai localization"
}
}
end
function NepgearsyHUDReborn:InitTweakData()
self.StarringColors = {
"NepgearsyHUDReborn/Color/White",
"NepgearsyHUDReborn/Color/Red",
"NepgearsyHUDReborn/Color/Green",
"NepgearsyHUDReborn/Color/Blue",
"NepgearsyHUDReborn/Color/Purple",
"NepgearsyHUDReborn/Color/Yellow",
"NepgearsyHUDReborn/Color/Orange",
"NepgearsyHUDReborn/Color/Pink",
"NepgearsyHUDReborn/Color/Fushia",
"NepgearsyHUDReborn/Color/Cyan",
"NepgearsyHUDReborn/Color/Blue_Ocean",
"NepgearsyHUDReborn/Color/Red_Fushia"
}
if self.Dev then table.insert(self.StarringColors, "DEV") end -- hi :3
self.CPColors = deep_clone(self.StarringColors)
self.CPBorderColors = deep_clone(self.StarringColors)
self.AssaultBarFonts = {
"NepgearsyHUDReborn/Fonts/Normal",
"NepgearsyHUDReborn/Fonts/Eurostile"
}
self.HealthColor = {
"NepgearsyHUDReborn/Color/White",
"NepgearsyHUDReborn/Color/Green",
"NepgearsyHUDReborn/Color/Red",
"NepgearsyHUDReborn/Color/Orange",
"NepgearsyHUDReborn/Color/Yellow",
"NepgearsyHUDReborn/Color/Cyan",
"NepgearsyHUDReborn/Color/Blue_Ocean",
"NepgearsyHUDReborn/Color/Blue",
"NepgearsyHUDReborn/Color/Purple",
"NepgearsyHUDReborn/Color/Pink",
"NepgearsyHUDReborn/Color/Fushia",
"NepgearsyHUDReborn/Color/Red_Fushia"
}
self.ArmorColor = deep_clone(self.HealthColor)
self.ObjectiveColor = deep_clone(self.StarringColors)
self.HealthStyle = {
"NepgearsyHUDReborn/HealthStyle/Thin",
"NepgearsyHUDReborn/HealthStyle/Vanilla"
}
self.StatusNumberType = {
"NepgearsyHUDReborn/StatusNumberType/Health_Counter",
"NepgearsyHUDReborn/StatusNumberType/Shield_Counter"
}
end
function NepgearsyHUDReborn:TeammateRadialIDToPath(id, type)
local tritp = {}
for i = 1, 12 do
tritp[i] = {}
end
tritp[1]["Health"] = "NepgearsyHUDReborn/HUD/Health"
tritp[2]["Health"] = "NepgearsyHUDReborn/HUD/HealthGreen"
tritp[3]["Health"] = "NepgearsyHUDReborn/HUD/HealthRed"
tritp[4]["Health"] = "NepgearsyHUDReborn/HUD/HealthOrange"
tritp[5]["Health"] = "NepgearsyHUDReborn/HUD/HealthYellow"
tritp[6]["Health"] = "NepgearsyHUDReborn/HUD/HealthCyan"
tritp[7]["Health"] = "NepgearsyHUDReborn/HUD/HealthBlueOcean"
tritp[8]["Health"] = "NepgearsyHUDReborn/HUD/HealthBlue"
tritp[9]["Health"] = "NepgearsyHUDReborn/HUD/HealthPurple"
tritp[10]["Health"] = "NepgearsyHUDReborn/HUD/HealthPink"
tritp[11]["Health"] = "NepgearsyHUDReborn/HUD/HealthFushia"
tritp[12]["Health"] = "NepgearsyHUDReborn/HUD/HealthRedFushia"
tritp[1]["Armor"] = "NepgearsyHUDReborn/HUD/Shield"
tritp[2]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldGreen"
tritp[3]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldRed"
tritp[4]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldOrange"
tritp[5]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldYellow"
tritp[6]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldCyan"
tritp[7]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldBlueOcean"
tritp[8]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldBlue"
tritp[9]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldPurple"
tritp[10]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldPink"
tritp[11]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldFushia"
tritp[12]["Armor"] = "NepgearsyHUDReborn/HUD/ShieldRedFushia"
return tritp[id][type]
end
function NepgearsyHUDReborn:StringToColor(module, id)
local stc = {}
stc["starring"] = {}
stc["starring"][1] = Color.white
stc["starring"][2] = Color.red
stc["starring"][3] = Color.green
stc["starring"][4] = Color.blue
stc["starring"][5] = Color("9800ff")
stc["starring"][6] = Color.yellow
stc["starring"][7] = Color("ff6e00")
stc["starring"][8] = Color("ffa3f5")
stc["starring"][9] = Color("ff00e3")
stc["starring"][10] = Color("00ffff")
stc["starring"][11] = Color("2f5ab7")
stc["starring"][12] = Color("ff006e")
stc["starring"][13] = Color(1, 0.63, 0.58, 0.95)
stc["cpcolor"] = deep_clone(stc["starring"])
stc["cpbordercolor"] = deep_clone(stc["starring"])
stc["objective_color"] = deep_clone(stc["starring"])
return stc[module][id]
end
function NepgearsyHUDReborn:InitChangelog()
if SystemFS:exists(self.ModPath .. "Changelog.txt") then
local file = io.open( self.ModPath .. "Changelog.txt", "r")
self.Changelog = file:read("*all")
return
end
self.Changelog = ""
return
end
function NepgearsyHUDReborn:InitLocalization()
self.LocalizationTable = {}
self.Localization = {
[1] = {
localized_name = "NepgearsyHUDReborn/Localization/English",
path = "english.txt"
},
[2] = {
localized_name = "NepgearsyHUDReborn/Localization/Turkish",
path = "turkish.txt"
},
[3] = {
localized_name = "NepgearsyHUDReborn/Localization/Portuguese",
path = "portuguese.txt"
},
[4] = {
localized_name = "NepgearsyHUDReborn/Localization/Spanish",
path = "spanish.txt"
},
[5] = {
localized_name = "NepgearsyHUDReborn/Localization/Russian",
path = "russian.txt"
},
[6] = {
localized_name = "NepgearsyHUDReborn/Localization/French",
path = "french.txt"
},
[7] = {
localized_name = "NepgearsyHUDReborn/Localization/Romanian",
path = "romanian.txt"
},
[8] = {
localized_name = "NepgearsyHUDReborn/Localization/German",
path = "german.txt"
},
[9] = {
localized_name = "NepgearsyHUDReborn/Localization/Thai",
path = "thai.txt"
}
}
for i, localization in ipairs(self.Localization) do
table.insert(self.LocalizationTable, localization.localized_name)
end
end
function NepgearsyHUDReborn:GetForcedLocalization()
local Chosen = self:GetOption("ForcedLocalization")
local Folder = self.ModPath .. "Localization/"
if not self.Localization[Chosen] then
self:Error("Can't load a localization file if there's no ID for it! Returning english.")
return Folder .. self.Localization[1].path
end
for i, localization in ipairs(self.Localization) do
if i == Chosen then
return Folder .. localization.path
end
end
end
function NepgearsyHUDReborn:InitMenu()
self.Menu = NepHudMenu:new()
end
function NepgearsyHUDReborn:Log(text, ...)
log("[NepgearsyHUDReborn] LOG : " .. text, ...)
end
function NepgearsyHUDReborn:DebugLog(text, ...)
if not self.Dev then
return
end
log("[NepgearsyHUDReborn] DEVLOG : " .. text, ...)
end
function NepgearsyHUDReborn:Error(text, ...)
log("[NepgearsyHUDReborn] ERROR : " .. text, ...)
end
function NepgearsyHUDReborn:GetOption(option_name)
return NepgearsyHUDReborn.Options:GetValue(option_name)
end
function NepgearsyHUDReborn:SetOption(option_name, value)
return NepgearsyHUDReborn.Options:SetValue(option_name, value)
end
-- Init NepHook functions based on Luffy's one. Hug to you if you read this :satanialove:
NepHook = NepHook or {}
function NepHook:Post(based_class, based_func, content)
local concat_id = tostring(based_func) .. "_PostHook"
Hooks:PostHook(based_class, based_func, concat_id, content)
end
function NepHook:Pre(based_class, based_func, content)
local concat_id = tostring(based_func) .. "_PreHook"
Hooks:PreHook(based_class, based_func, concat_id, content)
end
-- Init NepgearsyHUDReborn coreclass if not initialized yet.
if not NepgearsyHUDReborn.Initialized then
NepgearsyHUDReborn:Init()
end
if Hooks then
Hooks:Add("MenuManagerPopulateCustomMenus", "InitNepHudMenu", callback(NepgearsyHUDReborn, NepgearsyHUDReborn, "InitMenu"))
Hooks:Add("LocalizationManagerPostInit", "PostInitLocalizationNepHud", function(loc)
loc:load_localization_file( NepgearsyHUDReborn:GetForcedLocalization() )
end)
end