Update boss keygen code to better match requirements

This commit is contained in:
Chomp 2021-08-31 18:39:30 +01:00
parent f695450f70
commit 4baaeb47bc
6 changed files with 38 additions and 14 deletions

View File

@ -0,0 +1,15 @@
using Common.Models;
namespace Common.Extensions
{
public static class EnumExtensions
{
/// <summary>
/// Add a string to a list only if it doesnt already exist
/// </summary>
public static bool IsBoss(this BotType self)
{
return self.HasFlag(BotType.bossbully | BotType.bossgluhar | BotType.bosskilla | BotType.bosskojaniy | BotType.bosssanitar);
}
}
}

View File

@ -1,4 +1,4 @@
namespace Generator.Models namespace Common.Models
{ {
public enum BotType public enum BotType
{ {
@ -21,6 +21,7 @@
followerstormtrooper = 17, followerstormtrooper = 17,
cursedassault = 18, cursedassault = 18,
sectantpriest = 19, sectantpriest = 19,
sectantwarrior = 20 sectantwarrior = 20,
usec = 21
} }
} }

View File

@ -1,7 +1,7 @@
using Common; using Common;
using Common.Extensions; using Common.Extensions;
using Common.Models;
using Generator.Helpers; using Generator.Helpers;
using Generator.Models;
using Generator.Models.Input; using Generator.Models.Input;
using Generator.Models.Output; using Generator.Models.Output;
using System; using System;

View File

@ -65,16 +65,22 @@ namespace Generator
} }
} }
private void AddTacticalVestLoot(Bot finalAssaultBot, List<Datum> bots) private void AddTacticalVestLoot(Bot finalBot, List<Datum> bots)
{ {
var tacVestItems = GetItemsStoredInEquipmentItem(bots, "TacticalVest"); var tacVestItems = GetItemsStoredInEquipmentItem(bots, "TacticalVest");
finalAssaultBot.inventory.items.TacticalVest.AddRange(tacVestItems); finalBot.inventory.items.TacticalVest.AddRange(tacVestItems);
} }
private void AddBackbackLoot(Bot finalAssaultBot, List<Datum> bots) private void AddBackbackLoot(Bot finalBot, List<Datum> bots)
{ {
// add generic keys to bosses
if (finalBot.botType.IsBoss())
{
finalBot.inventory.items.Backpack.AddRange(SpecialLootHelper.GetGenericBossKeys());
}
var backpackItems = GetItemsStoredInEquipmentItem(bots, "Backpack"); var backpackItems = GetItemsStoredInEquipmentItem(bots, "Backpack");
finalAssaultBot.inventory.items.Backpack.AddRange(backpackItems); finalBot.inventory.items.Backpack.AddRange(backpackItems);
} }
private void AddSecureContainerLoot(Bot finalAssaultBot, List<Datum> bots) private void AddSecureContainerLoot(Bot finalAssaultBot, List<Datum> bots)

View File

@ -1,4 +1,5 @@
using Generator.Models; using Common.Models;
using Generator.Models;
using System.Collections.Generic; using System.Collections.Generic;
namespace Generator.Helpers.Gear namespace Generator.Helpers.Gear
@ -58,6 +59,11 @@ namespace Generator.Helpers.Gear
"5a0eee1486f77402aa773226" // "Health Resort east wing room 328 key" "5a0eee1486f77402aa773226" // "Health Resort east wing room 328 key"
}; };
public static IEnumerable<string> GetGenericBossKeys()
{
return _genericBossKeys;
}
public static IEnumerable<string> GetSpecialLootForBotType(BotType botType) public static IEnumerable<string> GetSpecialLootForBotType(BotType botType)
{ {
var results = new List<string>(); var results = new List<string>();
@ -70,20 +76,15 @@ namespace Generator.Helpers.Gear
case BotType.marksman: case BotType.marksman:
break; break;
case BotType.bossbully: case BotType.bossbully:
results.AddRange(_genericBossKeys);
break; break;
case BotType.bossgluhar: case BotType.bossgluhar:
results.AddRange(_genericBossKeys);
break; break;
case BotType.bosskilla: case BotType.bosskilla:
results.AddRange(_genericBossKeys);
break; break;
case BotType.bosskojaniy: case BotType.bosskojaniy:
results.AddRange(_genericBossKeys);
results.Add("5d08d21286f774736e7c94c3"); // Shturman's stash key results.Add("5d08d21286f774736e7c94c3"); // Shturman's stash key
break; break;
case BotType.bosssanitar: case BotType.bosssanitar:
results.AddRange(_genericBossKeys);
results.Add("5efde6b4f5448336730dbd61"); // Keycard with a blue marking results.Add("5efde6b4f5448336730dbd61"); // Keycard with a blue marking
break; break;
case BotType.bossstormtrooper: case BotType.bossstormtrooper:

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json; using Common.Models;
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
namespace Generator.Models.Output namespace Generator.Models.Output