From 48cb7b0a60d580f6c2c7bca40bbda331fb5e2173 Mon Sep 17 00:00:00 2001 From: MatthewGlancy Date: Thu, 8 Feb 2024 21:16:18 +0000 Subject: [PATCH 1/3] Update Game.market.deal documentation --- dist/index.d.ts | 10 +++++++++- src/market.ts | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 68c5c5b..2b4b3a1 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -3133,8 +3133,16 @@ interface Market { * You can use Game.market.calcTransactionCost method to estimate it. * * When multiple players try to execute the same deal, the one with the shortest distance takes precedence. + * + * You cannot execute more than 10 deals during one tick. + * + * @param orderId The order ID as provided in Game.market.orders + * @param amount The amount of resources to transfer. + * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). + * + * @returns Result Code: OK, ERR_NOT_OWNER, ERR_NOT_ENOUGH_RESOURCES, ERR_FULL, ERR_INVALID_ARGS, ERR_TIRED */ - deal(orderId: string, amount: number, targetRoomName?: string): ScreepsReturnCode; + deal(orderId: string, amount: number, yourRoomName?: string): ScreepsReturnCode; /** * Add more capacity to an existing order. It will affect `remainingAmount` and `totalAmount` properties. You will be charged `price*addAmount*0.05` credits. * Extending the order doesn't update its expiration time. diff --git a/src/market.ts b/src/market.ts index 2132ea3..80e10b2 100644 --- a/src/market.ts +++ b/src/market.ts @@ -67,8 +67,16 @@ interface Market { * You can use Game.market.calcTransactionCost method to estimate it. * * When multiple players try to execute the same deal, the one with the shortest distance takes precedence. + * + * You cannot execute more than 10 deals during one tick. + * + * @param orderId The order ID as provided in Game.market.orders + * @param amount The amount of resources to transfer. + * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). + * + * @returns Result Code: OK, ERR_NOT_OWNER, ERR_NOT_ENOUGH_RESOURCES, ERR_FULL, ERR_INVALID_ARGS, ERR_TIRED */ - deal(orderId: string, amount: number, targetRoomName?: string): ScreepsReturnCode; + deal(orderId: string, amount: number, yourRoomName?: string): ScreepsReturnCode; /** * Add more capacity to an existing order. It will affect `remainingAmount` and `totalAmount` properties. You will be charged `price*addAmount*0.05` credits. * Extending the order doesn't update its expiration time. From f58060d97ab796091f82ac14cb1f0c089dd7c162 Mon Sep 17 00:00:00 2001 From: MatthewGlancy Date: Thu, 8 Feb 2024 21:21:24 +0000 Subject: [PATCH 2/3] Fix long line for tests --- dist/index.d.ts | 3 ++- src/market.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 2b4b3a1..90684e0 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -3138,7 +3138,8 @@ interface Market { * * @param orderId The order ID as provided in Game.market.orders * @param amount The amount of resources to transfer. - * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). + * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. + * This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). * * @returns Result Code: OK, ERR_NOT_OWNER, ERR_NOT_ENOUGH_RESOURCES, ERR_FULL, ERR_INVALID_ARGS, ERR_TIRED */ diff --git a/src/market.ts b/src/market.ts index 80e10b2..10fc7b5 100644 --- a/src/market.ts +++ b/src/market.ts @@ -72,7 +72,8 @@ interface Market { * * @param orderId The order ID as provided in Game.market.orders * @param amount The amount of resources to transfer. - * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). + * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. + * This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). * * @returns Result Code: OK, ERR_NOT_OWNER, ERR_NOT_ENOUGH_RESOURCES, ERR_FULL, ERR_INVALID_ARGS, ERR_TIRED */ From 867be8621e61ec82d1d1556081fdbd45a1d7a183 Mon Sep 17 00:00:00 2001 From: Mofeng <363034937@qq.com> Date: Sun, 31 Mar 2024 23:11:15 +0800 Subject: [PATCH 3/3] chore: keep comment the same as official doc --- dist/index.d.ts | 2 +- src/market.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 90684e0..d49128f 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -3139,7 +3139,7 @@ interface Market { * @param orderId The order ID as provided in Game.market.orders * @param amount The amount of resources to transfer. * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. - * This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). + * This argument is not used when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). * * @returns Result Code: OK, ERR_NOT_OWNER, ERR_NOT_ENOUGH_RESOURCES, ERR_FULL, ERR_INVALID_ARGS, ERR_TIRED */ diff --git a/src/market.ts b/src/market.ts index 10fc7b5..22e532e 100644 --- a/src/market.ts +++ b/src/market.ts @@ -73,7 +73,7 @@ interface Market { * @param orderId The order ID as provided in Game.market.orders * @param amount The amount of resources to transfer. * @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy. - * This argument should not be passed when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). + * This argument is not used when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}). * * @returns Result Code: OK, ERR_NOT_OWNER, ERR_NOT_ENOUGH_RESOURCES, ERR_FULL, ERR_INVALID_ARGS, ERR_TIRED */