SUMMARY This patch attempts to reduce or eliminate town scumming by having shop keepers remember which items you purchase frequently, and keep those in stock. It does not affect the black market. This patch should be available at: http://www.visi.com/~jmr/angband/README.angband-3.0.3-store-patch.html MOTIVATION I was motivated to write this after watching my girlfriend town scum endlessly looking for enchantment scrolls so that her arrows would stack. In an e-mail conversation with Mr. Ruhlmann, he asked why I didn't simply force certain items to always be stocked, as that would certainly require less code. I did it this way because I didn't want to decide for all players which items should be stocked. Also, the items a player wants change over the course of the game. My way, each player will have the items he/she buys in stock, no matter which items those are. If your level 50 warrior finds cure light wounds potions useful, my patch tries to make sure that he/she has an ample supply. Also, in the real world, store owners make an effort to keep things people actually buy in stock (not that the real world has any particular bearing on the angband world). TECHNICAL DETAILS I define a store_inventory_type which contains the k_idx of an item, and a count indicating how often the player buys the item. I modify the store_type to include an array of store_inventory_type structures. The count for an item is incremented (currently by 50) each time the player buys the item, and is decremented by 1 each time the stores shuffle their inventory (currently every 1,000 turns). I keep the array sorted by count, and shops consult the array when generating new items to stock the stores. In this way, shop keepers keep the items the player buys the most in stock. Also, over time, the shop keepers "forget" about items if you don't keep buying them. Once an item's count drops to zero, it is completely forgotten about. Storing this array required a change to the save file format. Appropriate changes have been made to load.c and save.c and the VERSION_* defines has been updated (to 3.1.0). I have tested upgrading 3.0.X savefiles. I've put in some debug commands which let you look at and clear the inventory control data. Debug command 'S' dumps out the inventory control structures for all stores. Debug command 'I' clears the inventory control structures for all stores. The default keymap for accessing the debug commands is ctrl-a. DISCLAIMER Applying this patch may cause your angband to become unstable, and could possibly corrupt your savefile. Please backup your savefile before converting to the new format. (IMHO,) I'm a pretty solid professional coder, but this is the first time I've ever seriously hacked angband. I've done a reasonable amount of hand testing of the code, and my girlfriend has been running a character on an angband with this patch and the auto-squelch patch for a couple weeks with no troubles. INSTALLATION Make a backup copy of your savefile! patch -p0 < angband-3.0.3-store-patch cd angband-3.0.3/src make install Play!