@@ -3079,14 +3079,16 @@ interface Market {
30793079 * it will be automatically activated and deactivated depending on the resource/credits availability.
30803080 *
30813081 * An order expires in 30 days after its creation, and the remaining market fee is returned.
3082+ *
3083+ * @param params A object describing the order.
3084+ * @returns One of the following codes:
3085+ * - OK: The operation has been scheduled successfully.
3086+ * - ERR_NOT_OWNER: You are not the owner of the room's terminal or there is no terminal.
3087+ * - ERR_NOT_ENOUGH_RESOURCES: You don't have enough credits to pay a fee.
3088+ * - ERR_FULL: You cannot create more than 50 orders.
3089+ * - ERR_INVALID_ARGS: The arguments provided are invalid.
30823090 */
3083- createOrder ( params : {
3084- type : ORDER_BUY | ORDER_SELL ;
3085- resourceType : MarketResourceConstant ;
3086- price : number ;
3087- totalAmount : number ;
3088- roomName ?: string ;
3089- } ) : ScreepsReturnCode ;
3091+ createOrder ( params : CreateOrderParam ) : ScreepsReturnCode ;
30903092 /**
30913093 * Execute a trade deal from your Terminal to another player's Terminal using the specified buy/sell order.
30923094 *
@@ -3186,6 +3188,37 @@ interface PriceHistory {
31863188 avgPrice : number ;
31873189 stddevPrice : number ;
31883190}
3191+
3192+ /** Parameters to {@link Game.market.createOrder} */
3193+ interface CreateOrderParam {
3194+ /**
3195+ * The order type.
3196+ */
3197+ type : ORDER_BUY | ORDER_SELL ;
3198+ /**
3199+ * The resource type to trade.
3200+ *
3201+ * If your Terminal doesn't have the specified resource, the order will be temporary inactive.
3202+ */
3203+ resourceType : MarketResourceConstant ;
3204+ /**
3205+ * The price for one resource unit in credits.
3206+ *
3207+ * Can be a decimal number.
3208+ */
3209+ price : number ;
3210+ /**
3211+ * The amount of resources to be traded in total.
3212+ */
3213+ totalAmount : number ;
3214+ /**
3215+ * The room where your order will be created.
3216+ *
3217+ * You must have your own Terminal structure in this room, otherwise the created order will be temporary inactive.
3218+ * This argument is not used when `resourceType` is one of the {@link InterShardResourceConstant} resources.
3219+ */
3220+ roomName ?: string ;
3221+ }
31893222interface Memory {
31903223 creeps : { [ name : string ] : CreepMemory } ;
31913224 powerCreeps : { [ name : string ] : PowerCreepMemory } ;
0 commit comments