Add weight system to generation object

This commit is contained in:
Dev 2023-08-21 16:32:20 +01:00
parent de11386c5a
commit 5eb4f1b175
10 changed files with 984 additions and 66 deletions

View File

@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace Common.Models
{
public class GenerationWeightData
{
public Dictionary<string, int> weights { get; set; }
public List<string> whitelist { get; set; }
}
}

View File

@ -7,14 +7,12 @@ namespace Common.Models.Output;
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Serialization, WriteIndented = true)]
public partial class BotJsonContext : JsonSerializerContext
{
}
public class Bot
{
public Bot()
{
}
public Bot(BotType botType)
@ -183,23 +181,28 @@ public class EquipmentChances
public class GenerationChances
{
public GenerationChances(int specialMin, int SpecialMax,
int healingMin, int healingMax,
int drugMin, int drugMax,
int stimMin, int stimMax,
int looseLootMin, int looseLootMax,
int magazinesMin, int MagazineMax,
int grenandesMin, int grenadesMax)
public GenerationChances(
GenerationWeightData specialItems,
GenerationWeightData healingItems,
GenerationWeightData drugItems,
GenerationWeightData stimItems,
GenerationWeightData backpackLootItems,
GenerationWeightData pocketLootItems,
GenerationWeightData vestLootItems,
GenerationWeightData magazineItems,
GenerationWeightData grenadeItems)
{
items = new ItemChances
{
specialItems = new MinMax(specialMin, SpecialMax),
healing = new MinMax(healingMin, healingMax),
drugs = new MinMax(drugMin, drugMax),
stims = new MinMax(stimMin, stimMax),
looseLoot = new MinMax(looseLootMin, looseLootMax),
magazines = new MinMax(magazinesMin, MagazineMax),
grenades = new MinMax(grenandesMin, grenadesMax)
specialItems = specialItems,
healing = healingItems,
drugs = drugItems,
stims = stimItems,
backpackLoot = backpackLootItems,
pocketLoot = pocketLootItems,
vestLoot = vestLootItems,
magazines = magazineItems,
grenades = grenadeItems
};
}
@ -215,22 +218,26 @@ public class ItemChances
{
public ItemChances()
{
specialItems = new MinMaxWithWhitelist(0, 1, System.Array.Empty<string>());
healing = new MinMaxWithWhitelist(1, 2, System.Array.Empty<string>());
drugs = new MinMaxWithWhitelist(0, 1, System.Array.Empty<string>());
stims = new MinMaxWithWhitelist(0, 1, System.Array.Empty<string>());
looseLoot = new MinMaxWithWhitelist(0, 3, System.Array.Empty<string>());
magazines = new MinMaxWithWhitelist(2, 4, System.Array.Empty<string>());
grenades = new MinMaxWithWhitelist(0, 5, System.Array.Empty<string>());
specialItems = new GenerationWeightData(); // 0,1
healing = new GenerationWeightData(); // 1, 2
drugs = new GenerationWeightData(); // 0, 1
stims = new GenerationWeightData(); // 0, 1
backpackLoot = new GenerationWeightData(); //0,3
pocketLoot = new GenerationWeightData();
vestLoot = new GenerationWeightData();
magazines = new GenerationWeightData(); //2,4
grenades = new GenerationWeightData(); //0,5
}
public MinMax specialItems { get; set; }
public MinMax healing { get; set; }
public MinMax drugs { get; set; }
public MinMax stims { get; set; }
public MinMax looseLoot { get; set; }
public MinMax magazines { get; set; }
public MinMax grenades { get; set; }
public GenerationWeightData specialItems { get; set; }
public GenerationWeightData healing { get; set; }
public GenerationWeightData drugs { get; set; }
public GenerationWeightData stims { get; set; }
public GenerationWeightData backpackLoot { get; set; }
public GenerationWeightData pocketLoot { get; set; }
public GenerationWeightData vestLoot { get; set; }
public GenerationWeightData magazines { get; set; }
public GenerationWeightData grenades { get; set; }
}
public class MinMax
@ -244,15 +251,3 @@ public class MinMax
public int min { get; set; }
public int max { get; set; }
}
public class MinMaxWithWhitelist : MinMax
{
public MinMaxWithWhitelist(int min, int max, string[] whitelist) : base(min, max)
{
this.min = min;
this.max = max;
this.whitelist = whitelist;
}
public string[] whitelist { get; set; }
}

View File

@ -0,0 +1,879 @@
{
"assault": {
"specialItems": {
"weights": {
"0": 1,
"1": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 1,
"1": 2,
"2": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2,
"2": 0
},
"whitelist": []
},
"stims": {
"weights": {
"0": 15,
"1": 5,
"2": 1
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 2,
"2": 2,
"3": 1,
"4": 1,
"5": 1,
"6": 1
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 6,
"2": 3,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 0,
"5": 0,
"6": 0
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 3,
"4": 1
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 2,
"2": 1,
"3": 1,
"4": 0,
"5": 0
},
"whitelist": []
}
},
"marksman": {
"specialItems": {
"weights": {
"0": 1,
"1": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 0,
"1": 2,
"2": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2,
"2": 0
},
"whitelist": []
},
"stims": {
"weights": {
"0": 3,
"1": 1,
"2": 0
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 3,
"1": 10,
"2": 3,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 2,
"2": 2,
"3": 0,
"4": 0,
"5": 0,
"6": 0
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 3,
"4": 1
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 2,
"2": 1,
"3": 1,
"4": 1,
"5": 0
},
"whitelist": []
}
},
"default": {
"specialItems": {
"weights": {
"0": 1,
"1": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 1,
"1": 2,
"2": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2,
"2": 0
},
"whitelist": []
},
"stims": {
"weights": {
"0": 2,
"1": 1,
"2": 0
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 6,
"2": 3,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 0,
"5": 0,
"6": 0
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 3,
"4": 1
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 2,
"2": 1,
"3": 1,
"4": 0,
"5": 0
},
"whitelist": []
}
},
"followerboar": {
"specialItems": {
"weights": {
"0": 1,
"1": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 1,
"1": 2,
"2": 3,
"3": 5,
"4": 2,
"5": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 9,
"2": 3,
"3": 2,
"4": 1
},
"whitelist": []
},
"stims": {
"weights": {
"0": 9,
"1": 5,
"2": 2,
"3": 1,
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 4,
"2": 13,
"3": 3,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 6,
"2": 3,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 0,
"5": 0,
"6": 0
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 3,
"4": 1
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 2,
"2": 1,
"3": 1,
"4": 0,
"5": 0
},
"whitelist": []
}
},
"pmcbot": {
"specialItems": {
"weights": {
"0": 1,
"1": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 1,
"1": 2,
"2": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2,
"2": 0
},
"whitelist": []
},
"stims": {
"weights": {
"0": 2,
"1": 1,
"2": 0
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 6,
"2": 3,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 3,
"2": 5,
"3": 1,
"4": 1,
"5": 1,
"6": 1
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 3,
"4": 2
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 1,
"2": 5,
"3": 2,
"4": 1,
"5": 1
},
"whitelist": []
}
},
"bosskojaniy": {
"specialItems": {
"weights": {
"0": 0,
"1": 0,
"2": 1
},
"whitelist": []
},
"healing": {
"weights": {
"0": 1,
"1": 2,
"2": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2,
"2": 0
},
"whitelist": []
},
"stims": {
"weights": {
"0": 2,
"1": 1,
"2": 0
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 6,
"2": 3,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 3,
"2": 5,
"3": 1,
"4": 1,
"5": 1,
"6": 1
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 3,
"4": 2
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 1,
"2": 5,
"3": 2,
"4": 1,
"5": 1
},
"whitelist": []
}
},
"bossbully": {
"specialItems": {
"weights": {
"0": 0
},
"whitelist": []
},
"healing": {
"weights": {
"1": 1,
"2": 2
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2
},
"whitelist": []
},
"stims": {
"weights": {
"0": 2,
"1": 1,
"2": 0
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 2,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 6,
"2": 3,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 3,
"2": 5,
"3": 1,
"4": 1,
"5": 1,
"6": 1
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 3,
"4": 2
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 1,
"2": 5,
"3": 2,
"4": 1,
"5": 1
},
"whitelist": []
}
},
"exusec": {
"specialItems": {
"weights": {
"0": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 1,
"1": 1,
"2": 2
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2
},
"whitelist": []
},
"stims": {
"weights": {
"0": 5,
"1": 1
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 2,
"2": 5,
"3": 3,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 7,
"2": 4,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 3,
"2": 5,
"3": 1,
"4": 1
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 1,
"3": 2,
"4": 3
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 1,
"2": 3,
"3": 2,
"4": 2,
"5": 1
},
"whitelist": []
}
},
"bosskilla": {
"specialItems": {
"weights": {
"0": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 2,
"1": 1,
"2": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2
},
"whitelist": []
},
"stims": {
"weights": {
"0": 5,
"1": 1
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 2,
"2": 5,
"3": 3,
"4": 1,
"5": 1,
"6": 1,
"7": 0
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 7,
"2": 4,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 3,
"2": 4,
"3": 1,
"4": 1
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 5,
"3": 6
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 2,
"2": 3,
"3": 3,
"4": 1,
"5": 1
},
"whitelist": []
}
},
"bossgluhar": {
"specialItems": {
"weights": {
"0": 0
},
"whitelist": []
},
"healing": {
"weights": {
"0": 2,
"1": 1,
"2": 1
},
"whitelist": []
},
"drugs": {
"weights": {
"0": 1,
"1": 2
},
"whitelist": []
},
"stims": {
"weights": {
"0": 5,
"1": 1
},
"whitelist": []
},
"backpackLoot": {
"weights": {
"0": 1,
"1": 1,
"2": 4,
"3": 5,
"4": 2,
"5": 1,
"6": 1,
"7": 1
},
"whitelist": []
},
"pocketLoot": {
"weights": {
"0": 1,
"1": 7,
"2": 4,
"3": 1,
"4": 1
},
"whitelist": []
},
"vestLoot": {
"weights": {
"0": 1,
"1": 3,
"2": 4,
"3": 1,
"4": 1
},
"whitelist": []
},
"magazines": {
"weights": {
"0": 0,
"1": 0,
"2": 5,
"3": 6,
"4": 4
},
"whitelist": []
},
"grenades": {
"weights": {
"0": 1,
"1": 2,
"2": 3,
"3": 3,
"4": 1,
"5": 1
},
"whitelist": []
}
}
}

View File

@ -194,7 +194,7 @@
"5dcbd56fdbd3d91b3e5468d5": 13
},
"Holster": {
"5b3b713c5acfc4330140bd8d": 1,
"5b3b713c5acfc4330140bd8d": 3,
"602a9740da11d6478d5a06dc": 5,
"6193a720f8ee7e52e42109ed": 1
}

