From 8dedb15ce19bb233453fd39ef8708f44c4613a27 Mon Sep 17 00:00:00 2001 From: tnhnblgl <51187395+tnhnblgl@users.noreply.github.com> Date: Thu, 24 Jul 2025 21:03:40 +0300 Subject: [PATCH] Fix troop exploit (#1556) ## Description: Fixes #1554 (short description) ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I have read and accepted the CLA aggreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: dovg --- src/core/Schemas.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Schemas.ts b/src/core/Schemas.ts index f439ea5fa..b65fc8864 100644 --- a/src/core/Schemas.ts +++ b/src/core/Schemas.ts @@ -246,7 +246,7 @@ export const AllianceExtensionIntentSchema = BaseIntentSchema.extend({ export const AttackIntentSchema = BaseIntentSchema.extend({ type: z.literal("attack"), targetID: ID.nullable(), - troops: z.number().nullable(), + troops: z.number().nonnegative().nullable(), }); export const SpawnIntentSchema = BaseIntentSchema.extend({ @@ -261,7 +261,7 @@ export const SpawnIntentSchema = BaseIntentSchema.extend({ export const BoatAttackIntentSchema = BaseIntentSchema.extend({ type: z.literal("boat"), targetID: ID.nullable(), - troops: z.number(), + troops: z.number().nonnegative(), dst: z.number(), src: z.number().nullable(), });