give <item> <player> [gold]
To cancel a give:
keep <item> [player]
To see a list:
offers [player]
accept <item> <gold> [player]
sell <object> for <amount>
sell <object> <creature> for <amount>
sell <object> to <creature> for <amount>
sell <creature> <object> for <amount>
sell to <creature> <object> for <amount>
buy/view <object>
buy/view <object> <creature>
buy/view <object> from <creature>
buy/view <creature> <object>
buy/view from <creature> <object>
>trade testdummy
You begin trading with testdummy.
>offer sword
You offer a sword.
>offer mushrooms
You offer 2 mushrooms.
>offer glass
You offer a glass.
testdummy offers 100 gold.
testdummy accepts deal.
> accept
You accept the deal.
You are trading:
a sword
2 mushrooms
1 glass
You will recieve:
100 gold
Both players accepted deal, confirm and proceed with trade
testdummy confirmed trade.
> confirm
You confirmed the trade
Both players confirmed trade, trade complete.
Testdummy offers to sell you a vorpal longsword for 100 gold (transaction ID #G78)
Testdummy offers to sell you a rusty longsword for 1000000 gold (transaction ID #M12)
> buy #G78
You buy a vorpal longsword from Testdummy for 100 gold.
I've recently worked on a method for selling items, and doing so in one step to avoid situations where the item is exchanged but not the gold. I came up with an offer/accept approach, where one player offers an item to another player (or anyone) for a set price, who can then choose to accept the offer, which exchanges the item and gold at the same time, or ignore it. Command syntax is along the following lines…
Having the buyer specify the same gold as the seller acts as validation criteria to ensure the seller can't jack-up the price just as the buyer accepts the offer.
In terms of implementation, I ended up storing the details of any offer (i.e., the price and to whom the offer was made) on the item itself. This seems ok, but wastes memory since only a fraction of items are on offer at any given point in time. Maybe an explicit offer list on the player would be better. Any thoughts on this approach and ways to improve it, or alternate approaches that may work better?
Edit: Note that shopkeepers offer items to anyone, and will accept offered items (if the price is right) as well.