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)
|
||||||
|
@ -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