merge into main #1
@ -13,14 +13,19 @@ namespace Common.Models
|
||||
|
||||
public class Props
|
||||
{
|
||||
public string defMagType;
|
||||
|
||||
public string Name { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<Chamber> Chambers { get; set; }
|
||||
public List<Cartridge> Cartridges { get;set;}
|
||||
public List<Slot> Slots { get; set; }
|
||||
public string defAmmo { get; set; }
|
||||
public string weapClass { get; set; }
|
||||
public string weapUseType { get; set; }
|
||||
public string ammoCaliber { get; set; }
|
||||
public string Caliber { get; set; }
|
||||
}
|
||||
|
||||
public class Chamber
|
||||
@ -34,10 +39,21 @@ namespace Common.Models
|
||||
public string _proto { get; set; }
|
||||
}
|
||||
|
||||
public class Cartridge
|
||||
{
|
||||
public string _name { get; set; }
|
||||
public string _id { get; set; }
|
||||
public string _parent { get; set; }
|
||||
public int _max_count { get; set; }
|
||||
public ChamberProps _props { get; set; }
|
||||
public string _proto { get; set; }
|
||||
}
|
||||
|
||||
public class Slot
|
||||
{
|
||||
public string _name { get; set; }
|
||||
public bool _required { get; set; }
|
||||
public ChamberProps _props { get;set;}
|
||||
}
|
||||
|
||||
public class ChamberProps
|
||||
|
@ -45,9 +45,12 @@ namespace Common.Models.Output
|
||||
equipment = new Equipment();
|
||||
items = new Items();
|
||||
mods = new Dictionary<string, Dictionary<string, List<string>>>();
|
||||
Ammo = new Dictionary<string, Dictionary<string, int>>();
|
||||
}
|
||||
|
||||
public Equipment equipment { get; set; }
|
||||
|
||||
public Dictionary<string, Dictionary<string, int>> Ammo { get;set;}
|
||||
public Dictionary<string, Dictionary<string, List<string>>> mods { get; set; }
|
||||
public Items items { get; set; }
|
||||
}
|
||||
|
233366
Common/Assets/items.json
233366
Common/Assets/items.json
File diff suppressed because it is too large
Load Diff
@ -1,163 +1,200 @@
|
||||
{
|
||||
"assault": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"54491c4f4bdc2db1078b4568": 61,
|
||||
"5580223e4bdc2d1c128b457f": 4,
|
||||
"5644bd2b4bdc2d3b4c8b4572": 10,
|
||||
"56dee2bdd2720bc8328b4567": 80,
|
||||
"574d967124597745970e7c94": 56,
|
||||
"576165642459773c7a400233": 80,
|
||||
"57d14d2524597714373db789": 16,
|
||||
"57dc2fa62459775949412633": 41,
|
||||
"587e02ff24597743df3deaeb": 37,
|
||||
"59d6088586f774275f37482f": 22,
|
||||
"59e6152586f77473dc057aa1": 83,
|
||||
"59e6687d86f77411d949b251": 61,
|
||||
"59f9cabd86f7743a10721f46": 49,
|
||||
"59ff346386f77477562ff5e2": 12,
|
||||
"5a38e6bac4a2826c6e06d79b": 78,
|
||||
"5ab8e9fcd8ce870019439434": 4,
|
||||
"5ac4cd105acfc40016339859": 32,
|
||||
"5ac66d9b5acfc4001633997a": 9,
|
||||
"5ae08f0a5acfc408fb1398a1": 4,
|
||||
"5bf3e03b0db834001d2c4a9c": 4,
|
||||
"5bf3e0490db83400196199af": 7,
|
||||
"5bfd297f0db834001a669119": 5,
|
||||
"5c07c60e0db834002330051f": 33,
|
||||
"5c501a4d2e221602b412b540": 27,
|
||||
"5de652c31b7e3716273428be": 17,
|
||||
"5e870397991fd70db46995c8": 29,
|
||||
"5ea03f7400685063ec28bfa8": 11,
|
||||
"606dae0ab0e443224b421bb7": 57,
|
||||
"60db29ce99594040e04c4a27": 4,
|
||||
"61f7c9e189e6fb1a5e3ea78d": 32
|
||||
"Equipment": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"54491c4f4bdc2db1078b4568": 61,
|
||||
"5580223e4bdc2d1c128b457f": 4,
|
||||
"5644bd2b4bdc2d3b4c8b4572": 10,
|
||||
"56dee2bdd2720bc8328b4567": 80,
|
||||
"574d967124597745970e7c94": 56,
|
||||
"576165642459773c7a400233": 80,
|
||||
"57d14d2524597714373db789": 16,
|
||||
"57dc2fa62459775949412633": 41,
|
||||
"587e02ff24597743df3deaeb": 37,
|
||||
"59d6088586f774275f37482f": 22,
|
||||
"59e6152586f77473dc057aa1": 83,
|
||||
"59e6687d86f77411d949b251": 61,
|
||||
"59f9cabd86f7743a10721f46": 49,
|
||||
"59ff346386f77477562ff5e2": 12,
|
||||
"5a38e6bac4a2826c6e06d79b": 78,
|
||||
"5ab8e9fcd8ce870019439434": 4,
|
||||
"5ac4cd105acfc40016339859": 32,
|
||||
"5ac66d9b5acfc4001633997a": 9,
|
||||
"5ae08f0a5acfc408fb1398a1": 4,
|
||||
"5bf3e03b0db834001d2c4a9c": 4,
|
||||
"5bf3e0490db83400196199af": 7,
|
||||
"5bfd297f0db834001a669119": 5,
|
||||
"5c07c60e0db834002330051f": 33,
|
||||
"5c501a4d2e221602b412b540": 27,
|
||||
"5de652c31b7e3716273428be": 17,
|
||||
"5e870397991fd70db46995c8": 29,
|
||||
"5ea03f7400685063ec28bfa8": 11,
|
||||
"606dae0ab0e443224b421bb7": 57,
|
||||
"60db29ce99594040e04c4a27": 4,
|
||||
"61f7c9e189e6fb1a5e3ea78d": 32
|
||||
},
|
||||
"Backpack": {
|
||||
"544a5cde4bdc2d39388b456b": 9,
|
||||
"56e335e4d2720b6c058b456d": 4,
|
||||
"56e33634d2720bd8058b456b": 10,
|
||||
"56e33680d2720be2748b4576": 12,
|
||||
"59e763f286f7742ee57895da": 1,
|
||||
"5ab8ee7786f7742d8f33f0b9": 1,
|
||||
"5ab8f04f86f774585f4237d8": 12,
|
||||
"5f5e45cc5021ce62144be7aa": 4,
|
||||
"60a2828e8689911a226117f9": 1
|
||||
}
|
||||
},
|
||||
"Backpack": {
|
||||
"544a5cde4bdc2d39388b456b": 9,
|
||||
"56e335e4d2720b6c058b456d": 4,
|
||||
"56e33634d2720bd8058b456b": 10,
|
||||
"56e33680d2720be2748b4576": 12,
|
||||
"59e763f286f7742ee57895da": 1,
|
||||
"5ab8ee7786f7742d8f33f0b9": 1,
|
||||
"5ab8f04f86f774585f4237d8": 12,
|
||||
"5f5e45cc5021ce62144be7aa": 4,
|
||||
"60a2828e8689911a226117f9": 1
|
||||
"Ammo": {
|
||||
"Caliber366TKM": {
|
||||
"5f0596629e22f464da6bbdd9": 1,
|
||||
"59e6542b86f77411dc52a77a": 1,
|
||||
"59e655cb86f77411dc52a77b": 1
|
||||
},
|
||||
"Caliber12g": {
|
||||
"5d6e67fba4b9361bc73bc779": 1,
|
||||
"5d6e689ca4b9361bc8618956": 1,
|
||||
"560d5e524bdc2d25448b4571": 1,
|
||||
"5d6e6806a4b936088465b17e": 1,
|
||||
"5d6e68dea4b9361bcc29e659": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"pmcBot": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"5447a9cd4bdc2dbd208b4567": 30,
|
||||
"54491c4f4bdc2db1078b4568": 50,
|
||||
"574d967124597745970e7c94": 58,
|
||||
"576165642459773c7a400233": 36,
|
||||
"57c44b372459772d2b39b8ce": 10,
|
||||
"57d14d2524597714373db789": 93,
|
||||
"57dc2fa62459775949412633": 81,
|
||||
"583990e32459771419544dd2": 103,
|
||||
"58948c8e86f77409493f7266": 12,
|
||||
"5926bb2186f7744b1c6c6e60": 107,
|
||||
"5a7828548dc32e5a9c28b516": 120,
|
||||
"5ac4cd105acfc40016339859": 34,
|
||||
"5ac66d725acfc43b321d4b60": 41,
|
||||
"5ac66d9b5acfc4001633997a": 53,
|
||||
"5b0bbe4e5acfc40dc528a72d": 3,
|
||||
"5bb2475ed4351e00853264e3": 17,
|
||||
"5bd70322209c4d00d7167b8f": 6,
|
||||
"5c488a752e221602b412af63": 10,
|
||||
"5d43021ca4b9362eab4b5e25": 6,
|
||||
"5df8ce05b11454561e39243b": 4,
|
||||
"5f2a9575926fd9352339381f": 27,
|
||||
"5fbcc1d9016cce60e8341ab3": 12,
|
||||
"5fc3f2d5900b1d5091531e57": 14,
|
||||
"60339954d62c9b14ed777c06": 18,
|
||||
"606587252535c57a13424cfd": 4,
|
||||
"623063e994fc3f7b302a9696": 35
|
||||
}
|
||||
"Equipment": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"5447a9cd4bdc2dbd208b4567": 30,
|
||||
"54491c4f4bdc2db1078b4568": 50,
|
||||
"574d967124597745970e7c94": 58,
|
||||
"576165642459773c7a400233": 36,
|
||||
"57c44b372459772d2b39b8ce": 10,
|
||||
"57d14d2524597714373db789": 93,
|
||||
"57dc2fa62459775949412633": 81,
|
||||
"583990e32459771419544dd2": 103,
|
||||
"58948c8e86f77409493f7266": 12,
|
||||
"5926bb2186f7744b1c6c6e60": 107,
|
||||
"5a7828548dc32e5a9c28b516": 120,
|
||||
"5ac4cd105acfc40016339859": 34,
|
||||
"5ac66d725acfc43b321d4b60": 41,
|
||||
"5ac66d9b5acfc4001633997a": 53,
|
||||
"5b0bbe4e5acfc40dc528a72d": 3,
|
||||
"5bb2475ed4351e00853264e3": 17,
|
||||
"5bd70322209c4d00d7167b8f": 6,
|
||||
"5c488a752e221602b412af63": 10,
|
||||
"5d43021ca4b9362eab4b5e25": 6,
|
||||
"5df8ce05b11454561e39243b": 4,
|
||||
"5f2a9575926fd9352339381f": 27,
|
||||
"5fbcc1d9016cce60e8341ab3": 12,
|
||||
"5fc3f2d5900b1d5091531e57": 14,
|
||||
"60339954d62c9b14ed777c06": 18,
|
||||
"606587252535c57a13424cfd": 4,
|
||||
"623063e994fc3f7b302a9696": 35
|
||||
}
|
||||
},
|
||||
"Ammo": {}
|
||||
},
|
||||
"bossBully": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"576165642459773c7a400233": 15,
|
||||
"5926bb2186f7744b1c6c6e60": 11,
|
||||
"5ac66cb05acfc40198510a10": 45,
|
||||
"5ac66d015acfc400180ae6e4": 41,
|
||||
"5dcbd56fdbd3d91b3e5468d5": 13
|
||||
"Equipment": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"576165642459773c7a400233": 15,
|
||||
"5926bb2186f7744b1c6c6e60": 11,
|
||||
"5ac66cb05acfc40198510a10": 45,
|
||||
"5ac66d015acfc400180ae6e4": 41,
|
||||
"5dcbd56fdbd3d91b3e5468d5": 13
|
||||
},
|
||||
"Holster": {
|
||||
"5b3b713c5acfc4330140bd8d": 1,
|
||||
"602a9740da11d6478d5a06dc": 5,
|
||||
"6193a720f8ee7e52e42109ed": 1
|
||||
}
|
||||
},
|
||||
"Holster": {
|
||||
"5b3b713c5acfc4330140bd8d": 1,
|
||||
"602a9740da11d6478d5a06dc": 5,
|
||||
"6193a720f8ee7e52e42109ed": 1
|
||||
}
|
||||
"Ammo": {}
|
||||
},
|
||||
"bossKilla": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"59984ab886f7743e98271174": 2,
|
||||
"59ff346386f77477562ff5e2": 3,
|
||||
"5beed0f50db834001c062b12": 17
|
||||
}
|
||||
"Equipment": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"59984ab886f7743e98271174": 2,
|
||||
"59ff346386f77477562ff5e2": 3,
|
||||
"5beed0f50db834001c062b12": 17
|
||||
}
|
||||
},
|
||||
"Ammo": {}
|
||||
},
|
||||
"bossKojaniy": {
|
||||
"Backpack": {
|
||||
"56e335e4d2720b6c058b456d": 37,
|
||||
"5c0e805e86f774683f3dd637": 11,
|
||||
"5ca20d5986f774331e7c9602": 38,
|
||||
"6034d103ca006d2dca39b3f0": 11,
|
||||
"6038d614d10cbf667352dd44": 11,
|
||||
"618cfae774bb2d036a049e7c": 11
|
||||
"Equipment": {
|
||||
"Backpack": {
|
||||
"56e335e4d2720b6c058b456d": 37,
|
||||
"5c0e805e86f774683f3dd637": 11,
|
||||
"5ca20d5986f774331e7c9602": 38,
|
||||
"6034d103ca006d2dca39b3f0": 11,
|
||||
"6038d614d10cbf667352dd44": 11,
|
||||
"618cfae774bb2d036a049e7c": 11
|
||||
},
|
||||
"FirstPrimaryWeapon": {
|
||||
"5c46fbd72e2216398b5a8c9c": 4,
|
||||
"6176aca650224f204c1da3fb": 1
|
||||
}
|
||||
},
|
||||
"FirstPrimaryWeapon": {
|
||||
"5c46fbd72e2216398b5a8c9c": 4,
|
||||
"6176aca650224f204c1da3fb": 1
|
||||
}
|
||||
"Ammo": {}
|
||||
},
|
||||
"bossTagilla": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"576165642459773c7a400233": 12,
|
||||
"583990e32459771419544dd2": 7,
|
||||
"5beed0f50db834001c062b12": 2,
|
||||
"606dae0ab0e443224b421bb7": 1
|
||||
}
|
||||
"Equipment": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"576165642459773c7a400233": 12,
|
||||
"583990e32459771419544dd2": 7,
|
||||
"5beed0f50db834001c062b12": 2,
|
||||
"606dae0ab0e443224b421bb7": 1
|
||||
}
|
||||
},
|
||||
"Ammo": {}
|
||||
},
|
||||
"exUsec": {
|
||||
"ArmorVest": {
|
||||
"5648a7494bdc2d9d488b4583": 32,
|
||||
"5b44cf1486f77431723e3d05": 7,
|
||||
"5b44d0de86f774503d30cba8": 18,
|
||||
"5c0e655586f774045612eeb2": 26,
|
||||
"5fd4c474dd870108a754b241": 7,
|
||||
"609e8540d5c319764c2bc2e9": 18
|
||||
"Equipment": {
|
||||
"ArmorVest": {
|
||||
"5648a7494bdc2d9d488b4583": 32,
|
||||
"5b44cf1486f77431723e3d05": 7,
|
||||
"5b44d0de86f774503d30cba8": 18,
|
||||
"5c0e655586f774045612eeb2": 26,
|
||||
"5fd4c474dd870108a754b241": 7,
|
||||
"609e8540d5c319764c2bc2e9": 18
|
||||
},
|
||||
"FirstPrimaryWeapon": {
|
||||
"5447a9cd4bdc2dbd208b4567": 31,
|
||||
"59d6088586f774275f37482f": 22,
|
||||
"5ac4cd105acfc40016339859": 10,
|
||||
"5ac66d725acfc43b321d4b60": 7,
|
||||
"5b0bbe4e5acfc40dc528a72d": 2,
|
||||
"5bb2475ed4351e00853264e3": 4,
|
||||
"5df8ce05b11454561e39243b": 1,
|
||||
"5fbcc1d9016cce60e8341ab3": 1,
|
||||
"606587252535c57a13424cfd": 2,
|
||||
"6184055050224f204c1da540": 1,
|
||||
"618428466ef05c2ce828f218": 19,
|
||||
"628a60ae6b1d481ff772e9c8": 7
|
||||
}
|
||||
},
|
||||
"FirstPrimaryWeapon": {
|
||||
"5447a9cd4bdc2dbd208b4567": 31,
|
||||
"59d6088586f774275f37482f": 22,
|
||||
"5ac4cd105acfc40016339859": 10,
|
||||
"5ac66d725acfc43b321d4b60": 7,
|
||||
"5b0bbe4e5acfc40dc528a72d": 2,
|
||||
"5bb2475ed4351e00853264e3": 4,
|
||||
"5df8ce05b11454561e39243b": 1,
|
||||
"5fbcc1d9016cce60e8341ab3": 1,
|
||||
"606587252535c57a13424cfd": 2,
|
||||
"6184055050224f204c1da540": 1,
|
||||
"618428466ef05c2ce828f218": 19,
|
||||
"628a60ae6b1d481ff772e9c8": 7
|
||||
}
|
||||
"Ammo": {}
|
||||
},
|
||||
"marksman": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"55801eed4bdc2d89578b4588": 87,
|
||||
"5644bd2b4bdc2d3b4c8b4572": 58,
|
||||
"574d967124597745970e7c94": 149,
|
||||
"57838ad32459774a17445cd2": 12,
|
||||
"57dc2fa62459775949412633": 27,
|
||||
"5839a40f24597726f856b511": 16,
|
||||
"587e02ff24597743df3deaeb": 292,
|
||||
"5ae08f0a5acfc408fb1398a1": 244,
|
||||
"5bfea6e90db834001b7347f3": 13,
|
||||
"5c46fbd72e2216398b5a8c9c": 97
|
||||
"Equipment": {
|
||||
"FirstPrimaryWeapon": {
|
||||
"55801eed4bdc2d89578b4588": 87,
|
||||
"5644bd2b4bdc2d3b4c8b4572": 58,
|
||||
"574d967124597745970e7c94": 149,
|
||||
"57838ad32459774a17445cd2": 12,
|
||||
"57dc2fa62459775949412633": 27,
|
||||
"5839a40f24597726f856b511": 16,
|
||||
"587e02ff24597743df3deaeb": 292,
|
||||
"5ae08f0a5acfc408fb1398a1": 244,
|
||||
"5bfea6e90db834001b7347f3": 13,
|
||||
"5c46fbd72e2216398b5a8c9c": 97
|
||||
},
|
||||
"TacticalVest": {
|
||||
"572b7adb24597762ae139821": 20,
|
||||
"5929a2a086f7744f4b234d43": 4,
|
||||
"5ca20abf86f77418567a43f2": 1
|
||||
}
|
||||
},
|
||||
"TacticalVest": {
|
||||
"572b7adb24597762ae139821": 20,
|
||||
"5929a2a086f7744f4b234d43": 4,
|
||||
"5ca20abf86f77418567a43f2": 1
|
||||
}
|
||||
"Ammo": {}
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,9 @@ namespace Generator
|
||||
foreach (var rawParsedBot in rawParsedBotOfCurrentType)
|
||||
{
|
||||
GearHelpers.AddEquippedGear(botToUpdate, rawParsedBot);
|
||||
GearHelpers.AddAmmo(botToUpdate, rawParsedBot);
|
||||
GearHelpers.AddEquippedMods(botToUpdate, rawParsedBot);
|
||||
GearHelpers.AddCartridges(botToUpdate, rawParsedBot);
|
||||
//GearHelpers.AddCartridges(botToUpdate, rawParsedBot);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
using Common.Models.Input;
|
||||
using Common.Models.Output;
|
||||
using Generator.Weighting;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Generator.Helpers.Gear
|
||||
{
|
||||
@ -64,6 +62,28 @@ namespace Generator.Helpers.Gear
|
||||
botToUpdate.inventory.mods = itemsWithModsDictionary;
|
||||
}
|
||||
|
||||
internal static void AddAmmo(Bot botToUpdate, Datum bot)
|
||||
{
|
||||
var weightService = new WeightingService();
|
||||
foreach (var inventoryItem in bot.Inventory.items.Where(x => x.slotId != null && (x.slotId == "patron_in_weapon" || x.slotId == "cartridges" || x.slotId.StartsWith("camora"))))
|
||||
{
|
||||
var caliber = ItemTemplateHelper.GetTemplateById(inventoryItem._tpl)._props.ammoCaliber;
|
||||
|
||||
if (caliber == null)
|
||||
{
|
||||
caliber = ItemTemplateHelper.GetTemplateById(inventoryItem._tpl)._props.Caliber;
|
||||
}
|
||||
|
||||
// Create key if caliber doesnt exist
|
||||
if (!botToUpdate.inventory.Ammo.ContainsKey(caliber))
|
||||
{
|
||||
botToUpdate.inventory.Ammo[caliber] = new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
botToUpdate.inventory.Ammo[caliber].AddUnique(inventoryItem._tpl, weightService.GetAmmoWeight(inventoryItem._tpl, botToUpdate.botType, caliber));
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddEquippedGear(Bot botToUpdate, Datum bot)
|
||||
{
|
||||
// add equipped gear
|
||||
|
@ -6,35 +6,35 @@ internal static class Program
|
||||
{
|
||||
// Create list of bots we want to process
|
||||
string[] botTypes = {
|
||||
"assault",
|
||||
"marksman",
|
||||
"pmcBot",
|
||||
"exUsec",
|
||||
"assault",
|
||||
"marksman",
|
||||
"pmcBot",
|
||||
"exUsec",
|
||||
|
||||
"bossbully",
|
||||
"bossgluhar",
|
||||
"bosskilla",
|
||||
"bosskojaniy",
|
||||
"bosssanitar",
|
||||
"bosstagilla",
|
||||
"bossknight",
|
||||
"bossbully",
|
||||
"bossgluhar",
|
||||
"bosskilla",
|
||||
"bosskojaniy",
|
||||
"bosssanitar",
|
||||
"bosstagilla",
|
||||
"bossknight",
|
||||
|
||||
"followerbully",
|
||||
"followergluharassault",
|
||||
"followergluharscout",
|
||||
"followergluharsecurity",
|
||||
"followergluharsnipe",
|
||||
"followerkojaniy",
|
||||
"followersanitar",
|
||||
"followerstormtrooper",
|
||||
"followerbirdeye",
|
||||
"followerbigpipe",
|
||||
//
|
||||
"cursedassault",
|
||||
//
|
||||
"sectantpriest",
|
||||
"sectantwarrior",
|
||||
"gifter"
|
||||
"followerbully",
|
||||
"followergluharassault",
|
||||
"followergluharscout",
|
||||
"followergluharsecurity",
|
||||
"followergluharsnipe",
|
||||
"followerkojaniy",
|
||||
"followersanitar",
|
||||
"followerstormtrooper",
|
||||
"followerbirdeye",
|
||||
"followerbigpipe",
|
||||
//
|
||||
"cursedassault",
|
||||
//
|
||||
"sectantpriest",
|
||||
"sectantwarrior",
|
||||
"gifter"
|
||||
};
|
||||
|
||||
// Read raw bot dumps and turn into c# objects
|
||||
@ -45,7 +45,7 @@ internal static class Program
|
||||
if (parsedBots.Count == 0)
|
||||
{
|
||||
LoggingHelpers.LogToConsole("no bots found, unable to continue");
|
||||
LoggingHelpers.LogToConsole("Check your dumps are in 'Generator\\bin\\Debug\\netcoreapp3.1\\dumps' and start with 'resp.' NOT 'req.'");
|
||||
LoggingHelpers.LogToConsole("Check your dumps are in 'Generator\\bin\\Debug\\net6.0\\dumps' and start with 'resp.' NOT 'req.'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,30 +9,60 @@ using System.Threading.Tasks;
|
||||
namespace Generator.Weighting
|
||||
{
|
||||
|
||||
public class Weightings
|
||||
{
|
||||
public Dictionary<string, Dictionary<string, int>> Equipment { get; set; }
|
||||
|
||||
// Ammo type + (dict of ammo + weight)
|
||||
public Dictionary <string, Dictionary<string, int>> Ammo { get; set; }
|
||||
}
|
||||
|
||||
public class WeightingService
|
||||
{
|
||||
private readonly Dictionary<BotType, Dictionary<string, Dictionary<string, int>>> _weights;
|
||||
private readonly Dictionary<BotType, Weightings> _weights;
|
||||
public WeightingService()
|
||||
{
|
||||
|
||||
var itemsFilePath = $"{Directory.GetCurrentDirectory()}\\Assets\\weights.json";
|
||||
if (!File.Exists(itemsFilePath))
|
||||
var weightsFilePath = $"{Directory.GetCurrentDirectory()}\\Assets\\weights.json";
|
||||
if (!File.Exists(weightsFilePath))
|
||||
{
|
||||
throw new Exception($"Missing weights.json in /assets ({itemsFilePath})");
|
||||
throw new Exception($"Missing weights.json in /assets ({weightsFilePath})");
|
||||
}
|
||||
|
||||
var itemsJson = File.ReadAllText(itemsFilePath);
|
||||
_weights = JsonSerializer.Deserialize<Dictionary<BotType, Dictionary<string, Dictionary<string, int>>>>(itemsJson);
|
||||
var weightJson = File.ReadAllText(weightsFilePath);
|
||||
_weights = JsonSerializer.Deserialize<Dictionary<BotType, Weightings>>(weightJson);
|
||||
}
|
||||
|
||||
public int GetAmmoWeight(string tpl, BotType botType, string caliber)
|
||||
{
|
||||
if (_weights.ContainsKey(botType))
|
||||
{
|
||||
var botWeights = _weights[botType];
|
||||
|
||||
if (botWeights.Ammo.ContainsKey(caliber))
|
||||
{
|
||||
var calibers = botWeights.Ammo[caliber];
|
||||
|
||||
if (calibers.ContainsKey(tpl))
|
||||
{
|
||||
return calibers[tpl];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int GetItemWeight(string tpl, BotType botType, string slot)
|
||||
{
|
||||
if (_weights.ContainsKey(botType))
|
||||
{
|
||||
var botWeights = _weights[botType];
|
||||
if (botWeights.Keys.Contains(slot, StringComparer.CurrentCultureIgnoreCase))
|
||||
var botItemList = _weights[botType];
|
||||
|
||||
if (botItemList.Equipment.Keys.Contains(slot, StringComparer.CurrentCultureIgnoreCase))
|
||||
{
|
||||
var slotWeights = botWeights.FirstOrDefault(x => x.Key.ToLower() == slot).Value;
|
||||
var slotWeights = botItemList.Equipment.FirstOrDefault(x => x.Key.ToLower() == slot).Value;
|
||||
if (slotWeights.Keys.Contains(tpl, StringComparer.CurrentCultureIgnoreCase))
|
||||
{
|
||||
var itemWeight = slotWeights[tpl];
|
||||
|
Loading…
x
Reference in New Issue
Block a user