forked from chomp/BotGenerator
handle revolver gen correctly, dont include patron_in_weapon for them
move to generic .net6
This commit is contained in:
parent
1c9d8b7700
commit
c63d0b3701
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -48,8 +48,13 @@ namespace PMCGenerator
|
|||||||
|
|
||||||
// Get top level mods types for this gun
|
// Get top level mods types for this gun
|
||||||
var uniqueModSlots = flatModList.Where(x => x.ParentId == weapon.Id).Select(x => x.SlotId).Distinct().ToList();
|
var uniqueModSlots = flatModList.Where(x => x.ParentId == weapon.Id).Select(x => x.SlotId).Distinct().ToList();
|
||||||
|
|
||||||
var chamberedBulletModItemName = "patron_in_weapon";
|
var chamberedBulletModItemName = "patron_in_weapon";
|
||||||
uniqueModSlots.AddUnique(chamberedBulletModItemName);
|
if (weapon.TemplateId != "60db29ce99594040e04c4a27") // shotgun revolver
|
||||||
|
{
|
||||||
|
uniqueModSlots.AddUnique(chamberedBulletModItemName);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var modSlotId in uniqueModSlots)
|
foreach (var modSlotId in uniqueModSlots)
|
||||||
{
|
{
|
||||||
Dictionary<string, List<string>> weaponModsToModify = output.mods[weapon.TemplateId];
|
Dictionary<string, List<string>> weaponModsToModify = output.mods[weapon.TemplateId];
|
||||||
@ -61,9 +66,12 @@ namespace PMCGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add compatible bullets to weapons gun chamber
|
// Add compatible bullets to weapons gun chamber
|
||||||
var modItemToAddBulletsTo = output.mods[weapon.TemplateId].FirstOrDefault(x => x.Key == chamberedBulletModItemName);
|
|
||||||
var compatibleBullets = GetCompatibileBullets(itemLibrary, weapon);
|
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
|
// Add compatabible mods to weapon
|
||||||
var modsForWeapon = flatModList.Where(x => x.ParentId == weapon.Id).ToList();
|
var modsForWeapon = flatModList.Where(x => x.ParentId == weapon.Id).ToList();
|
||||||
@ -152,7 +160,7 @@ namespace PMCGenerator
|
|||||||
|
|
||||||
var workingPath = Directory.GetCurrentDirectory();
|
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);
|
return JsonConvert.DeserializeObject<Dictionary<string, Item>>(itemsLibraryJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user