From e64adbf4b87876f7aca69d7b92dee7a3e5b24144 Mon Sep 17 00:00:00 2001 From: CWX Date: Wed, 8 Jan 2025 15:32:33 +0000 Subject: [PATCH] update DatabaseTables and services to be Camelcase --- Core/Models/Eft/Common/LocationBase.cs | 33 +++++++++ Core/Models/Eft/Common/Tables/Achievement.cs | 2 +- Core/Models/Eft/Common/Tables/Quest.cs | 22 ++++-- Core/Models/Eft/Common/Tables/TemplateItem.cs | 30 ++++++++ Core/Models/Enums/QuestRewardType.cs | 4 +- Core/Models/Spt/Server/DatabaseTables.cs | 34 ++++++--- Core/Services/DatabaseService.cs | 74 +++++++++---------- Core/Services/LocaleService.cs | 8 +- Core/Utils/ImporterUtil.cs | 2 + 9 files changed, 148 insertions(+), 61 deletions(-) diff --git a/Core/Models/Eft/Common/LocationBase.cs b/Core/Models/Eft/Common/LocationBase.cs index 8d53961f..c6246a55 100644 --- a/Core/Models/Eft/Common/LocationBase.cs +++ b/Core/Models/Eft/Common/LocationBase.cs @@ -239,6 +239,9 @@ public class LocationBase [JsonPropertyName("SpawnPointParams")] public List? SpawnPointParams { get; set; } + + [JsonPropertyName("areas")] + public Dictionary? Areas { get; set; } [JsonPropertyName("UnixDateTime")] public long? UnixDateTime { get; set; } @@ -273,6 +276,9 @@ public class LocationBase [JsonPropertyName("ForceOnlineRaidInPVE")] public bool? ForceOnlineRaidInPVE { get; set; } + + [JsonPropertyName("ExitZones")] + public string? ExitZones { get; set; } [JsonPropertyName("exit_count")] public int? ExitCount { get; set; } @@ -756,6 +762,12 @@ public class Exit [JsonPropertyName("Name")] public string? Name { get; set; } + + [JsonPropertyName("_Name")] + public string? _Name { get; set; } + + [JsonPropertyName("_name")] + public string? _NameLower { get; set; } [JsonPropertyName("PassageRequirement")] public string? PassageRequirement { get; set; } @@ -899,6 +911,27 @@ public class CrowdAttackSpawnParam public int? Weight { get; set; } } +public class Area +{ + [JsonPropertyName("center")] + public XYZ? Center { get; set; } + + [JsonPropertyName("infiltrationZone")] + public string? InfiltrationZone { get; set; } + + [JsonPropertyName("orientation")] + public double? Orientation { get; set; } + + [JsonPropertyName("position")] + public XYZ? Position { get; set; } + + [JsonPropertyName("sides")] + public List? Sides { get; set; } + + [JsonPropertyName("size")] + public XYZ? Size { get; set; } +} + public enum WildSpawnType { assault, diff --git a/Core/Models/Eft/Common/Tables/Achievement.cs b/Core/Models/Eft/Common/Tables/Achievement.cs index 3c51297e..152466c6 100644 --- a/Core/Models/Eft/Common/Tables/Achievement.cs +++ b/Core/Models/Eft/Common/Tables/Achievement.cs @@ -14,7 +14,7 @@ public class Achievement public string? AssetPath { get; set; } [JsonPropertyName("rewards")] - public QuestRewards? Rewards { get; set; } + public List? Rewards { get; set; } [JsonPropertyName("conditions")] public QuestConditionTypes? Conditions { get; set; } diff --git a/Core/Models/Eft/Common/Tables/Quest.cs b/Core/Models/Eft/Common/Tables/Quest.cs index c47c01bd..79b0078a 100644 --- a/Core/Models/Eft/Common/Tables/Quest.cs +++ b/Core/Models/Eft/Common/Tables/Quest.cs @@ -119,19 +119,19 @@ public class Quest public class QuestConditionTypes { - [JsonPropertyName("Started")] + [JsonPropertyName("started")] public List? Started { get; set; } - [JsonPropertyName("AvailableForFinish")] + [JsonPropertyName("availableForFinish")] public List? AvailableForFinish { get; set; } - [JsonPropertyName("AvailableForStart")] + [JsonPropertyName("availableForStart")] public List? AvailableForStart { get; set; } - [JsonPropertyName("Success")] + [JsonPropertyName("success")] public List? Success { get; set; } - [JsonPropertyName("Fail")] + [JsonPropertyName("fail")] public List? Fail { get; set; } } @@ -313,6 +313,9 @@ public class QuestConditionCounterCondition [JsonPropertyName("resetOnSessionEnd")] public bool? ResetOnSessionEnd { get; set; } + + [JsonPropertyName("bodyPartsWithEffects")] + public List? BodyPartsWithEffects { get; set; } } public class EnemyHealthEffect @@ -405,7 +408,7 @@ public class QuestReward public string? Id { get; set; } [JsonPropertyName("type")] - public QuestRewardType? Type { get; set; } + public string? Type { get; set; } // QuestRewardType [JsonPropertyName("index")] public int? Index { get; set; } @@ -442,4 +445,11 @@ public class QuestReward /** Game editions blacklisted from getting reward */ [JsonPropertyName("notAvailableInGameEditions")] public List? NotAvailableInGameEditions { get; set; } + + // This is always Null atm in the achievements.json + [JsonPropertyName("illustrationConfig")] + public object? IllustrationConfig { get; set; } + + [JsonPropertyName("isHidden")] + public bool? IsHidden { get; set; } } \ No newline at end of file diff --git a/Core/Models/Eft/Common/Tables/TemplateItem.cs b/Core/Models/Eft/Common/Tables/TemplateItem.cs index f555e21a..16c9e389 100644 --- a/Core/Models/Eft/Common/Tables/TemplateItem.cs +++ b/Core/Models/Eft/Common/Tables/TemplateItem.cs @@ -1314,6 +1314,36 @@ public class Props [JsonPropertyName("tradersDiscountPVE")] public int? TradersDiscountPVE { get; set; } + + [JsonPropertyName("AvailableAsDefault")] + public bool? AvailableAsDefault { get; set; } + + [JsonPropertyName("ProfileVersions")] + public List? ProfileVersions { get; set; } + + [JsonPropertyName("Side")] + public List? Side { get; set; } + + [JsonPropertyName("BodyPart")] + public string? BodyPart { get; set; } + + [JsonPropertyName("IntegratedArmorVest")] + public bool? IntegratedArmorVest { get; set; } + + [JsonPropertyName("WatchPosition")] + public XYZ? WatchPosition { get; set; } + + [JsonPropertyName("WatchPrefab")] + public Prefab? WatchPrefab { get; set; } + + [JsonPropertyName("WatchRotation")] + public XYZ? WatchRotation { get; set; } + + [JsonPropertyName("Game")] + public List? Game { get; set; } + + [JsonPropertyName("Body")] + public string? Body { get; set; } } public class WeaponRecoilSettings diff --git a/Core/Models/Enums/QuestRewardType.cs b/Core/Models/Enums/QuestRewardType.cs index 4907a972..8e20707b 100644 --- a/Core/Models/Enums/QuestRewardType.cs +++ b/Core/Models/Enums/QuestRewardType.cs @@ -13,5 +13,7 @@ public enum QuestRewardType TraderStandingRestore, StashRows, Achievement, - Pockets + Pockets, + CustomizationOffer, + CustomizationDirect } \ No newline at end of file diff --git a/Core/Models/Spt/Server/DatabaseTables.cs b/Core/Models/Spt/Server/DatabaseTables.cs index 53e7dfc3..5a5a0de6 100644 --- a/Core/Models/Spt/Server/DatabaseTables.cs +++ b/Core/Models/Spt/Server/DatabaseTables.cs @@ -1,18 +1,28 @@ -using Core.Models.Eft.Common; +using System.Text.Json.Serialization; +using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; namespace Core.Models.Spt.Server; public class DatabaseTables { - public Bots.Bots? bots { get; set; } - public Hideout.Hideout? hideout { get; set; } - public LocaleBase? locales { get; set; } - public Locations? locations { get; set; } - public Match? match { get; set; } - public Templates.Templates? templates { get; set; } - public Dictionary? traders { get; set; } - public Globals? globals { get; set; } - public ServerBase? server { get; set; } - public SettingsBase? settings { get; set; } -} \ No newline at end of file + public Bots.Bots? Bots { get; set; } + + public Hideout.Hideout? Hideout { get; set; } + + public LocaleBase? Locales { get; set; } + + public Locations? Locations { get; set; } + + public Match? Match { get; set; } + + public Templates.Templates? Templates { get; set; } + + public Dictionary? Traders { get; set; } + + public Globals? Globals { get; set; } + + public ServerBase? Server { get; set; } + + public SettingsBase? Settings { get; set; } +} diff --git a/Core/Services/DatabaseService.cs b/Core/Services/DatabaseService.cs index 062d9c80..57349659 100644 --- a/Core/Services/DatabaseService.cs +++ b/Core/Services/DatabaseService.cs @@ -51,10 +51,10 @@ public class DatabaseService */ public Bots GetBots() { - if (_databaseServer.GetTables().bots == null) + if (_databaseServer.GetTables().Bots == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/bots")); - return _databaseServer.GetTables().bots!; + return _databaseServer.GetTables().Bots!; } /** @@ -62,11 +62,11 @@ public class DatabaseService */ public Globals GetGlobals() { - if (_databaseServer.GetTables().globals == null) + if (_databaseServer.GetTables().Globals == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/globals.json")); - return _databaseServer.GetTables().globals!; + return _databaseServer.GetTables().Globals!; } /** @@ -74,11 +74,11 @@ public class DatabaseService */ public Hideout GetHideout() { - if (_databaseServer.GetTables().hideout == null) + if (_databaseServer.GetTables().Hideout == null) throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/hideout")); - return _databaseServer.GetTables().hideout!; + return _databaseServer.GetTables().Hideout!; } /** @@ -86,11 +86,11 @@ public class DatabaseService */ public LocaleBase GetLocales() { - if (_databaseServer.GetTables().locales == null) + if (_databaseServer.GetTables().Locales == null) throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/locales")); - return _databaseServer.GetTables().locales!; + return _databaseServer.GetTables().Locales!; } /** @@ -98,11 +98,11 @@ public class DatabaseService */ public Locations GetLocations() { - if (_databaseServer.GetTables().locations == null) + if (_databaseServer.GetTables().Locations == null) throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/locales")); - return _databaseServer.GetTables().locations!; + return _databaseServer.GetTables().Locations!; } /** @@ -124,11 +124,11 @@ public class DatabaseService */ public Match GetMatch() { - if (_databaseServer.GetTables().match == null) + if (_databaseServer.GetTables().Match == null) throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/locales")); - return _databaseServer.GetTables().match!; + return _databaseServer.GetTables().Match!; } /** @@ -136,11 +136,11 @@ public class DatabaseService */ public ServerBase GetServer() { - if (_databaseServer.GetTables().server == null) + if (_databaseServer.GetTables().Server == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/server.json")); - return _databaseServer.GetTables().server!; + return _databaseServer.GetTables().Server!; } /** @@ -148,11 +148,11 @@ public class DatabaseService */ public SettingsBase GetSettings() { - if (_databaseServer.GetTables().settings == null) + if (_databaseServer.GetTables().Settings == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/settings.json")); - return _databaseServer.GetTables().settings!; + return _databaseServer.GetTables().Settings!; } /** @@ -160,11 +160,11 @@ public class DatabaseService */ public Templates GetTemplates() { - if (_databaseServer.GetTables().templates == null) + if (_databaseServer.GetTables().Templates == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates")); - return _databaseServer.GetTables().templates!; + return _databaseServer.GetTables().Templates!; } /** @@ -172,11 +172,11 @@ public class DatabaseService */ public List GetAchievements() { - if (_databaseServer.GetTables().templates?.Achievements == null) + if (_databaseServer.GetTables().Templates?.Achievements == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/achievements.json")); - return _databaseServer.GetTables().templates?.Achievements!; + return _databaseServer.GetTables().Templates?.Achievements!; } /** @@ -184,11 +184,11 @@ public class DatabaseService */ public Dictionary GetCustomization() { - if (_databaseServer.GetTables().templates?.Customization == null) + if (_databaseServer.GetTables().Templates?.Customization == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/customization.json")); - return _databaseServer.GetTables().templates?.Customization!; + return _databaseServer.GetTables().Templates?.Customization!; } /** @@ -196,10 +196,10 @@ public class DatabaseService */ public HandbookBase GetHandbook() { - if (_databaseServer.GetTables().templates?.Handbook == null) + if (_databaseServer.GetTables().Templates?.Handbook == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/handbook.json")); - return _databaseServer.GetTables().templates?.Handbook!; + return _databaseServer.GetTables().Templates?.Handbook!; } /** @@ -207,10 +207,10 @@ public class DatabaseService */ public Dictionary GetItems() { - if (_databaseServer.GetTables().templates?.Items == null) + if (_databaseServer.GetTables().Templates?.Items == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/items.json")); - return _databaseServer.GetTables().templates?.Items!; + return _databaseServer.GetTables().Templates?.Items!; } /** @@ -218,10 +218,10 @@ public class DatabaseService */ public Dictionary GetPrices() { - if (_databaseServer.GetTables().templates?.Prices == null) + if (_databaseServer.GetTables().Templates?.Prices == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/prices.json")); - return _databaseServer.GetTables().templates?.Prices!; + return _databaseServer.GetTables().Templates?.Prices!; } /** @@ -229,10 +229,10 @@ public class DatabaseService */ public ProfileTemplates GetProfiles() { - if (_databaseServer.GetTables().templates?.Profiles == null) + if (_databaseServer.GetTables().Templates?.Profiles == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/profiles.json")); - return _databaseServer.GetTables().templates?.Profiles!; + return _databaseServer.GetTables().Templates?.Profiles!; } /** @@ -240,10 +240,10 @@ public class DatabaseService */ public Dictionary GetQuests() { - if (_databaseServer.GetTables().templates?.Quests == null) + if (_databaseServer.GetTables().Templates?.Quests == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/quests.json")); - return _databaseServer.GetTables().templates?.Quests!; + return _databaseServer.GetTables().Templates?.Quests!; } /** @@ -251,10 +251,10 @@ public class DatabaseService */ public Dictionary GetTraders() { - if (_databaseServer.GetTables().traders == null) + if (_databaseServer.GetTables().Traders == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/traders")); - return _databaseServer.GetTables().traders!; + return _databaseServer.GetTables().Traders!; } /** @@ -276,10 +276,10 @@ public class DatabaseService */ public LocationServices GetLocationServices() { - if (_databaseServer.GetTables().templates?.LocationServices == null) + if (_databaseServer.GetTables().Templates?.LocationServices == null) throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/locationServices.json")); - return _databaseServer.GetTables().templates?.LocationServices!; + return _databaseServer.GetTables().Templates?.LocationServices!; } /** @@ -327,4 +327,4 @@ public class DatabaseService { return isDataValid; } -} \ No newline at end of file +} diff --git a/Core/Services/LocaleService.cs b/Core/Services/LocaleService.cs index 714acd37..d325c60a 100644 --- a/Core/Services/LocaleService.cs +++ b/Core/Services/LocaleService.cs @@ -29,13 +29,13 @@ public class LocaleService */ public Dictionary GetLocaleDb() { - var desiredLocale = _databaseServer.GetTables().locales.Global[GetDesiredGameLocale()]; + var desiredLocale = _databaseServer.GetTables().Locales.Global[GetDesiredGameLocale()]; if (desiredLocale != null) return desiredLocale; _logger.Warning( $"Unable to find desired locale file using locale: {GetDesiredGameLocale()} from config/locale.json, falling back to 'en'"); - return _databaseServer.GetTables().locales.Global["en"]; + return _databaseServer.GetTables().Locales.Global["en"]; } /** @@ -132,7 +132,7 @@ public class LocaleService return "en"; } - var locales = _databaseServer.GetTables().locales; + var locales = _databaseServer.GetTables().Locales; var baseNameCode = platformLocale.TwoLetterISOLanguageName.ToLower(); if (locales.Global.ContainsKey(baseNameCode)) return baseNameCode; @@ -161,4 +161,4 @@ public class LocaleService { return CultureInfo.InstalledUICulture; } -} \ No newline at end of file +} diff --git a/Core/Utils/ImporterUtil.cs b/Core/Utils/ImporterUtil.cs index b383be85..2d667f8a 100644 --- a/Core/Utils/ImporterUtil.cs +++ b/Core/Utils/ImporterUtil.cs @@ -38,6 +38,8 @@ public class ImporterUtil foreach (var file in files) { if (_fileUtil.GetFileExtension(file) != "json") continue; + // to skip ArchivedQuests.json + if (file.ToLower().Contains("archived")) continue; // const filename = this.vfs.stripExtension(file); // const filePathAndName = `${filepath}${file}`; var fileData = await File.ReadAllTextAsync(file);