mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
Add weekly challenge configuration management: implement types and functions for building and parsing weekly challenge configurations; enhance UI for challenge type and amount selection
This commit is contained in:
@@ -329,7 +329,7 @@ public class ServerSettingsService(DorkNetDbContext db)
|
||||
if (!element.TryGetProperty("ct", out var typeElement) || !typeElement.TryGetInt32(out var type))
|
||||
return false;
|
||||
|
||||
if (type == 0)
|
||||
if (type == 0 || IsKnownClientChallengeType(type))
|
||||
return true;
|
||||
|
||||
if (type != 1)
|
||||
@@ -352,6 +352,21 @@ public class ServerSettingsService(DorkNetDbContext db)
|
||||
return children.EnumerateArray().All(IsClientWeeklyChallengeConfigElement);
|
||||
}
|
||||
|
||||
private static bool IsKnownClientChallengeType(int type) => type is
|
||||
2 // TimedBufferChallenge
|
||||
or 3 // DynamicFloatArithmeticChallenge
|
||||
or 4 // DynamicIntArithmeticChallenge
|
||||
or 6 // RequiredEventTypeChallenge
|
||||
or 7 // RequiredRoomSceneLocationChallenge
|
||||
or 8 // RequiredEnemyTypeChallenge
|
||||
or 9 // BoolVarEqualsChallenge
|
||||
or 11 // DiscGolfFinishUnderParChallenge
|
||||
or 12 // RequiredGameModeActivityChallenge
|
||||
or 13 // CompleteGameWithoutChallenge
|
||||
or 14 // RequiredGestureChallenge
|
||||
or 15 // HitstreakChallenge
|
||||
or 16; // HitstreakCountChallenge
|
||||
|
||||
private static string CountedAnyChallengeConfig(int target) =>
|
||||
"{\"ct\":1,\"ctc\":[{\"ct\":0}],\"t\":" + Math.Clamp(target, 1, 1000) + ",\"cc\":0}";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user