Better way of determining if weapon is primary or secondary

This commit is contained in:
Chomp 2021-09-21 14:10:52 +01:00
parent 8237fdbe67
commit acf4f2ca40
2 changed files with 16 additions and 1 deletions

View File

@ -19,6 +19,8 @@ namespace Common.Models
public List<Chamber> Chambers { get; set; } public List<Chamber> Chambers { get; set; }
public List<Slot> Slots { get; set; } public List<Slot> Slots { get; set; }
public string defAmmo { get; set; } public string defAmmo { get; set; }
public string weapClass { get; set; }
public string weapUseType { get; set; }
} }
public class Chamber public class Chamber

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Common.Models; using Common.Models;
using Generator.Helpers;
namespace PMCGenerator namespace PMCGenerator
{ {
@ -270,8 +271,14 @@ namespace PMCGenerator
var result = new List<WeaponDetails>(); var result = new List<WeaponDetails>();
foreach (var file in parsedPresets) foreach (var file in parsedPresets)
{ {
foreach (var item in file.weaponbuilds.Where(x=> !x.Key.Contains("pistol"))) foreach (var item in file.weaponbuilds)
{ {
var itemBase = ItemTemplateHelper.GetTemplateById(item.Value.items[0]._tpl);
if (itemBase._props.weapUseType != "primary")
{
continue;
}
Weapon weapon = item.Value; Weapon weapon = item.Value;
result.Add(new WeaponDetails(item.Key, weapon.items[0]._id, weapon.items[0]._tpl)); result.Add(new WeaponDetails(item.Key, weapon.items[0]._id, weapon.items[0]._tpl));
} }
@ -287,6 +294,12 @@ namespace PMCGenerator
{ {
foreach (var item in file.weaponbuilds.Where(x => x.Key.Contains("pistol"))) foreach (var item in file.weaponbuilds.Where(x => x.Key.Contains("pistol")))
{ {
var itemBase = ItemTemplateHelper.GetTemplateById(item.Value.items[0]._tpl);
if (itemBase._props.weapUseType != "secondary")
{
continue;
}
Weapon weapon = item.Value; Weapon weapon = item.Value;
result.Add(new WeaponDetails(item.Key, weapon.items[0]._id, weapon.items[0]._tpl)); result.Add(new WeaponDetails(item.Key, weapon.items[0]._id, weapon.items[0]._tpl));
} }