Converted customisations ids to mongoIds

This commit is contained in:
Chomp
2025-07-09 17:24:12 +01:00
parent 4ba9a9f0d4
commit 5d9a97ce5b
6 changed files with 31 additions and 62 deletions
@@ -16,7 +16,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731c8bafff850080488bb"
},
"Encyclopedia": {
@@ -2714,7 +2714,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731d1170146228c0d222a"
},
"Encyclopedia": {
@@ -5612,7 +5612,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731c8bafff850080488bb"
},
"Encyclopedia": {
@@ -8869,7 +8869,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731d1170146228c0d222a"
},
"Encyclopedia": {
@@ -12234,7 +12234,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731c8bafff850080488bb"
},
"Encyclopedia": {
@@ -15949,7 +15949,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731d1170146228c0d222a"
},
"Encyclopedia": {
@@ -19871,7 +19871,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "6746fd09bafff85008048838"
},
"Encyclopedia": {
@@ -23637,7 +23637,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "67471938bafff850080488b7"
},
"Encyclopedia": {
@@ -27549,7 +27549,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "67471928d17d6431550563b5"
},
"Encyclopedia": {
@@ -32054,7 +32054,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "6747193f170146228c0d2226"
},
"Encyclopedia": {
@@ -36765,7 +36765,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "67471928d17d6431550563b5"
},
"Encyclopedia": {
@@ -37754,7 +37754,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "6747193f170146228c0d2226"
},
"Encyclopedia": {
@@ -38744,7 +38744,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "6746fd09bafff85008048838"
},
"Encyclopedia": {
@@ -41892,7 +41892,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "67471938bafff850080488b7"
},
"Encyclopedia": {
@@ -45027,7 +45027,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "67471928d17d6431550563b5"
},
"Encyclopedia": {
@@ -48450,7 +48450,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "6747193f170146228c0d2226"
},
"Encyclopedia": {
@@ -51864,7 +51864,7 @@
"Body": "5cc0858d14c02e000c6bea66",
"Feet": "5cc085bb14c02e000e67a5c5",
"Hands": "5cc0876314c02e000c6bea6b",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731c8bafff850080488bb"
},
"Encyclopedia": {
@@ -52843,7 +52843,7 @@
"Body": "5cde95d97d6c8b647a3769b0",
"Feet": "5cde95ef7d6c8b04713c4f2d",
"Hands": "5cde95fa7d6c8b04737c2d13",
"Head": "__REPLACEME__",
"Head": "000000000000000000000000",
"DogTag": "674731d1170146228c0d222a"
},
"Encyclopedia": {
@@ -527,7 +527,7 @@ public class BotGenerator(
bot.Customization.Body = weightedRandomHelper.GetWeightedValue<string>(appearance.Body);
var bodyGlobalDictDb = databaseService.GetGlobals().Configuration.Customization.Body;
var chosenBodyTemplate = databaseService.GetCustomization()[bot.Customization.Body];
var chosenBodyTemplate = databaseService.GetCustomization()[bot.Customization.Body.Value];
// Some bodies have matching hands, look up body to see if this is the case
var chosenBody = bodyGlobalDictDb.FirstOrDefault(c =>
@@ -319,48 +319,17 @@ public record Customization
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
private string? _head;
private string? _body;
private string? _feet;
private string? _dogtag;
private string? _hands;
private string? _voice;
public MongoId? Head { get; set; }
public string? Head
{
get { return _head; }
set { _head = value == null ? null : string.Intern(value); }
}
public MongoId? Body { get; set; }
public string? Body
{
get { return _body; }
set { _body = value == null ? null : string.Intern(value); }
}
public MongoId? Feet { get; set; }
public string? Feet
{
get { return _feet; }
set { _feet = value == null ? null : string.Intern(value); }
}
public MongoId? Hands { get; set; }
public string? Hands
{
get { return _hands; }
set { _hands = value == null ? null : string.Intern(value); }
}
public MongoId? DogTag { get; set; }
public string? DogTag
{
get { return _dogtag; }
set { _dogtag = value == null ? null : string.Intern(value); }
}
public string? Voice
{
get { return _voice; }
set { _voice = value == null ? null : string.Intern(value); }
}
public MongoId? Voice { get; set; }
}
public record BotBaseHealth
@@ -32,7 +32,7 @@ public record Templates
public HandbookBase? Handbook { get; set; }
[JsonPropertyName("customization")]
public Dictionary<string, CustomizationItem>? Customization { get; set; }
public Dictionary<MongoId, CustomizationItem>? Customization { get; set; }
/// <summary>
/// The profile templates listed in the launcher on profile creation, split by account type (e.g. Standard) then side (e.g. bear/usec)
@@ -232,7 +232,7 @@ public class DatabaseService(
}
/// <returns> assets/database/templates/customisation.json </returns>
public Dictionary<string, CustomizationItem?> GetCustomization()
public Dictionary<MongoId, CustomizationItem?> GetCustomization()
{
if (databaseServer.GetTables().Templates?.Customization == null)
{
@@ -187,7 +187,7 @@ public class ProfileFixerService(
);
// Check Head
if (customizationDb[pmcProfile.Customization.Head] is null)
if (!customizationDb.ContainsKey(pmcProfile.Customization.Head.Value))
{
var defaultHead = playerIsUsec
? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecHead")
@@ -196,7 +196,7 @@ public class ProfileFixerService(
}
// check Body
if (customizationDb[pmcProfile.Customization.Body] is null)
if (customizationDb.ContainsKey(pmcProfile.Customization.Body.Value))
{
var defaultBody = playerIsUsec
? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecBody")
@@ -205,7 +205,7 @@ public class ProfileFixerService(
}
// check Hands
if (customizationDb[pmcProfile.Customization.Hands] is null)
if (customizationDb.ContainsKey(pmcProfile.Customization.Hands.Value))
{
var defaultHands = playerIsUsec
? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecHands")
@@ -214,7 +214,7 @@ public class ProfileFixerService(
}
// check Feet
if (customizationDb[pmcProfile.Customization.Feet] is null)
if (customizationDb.ContainsKey(pmcProfile.Customization.Feet.Value))
{
var defaultFeet = playerIsUsec
? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecFeet")