Trade

Shows one player's inventory as a shop on another's screen, using the game's shop screen. The buyer sees the seller's items at `prices` or the server's price, and the seller's money as the purse, but not their money items, quest items or worn gear. A basket is checked against both inventories, and then both change together with the reason 'trade', or neither does. A trade ends when the buyer closes the screen, either player leaves or is knocked out, Trade.close is called, or the resource that opened it stops.

trade.open()

Trade.open(seller, buyer, options)

Opens the seller's inventory as a shop on the buyer's screen, and returns the session id. It returns 0 if a player is gone or not ready, both are the same player, an inventory is missing, or a tradeOpen handler returns false.

trade.close()

Trade.close(sessionId)

Ends a trade. Returns false if it has already ended.

trade.activeSession()

Trade.activeSession(player)

The trade session the player is in as buyer or seller, or 0.