Naming consistency improvements
This commit is contained in:
parent
dd72a6e5e2
commit
7547f3379f
@ -15,24 +15,24 @@ namespace Generator
|
||||
public static class BaseBotGenerator
|
||||
{
|
||||
//TODO: pass in bot types and use those to create the classes in rawBots list
|
||||
public static IEnumerable<Bot> GenerateBaseDetails(IEnumerable<Datum> parsedBots, string workingPath, IEnumerable<string> botTypes)
|
||||
public static IEnumerable<Bot> GenerateBaseDetails(IEnumerable<Datum> rawBots, string workingPath, IEnumerable<string> botTypes)
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
LoggingHelpers.LogToConsole("Started processing bot base");
|
||||
|
||||
// Create a list of bot objects ready to be hydrated
|
||||
var rawBots = new List<Bot>();
|
||||
var baseBots = new List<Bot>();
|
||||
foreach (var botType in botTypes)
|
||||
{
|
||||
var typeToAdd = (BotType)Enum.Parse(typeof(BotType), botType);
|
||||
rawBots.Add(new Bot(typeToAdd));
|
||||
baseBots.Add(new Bot(typeToAdd));
|
||||
}
|
||||
|
||||
// Iterate over each bot type wejust made and put some data into them
|
||||
foreach (var botToUpdate in rawBots)
|
||||
foreach (var botToUpdate in baseBots)
|
||||
{
|
||||
var rawBotsOfSameType = parsedBots
|
||||
.Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
var rawBotsOfSameType = rawBots.Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
if (rawBotsOfSameType.Count == 0)
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace Generator
|
||||
stopwatch.Stop();
|
||||
LoggingHelpers.LogToConsole($"Finished processing bot base. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
|
||||
|
||||
return rawBots;
|
||||
return baseBots;
|
||||
}
|
||||
|
||||
private static void AddSkills(Bot botToUpdate, IEnumerable<Datum> rawBotsOfSameType)
|
||||
@ -88,9 +88,9 @@ namespace Generator
|
||||
botToUpdate.experience.reward.max = firstBotOfDesiredType.Info.Settings.Experience;
|
||||
}
|
||||
|
||||
private static void AddVoice(Bot bot, Datum rawParsedBot)
|
||||
private static void AddVoice(Bot bot, Datum rawBot)
|
||||
{
|
||||
bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice);
|
||||
bot.appearance.voice.AddUnique(rawBot.Info.Voice);
|
||||
}
|
||||
|
||||
private static void AddDifficulties(Bot bot, string workingPath)
|
||||
@ -103,9 +103,9 @@ namespace Generator
|
||||
DifficultyHelper.AddDifficultySettings(bot, botFiles);
|
||||
}
|
||||
|
||||
private static void UpdateBodyPartHealth(Bot botToUpdate, List<Datum> rawParsedBots)
|
||||
private static void UpdateBodyPartHealth(Bot botToUpdate, List<Datum> rawBots)
|
||||
{
|
||||
var firstBotOfDesiredType = rawParsedBots.FirstOrDefault();
|
||||
var firstBotOfDesiredType = rawBots.FirstOrDefault();
|
||||
if (firstBotOfDesiredType == null)
|
||||
{
|
||||
LoggingHelpers.LogToConsole($"bot type of: {botToUpdate.botType} not found, unable to update body part health.");
|
||||
|
@ -11,14 +11,14 @@ namespace Generator
|
||||
{
|
||||
public static class BotChancesGenerator
|
||||
{
|
||||
public static IEnumerable<Bot> AddChances(this IEnumerable<Bot> botsWithGear, IEnumerable<Datum> parsedBots)
|
||||
public static IEnumerable<Bot> AddChances(this IEnumerable<Bot> botsToUpdate, IEnumerable<Datum> rawBots)
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
LoggingHelpers.LogToConsole("Started processing bot gear");
|
||||
|
||||
foreach (var botToUpdate in botsWithGear)
|
||||
foreach (var botToUpdate in botsToUpdate)
|
||||
{
|
||||
var rawParsedBotOfCurrentType = parsedBots
|
||||
var rawParsedBotOfCurrentType = rawBots
|
||||
.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
@ -36,7 +36,7 @@ namespace Generator
|
||||
stopwatch.Stop();
|
||||
LoggingHelpers.LogToConsole($"Finished processing bot chances. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
|
||||
|
||||
return botsWithGear;
|
||||
return botsToUpdate;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,16 +11,15 @@ namespace Generator
|
||||
{
|
||||
public static class BotGearGenerator
|
||||
{
|
||||
public static IEnumerable<Bot> AddGear(this IEnumerable<Bot> baseBots, IEnumerable<Datum> parsedBots)
|
||||
public static IEnumerable<Bot> AddGear(this IEnumerable<Bot> baseBots, IEnumerable<Datum> rawBots)
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
LoggingHelpers.LogToConsole("Started processing bot gear");
|
||||
|
||||
foreach (var botToUpdate in baseBots)
|
||||
{
|
||||
var rawParsedBotOfCurrentType = parsedBots
|
||||
.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
var rawParsedBotOfCurrentType = rawBots.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
if (rawParsedBotOfCurrentType.Count == 0)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ namespace Generator
|
||||
{
|
||||
public static class BotLootGenerator
|
||||
{
|
||||
internal static IEnumerable<Bot> AddLoot(this IEnumerable<Bot> botsWithGear, IEnumerable<Datum> parsedBots)
|
||||
internal static IEnumerable<Bot> AddLoot(this IEnumerable<Bot> botsWithGear, IEnumerable<Datum> rawBots)
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
LoggingHelpers.LogToConsole("Started processing bot loot");
|
||||
@ -21,7 +21,7 @@ namespace Generator
|
||||
// Iterate over assault/raider etc
|
||||
Parallel.ForEach(botsWithGear, botToUpdate =>
|
||||
{
|
||||
var rawBotsOfSameType = parsedBots
|
||||
var rawBotsOfSameType = rawBots
|
||||
.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
@ -47,22 +47,22 @@ namespace Generator
|
||||
return botsWithGear;
|
||||
}
|
||||
|
||||
private static void AddPocketLoot(Bot botToUpdate, Datum bot)
|
||||
private static void AddPocketLoot(Bot botToUpdate, Datum rawBot)
|
||||
{
|
||||
// pocket loot
|
||||
foreach (var lootItem in bot.Inventory.items.Where(x => x?.slotId?.StartsWith("pocket") == true))
|
||||
foreach (var lootItem in rawBot.Inventory.items.Where(x => x?.slotId?.StartsWith("pocket") == true))
|
||||
{
|
||||
botToUpdate.inventory.items.Pockets.AddUnique(lootItem._tpl);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddTacticalVestLoot(Bot botToUpdate, IEnumerable<Datum> bots)
|
||||
private static void AddTacticalVestLoot(Bot botToUpdate, IEnumerable<Datum> rawBots)
|
||||
{
|
||||
var tacVestItems = GetItemsStoredInEquipmentItem(bots, "TacticalVest");
|
||||
var tacVestItems = GetItemsStoredInEquipmentItem(rawBots, "TacticalVest");
|
||||
botToUpdate.inventory.items.TacticalVest.AddRange(tacVestItems);
|
||||
}
|
||||
|
||||
private static void AddBackpackLoot(Bot botToUpdate, IEnumerable<Datum> bots)
|
||||
private static void AddBackpackLoot(Bot botToUpdate, IEnumerable<Datum> rawBots)
|
||||
{
|
||||
// add generic keys to bosses
|
||||
if (botToUpdate.botType.IsBoss())
|
||||
@ -70,13 +70,13 @@ namespace Generator
|
||||
botToUpdate.inventory.items.Backpack.AddRange(SpecialLootHelper.GetGenericBossKeys());
|
||||
}
|
||||
|
||||
var backpackItems = GetItemsStoredInEquipmentItem(bots, "Backpack");
|
||||
var backpackItems = GetItemsStoredInEquipmentItem(rawBots, "Backpack");
|
||||
botToUpdate.inventory.items.Backpack.AddRange(backpackItems);
|
||||
}
|
||||
|
||||
private static void AddSecureContainerLoot(Bot botToUpdate, IEnumerable<Datum> bots)
|
||||
private static void AddSecureContainerLoot(Bot botToUpdate, IEnumerable<Datum> rawBots)
|
||||
{
|
||||
var tacVestItems = GetItemsStoredInEquipmentItem(bots, "SecuredContainer");
|
||||
var tacVestItems = GetItemsStoredInEquipmentItem(rawBots, "SecuredContainer");
|
||||
botToUpdate.inventory.items.SecuredContainer.AddRange(tacVestItems);
|
||||
}
|
||||
|
||||
@ -85,11 +85,11 @@ namespace Generator
|
||||
botToUpdate.inventory.items.SpecialLoot.AddRange(SpecialLootHelper.GetSpecialLootForBotType(botToUpdate.botType));
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetItemsStoredInEquipmentItem(IEnumerable<Datum> bots, string containerName)
|
||||
private static IEnumerable<string> GetItemsStoredInEquipmentItem(IEnumerable<Datum> rawBots, string containerName)
|
||||
{
|
||||
var itemsStoredInContainer = new List<string>();
|
||||
var containers = new List<string>();
|
||||
foreach (var bot in bots)
|
||||
foreach (var bot in rawBots)
|
||||
{
|
||||
// find the container type we want on this bot (backpack etc)
|
||||
// Add to list
|
||||
|
@ -11,12 +11,12 @@ namespace Generator.Helpers
|
||||
{
|
||||
private static readonly string[] _difficulties = new[] { "easy", "normal", "hard", "impossible" };
|
||||
|
||||
public static void AddDifficultySettings(Bot bot, List<string> difficultyFilePaths)
|
||||
public static void AddDifficultySettings(Bot botToUpdate, List<string> difficultyFilePaths)
|
||||
{
|
||||
// Read bot setting files from assets folder that match this bots type
|
||||
// Save into dictionary with difficulty as key
|
||||
var difficultySettingsJsons = new Dictionary<string, DifficultySettings>();
|
||||
foreach (var path in difficultyFilePaths.Where(x=>x.Contains($"_{bot.botType}", System.StringComparison.InvariantCultureIgnoreCase)))
|
||||
foreach (var path in difficultyFilePaths.Where(x=>x.Contains($"_{botToUpdate.botType}", System.StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
var json = File.ReadAllText(path);
|
||||
var serialisedObject = JsonConvert.DeserializeObject<DifficultySettings>(json);
|
||||
@ -37,7 +37,7 @@ namespace Generator.Helpers
|
||||
settings = difficultySettingsJsons.FirstOrDefault(x => x.Key != null);
|
||||
}
|
||||
|
||||
SaveSettingsIntoBotFile(bot, difficulty, settings.Value);
|
||||
SaveSettingsIntoBotFile(botToUpdate, difficulty, settings.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,21 +49,21 @@ namespace Generator.Helpers
|
||||
return splitPath.Last().Split("_")[0];
|
||||
}
|
||||
|
||||
private static void SaveSettingsIntoBotFile(Bot bot, string difficulty, DifficultySettings settings)
|
||||
private static void SaveSettingsIntoBotFile(Bot botToUpdate, string difficulty, DifficultySettings settings)
|
||||
{
|
||||
switch (difficulty)
|
||||
{
|
||||
case "easy":
|
||||
bot.difficulty.easy = settings;
|
||||
botToUpdate.difficulty.easy = settings;
|
||||
break;
|
||||
case "normal":
|
||||
bot.difficulty.normal = settings;
|
||||
botToUpdate.difficulty.normal = settings;
|
||||
break;
|
||||
case "hard":
|
||||
bot.difficulty.hard = settings;
|
||||
botToUpdate.difficulty.hard = settings;
|
||||
break;
|
||||
case "impossible":
|
||||
bot.difficulty.impossible = settings;
|
||||
botToUpdate.difficulty.impossible = settings;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user