diff --git a/ConsoleCommands/Spawn.cs b/ConsoleCommands/Spawn.cs index 6bb7781f..b257ff2b 100644 --- a/ConsoleCommands/Spawn.cs +++ b/ConsoleCommands/Spawn.cs @@ -10,7 +10,6 @@ using EFT.Trainer.Features; using EFT.Trainer.Properties; using JetBrains.Annotations; -using UnityEngine; using Random = UnityEngine.Random; #nullable enable @@ -87,7 +86,7 @@ private static void SpawnTemplate(ItemTemplate template, Player player, ConsoleC } else { - item.SpawnedInSession = true; // found in raid + SetupItem(itemFactory, item); _ = new TraderControllerClass(item, item.Id, item.ShortName); var go = poolManager.CreateLootPrefab(item, ECameraType.Default); @@ -110,4 +109,39 @@ private static void SpawnTemplate(ItemTemplate template, Player player, ConsoleC return Task.CompletedTask; }); } + + private static void SetupItem(ItemFactoryClass itemFactory, Item item) + { + item.SpawnedInSession = true; // found in raid + + if (item.TryGetItemComponent(out var dogtag)) + { + dogtag.AccountId = Random.Range(0, int.MaxValue).ToString(); + dogtag.ProfileId = Random.Range(0, int.MaxValue).ToString(); + dogtag.Nickname = $"Rambo{Random.Range(1, 256)}"; + dogtag.Side = Enum.GetValues(typeof(EPlayerSide)).Cast().Random(); + dogtag.Level = Random.Range(1, 69); + dogtag.Time = DateTime.Now; + dogtag.Status = "died"; + dogtag.KillerAccountId = Random.Range(0, int.MaxValue).ToString(); + dogtag.KillerProfileId = Random.Range(0, int.MaxValue).ToString(); + dogtag.KillerName = ""; + dogtag.WeaponName = ""; + } + + if (item.TryGetItemComponent(out var armorHolder)) + { + foreach (var slot in armorHolder.ArmorSlots) + { + var plate = itemFactory.CreateItem(MongoID.Generate(), KnownTemplateIds.CultTermiteBallisticPlate, null); + slot.AddWithoutRestrictions(plate); + } + } + + if (item.TryGetItemComponent(out var repairable)) + { + repairable.MaxDurability = repairable.TemplateDurability; + repairable.Durability = repairable.MaxDurability; + } + } } diff --git a/KnownTemplateIds.cs b/KnownTemplateIds.cs index 27a4449f..45750dd2 100644 --- a/KnownTemplateIds.cs +++ b/KnownTemplateIds.cs @@ -18,5 +18,7 @@ public static class KnownTemplateIds public const string AirDropSupply = "622334fa3136504a544d160c"; public const string AirDropWeapon = "6223351bb5d97a7b2c635ca7"; + public const string CultTermiteBallisticPlate = "656fa99800d62bcd2e024088"; + public static string DefaultInventoryLocalizedShortName = ((MongoID)DefaultInventory).LocalizedShortName(); }