22c71bee5b
* Remove unused model * Start moving methods to extensions, cleanup code
50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using SPTarkov.Server.Core.Helpers;
|
|
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
|
using SPTarkov.Server.Core.Models.Enums;
|
|
|
|
namespace SPTarkov.Server.Core.Extensions
|
|
{
|
|
public static class ProductionExtensions
|
|
{
|
|
private static readonly HashSet<string> _idCheck =
|
|
[
|
|
HideoutHelper.BitcoinFarm,
|
|
HideoutHelper.CultistCircleCraftId,
|
|
];
|
|
|
|
/// <summary>
|
|
/// Has the craft completed
|
|
/// Ignores bitcoin farm/cultist circle as they're continuous crafts
|
|
/// </summary>
|
|
/// <param name="craft">Craft to check</param>
|
|
/// <returns>True when craft is complete</returns>
|
|
public static bool IsCraftComplete(this Production craft)
|
|
{
|
|
return craft.Progress >= craft.ProductionTime && !_idCheck.Contains(craft.RecipeId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Is a craft from a particular hideout area
|
|
/// </summary>
|
|
/// <param name="craft">Craft to check</param>
|
|
/// <param name="hideoutType">Type to check craft against</param>
|
|
/// <returns>True if it is from that area</returns>
|
|
public static bool IsCraftOfType(this Production craft, HideoutAreas hideoutType)
|
|
{
|
|
switch (hideoutType)
|
|
{
|
|
case HideoutAreas.WaterCollector:
|
|
return craft.RecipeId == HideoutHelper.WaterCollector;
|
|
case HideoutAreas.BitcoinFarm:
|
|
return craft.RecipeId == HideoutHelper.BitcoinFarm;
|
|
case HideoutAreas.ScavCase:
|
|
return craft.SptIsScavCase ?? false;
|
|
case HideoutAreas.CircleOfCultists:
|
|
return craft.SptIsCultistCircle ?? false;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|