refactor(mod): changed hardcode items and locale to JSON controlled one

This commit is contained in:
Yui
2025-11-04 15:33:50 -03:00
parent 99c737c672
commit a4b2bf4bcf
14 changed files with 431 additions and 262 deletions

View File

@@ -0,0 +1,29 @@
using moe.yuyui.weebsights_port.Models;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.DI;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Utils;
namespace moe.yuyui.weebsights_port.Services;
[Injectable(TypePriority = OnLoadOrder.PostDBModLoader + 4)]
public class WeebLocaleService(JsonUtil jsonUtil)
{
public bool TryLoadLocales(string filePath, out Dictionary<MongoId, WeebLocaleConfig> outputObject)
{
var json = LoadLocales(filePath);
if (json == null)
{
outputObject = new Dictionary<MongoId, WeebLocaleConfig>();
return false;
}
outputObject = json;
return true;
}
public Dictionary<MongoId, WeebLocaleConfig>? LoadLocales(string filePath)
{
return jsonUtil.DeserializeFromFile<Dictionary<MongoId, WeebLocaleConfig>>(filePath);
}
}