= Shops Shops let players **buy** and **sell** goods for coin. A shop is just a **mobile** marked as a shopkeeper, so everything in **[[All about Mobiles]]** applies to it too. Money is the usual **gold / silver / copper** — //1 gold = 100 silver, 1 silver = 100 copper//. == What a shopkeeper does A shopkeeper **sells** the items it holds (each at its **value**) and **buys** sellable items from players (at a discount — its **rate**). The coins it pays out come from its own **till**, so a shop can run short of money until it earns more. == Making a shopkeeper A shopkeeper is a mobile with **data shopkeeper true**. Make it **npc** as well, so it can't be dragged into a fight: {{{ mob create grocer mob grocer data shopkeeper true mob grocer data npc true }}} == Pricing items An item is worth whatever its **value** says, written in coins. Anything with no value (or a value of zero) can't be bought or sold. * **item //ref// data value 5 copper** — five copper * **item //ref// data value 1 silver 5 copper** — mixed coins (gold, silver, copper) == Stocking goods to sell To put goods on the shelves, **give** the shopkeeper items you've priced — giving is just a plain hand-over, so the item drops straight into the shop, for sale. By default an item is **one of a kind**: once a player buys it, it's gone. Mark an item **data stock true** and the shop **never runs out** of it (each sale hands the buyer a fresh copy): {{{ item create torch item torch data value 5 copper item torch data stock true give torch grocer }}} The grocer now sells torches forever. (A shop also re-sells items players bring in — see below — but those are finite and vanish once bought.) == Buying from players: the till and the rate A shop **buys** items players sell it, then re-sells them at full value. Two fields control the buying side: * **data rate //percent//** — how much of an item's value the shop pays, default **50**. //mob grocer data rate 40// pays 40%. * **data gold / silver / copper** — the shop's **till**. Seed it so the shop has coin to pay with: //mob grocer data gold 20//. When the till is empty the shop can't buy until it earns more (players buying from it top it up). A shop won't buy **junk**, **cursed**, **donated** or **garbage** goods (the sort that pile up in the recycling and the dump), nor anything with no value. == Player commands These work whenever a shopkeeper is in the room: * **list** — what the shop sells, with prices (an endless line reads //(in stock)//) * **value //item//** — ask the shopkeeper what they'd give you for it (their offer) * **buy //item//** or **buy //n// //item//** — buy at full value (//buy 5 arrows//) * **sell //item//** or **sell //n// //item//** — sell at the shop's rate * **sell all //[keyword]//** — offer each carried item in turn; answer **y**, **n**, or **q** to quit == A worked example {{{ mob create blacksmith mob blacksmith data shopkeeper true mob blacksmith data npc true mob blacksmith data rate 40 mob blacksmith data gold 25 item create dagger item dagger data value 2 silver item dagger data stock true give dagger blacksmith }}} The blacksmith now sells daggers (2 silver each, never out of stock) and buys blades adventurers bring in at 40% of their value, paying from a 25-gold till. == See also * **[[All about Mobiles]]** — making and configuring the shopkeeper itself * **[[All about Items]]** — creating, describing and pricing items * In-game: **help item**, **help mob**