forked from chomp/BotGenerator
Loop over all weapons, not just primary
This commit is contained in:
parent
5541be7c34
commit
3067035494
@ -20,6 +20,9 @@ namespace PMCGenerator
|
|||||||
// Create flat lists of weapons + list of mods
|
// Create flat lists of weapons + list of mods
|
||||||
var flatPrimaryWeaponsList = GetWeaponsFromRawFile(parsedPresets);
|
var flatPrimaryWeaponsList = GetWeaponsFromRawFile(parsedPresets);
|
||||||
var flatSecondaryWeaponsList = GetSecondaryWeaponsFromRawFile(parsedPresets);
|
var flatSecondaryWeaponsList = GetSecondaryWeaponsFromRawFile(parsedPresets);
|
||||||
|
|
||||||
|
var flatAllWeaponsList = CombinePrimaryAndSecondaryWeapons(flatPrimaryWeaponsList, flatSecondaryWeaponsList);
|
||||||
|
|
||||||
var flatModList = GetModsFromRawFile(parsedPresets);
|
var flatModList = GetModsFromRawFile(parsedPresets);
|
||||||
|
|
||||||
// Add weapon mods to output
|
// Add weapon mods to output
|
||||||
@ -27,10 +30,12 @@ namespace PMCGenerator
|
|||||||
FirstPrimaryWeapon = new List<string>(),
|
FirstPrimaryWeapon = new List<string>(),
|
||||||
Holster = new List<string>(),
|
Holster = new List<string>(),
|
||||||
mods = new Dictionary<string, Dictionary<string, List<string>>>() };
|
mods = new Dictionary<string, Dictionary<string, List<string>>>() };
|
||||||
|
|
||||||
output.FirstPrimaryWeapon.AddRange(flatPrimaryWeaponsList.Select(x => x.TemplateId).Distinct());
|
output.FirstPrimaryWeapon.AddRange(flatPrimaryWeaponsList.Select(x => x.TemplateId).Distinct());
|
||||||
output.Holster.AddRange(flatSecondaryWeaponsList.Select(x => x.TemplateId).Distinct());
|
output.Holster.AddRange(flatSecondaryWeaponsList.Select(x => x.TemplateId).Distinct());
|
||||||
|
|
||||||
foreach (var weapon in flatPrimaryWeaponsList)
|
// Loop over each gun
|
||||||
|
foreach (var weapon in flatAllWeaponsList)
|
||||||
{
|
{
|
||||||
// add weapon if its not already here
|
// add weapon if its not already here
|
||||||
if (!output.mods.ContainsKey(weapon.TemplateId))
|
if (!output.mods.ContainsKey(weapon.TemplateId))
|
||||||
@ -109,6 +114,14 @@ namespace PMCGenerator
|
|||||||
CreateJsonFile(outputPath, outputJson);
|
CreateJsonFile(outputPath, outputJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<WeaponDetails> CombinePrimaryAndSecondaryWeapons(List<WeaponDetails> flatPrimaryWeaponsList, List<WeaponDetails> flatSecondaryWeaponsList)
|
||||||
|
{
|
||||||
|
var result = new List<WeaponDetails>();
|
||||||
|
result.AddRange(flatPrimaryWeaponsList);
|
||||||
|
result.AddRange(flatSecondaryWeaponsList);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a strongly typed dictionary of BSGs items library
|
/// Get a strongly typed dictionary of BSGs items library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user