UODiamondCodex

Player Vendors System

A full player-owned vendor system: place a vendor deed in your house, stock items into sell-bags, price them, and let customers buy — with owner controls for pricing, sharing, restocking, appearance, and cashing out. Source: UOD - System Vendors.scp.

How it works

Placingi_deed_vendor_male / i_deed_vendor_female deeds may only be used inside a house region (r_housing) by a house owner/co-owner/friend. Double-clicking spawns c_vendor_male / c_vendor_female, which run f_initvendor on creation.

Initialisationf_initvendor sets the NPC's stats/brain, colours and titles it "The Vendor," adds the e_vendor_custom event, gives it a backpack, and creates 10 heavy i_vendor_sell containers ("Sell Bags") to hold stock. Ownership is transferred with a linked i_memory (vendor_transfer).

Ownership & permissionsvendor_isadmin returns true for GMs, the vendor's tag.owner, and (when tag.shared==1) the house's owners/co-owners. This gates all management actions.

Stocking & pricing — dropping an item onto a sell-bag/vendor (ContainerDroponSelf / e_selling) calls f_setdefaultprice, which flags the item for sale (e_selling, price 0) and neutralises its type so it can't be used. Owners set a price by double-clicking a for-sale item → dialog d_vendor_pricef_vendor_setprice → console prompt (price_this_item, max 9,999,999gp). f_unsetdefaultprice reverses this when an item is removed or sold.

Buying — a customer double-clicking the vendor (via e_vendor_custom @dclick) hears a greeting and has the stocked sell-bags opened (f_vendor_opencontainers). Double-clicking a priced item shows d_vendor_purchase; confirming checks the buyer's gold (backpack or bank layer 29), consumes it, plays the pay sound, credits tag.money, and bounces the item to the buyer.

Home-keepingi_vendor_go (equipped on the vendor) periodically checks the vendor is still on its house sign spot and, if displaced, walks it home and keeps its food topped up.

Commands / player-facing usage

Interaction is through the vendor NPC and its gumps, not .commands. The main owner gump d_vendor (opened by double-clicking your own vendor) offers:

Button Action
Toggle activation Enable/disable the store
Get sales total Withdraw accumulated gold as an i_check (owner only)
Undress Strip the vendor; clothes go to your pack
Switch sex Toggle Male/Female body
Rename rename_vendor — rename the vendor via console prompt
Redeed Turn the vendor back into a deed (deletes its stock & gold)
Toggle share Share management with house Owner/Co-Owners (tag.shared)
Stock Open the 10 sell-bags to load stock (f_vendor_opencontainers)

Key definitions

DEFNAME Role
c_vendor_male / c_vendor_female The vendor NPC chardefs
i_deed_vendor_male / i_deed_vendor_female House-only placement deeds
f_initvendor Sets up a new vendor (stats, 10 sell-bags, ownership)
e_vendor_custom (EVENTS) Core vendor behaviour: click/dclick, ownership, greeting
e_selling (TYPEDEF) Marks an item as for-sale; handles price/purchase clicks
i_vendor_sell "Sell Bag" stock container (10 per vendor)
vendor_isadmin Permission check (owner / co-owner / GM)
f_setdefaultprice / f_unsetdefaultprice Flag/unflag an item for sale
f_vendor_setprice / price_this_item Owner price-setting flow
d_vendor / d_vendor_price / d_vendor_purchase Management, pricing, and buy gumps
i_vendor_go Keeps the vendor on its home spot and fed
tag.money / tag.owner / tag.shared / tag.enabled Vendor state tags

Note: Items with tag.type == t_normal are treated as "bugged" and cannot be bought/sold until replaced — a data-migration guard. Message colours use def.sysvendor / def.systarget.