.NET Format Style Fixes

This commit is contained in:
refringe
2025-06-18 17:09:20 +00:00
committed by Format Bot
parent ca0a7d6345
commit 6e01428b2b
774 changed files with 23507 additions and 40003 deletions
@@ -26,7 +26,7 @@ public class BarrelInvetoryMagGen(
// Can't be done by _props.ammoType as grenade launcher shoots grenades with ammoType of "buckshot"
double? randomisedAmmoStackSize;
if (inventoryMagGen.GetAmmoTemplate().Properties.StackMaxRandom == 1)
// Doesn't stack
// Doesn't stack
{
randomisedAmmoStackSize = _randomUtil.GetInt(3, 6);
}
@@ -40,7 +40,7 @@ public class BarrelInvetoryMagGen(
_botWeaponGeneratorHelper.AddAmmoIntoEquipmentSlots(
inventoryMagGen.GetAmmoTemplate().Id,
(int) randomisedAmmoStackSize,
(int)randomisedAmmoStackSize,
inventoryMagGen.GetPmcInventory(),
null
);
@@ -42,7 +42,9 @@ public class ExternalInventoryMagGen(
var defaultMagazineTpl = _botWeaponGeneratorHelper.GetWeaponsDefaultMagazineTpl(weapon);
var isShotgun = _itemHelper.IsOfBaseclass(weapon.Id, BaseClasses.SHOTGUN);
var randomizedMagazineCount = _botWeaponGeneratorHelper.GetRandomizedMagazineCount(inventoryMagGen.GetMagCount());
var randomizedMagazineCount = _botWeaponGeneratorHelper.GetRandomizedMagazineCount(
inventoryMagGen.GetMagCount()
);
for (var i = 0; i < randomizedMagazineCount; i++)
{
var magazineWithAmmo = _botWeaponGeneratorHelper.CreateMagazineWithAmmo(
@@ -60,7 +62,7 @@ public class ExternalInventoryMagGen(
);
if (fitsIntoInventory == ItemAddedResult.NO_CONTAINERS)
// No containers to fit magazines, stop trying
// No containers to fit magazines, stop trying
{
break;
}
@@ -73,7 +75,9 @@ public class ExternalInventoryMagGen(
{
if (_logger.IsLogEnabled(LogLevel.Debug))
{
_logger.Debug($"Failed {fitAttempts} times to add magazine {magazineTpl} to bot inventory, stopping");
_logger.Debug(
$"Failed {fitAttempts} times to add magazine {magazineTpl} to bot inventory, stopping"
);
}
break;
@@ -84,7 +88,7 @@ public class ExternalInventoryMagGen(
* Temporary workaround to Killa spawning with no extra mags if he spawns with a drum mag */
if (magazineTpl == defaultMagazineTpl)
// We were already on default - stop here to prevent infinite loop
// We were already on default - stop here to prevent infinite loop
{
break;
}
@@ -93,13 +97,13 @@ public class ExternalInventoryMagGen(
attemptedMagBlacklist.Add(magazineTpl);
if (defaultMagazineTpl is null)
// No default to fall back to, stop trying to add mags
// No default to fall back to, stop trying to add mags
{
break;
}
if (defaultMagazineTpl == BaseClasses.MAGAZINE)
// Magazine base type, do not use
// Magazine base type, do not use
{
break;
}
@@ -110,7 +114,10 @@ public class ExternalInventoryMagGen(
if (magTemplate is null)
{
_logger.Error(
_localisationService.GetText("bot-unable_to_find_default_magazine_item", magazineTpl)
_localisationService.GetText(
"bot-unable_to_find_default_magazine_item",
magazineTpl
)
);
break;
@@ -152,7 +159,7 @@ public class ExternalInventoryMagGen(
}
if (fitsIntoInventory == ItemAddedResult.SUCCESS)
// Reset fit counter now it succeeded
// Reset fit counter now it succeeded
{
fitAttempts = 0;
}
@@ -165,27 +172,34 @@ public class ExternalInventoryMagGen(
/// <param name="weaponTpl"> Weapon to get mag for </param>
/// <param name="magazineBlacklist"> Blacklisted magazines </param>
/// <returns> Item of chosen magazine </returns>
public TemplateItem? GetRandomExternalMagazineForInternalMagazineGun(string weaponTpl, List<string> magazineBlacklist)
public TemplateItem? GetRandomExternalMagazineForInternalMagazineGun(
string weaponTpl,
List<string> magazineBlacklist
)
{
// The mag Slot data for the weapon
var magSlot = _itemHelper.GetItem(weaponTpl).Value.Properties.Slots.FirstOrDefault(x => x.Name == "mod_magazine");
var magSlot = _itemHelper
.GetItem(weaponTpl)
.Value.Properties.Slots.FirstOrDefault(x => x.Name == "mod_magazine");
if (magSlot is null)
{
return null;
}
// All possible mags that fit into the weapon excluding blacklisted
var magazinePool = magSlot.Props.Filters[0]
var magazinePool = magSlot
.Props.Filters[0]
.Filter.Where(x => !magazineBlacklist.Contains(x))
.Select(x => _itemHelper.GetItem(x).Value
);
.Select(x => _itemHelper.GetItem(x).Value);
if (magazinePool is null)
{
return null;
}
// Non-internal magazines that fit into the weapon
var externalMagazineOnlyPool = magazinePool.Where(x => x.Properties.ReloadMagType != ReloadMode.InternalMagazine);
var externalMagazineOnlyPool = magazinePool.Where(x =>
x.Properties.ReloadMagType != ReloadMode.InternalMagazine
);
if (externalMagazineOnlyPool is null || !externalMagazineOnlyPool.Any())
{
return null;
@@ -5,9 +5,9 @@ using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Generators.WeaponGen.Implementations;
[Injectable]
public class InternalMagazineInventoryMagGen(
BotWeaponGeneratorHelper _botWeaponGeneratorHelper
) : InventoryMagGen, IInventoryMagGen
public class InternalMagazineInventoryMagGen(BotWeaponGeneratorHelper _botWeaponGeneratorHelper)
: InventoryMagGen,
IInventoryMagGen
{
public int GetPriority()
{
@@ -16,7 +16,8 @@ public class InternalMagazineInventoryMagGen(
public bool CanHandleInventoryMagGen(InventoryMagGen inventoryMagGen)
{
return inventoryMagGen.GetMagazineTemplate().Properties.ReloadMagType == ReloadMode.InternalMagazine;
return inventoryMagGen.GetMagazineTemplate().Properties.ReloadMagType
== ReloadMode.InternalMagazine;
}
public void Process(InventoryMagGen inventoryMagGen)
@@ -27,7 +28,7 @@ public class InternalMagazineInventoryMagGen(
);
_botWeaponGeneratorHelper.AddAmmoIntoEquipmentSlots(
inventoryMagGen.GetAmmoTemplate().Id,
(int) bulletCount,
(int)bulletCount,
inventoryMagGen.GetPmcInventory(),
null
);
@@ -5,9 +5,9 @@ using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Generators.WeaponGen.Implementations;
[Injectable]
public class UbglExternalMagGen(
BotWeaponGeneratorHelper _botWeaponGeneratorHelper
) : InventoryMagGen, IInventoryMagGen
public class UbglExternalMagGen(BotWeaponGeneratorHelper _botWeaponGeneratorHelper)
: InventoryMagGen,
IInventoryMagGen
{
public int GetPriority()
{
@@ -27,7 +27,7 @@ public class UbglExternalMagGen(
);
_botWeaponGeneratorHelper.AddAmmoIntoEquipmentSlots(
inventoryMagGen.GetAmmoTemplate().Id,
(int) bulletCount,
(int)bulletCount,
inventoryMagGen.GetPmcInventory(),
[EquipmentSlots.TacticalVest]
);