Section 7:    #SHOPS

Here's how a shop is formatted:

[mob#] [item types] [profit-buy] [p-sell] [op-hour] [close] [MaxNumber] [ProdRate] [InitNumber]


3000 2 3 4 10 0    105 15    0 23    35 5 15   * the wizard

All of these options are on the same line. 0 (zero) ends the section.

The first value, the mobile-vnum, is the 'keeper', or the mobile who is the shopkeeper. ALL MOBILES with that vnum will be shopkeepers.

The [item types] section designates what the keeper will buy. He may buy up to five types of items, and zeroes must be placed in the shop entry for anything less than five. (The wizard above buys scrolls, wands, staves and potions, and a zero is placed in the last option since he only buys four types of things. If all the slots were set to zero, he wouldn't buy anything, but he would still sell what he was loaded as having.)

The following is a list of acceptable object numbers and their corresponding types:

1  Light                28 Map
2  Scroll               29 Portal
3  Wand                 30 Warpstone
4  Staff                32 Gem
5  Weapon               33 Jewelry
8  Treasure             38 Quiver
9  Armor                43 Ring
10 Potion               45 Sheath
11 Clothing             46 Trophy
12 Furniture            48 Instrument
15 Container            49 Missile
17 Drink container      52 Shield
22 Boat                 53 Buckler
26 Pill

(Any item type not listed in the above is not listed either because it is not appropriate to have a shopkeeper that would buy that type of item, or because that type of item can't be sold (like money :).)

The 'profit-buy' number is a markup for players buying the item, in percentage points. 100 is nominal price; 150 is 50% markup, and so on. The 'profit-sell' number is a markdown for players selling the item, in percentage points. 100 is nominal price, 75 is 25% markdown, and so on. The buying markup should be at least 100, generally greater, and the selling markdown should be no more than 100, generally lower.

The 'open-hour' and 'close-hour' numbers define the hours when the shopkeeper will do business. For a 24-hour shop, these numbers would be 0 and 23.

Now we have the problem that a full set of armor is produced in much more time than a bread would. Therefore, the following fields have been added:

The 'MaxNumber' contains the maximum amount of any item that the shopkeeper can store in his shop. This means, he will produce until this number is reached. The 'ProdRate' (Production Rate) controls how many items a shopkeeper can produce in one day. This means, this value is set to the amount of items produced in one day for each item he produces. The last value, 'InitNumber', sets the number of items the shopkeeper starts with when the Mud is started. Please remember that these values count for every different item that is produced.

Everything beyond 'InitNumber' to the end of the line is taken to be a comment.

Note that there is no room number for a shop. Just load the shopkeeper mobile into the room of your choice, via that #RESETS section, and make the mobile a sentinel in the ACT-FLAGS section of the mobile in #MOBILES. Or, for a wandering shopkeeper, just make it non-sentinel.

The objects the shopkeeper sells are exactly those loaded by the 'G' reset command in #RESETS for that shopkeeper. These items replenish automatically. If a player sells an object to a shopkeeper, the shopkeeper will keep it for resale if he, she, or it doesn't already have an identical object. The items a player sells to a shopkeeper, however, do not replenish.

Shopkeepers should generally be flagged as NO_PURGE.

Hints for creating shopkeepers

8. The #SPECIALS Format

M [mobvnum] [spec_fun word] 
S (end of section) 


M 1000 spec_breath_gas

Special procedures are not assigned in the mobile structure itself, but they do relate directly to mobiles. The procedure for assigning procedures will be detailed in another document, but the basic function is covered here.

A special procedure gives a mobile some added functionality, allowing it do more complicated actions than are normally possible. Examples are Hassan's guardian duties, the fido's ability to eat corpses, and the warring mobiles in the dangerous neighborhood. New specials can be requested, but don't rely on someone else being willing to code one for you.

The following specials are available:

spec_breath_acidMobile breathes acid in combat
spec_breath_fireMobile breathes fire in combat (area attack)
spec_breath_frostMobile breathes frost in combat (area attack)
spec_breath_gasMobile breathes poison gas in combat (area attack)
spec_breath_lightningMobile breathes lightning in combat
spec_breath_anyMobile may use any breath weapon
spec_cast_adeptMobile casts helpful spells on low-level players
spec_cast_clericMobile casts clerical spells (ALWAYS set the cleric act flag)
spec_cast_mageMobile casts mage spells (ALWAYS set the mage act flag)
spec_cast_undeadMobile casts spells appropriate for the undead
spec_executionerMobile attacks Killers and Thieves
spec_fidoMobile devours corpses
spec_guardMobile protects good-aligned people from attack
spec_janitorMobile cleans up junk lying on the ground
spec_poisonMobile has a poison attack
spec_thiefMobile steals gold (ALWAYS set the thief act flag)
spec_nasty_thiefMobile attacks, robs, and runs (ALWAYS set thief flag)

The following specials are coded, but should NOT be used because they are tailored to specific mobiles. Check them out online for examples of unique or area-specific specials that can possibly be coded for your mobiles:

spec_troll_memberMobile attacks ogre gang members (gangland mobs only)
spec_ogre_memberMobile attacks troll gang members (gangland mobs only)
spec_patrolmanMobile tries to break up fights (gangland mobs only)
spec_mayorThe Midgaard mayor special (opens/closes city gates ..)

Hints for creating shopkeepers