View File

@ -23,7 +23,7 @@ namespace Generator
baseBots.Add(new Bot(typeToAdd));
}
// Iterate over each bot type wejust made and put some data into them
// Iterate over each bot type we just made and put some data into them
foreach (var botToUpdate in baseBots)
{
var rawBotType = botToUpdate.botType.ToString();
@ -31,7 +31,6 @@ namespace Generator
.ToList();
var rawBotsOfSameTypeCount = rawBotsOfSameType.Count.ToString();
if (rawBotsOfSameType.Count == 0)
{
LoggingHelpers.LogToConsole($"no bots of type {rawBotType}, skipping", ConsoleColor.DarkRed);
@ -54,6 +53,7 @@ namespace Generator
}
}
stopwatch.Stop();
LoggingHelpers.LogToConsole($"Finished processing bot base. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
@ -136,12 +136,10 @@ namespace Generator
Head = new MinMax(bot.Health.BodyParts.Head.Health.Current, bot.Health.BodyParts.Head.Health.Maximum),
Chest = new MinMax(bot.Health.BodyParts.Chest.Health.Current, bot.Health.BodyParts.Chest.Health.Maximum),
Stomach = new MinMax(bot.Health.BodyParts.Stomach.Health.Current, bot.Health.BodyParts.Stomach.Health.Maximum),
LeftArm = new MinMax(bot.Health.BodyParts.LeftArm.Health.Current, bot.Health.BodyParts.LeftArm.Health.Maximum)
LeftArm = new MinMax(bot.Health.BodyParts.LeftArm.Health.Current, bot.Health.BodyParts.LeftArm.Health.Maximum),
RightArm = new MinMax(bot.Health.BodyParts.RightArm.Health.Current, bot.Health.BodyParts.RightArm.Health.Maximum),
};
bodyPartHpToAdd.RightArm.min = bot.Health.BodyParts.RightArm.Health.Current;
bodyPartHpToAdd.RightArm.max = bot.Health.BodyParts.RightArm.Health.Maximum;
bodyPartHpToAdd.LeftLeg.min = bot.Health.BodyParts.LeftLeg.Health.Current;
bodyPartHpToAdd.LeftLeg.max = bot.Health.BodyParts.LeftLeg.Health.Maximum;
@ -174,7 +172,6 @@ namespace Generator
{
botToUpdate.lastName.AddUnique(name[1]);
}
}
}
}

