update DatabaseTables and services to be Camelcase

This commit is contained in:
CWX
2025-01-08 15:32:33 +00:00
parent ab95956a55
commit e64adbf4b8
9 changed files with 148 additions and 61 deletions
+33
View File
@@ -239,6 +239,9 @@ public class LocationBase
[JsonPropertyName("SpawnPointParams")]
public List<SpawnPointParam>? SpawnPointParams { get; set; }
[JsonPropertyName("areas")]
public Dictionary<string, Area>? 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<string>? Sides { get; set; }
[JsonPropertyName("size")]
public XYZ? Size { get; set; }
}
public enum WildSpawnType
{
assault,
+1 -1
View File
@@ -14,7 +14,7 @@ public class Achievement
public string? AssetPath { get; set; }
[JsonPropertyName("rewards")]
public QuestRewards? Rewards { get; set; }
public List<QuestReward>? Rewards { get; set; }
[JsonPropertyName("conditions")]
public QuestConditionTypes? Conditions { get; set; }
+16 -6
View File
@@ -119,19 +119,19 @@ public class Quest
public class QuestConditionTypes
{
[JsonPropertyName("Started")]
[JsonPropertyName("started")]
public List<QuestCondition>? Started { get; set; }
[JsonPropertyName("AvailableForFinish")]
[JsonPropertyName("availableForFinish")]
public List<QuestCondition>? AvailableForFinish { get; set; }
[JsonPropertyName("AvailableForStart")]
[JsonPropertyName("availableForStart")]
public List<QuestCondition>? AvailableForStart { get; set; }
[JsonPropertyName("Success")]
[JsonPropertyName("success")]
public List<QuestCondition>? Success { get; set; }
[JsonPropertyName("Fail")]
[JsonPropertyName("fail")]
public List<QuestCondition>? Fail { get; set; }
}
@@ -313,6 +313,9 @@ public class QuestConditionCounterCondition
[JsonPropertyName("resetOnSessionEnd")]
public bool? ResetOnSessionEnd { get; set; }
[JsonPropertyName("bodyPartsWithEffects")]
public List<EnemyHealthEffect>? 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<string>? 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; }
}
@@ -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<string>? ProfileVersions { get; set; }
[JsonPropertyName("Side")]
public List<string>? 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<string>? Game { get; set; }
[JsonPropertyName("Body")]
public string? Body { get; set; }
}
public class WeaponRecoilSettings
+3 -1
View File
@@ -13,5 +13,7 @@ public enum QuestRewardType
TraderStandingRestore,
StashRows,
Achievement,
Pockets
Pockets,
CustomizationOffer,
CustomizationDirect
}
+22 -12
View File
@@ -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<string, Trader>? traders { get; set; }
public Globals? globals { get; set; }
public ServerBase? server { get; set; }
public SettingsBase? settings { get; set; }
}
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<string, Trader>? Traders { get; set; }
public Globals? Globals { get; set; }
public ServerBase? Server { get; set; }
public SettingsBase? Settings { get; set; }
}
+37 -37
View File
@@ -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<Achievement> 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<string, CustomizationItem> 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<string, TemplateItem> 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<string, double> 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<string, Quest> 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<string, Trader> 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;
}
}
}
+4 -4
View File
@@ -29,13 +29,13 @@ public class LocaleService
*/
public Dictionary<string, string> 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;
}
}
}
+2
View File
@@ -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);