Merge branch 'develop' into refactor/perf-work
This commit is contained in:
@@ -362,20 +362,25 @@ public record Upd
|
||||
set;
|
||||
}
|
||||
|
||||
public Lockable? Lockable // LockableComponent in the client
|
||||
public LockableComponent? Lockable
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public record Lockable
|
||||
public record LockableKeyComponent
|
||||
{
|
||||
public bool? Locked
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public float? RelativeValue { get; set; }
|
||||
public int? NumberOfUsages { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public record LockableComponent
|
||||
{
|
||||
public string[]? KeyIds { get; set; }
|
||||
public bool? Locked { get; set; }
|
||||
public LockableKeyComponent? KeyComponent { get; set; }
|
||||
}
|
||||
|
||||
public enum PinLockState
|
||||
|
||||
@@ -33,15 +33,19 @@ public class EventOutputHolder
|
||||
_cloner = cloner;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a fresh/empty response to send to the client
|
||||
/// </summary>
|
||||
/// <param name="sessionId">Player id</param>
|
||||
/// <returns>ItemEventRouterResponse</returns>
|
||||
public ItemEventRouterResponse GetOutput(string sessionId)
|
||||
{
|
||||
var resultFound = _outputStore.TryGetValue(sessionId, out var result);
|
||||
if (resultFound)
|
||||
if (_outputStore.TryGetValue(sessionId, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
// Nothing found, reset to default
|
||||
// Nothing found, Create new empty output response
|
||||
ResetOutput(sessionId);
|
||||
_outputStore.TryGetValue(sessionId, out result!);
|
||||
|
||||
@@ -54,9 +58,11 @@ public class EventOutputHolder
|
||||
|
||||
if (_outputStore.ContainsKey(sessionId))
|
||||
{
|
||||
// Dict contains existing output object, purge it
|
||||
_outputStore.Remove(sessionId);
|
||||
}
|
||||
|
||||
// Create fresh output object
|
||||
_outputStore.Add(
|
||||
sessionId,
|
||||
new ItemEventRouterResponse
|
||||
@@ -134,7 +140,13 @@ public class EventOutputHolder
|
||||
{
|
||||
foreach (var production in productions)
|
||||
{
|
||||
if ((production.Value.SptIsComplete ?? false) && (production.Value.SptIsContinuous ?? false))
|
||||
if (production.Value == null)
|
||||
{
|
||||
// cultist circle
|
||||
// remove production in case client already issued a HideoutDeleteProductionCommand and the item is moved to stash
|
||||
productions.Remove(production.Key);
|
||||
}
|
||||
else if ((production.Value.SptIsComplete ?? false) && (production.Value.SptIsContinuous ?? false))
|
||||
{
|
||||
// Water collector / Bitcoin etc
|
||||
production.Value.SptIsComplete = false;
|
||||
|
||||
@@ -58,7 +58,15 @@ public class CircleOfCultistService(
|
||||
HideoutCircleOfCultistProductionStartRequestData request
|
||||
)
|
||||
{
|
||||
var cultistCircleStashId = pmcData.Inventory.HideoutAreaStashes.GetValueOrDefault(HideoutAreas.CIRCLE_OF_CULTISTS.ToString());
|
||||
var output = _eventOutputHolder.GetOutput(sessionId);
|
||||
|
||||
var cultistCircleStashId = pmcData.Inventory.HideoutAreaStashes.GetValueOrDefault(((int)HideoutAreas.CIRCLE_OF_CULTISTS).ToString());
|
||||
if (cultistCircleStashId is null)
|
||||
{
|
||||
_logger.Error("Could not find cultist circle stash ID inside inventory! No rewards generated");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
// `cultistRecipes` just has single recipeId
|
||||
var cultistCraftData = _databaseService.GetHideout().Production.CultistRecipes.FirstOrDefault();
|
||||
@@ -94,8 +102,6 @@ public class CircleOfCultistService(
|
||||
craftingInfo.Time
|
||||
);
|
||||
|
||||
var output = _eventOutputHolder.GetOutput(sessionId);
|
||||
|
||||
// Remove sacrificed items from circle inventory
|
||||
foreach (var item in sacrificedItems)
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user