View File

@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Generator.Weighting;
namespace Generator
{
@ -16,6 +17,7 @@ namespace Generator
var stopwatch = Stopwatch.StartNew();
LoggingHelpers.LogToConsole("Started processing bot gear");
var weightHelper = new WeightingService();
foreach (var botToUpdate in botsToUpdate)
{
var botType = botToUpdate.botType.ToString();
@ -30,7 +32,7 @@ namespace Generator
// TODO: Add check to make sure incoming bot list has gear
GearChanceHelpers.CalculateEquipmentChances(botToUpdate, rawParsedBotOfCurrentType);
GearChanceHelpers.AddGenerationChances(botToUpdate);
GearChanceHelpers.AddGenerationChances(botToUpdate, rawBots, weightHelper);
GearChanceHelpers.CalculateModChances(botToUpdate, rawParsedBotOfCurrentType);
GearChanceHelpers.ApplyModChanceOverrides(botToUpdate);
GearChanceHelpers.ApplyEquipmentChanceOverrides(botToUpdate);

View File

@ -173,10 +173,6 @@
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<Page Include="Assets\normal_arenaFighterEvent_BotGlobalSettings.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@ -184,6 +180,9 @@
</ItemGroup>
<ItemGroup>
<None Update="Assets\generationWeights.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\normal_bossBoarSniper_BotGlobalSettings.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@ -195,4 +194,8 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
</Project>

View File

@ -4,6 +4,7 @@ using Common.Models.Output;
using System.Collections.Generic;
using System.Linq;
using Common.Models;
using Generator.Weighting;
namespace Generator.Helpers.Gear
{
@ -149,16 +150,23 @@ namespace Generator.Helpers.Gear
}
}
public static void AddGenerationChances(Bot bot)
public static void AddGenerationChances(Bot bot, IEnumerable<Datum> rawBots, WeightingService weightingService)
{
var weightsData = weightingService.GetBotGenerationWeights(bot.botType);
bot.generation = new GenerationChances(
bot.inventory.items.SpecialLoot.Count, bot.inventory.items.SpecialLoot.Count,
healingMin: GetMedicalItemCountByBotType(bot.botType).min, healingMax: GetMedicalItemCountByBotType(bot.botType).max,
drugMin: 0, drugMax: 1,
stimMin: 0, stimMax: 1,
looseLootMin: GetLooseLootCountByBotType(bot.botType).min, looseLootMax: GetLooseLootCountByBotType(bot.botType).max,
magazinesMin: GetMagazineCountByBotType(bot.botType).min, MagazineMax: GetMagazineCountByBotType(bot.botType).max,
grenandesMin: 0, grenadesMax: 5); //TODO get dynamically
weightsData["specialItems"],
weightsData["healing"],
weightsData["drugs"],
weightsData["stims"],
weightsData["backpackLoot"],
weightsData["pocketLoot"],
weightsData["vestLoot"],
weightsData["magazines"],
weightsData["grenades"]);
// it makes some crazy values, one assault bot has 10 grenades!
//AddGrenadeMinMax(bot, rawBots);
}
public static void CalculateEquipmentChances(Bot bot, List<Datum> baseBots)

