handle revolver gen correctly, dont include patron_in_weapon for them

move to generic .net6
This commit is contained in:
Chomp 2021-12-18 14:07:32 +00:00
parent 1c9d8b7700
commit c63d0b3701
2 changed files with 14 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@ -48,8 +48,13 @@ namespace PMCGenerator
// Get top level mods types for this gun
var uniqueModSlots = flatModList.Where(x => x.ParentId == weapon.Id).Select(x => x.SlotId).Distinct().ToList();
var chamberedBulletModItemName = "patron_in_weapon";
uniqueModSlots.AddUnique(chamberedBulletModItemName);
if (weapon.TemplateId != "60db29ce99594040e04c4a27") // shotgun revolver
{
uniqueModSlots.AddUnique(chamberedBulletModItemName);
}
foreach (var modSlotId in uniqueModSlots)
{
Dictionary<string, List<string>> weaponModsToModify = output.mods[weapon.TemplateId];
@ -61,9 +66,12 @@ namespace PMCGenerator
}
// Add compatible bullets to weapons gun chamber
var modItemToAddBulletsTo = output.mods[weapon.TemplateId].FirstOrDefault(x => x.Key == chamberedBulletModItemName);
var compatibleBullets = GetCompatibileBullets(itemLibrary, weapon);
modItemToAddBulletsTo.Value.AddUniqueRange(compatibleBullets);
var modItemToAddBulletsTo = output.mods[weapon.TemplateId].FirstOrDefault(x => x.Key == chamberedBulletModItemName);
if (modItemToAddBulletsTo.Key != null) // some guns dont have a mod you add bullets to (e.g. revolvers)
{
modItemToAddBulletsTo.Value.AddUniqueRange(compatibleBullets);
}
// Add compatabible mods to weapon
var modsForWeapon = flatModList.Where(x => x.ParentId == weapon.Id).ToList();
@ -152,7 +160,7 @@ namespace PMCGenerator
var workingPath = Directory.GetCurrentDirectory();
var itemsLibraryJson = File.ReadAllText(workingPath + "\\input" + "\\items.json");
var itemsLibraryJson = File.ReadAllText(workingPath + "\\Assets" + "\\items.json");
return JsonConvert.DeserializeObject<Dictionary<string, Item>>(itemsLibraryJson);
}