forked from chomp/BotGenerator
Add weight system to generation object
This commit is contained in:
parent
de11386c5a
commit
5eb4f1b175
10
Common.Models/GenerationWeightData.cs
Normal file
10
Common.Models/GenerationWeightData.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
@ -7,14 +7,12 @@ namespace Common.Models.Output;
|
|||||||
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Serialization, WriteIndented = true)]
|
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Serialization, WriteIndented = true)]
|
||||||
public partial class BotJsonContext : JsonSerializerContext
|
public partial class BotJsonContext : JsonSerializerContext
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Bot
|
public class Bot
|
||||||
{
|
{
|
||||||
public Bot()
|
public Bot()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bot(BotType botType)
|
public Bot(BotType botType)
|
||||||
@ -183,23 +181,28 @@ public class EquipmentChances
|
|||||||
|
|
||||||
public class GenerationChances
|
public class GenerationChances
|
||||||
{
|
{
|
||||||
public GenerationChances(int specialMin, int SpecialMax,
|
public GenerationChances(
|
||||||
int healingMin, int healingMax,
|
GenerationWeightData specialItems,
|
||||||
int drugMin, int drugMax,
|
GenerationWeightData healingItems,
|
||||||
int stimMin, int stimMax,
|
GenerationWeightData drugItems,
|
||||||
int looseLootMin, int looseLootMax,
|
GenerationWeightData stimItems,
|
||||||
int magazinesMin, int MagazineMax,
|
GenerationWeightData backpackLootItems,
|
||||||
int grenandesMin, int grenadesMax)
|
GenerationWeightData pocketLootItems,
|
||||||
|
GenerationWeightData vestLootItems,
|
||||||
|
GenerationWeightData magazineItems,
|
||||||
|
GenerationWeightData grenadeItems)
|
||||||
{
|
{
|
||||||
items = new ItemChances
|
items = new ItemChances
|
||||||
{
|
{
|
||||||
specialItems = new MinMax(specialMin, SpecialMax),
|
specialItems = specialItems,
|
||||||
healing = new MinMax(healingMin, healingMax),
|
healing = healingItems,
|
||||||
drugs = new MinMax(drugMin, drugMax),
|
drugs = drugItems,
|
||||||
stims = new MinMax(stimMin, stimMax),
|
stims = stimItems,
|
||||||
looseLoot = new MinMax(looseLootMin, looseLootMax),
|
backpackLoot = backpackLootItems,
|
||||||
magazines = new MinMax(magazinesMin, MagazineMax),
|
pocketLoot = pocketLootItems,
|
||||||
grenades = new MinMax(grenandesMin, grenadesMax)
|
vestLoot = vestLootItems,
|
||||||
|
magazines = magazineItems,
|
||||||
|
grenades = grenadeItems
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,22 +218,26 @@ public class ItemChances
|
|||||||
{
|
{
|
||||||
public ItemChances()
|
public ItemChances()
|
||||||
{
|
{
|
||||||
specialItems = new MinMaxWithWhitelist(0, 1, System.Array.Empty<string>());
|
specialItems = new GenerationWeightData(); // 0,1
|
||||||
healing = new MinMaxWithWhitelist(1, 2, System.Array.Empty<string>());
|
healing = new GenerationWeightData(); // 1, 2
|
||||||
drugs = new MinMaxWithWhitelist(0, 1, System.Array.Empty<string>());
|
drugs = new GenerationWeightData(); // 0, 1
|
||||||
stims = new MinMaxWithWhitelist(0, 1, System.Array.Empty<string>());
|
stims = new GenerationWeightData(); // 0, 1
|
||||||
looseLoot = new MinMaxWithWhitelist(0, 3, System.Array.Empty<string>());
|
backpackLoot = new GenerationWeightData(); //0,3
|
||||||
magazines = new MinMaxWithWhitelist(2, 4, System.Array.Empty<string>());
|
pocketLoot = new GenerationWeightData();
|
||||||
grenades = new MinMaxWithWhitelist(0, 5, System.Array.Empty<string>());
|
vestLoot = new GenerationWeightData();
|
||||||
|
magazines = new GenerationWeightData(); //2,4
|
||||||
|
grenades = new GenerationWeightData(); //0,5
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinMax specialItems { get; set; }
|
public GenerationWeightData specialItems { get; set; }
|
||||||
public MinMax healing { get; set; }
|
public GenerationWeightData healing { get; set; }
|
||||||
public MinMax drugs { get; set; }
|
public GenerationWeightData drugs { get; set; }
|
||||||
public MinMax stims { get; set; }
|
public GenerationWeightData stims { get; set; }
|
||||||
public MinMax looseLoot { get; set; }
|
public GenerationWeightData backpackLoot { get; set; }
|
||||||
public MinMax magazines { get; set; }
|
public GenerationWeightData pocketLoot { get; set; }
|
||||||
public MinMax grenades { get; set; }
|
public GenerationWeightData vestLoot { get; set; }
|
||||||
|
public GenerationWeightData magazines { get; set; }
|
||||||
|
public GenerationWeightData grenades { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MinMax
|
public class MinMax
|
||||||
@ -244,15 +251,3 @@ public class MinMax
|
|||||||
public int min { get; set; }
|
public int min { get; set; }
|
||||||
public int max { 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; }
|
|
||||||
}
|
|
||||||
|
879
Generator/Assets/generationWeights.json
Normal file
879
Generator/Assets/generationWeights.json
Normal 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": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -194,7 +194,7 @@
|
|||||||
"5dcbd56fdbd3d91b3e5468d5": 13
|
"5dcbd56fdbd3d91b3e5468d5": 13
|
||||||
},
|
},
|
||||||
"Holster": {
|
"Holster": {
|
||||||
"5b3b713c5acfc4330140bd8d": 1,
|
"5b3b713c5acfc4330140bd8d": 3,
|
||||||
"602a9740da11d6478d5a06dc": 5,
|
"602a9740da11d6478d5a06dc": 5,
|
||||||
"6193a720f8ee7e52e42109ed": 1
|
"6193a720f8ee7e52e42109ed": 1
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace Generator
|
|||||||
baseBots.Add(new Bot(typeToAdd));
|
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)
|
foreach (var botToUpdate in baseBots)
|
||||||
{
|
{
|
||||||
var rawBotType = botToUpdate.botType.ToString();
|
var rawBotType = botToUpdate.botType.ToString();
|
||||||
@ -31,7 +31,6 @@ namespace Generator
|
|||||||
.ToList();
|
.ToList();
|
||||||
var rawBotsOfSameTypeCount = rawBotsOfSameType.Count.ToString();
|
var rawBotsOfSameTypeCount = rawBotsOfSameType.Count.ToString();
|
||||||
|
|
||||||
|
|
||||||
if (rawBotsOfSameType.Count == 0)
|
if (rawBotsOfSameType.Count == 0)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogToConsole($"no bots of type {rawBotType}, skipping", ConsoleColor.DarkRed);
|
LoggingHelpers.LogToConsole($"no bots of type {rawBotType}, skipping", ConsoleColor.DarkRed);
|
||||||
@ -54,6 +53,7 @@ namespace Generator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
LoggingHelpers.LogToConsole($"Finished processing bot base. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
|
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),
|
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),
|
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),
|
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.min = bot.Health.BodyParts.LeftLeg.Health.Current;
|
||||||
bodyPartHpToAdd.LeftLeg.max = bot.Health.BodyParts.LeftLeg.Health.Maximum;
|
bodyPartHpToAdd.LeftLeg.max = bot.Health.BodyParts.LeftLeg.Health.Maximum;
|
||||||
|
|
||||||
@ -174,7 +172,6 @@ namespace Generator
|
|||||||
{
|
{
|
||||||
botToUpdate.lastName.AddUnique(name[1]);
|
botToUpdate.lastName.AddUnique(name[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Generator.Weighting;
|
||||||
|
|
||||||
namespace Generator
|
namespace Generator
|
||||||
{
|
{
|
||||||
@ -16,6 +17,7 @@ namespace Generator
|
|||||||
var stopwatch = Stopwatch.StartNew();
|
var stopwatch = Stopwatch.StartNew();
|
||||||
LoggingHelpers.LogToConsole("Started processing bot gear");
|
LoggingHelpers.LogToConsole("Started processing bot gear");
|
||||||
|
|
||||||
|
var weightHelper = new WeightingService();
|
||||||
foreach (var botToUpdate in botsToUpdate)
|
foreach (var botToUpdate in botsToUpdate)
|
||||||
{
|
{
|
||||||
var botType = botToUpdate.botType.ToString();
|
var botType = botToUpdate.botType.ToString();
|
||||||
@ -30,7 +32,7 @@ namespace Generator
|
|||||||
|
|
||||||
// TODO: Add check to make sure incoming bot list has gear
|
// TODO: Add check to make sure incoming bot list has gear
|
||||||
GearChanceHelpers.CalculateEquipmentChances(botToUpdate, rawParsedBotOfCurrentType);
|
GearChanceHelpers.CalculateEquipmentChances(botToUpdate, rawParsedBotOfCurrentType);
|
||||||
GearChanceHelpers.AddGenerationChances(botToUpdate);
|
GearChanceHelpers.AddGenerationChances(botToUpdate, rawBots, weightHelper);
|
||||||
GearChanceHelpers.CalculateModChances(botToUpdate, rawParsedBotOfCurrentType);
|
GearChanceHelpers.CalculateModChances(botToUpdate, rawParsedBotOfCurrentType);
|
||||||
GearChanceHelpers.ApplyModChanceOverrides(botToUpdate);
|
GearChanceHelpers.ApplyModChanceOverrides(botToUpdate);
|
||||||
GearChanceHelpers.ApplyEquipmentChanceOverrides(botToUpdate);
|
GearChanceHelpers.ApplyEquipmentChanceOverrides(botToUpdate);
|
||||||
|
@ -173,10 +173,6 @@
|
|||||||
<ProjectReference Include="..\Common\Common.csproj" />
|
<ProjectReference Include="..\Common\Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Models\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="Assets\normal_arenaFighterEvent_BotGlobalSettings.txt">
|
<Page Include="Assets\normal_arenaFighterEvent_BotGlobalSettings.txt">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
@ -184,6 +180,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Update="Assets\generationWeights.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="Assets\normal_bossBoarSniper_BotGlobalSettings.txt">
|
<None Update="Assets\normal_bossBoarSniper_BotGlobalSettings.txt">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@ -195,4 +194,8 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -4,6 +4,7 @@ using Common.Models.Output;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Common.Models;
|
using Common.Models;
|
||||||
|
using Generator.Weighting;
|
||||||
|
|
||||||
namespace Generator.Helpers.Gear
|
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.generation = new GenerationChances(
|
||||||
bot.inventory.items.SpecialLoot.Count, bot.inventory.items.SpecialLoot.Count,
|
weightsData["specialItems"],
|
||||||
healingMin: GetMedicalItemCountByBotType(bot.botType).min, healingMax: GetMedicalItemCountByBotType(bot.botType).max,
|
weightsData["healing"],
|
||||||
drugMin: 0, drugMax: 1,
|
weightsData["drugs"],
|
||||||
stimMin: 0, stimMax: 1,
|
weightsData["stims"],
|
||||||
looseLootMin: GetLooseLootCountByBotType(bot.botType).min, looseLootMax: GetLooseLootCountByBotType(bot.botType).max,
|
weightsData["backpackLoot"],
|
||||||
magazinesMin: GetMagazineCountByBotType(bot.botType).min, MagazineMax: GetMagazineCountByBotType(bot.botType).max,
|
weightsData["pocketLoot"],
|
||||||
grenandesMin: 0, grenadesMax: 5); //TODO get dynamically
|
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)
|
public static void CalculateEquipmentChances(Bot bot, List<Datum> baseBots)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace Generator;
|
using Generator.Helpers;
|
||||||
|
|
||||||
|
namespace Generator;
|
||||||
|
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Common.Models;
|
using Common.Models;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace Generator.Weighting
|
namespace Generator.Weighting
|
||||||
@ -14,10 +15,12 @@ namespace Generator.Weighting
|
|||||||
public class WeightingService
|
public class WeightingService
|
||||||
{
|
{
|
||||||
private readonly Dictionary<BotType, Weightings> _weights;
|
private readonly Dictionary<BotType, Weightings> _weights;
|
||||||
|
|
||||||
|
private readonly Dictionary<string, Dictionary<string, GenerationWeightData>> _generationWeights;
|
||||||
public WeightingService()
|
public WeightingService()
|
||||||
{
|
{
|
||||||
|
var assetsPath = $"{Directory.GetCurrentDirectory()}\\Assets";
|
||||||
var weightsFilePath = $"{Directory.GetCurrentDirectory()}\\Assets\\weights.json";
|
var weightsFilePath = $"{assetsPath}\\weights.json";
|
||||||
if (!File.Exists(weightsFilePath))
|
if (!File.Exists(weightsFilePath))
|
||||||
{
|
{
|
||||||
throw new Exception($"Missing weights.json in /assets ({weightsFilePath})");
|
throw new Exception($"Missing weights.json in /assets ({weightsFilePath})");
|
||||||
@ -25,6 +28,14 @@ namespace Generator.Weighting
|
|||||||
|
|
||||||
var weightJson = File.ReadAllText(weightsFilePath);
|
var weightJson = File.ReadAllText(weightsFilePath);
|
||||||
_weights = JsonSerializer.Deserialize<Dictionary<BotType, Weightings>>(weightJson);
|
_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)
|
public int GetAmmoWeight(string tpl, BotType botType, string caliber)
|
||||||
@ -71,5 +82,16 @@ namespace Generator.Weighting
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, GenerationWeightData> GetBotGenerationWeights(BotType botType)
|
||||||
|
{
|
||||||
|
_generationWeights.TryGetValue(botType.ToString(), out var result);
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return _generationWeights["default"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user