View File

@ -1,4 +1,6 @@
namespace Generator;
using Generator.Helpers;
namespace Generator;
internal static class Program
{

View File

@ -1,4 +1,5 @@
using Common.Models;
using System.Collections.Generic;
using System.Text.Json;
namespace Generator.Weighting
@ -14,10 +15,12 @@ namespace Generator.Weighting
public class WeightingService
{
private readonly Dictionary<BotType, Weightings> _weights;
private readonly Dictionary<string, Dictionary<string, GenerationWeightData>> _generationWeights;
public WeightingService()
{
var weightsFilePath = $"{Directory.GetCurrentDirectory()}\\Assets\\weights.json";
var assetsPath = $"{Directory.GetCurrentDirectory()}\\Assets";
var weightsFilePath = $"{assetsPath}\\weights.json";
if (!File.Exists(weightsFilePath))
{
throw new Exception($"Missing weights.json in /assets ({weightsFilePath})");
@ -25,6 +28,14 @@ namespace Generator.Weighting
var weightJson = File.ReadAllText(weightsFilePath);
_weights = JsonSerializer.Deserialize<Dictionary<BotType, Weightings>>(weightJson);
// bot / itemtype / itemcount
var generationWeightJson = File.ReadAllText($"{assetsPath}\\generationWeights.json");
// assault - dict
// speicalitems - object
// weights + whitelsit
_generationWeights = JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, GenerationWeightData>>>(generationWeightJson);
}
public int GetAmmoWeight(string tpl, BotType botType, string caliber)
@ -71,5 +82,16 @@ namespace Generator.Weighting
return 1;
}
public Dictionary<string, GenerationWeightData> GetBotGenerationWeights(BotType botType)
{
_generationWeights.TryGetValue(botType.ToString(), out var result);
if (result == null)
{
return _generationWeights["default"];
}
return result;
}
}
}