refactor(mod): renamed project file and made build script zip releases automagically

This commit is contained in:
Yui
2025-11-05 17:25:14 -03:00
parent 95c864b3c5
commit 46f5959a3e
40 changed files with 38 additions and 21 deletions

43
WeebSights/Mod.cs Normal file
View File

@@ -0,0 +1,43 @@
using System.Diagnostics;
using System.Reflection;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.DI;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Utils;
using WeebSights.Services;
namespace WeebSights;
[Injectable(TypePriority = OnLoadOrder.PostDBModLoader + 1)]
public class Mod(ISptLogger<Mod> logger,
WeebItemService weebItemService,
WeebTraderService weebTraderService,
WeebLocaleService weebLocaleService): IOnLoad
{
public Task OnLoad()
{
var stopWatch = Stopwatch.StartNew();
var currentAssemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (!weebLocaleService.TryLoadLocales(Path.Join(currentAssemblyPath, "/db/locales/en.json"), out var locales))
{
logger.Error("[Weeb Iron Sights] Failed to load locales. Names might be weird");
}
if(!weebItemService.TryLoadConfig(Path.Join(currentAssemblyPath, "/db/items.jsonc"), out var items))
{
logger.Critical("[Weeb Iron Sights] Failed to load items. MOD WILL NOT LOAD");
stopWatch.Stop();
return Task.CompletedTask;
}
var resultItemCreation = weebItemService.GenerateItems(items, locales);
if (!weebTraderService.AddToAssortFromItemClone(Traders.MECHANIC, resultItemCreation))
{
logger.Critical("[Weeb Iron Sights] Failed to add items into Mechanic. Sights wont be available for purchase");
}
stopWatch.Stop();
logger.Success($"[Weeb Iron Sights] Loaded in {stopWatch.ElapsedMilliseconds} ms");
return Task.CompletedTask;
}
}