mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 02:43:57 +00:00
fix Chapter_DealLevelSettlement
This commit is contained in:
@@ -45,7 +45,8 @@ public class Chapter_DealLevelSettlement : ICallGSHandler
|
||||
|
||||
if (string.Equals(sCmd, "BossPvpLogic_LevelSettlement", StringComparison.Ordinal))
|
||||
{
|
||||
var (response, sync) = BossPvpService.HandleSettlement(connection.Player!, tbParam);
|
||||
var normalized = NormalizeBossPvpSettlement(tbParam);
|
||||
var (response, sync) = BossPvpService.HandleSettlement(connection.Player!, normalized);
|
||||
extraSync = sync;
|
||||
return response;
|
||||
}
|
||||
@@ -66,6 +67,22 @@ public class Chapter_DealLevelSettlement : ICallGSHandler
|
||||
|
||||
return tbParam?.DeepClone() ?? new JsonObject();
|
||||
}
|
||||
|
||||
private static JsonNode? NormalizeBossPvpSettlement(JsonNode? tbParam)
|
||||
{
|
||||
if (tbParam is not JsonObject obj)
|
||||
return tbParam;
|
||||
|
||||
var clone = obj.DeepClone() as JsonObject ?? obj;
|
||||
if (clone.TryGetPropertyValue("ResidueTime", out var residueNode) &&
|
||||
residueNode is JsonValue residueValue &&
|
||||
residueValue.TryGetValue<double>(out var residueTime))
|
||||
{
|
||||
clone["ResidueTime"] = (int)Math.Max(0, Math.Round(residueTime, MidpointRounding.AwayFromZero));
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class DealLevelSettlementParam
|
||||
|
||||
Reference in New Issue
Block a user