Helper methods extensions (#431)
* Remove unused model * Start moving methods to extensions, cleanup code
This commit is contained in:
@@ -35,7 +35,6 @@ public class HideoutHelper(
|
||||
public const string BitcoinProductionId = "5d5c205bd582a50d042a3c0e";
|
||||
public const string WaterCollector = "5d5589c1f934db045e6c5492";
|
||||
public const int MaxSkillPoint = 5000;
|
||||
protected HashSet<string> _idCheck = [BitcoinFarm, CultistCircleCraftId];
|
||||
|
||||
/// <summary>
|
||||
/// Add production to profiles' Hideout.Production array
|
||||
@@ -341,20 +340,20 @@ public class HideoutHelper(
|
||||
}
|
||||
|
||||
// Skip processing (Don't skip continuous crafts like bitcoin farm or cultist circle)
|
||||
if (IsCraftComplete(craft))
|
||||
if (craft.IsCraftComplete())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Special handling required
|
||||
if (IsCraftOfType(craft, HideoutAreas.ScavCase))
|
||||
if (craft.IsCraftOfType(HideoutAreas.ScavCase))
|
||||
{
|
||||
UpdateScavCaseProductionTimer(pmcData, prodId.Key);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsCraftOfType(craft, HideoutAreas.WaterCollector))
|
||||
if (craft.IsCraftOfType(HideoutAreas.WaterCollector))
|
||||
{
|
||||
UpdateWaterCollectorProductionTimer(pmcData, prodId.Key, hideoutProperties);
|
||||
|
||||
@@ -362,7 +361,7 @@ public class HideoutHelper(
|
||||
}
|
||||
|
||||
// Continuous craft
|
||||
if (IsCraftOfType(craft, HideoutAreas.BitcoinFarm))
|
||||
if (craft.IsCraftOfType(HideoutAreas.BitcoinFarm))
|
||||
{
|
||||
UpdateBitcoinFarm(
|
||||
pmcData,
|
||||
@@ -375,7 +374,7 @@ public class HideoutHelper(
|
||||
}
|
||||
|
||||
// No recipe, needs special handling
|
||||
if (IsCraftOfType(craft, HideoutAreas.CircleOfCultists))
|
||||
if (craft.IsCraftOfType(HideoutAreas.CircleOfCultists))
|
||||
{
|
||||
UpdateCultistCircleCraftProgress(pmcData, prodId.Key);
|
||||
|
||||
@@ -397,43 +396,6 @@ public class HideoutHelper(
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
protected bool IsCraftOfType(Production craft, HideoutAreas hideoutType)
|
||||
{
|
||||
switch (hideoutType)
|
||||
{
|
||||
case HideoutAreas.WaterCollector:
|
||||
return craft.RecipeId == WaterCollector;
|
||||
case HideoutAreas.BitcoinFarm:
|
||||
return craft.RecipeId == BitcoinFarm;
|
||||
case HideoutAreas.ScavCase:
|
||||
return craft.SptIsScavCase ?? false;
|
||||
case HideoutAreas.CircleOfCultists:
|
||||
return craft.SptIsCultistCircle ?? false;
|
||||
default:
|
||||
_logger.Error(
|
||||
$"Unhandled hideout area: {hideoutType}, assuming craft: {craft.RecipeId} is not of this type"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
protected bool IsCraftComplete(Production craft)
|
||||
{
|
||||
return craft.Progress >= craft.ProductionTime && !_idCheck.Contains(craft.RecipeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update progress timer for water collector
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user