forked from chomp/BotGenerator
pass working path to class
pass a list of bot files to difficulty helper
This commit is contained in:
parent
b998737998
commit
1b22e9d01b
@ -5,6 +5,7 @@ using Generator.Models.Output;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Generator
|
namespace Generator
|
||||||
@ -12,10 +13,12 @@ namespace Generator
|
|||||||
public class BaseBotGenerator
|
public class BaseBotGenerator
|
||||||
{
|
{
|
||||||
private readonly List<Datum> _rawParsedBots;
|
private readonly List<Datum> _rawParsedBots;
|
||||||
|
private readonly string _workingPath;
|
||||||
|
|
||||||
public BaseBotGenerator(List<Datum> parsedBots)
|
public BaseBotGenerator(List<Datum> parsedBots, string workingPath)
|
||||||
{
|
{
|
||||||
_rawParsedBots = parsedBots;
|
_rawParsedBots = parsedBots;
|
||||||
|
_workingPath = workingPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Bot> AddBaseDetails()
|
public List<Bot> AddBaseDetails()
|
||||||
@ -40,7 +43,7 @@ namespace Generator
|
|||||||
.Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)).ToList();
|
.Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)).ToList();
|
||||||
|
|
||||||
UpdateBodyPartHealth(botToUpdate, rawBotsOfSameType);
|
UpdateBodyPartHealth(botToUpdate, rawBotsOfSameType);
|
||||||
AddDifficulties(botToUpdate, rawBotsOfSameType);
|
AddDifficulties(botToUpdate, _workingPath);
|
||||||
|
|
||||||
foreach (var rawParsedBot in rawBotsOfSameType)
|
foreach (var rawParsedBot in rawBotsOfSameType)
|
||||||
{
|
{
|
||||||
@ -61,20 +64,14 @@ namespace Generator
|
|||||||
bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice);
|
bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddDifficulties(Bot bot, List<Datum> rawParsedBots)
|
private void AddDifficulties(Bot bot, string workingPath)
|
||||||
{
|
{
|
||||||
switch (bot.botType)
|
var botFiles = Directory
|
||||||
{
|
.GetFiles($"{workingPath}//Assets", "*.txt", SearchOption.TopDirectoryOnly)
|
||||||
case BotType.assault:
|
.Where(x => x.Contains(bot.botType.ToString()))
|
||||||
DifficultyHelper.AddAssaultDifficulties(bot);
|
.ToList();
|
||||||
break;
|
|
||||||
case BotType.pmcBot:
|
DifficultyHelper.AddDifficultySettings(bot, botFiles);
|
||||||
break;
|
|
||||||
case BotType.marksman:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateBodyPartHealth(Bot botToUpdate, List<Datum> rawParsedBots)
|
private void UpdateBodyPartHealth(Bot botToUpdate, List<Datum> rawParsedBots)
|
||||||
|
@ -12,9 +12,9 @@ namespace Generator.Helpers.Gear
|
|||||||
{
|
{
|
||||||
int totalBotsCount = baseBots.Count;
|
int totalBotsCount = baseBots.Count;
|
||||||
int muzzleCount = 0, barrelCount = 0, handguardCount = 0, stockCount = 0, magazineCount = 0,
|
int muzzleCount = 0, barrelCount = 0, handguardCount = 0, stockCount = 0, magazineCount = 0,
|
||||||
mountCount = 0, flashlightCount = 0, tactical001Count = 0, tactical002Count = 0, tactical003Count =0,
|
mountCount = 0, flashlightCount = 0, tactical001Count = 0, tactical002Count = 0, tactical003Count = 0,
|
||||||
mount000Count = 0, pistolGripCount = 0, tacticalCount = 0, scopeCount = 0, recieverCount = 0,
|
mount000Count = 0, pistolGripCount = 0, tacticalCount = 0, scopeCount = 0, recieverCount = 0,
|
||||||
sightRearCount = 0, chargeCount = 0, mount001Count = 0, equipmentCount = 0, gasBlockCount=0,
|
sightRearCount = 0, chargeCount = 0, mount001Count = 0, equipmentCount = 0, gasBlockCount = 0,
|
||||||
launcherCount = 0, sightFrontCount = 0, stock000Count = 0, foregripCount = 0, tactical000Count = 0,
|
launcherCount = 0, sightFrontCount = 0, stock000Count = 0, foregripCount = 0, tactical000Count = 0,
|
||||||
nvgCount = 0, pistolGripAkmsCount = 0, stockAkmsCount = 0, equipment000Count = 0, equipment001Count = 0,
|
nvgCount = 0, pistolGripAkmsCount = 0, stockAkmsCount = 0, equipment000Count = 0, equipment001Count = 0,
|
||||||
equipment002Count = 0, bipodCount = 0;
|
equipment002Count = 0, bipodCount = 0;
|
||||||
@ -110,13 +110,13 @@ namespace Generator.Helpers.Gear
|
|||||||
public static void CalculateEquipmentChances(Bot bot, List<Datum> baseBots)
|
public static void CalculateEquipmentChances(Bot bot, List<Datum> baseBots)
|
||||||
{
|
{
|
||||||
var totalBotsCount = baseBots.Count;
|
var totalBotsCount = baseBots.Count;
|
||||||
int headwearCount = 0, earCount = 0, faceCoverCount = 0,armorVestCount = 0, eyeWearCount = 0, armBandCount = 0,
|
int headwearCount = 0, earCount = 0, faceCoverCount = 0, armorVestCount = 0, eyeWearCount = 0, armBandCount = 0,
|
||||||
tacticalVestCount = 0, backpackCount = 0, firstPrimaryCount = 0, secondPrimaryCount = 0, holsterCount = 0,
|
tacticalVestCount = 0, backpackCount = 0, firstPrimaryCount = 0, secondPrimaryCount = 0, holsterCount = 0,
|
||||||
scabbardCount = 0, pocketsCount = 0, securedContainerCount = 0;
|
scabbardCount = 0, pocketsCount = 0, securedContainerCount = 0;
|
||||||
|
|
||||||
foreach (var baseBot in baseBots)
|
foreach (var baseBot in baseBots)
|
||||||
{
|
{
|
||||||
headwearCount += baseBot.Inventory.items.Count(x=> x.slotId == "Headwear");
|
headwearCount += baseBot.Inventory.items.Count(x => x.slotId == "Headwear");
|
||||||
earCount += baseBot.Inventory.items.Count(x => x.slotId == "Earpiece");
|
earCount += baseBot.Inventory.items.Count(x => x.slotId == "Earpiece");
|
||||||
faceCoverCount += baseBot.Inventory.items.Count(x => x.slotId == "FaceCover");
|
faceCoverCount += baseBot.Inventory.items.Count(x => x.slotId == "FaceCover");
|
||||||
armorVestCount += baseBot.Inventory.items.Count(x => x.slotId == "ArmorVest");
|
armorVestCount += baseBot.Inventory.items.Count(x => x.slotId == "ArmorVest");
|
||||||
|
@ -23,7 +23,7 @@ namespace Generator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate the base bot class and add basic details (health/body part hp etc)
|
// Generate the base bot class and add basic details (health/body part hp etc)
|
||||||
var baseBotGenerator = new BaseBotGenerator(parsedBots);
|
var baseBotGenerator = new BaseBotGenerator(parsedBots, workingPath);
|
||||||
var baseBots = baseBotGenerator.AddBaseDetails();
|
var baseBots = baseBotGenerator.AddBaseDetails();
|
||||||
|
|
||||||
// Add weapons/armor to bot
|
// Add weapons/armor to bot
|
||||||
|
Loading…
x
Reference in New Issue
Block a user