1 /* SCCS Id: @(#)shknam.c 3.4 2003/01/09 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* shknam.c -- initialize a shop */
11 extern const struct shclass shtypes
[];
15 STATIC_DCL
void mkshobj_at(const struct shclass
*,int,int,BOOLEAN_P
);
16 STATIC_DCL
void nameshk(struct monst
*,const char * const *);
17 STATIC_DCL
int shkinit(const struct shclass
*,struct mkroom
*);
19 STATIC_DCL
void stock_blkmar(const struct shclass
*, struct mkroom
*, int);
21 /* WAC init shk services */
22 static void init_shk_services(struct monst
*);
25 static const char * const shkliquors
[] = {
27 "Njezjin", "Tsjernigof", "Ossipewsk", "Gorlowka",
31 "Konosja", "Weliki Oestjoeg", "Syktywkar", "Sablja",
34 "Walbrzych", "Swidnica", "Klodzko", "Raciborz", "Gliwice",
35 "Brzeg", "Krnov", "Hradec Kralove",
37 "Leuk", "Brig", "Brienz", "Thun", "Sarnen", "Burglen", "Elm",
38 "Flims", "Vals", "Schuls", "Zum Loch",
40 "Aganippe", "Appias", "Bolbe", "Limnaee", "Pallas", "Tritonis",
41 "Abarbarea", "Aegina", "Asopis", "Chalcis", "Cleone", "Combe",
42 "Corcyra", "Euboea", "Gargaphia", "Harpina", "Ismene", "Nemea",
43 "Ornea", "Peirene", "Salamis", "Sinope", "Tanagra", "Thebe",
46 "Schwiederloch", "Shol", "Pfahlhirsch", "Spendthrift",
47 "Heartfont", "Chansina", "Delilah", "Marihuana", "Boeing",
48 "Kovvelkov", "Jeler", "Hesser", "Rutte", "Meir", "Suchanek",
49 "Jannter", "Erdinger", "Warsteiner", "Grolsch", "Jack Daniels",
50 "Champagner", "Surilie", "Tamika", "Ga'er", "Tsedong",
51 "Moonjava", "Wollfahrt", "Andrews", "Browning", "Craven",
52 "Englefitch", "Gainsforth", "Hawkins", "Killingbeck", "Litton",
53 "Nebbish", "Rawlins", "Shingleton", "Waldegrove", "Zed",
57 static const char * const shkbooks
[] = {
59 "Skibbereen", "Kanturk", "Rath Luirc", "Ennistymon", "Lahinch",
60 "Kinnegad", "Lugnaquillia", "Enniscorthy", "Gweebarra",
61 "Kittamagh", "Nenagh", "Sneem", "Ballingeary", "Kilgarvan",
62 "Cahersiveen", "Glenbeigh", "Kilmihil", "Kiltamagh",
63 "Droichead Atha", "Inniscrone", "Clonegal", "Lisnaskea",
64 "Culdaff", "Dunfanaghy", "Inishbofin", "Kesh",
65 "Loughrea", "Croagh", "Maumakeogh", "Ballyjamesduff",
67 "Gilman", "Marsh", "Banks", "Waite", "Eliot", "Olmstead",
69 "Benderaz", "Nagano", "Newbig", "Hayabusa", "Eckart",
70 "Usanna", "Tresh", "Also Matte", "SIR", "Schroeder", "Shmeil",
71 "Wellstruct", "Seasoon", "Zhangmu", "Drepung", "Petal",
72 "Rokasel", "Ashton", "Callthorpe", "Crocker", "Epworth",
73 "Gibbs", "Higgledy", "Kirkeby", "Loddington", "Norwood",
74 "Robertson", "Skulker", "Waltham",
78 static const char * const shkarmors
[] = {
80 "Demirci", "Kalecik", "Boyabai", "Yildizeli", "Gaziantep",
81 "Siirt", "Akhalataki", "Tirebolu", "Aksaray", "Ermenak",
82 "Iskenderun", "Kadirli", "Siverek", "Pervari", "Malasgirt",
83 "Bayburt", "Ayancik", "Zonguldak", "Balya", "Tefenni",
84 "Artvin", "Kars", "Makharadze", "Malazgirt", "Midyat",
85 "Birecik", "Kirikkale", "Alaca", "Polatli", "Nallihan",
87 "Luna", "Nagi", "Nguyen", "Pecker", "Marid", "Warrington",
88 "Koopa", "Pietra", "Runner", "Iris flax", "Muxfield", "Petry",
89 "Erdogan", "Cunaj", "Istanbul", "Bosporus", "Hamzic", "Rikaze",
90 "Azura", "Rhiannon", "Ceyra", "Aynesworth", "Carlyle",
91 "Cunningham", "Esmund", "Glendale", "Hightower", "Kirkland",
92 "Malingerer", "Nottingham", "Rochforth", "Snelling", "Welkins",
96 static const char * const shkwands
[] = {
98 "Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach",
99 "Rhaeader", "Llandrindod", "Llanfair-ym-muallt",
100 "Y-Fenni", "Maesteg", "Rhydaman", "Beddgelert",
101 "Curig", "Llanrwst", "Llanerchymedd", "Caergybi",
103 "Nairn", "Turriff", "Inverurie", "Braemar", "Lochnagar",
104 "Kerloch", "Beinn a Ghlo", "Drumnadrochit", "Morven",
105 "Uist", "Storr", "Sgurr na Ciche", "Cannich", "Gairloch",
106 "Kyleakin", "Dunvegan",
108 "Walter", "Hall", "Hagen", "Rehe", "Pale", "Head", "Left",
109 "Haxxor", "Bolgra", "Baeran", "Telpan", "Klaf", "Trump", "Rary",
110 "Gallardo", "Peng", "Knat", "Glatz", "Jiangji", "Blaze",
111 "Starla", "Baendre", "Babington", "Caxton", "Danvers", "Fackler",
112 "Glover", "Hooks", "Knivetton", "Mahoney", "Olingsworth",
113 "Russell", "Staverton", "Wexcombe",
117 static const char * const shkrings
[] = {
118 /* Hollandse familienamen */
119 "Feyfer", "Flugi", "Gheel", "Havic", "Haynin", "Hoboken",
120 "Imbyze", "Juyn", "Kinsky", "Massis", "Matray", "Moy",
121 "Olycan", "Sadelin", "Svaving", "Tapper", "Terwen", "Wirix",
123 /* Skandinaviske navne */
124 "Rastegaisa", "Varjag Njarga", "Kautekeino", "Abisko",
125 "Enontekis", "Rovaniemi", "Avasaksa", "Haparanda",
126 "Lulea", "Gellivare", "Oeloe", "Kajaani", "Fauske",
128 "Sechs", "Saasch", "Schmitt", "Eigenlob", "Gynn", "Merilis",
129 "Agnethasson", "Grahw", "Buffy", "Madrugada", "Ata", "Gaab",
130 "Changdu", "Breanna", "Tranquilla", "Boerd", "Bartleby",
131 "Chamberlain", "Derington", "Fenton", "Goldsmith", "Hornblower",
132 "Lambert", "Marcheford", "Oxenbrigg", "Salter", "Styles",
137 static const char * const shkfoods
[] = {
139 "Djasinga", "Tjibarusa", "Tjiwidej", "Pengalengan",
140 "Bandjar", "Parbalingga", "Bojolali", "Sarangan",
141 "Ngebel", "Djombang", "Ardjawinangun", "Berbek",
142 "Papar", "Baliga", "Tjisolok", "Siboga", "Banjoewangi",
143 "Trenggalek", "Karangkobar", "Njalindoeng", "Pasawahan",
144 "Pameunpeuk", "Patjitan", "Kediri", "Pemboeang", "Tringanoe",
145 "Makin", "Tipor", "Semai", "Berhala", "Tegal", "Samoe",
147 "Bort", "Plejan", "Raj", "Bruch", "Himal", "Manger", "Kelk",
148 "Kraj", "Wurie", "Putin", "Dessert", "Suesska", "Vada",
149 "Cranice", "Ice Bird", "Doener Kebap", "Shawarma", "McDonalds",
150 "Burger King", "Kentucky Fried Chicken", "Mandy", "Le Crobag",
151 "Linzhi", "Breezy", "Windsong", "Epart", "Beckingham", "Chester",
152 "Digby", "Finch", "Goseborne", "Hornebolt", "Lancelot",
153 "Massingbird", "Parsons", "Sapsucker", "Sweetchuck",
158 static const char * const shkweapons
[] = {
160 "Voulgezac", "Rouffiac", "Lerignac", "Touverac", "Guizengeard",
161 "Melac", "Neuvicq", "Vanzac", "Picq", "Urignac", "Corignac",
162 "Fleac", "Lonzac", "Vergt", "Queyssac", "Liorac", "Echourgnac",
163 "Cazelon", "Eypau", "Carignan", "Monbazillac", "Jonzac",
164 "Pons", "Jumilhac", "Fenouilledes", "Laguiolet", "Saujon",
165 "Eymoutiers", "Eygurande", "Eauze", "Labouheyre",
166 /* Orkney http://www.contrib.andrew.cmu.edu/~grm/orkney.html */
167 "Crystie", "Marie", "Hector", "Inggagarth", "Cuthbert", "Marion",
168 "Ninian", "Margret", "Edduard", "Alisoun", "Androw", "Christeane",
169 "Henrie", "Sonneta", "Brandam", "Anne", "Malcolm", "Gelis", "Magnus",
170 "Katherein", "Edwart", "Katherine", "Johnne", "Cristiane", "Troelius",
171 "Helline", "Robertt", "Elspet", "Criste", "Alesoun", "Adam", "Helene",
172 "Williame", "Margrete", "Gibboun", "Mariota", "Niniane", "Margarete",
175 "Claude", "Catalina", "8-Ball", "Salvatore",
177 "Tommy", "Ken", "Vance", "Sonny", "Ricardo",
179 "Carl", "Sean", "Melvin", "Wilson", /* don't want "Lance" twice, sorry Soviet --Amy */
181 "Niko", "Dimitri", "Mikhail", "Vlad",
185 "Michael", "Franklin", "Trevor", "Steve",
188 "Legel", "Deathstrike", "Arschegast", "Mashevka", "Valus",
189 "Arm Chest Contractor", "Falcon", "Al Capone", "Schrack", "Mach",
190 "March", "Shigatse", "Dharma", "Zennia", "Boast", "Billingham",
191 "Chickenheart", "Donnett", "Fleetwilliam", "Grimsby", "Jay",
192 "Lassard", "Michelgrove", "Peckham", "Saunderson", "Tackleberry",
197 static const char * const shktools
[] = {
198 /* Amy edit: allow all names, regardless of which operating system you're using, because randomness FTW */
201 "Ymla", "Eed-morra", "Cubask", "Nieb", "Bnowr Falr", "Telloc Cyaj",
202 "Sperc", "Noskcirdneh", "Yawolloh", "Hyeghu", "Niskal", "Trahnil",
203 "Htargcm", "Enrobwem", "Kachzi Rellim", "Regien", "Donmyar",
204 "Yelpur", "Nosnehpets", "Stewe", "Renrut", "_Zlaw", "Nosalnef",
205 "Rewuorb", "Rellenk", "Yad", "Cire Htims", "Y-crad", "Nenilukah",
207 "Erreip", "Nehpets", "Mron", "Snivek", "Lapu", "Kahztiy",
208 "Lechaim", "Lexa", "Niod",
209 "Nhoj-lee", "Evad\'kh", "Ettaw-noj", "Tsew-mot", "Ydna-s",
210 "Yao-hang", "Tonbar", "Nivek", "Kivenhoug",
211 "Falo", "Nosid-da\'r", "Ekim-p", "Rebrol-nek", "Noslo", "Yl-rednow",
212 "Mured-oog", "Ivrajimsal",
213 "Nivram", "Llardom", "Nedraawi-nav",
214 "Lez-tneg", "Ytnu-haled", "Niknar", "AlliWar Wickson", "Oguhmk",
216 "Karma", "Sound Impacts", "Wheel Corner", "Montoya", "Lebenich",
217 "Strip-Mine", "be silent kert", "Being Moose", "Internet",
218 "Ancient Regime", "Work Houses", "Pipe Cutting Equipment", "Parvus",
219 "Gaellaei", "Tschulini", "Current Mountain", "Cuddle-Bundle",
220 "Coffin Nail", "Gyantse", "Feather", "Zoe", "El Sartre", "Boddenham",
221 "Clopton", "Duncombe", "Fleming", "Haddock", "Jameson", "Leventhorpe",
222 "Milsent", "Pemberton", "Schtulman", "Thornton", "Williams",
224 "Kaahb", "Badanoj", "Natas", "Sirhc", "Ntgnut", "Tnurgs",
225 "Remirol", "Noeda", "QIF", "Livednam", "Maerdixul", "Yvi Nedlog",
226 "Neercseulb", "Yton", "Ramysp", "Fle Cazorp", "Duam", "Selgnat",
227 "Nairodsay", "Repinsgub", "Sipokoileh", "Retnuh Navihs", "Rohk",
228 "Oirek", "Onnets", "Ypeed", "Lleremad", "Sia", "Dnnorle",
229 "Lidnnerae", "Htereblle", "Redocdnilb", "Ryklebli", "Thgink Yerg",
230 "Dexap", "Nogardlwarc", "Nacylg", "Nidrajsed Nouq",
231 "Omed", "Xniragag", "Evitcepsortni",
232 "Serolod", "Tehpmyn", "Irairam", "Ilol",
233 "Reppohssarg", "Aronumrat", "Nnyl", "Ylime", "Emilsrous",
234 "Gorflooc", "T0rm", "Suahnerri", "Grqerg", "Teuquob",
235 "Trqs Dedne Tsalb", "Leksrol", "Terger", "Urirat", "Laverog",
236 "Retniw", "Refrus Eutats", "Hagavvim Rey", "Eralfralos",
237 "Aimhtyhrra", "Essiar", "Sbut", "Arym Yresim", "Eirimnele",
238 "Tolasniw", "Aimyl", "Axxarhtoh", "Tcidsoa", "Redloheb", "Ycnuonna",
239 "Ahtariz", "Tlov", "Sohtilixitirk", "Nasrekir", "Owthtiek",
240 "Ledanagan", "Yoreel", "Garena", "Tsitonpyh", "Esoreci",
241 "Ikustodam", "Elomacaug Gnimalf", "Qretep", "Blevap", "Tnepocard",
242 "Plug Itna", "Oirdna", "Etinatem", "Lyrebyerg", "Nossllep",
243 "Esulcer", "Anelam", "Tsaebknip", "Enamkcim", "Namkrop",
244 "Goomorcim", "Rolam", "Kelrem", "Nomedcisum",
245 "Ruohruetama", "Resuelibom", "Ieoa", "Aletaber",
246 "Ecnalorcim", "Erifsysten", "Eribmu", "Iaf Tnc", "Ohor",
247 "Allobec", "Noocyt Elppaenip",
252 static const char * const shklight
[] = {
254 "Zarnesti", "Slanic", "Nehoiasu", "Ludus", "Sighisoara", "Nisipitu",
255 "Razboieni", "Bicaz", "Dorohoi", "Vaslui", "Fetesti", "Tirgu Neamt",
256 "Babadag", "Zimnicea", "Zlatna", "Jiu", "Eforie", "Mamaia",
258 "Silistra", "Tulovo", "Panagyuritshte", "Smolyan", "Kirklareli",
259 "Pernik", "Lom", "Haskovo", "Dobrinishte", "Varvara", "Oryahovo",
260 "Troyan", "Lovech", "Sliven",
262 "Andre", "Daniel", "Tiago", "Alexandre", "Joao",
263 "Carlos", "Fabio", "Ricardo", "Gustavo", "Rafael",
264 "Felipe", "Anderson", "Jorge", "Paulo", "Jose",
265 "Rogerio", "Roberto", "Marcos", "Luis", "Luciano",
267 "Habich", "Trong-Oul", "Dumont", "Dumas", "Vittel", "Hattrick",
268 "Pekriah", "Innocentia", "Diagna", "Castor", "Ronaldo", "Ganden",
269 "Jasmine", "Zora", "Burner", "Dobrindt", "Bramfield", "Compton",
270 "Edgerton", "Fraidycat", "Hancock", "Jenner", "Lillyliver", "Moore",
271 "Poltroon", "Scroggs", "Thursby", "Withinghall",
272 "Dimaethor", "Hador", "Grond", "Hast", "Maeth",
273 "Rom", "Belegur", "Camaen", "Elvedui", "Gwaedh",
274 "Maen", "Maerphen", "Alagos", "Gaeralagos",
275 "Faimben", "Fain", "Loss", "Cugu",
279 static const char * const shkgeneral
[] = {
281 "Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi",
282 "Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo",
283 "Akalapi", "Sipaliwini",
285 "Annootok", "Upernavik", "Angmagssalik",
287 "Aklavik", "Inuvik", "Tuktoyaktuk",
288 "Chicoutimi", "Ouiatchouane", "Chibougamau",
289 "Matagami", "Kipawa", "Kinojevis",
290 "Abitibi", "Maganasipi",
292 "Akureyri", "Kopasker", "Budereyri", "Akranes", "Bordeyri",
295 "Punita", "Shakuntala", "Richa", "Ninad", "Nikhil", "Sumeet",
296 "Roshni", "Mohan", "Ranjeet", "Bipin", "Madhuri", "Abhijeet",
297 "Purnima", "Radha", "Grishma", "Satish", "Aparna", "Reena",
298 "Shrinivas", "Arjun", "Shekhar", "Deep", "Sameer", "Sunil", "Apoorva",
300 "Miller", "Merkel", "Stone", "Bitchiya", "Pedas", "Garbage Houses",
301 "Kun-Kwei", "Persh", "Levart", "Gunnhild", "Gardener", "Boker",
302 "Tsurphu", "Luna", "Endurance", "Schiesskanista", "Lindner",
303 "Bridgeman", "Cooke", "Eggerley", "Froggenhall", "Harricott",
304 "Jones", "Limsley", "Morley", "Pratt", "Seymour", "Tweedy",
309 static const char *shkblack
[] = {
310 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
311 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
312 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
313 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
314 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
315 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
316 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
317 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
318 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
319 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
320 "One-eyed Sam", "One-eyed Sam", "One-eyed Sam",
324 /* STEPHEN WHITE'S NEW CODE */
325 static const char *shkpet
[] = {
326 "Silistra", "Tulovo", "Panagyuritshte", "Smolyan", "Kirklareli",
327 "Pernik", "Lom", "Haskovo", "Dobrinishte", "Varvara", "Oryahovo",
328 "Troyan", "Lovech", "Sliven",
329 /* Bee scientific names */
330 "Apis", "Mellifera", "Cerana", "Dorsata", "Andreniformis",
331 "Florea", "Nearctica", "Nigrocincta",
333 "Crematogaster", "Linepithema", "Humile", "Pheidole", "Nylanderia",
334 "Pubens", "Camponotus", "Lasius", "Alienus",
335 "Paratrechina", "Longicornis", "Solenopsis", "Invicta", "Tapinoma",
336 "Melanocephalum", "Monomorium", "Minimum", "Tetramorium", "Caespitum",
337 "Paraonis", "Dorymyrmex", "Brachymyrmex", "Technomyrmex", "Albipes",
338 /* Crab scientific names */
339 "Potamon", "Ibericum", "Parathelphusa", "Convexa", "Johongarthia", "Lagostoma",
340 "Gecarcoidea", "Natalis",
342 "War Mountain", "Oro", "Pure", "King", "Funo", "Cuntrina",
343 "Tato", "Santana", "Dickmouth", "Mul", "White Logel", "Lhasa",
344 "Melody", "Moonbeam", "Whoopee", "Sanuuicula", "Brocksby",
345 "Cosworth", "Emerson", "Frye", "Harwood", "Kay", "Litchfield",
346 "Mouse", "Rampston", "Shawe", "Vernon", "Yellowbelly",
347 "Spiffy", "Bonko", "Binky", "Tubby", "Zippy", "Jumbo",
348 "Mittens", "Chuckles", "Bam Bam", "Larry", "Curly",
349 "Moe", "Zaff", "Punky",
354 * To add new shop types, all that is necessary is to edit the shtypes[] array.
355 * See mkroom.h for the structure definition. Typically, you'll have to lower
356 * some or all of the probability fields in old entries to free up some
357 * percentage for the new type.
359 * The placement type field is not yet used but will be in the near future.
361 * The iprobs array in each entry defines the probabilities for various kinds
362 * of objects to be present in the given shop type. You can associate with
363 * each percentage either a generic object type (represented by one of the
364 * *_CLASS macros) or a specific object (represented by an onames.h define).
365 * In the latter case, prepend it with a unary minus so the code can know
366 * (by testing the sign) whether to use mkobj() or mksobj().
368 /* KMH -- Don't forget to update mkroom.h and lev_main.c when adding
371 const struct shclass shtypes
[] = {
372 {"general store", RANDOM_CLASS
, 23,
373 D_SHOP
, {{100, WILDCARD_CLASS
}, {0, 0}, {0, 0}}, shkgeneral
},
374 {"used armor dealership", ARMOR_CLASS
, 17,
375 D_SHOP
, {{90, ARMOR_CLASS
}, {10, WEAPON_CLASS
}, {0, 0}},
377 {"second-hand bookstore", SCROLL_CLASS
, 4, D_SHOP
,
378 {{90, SCROLL_CLASS
}, {10, SPBOOK_CLASS
}, {0, 0}}, shkbooks
},
379 {"liquor emporium", POTION_CLASS
, 4, D_SHOP
,
380 {{100, POTION_CLASS
}, {0, 0}, {0, 0}}, shkliquors
},
381 {"weapons outlet", WEAPON_CLASS
, 17, D_SHOP
, {
382 {80, WEAPON_CLASS
}, {3, -PISTOL_BULLET
}, {1, -ASSAULT_RIFLE_BULLET
}, {3, -RIFLE_BULLET
}, {2, -SMG_BULLET
}, {1, -SILVER_PISTOL_BULLET
},
383 {10, ARMOR_CLASS
}, {0, 0}}, shkweapons
},
384 {"delicatessen", FOOD_CLASS
, 2, D_SHOP
,
385 {{83, FOOD_CLASS
}, {5, -POT_FRUIT_JUICE
}, {4, -POT_BOOZE
},
386 {5, -POT_WATER
}, {3, -ICE_BOX
}}, shkfoods
},
387 {"jewelers", RING_CLASS
, 3, D_SHOP
,
388 {{85, RING_CLASS
}, {9, GEM_CLASS
}, {5, AMULET_CLASS
}, {1, IMPLANT_CLASS
}, {0, 0}},
390 {"quality apparel and accessories", WAND_CLASS
, 4, D_SHOP
,
391 {{96, WAND_CLASS
}, {2, -REGULAR_GLOVES
}, {2, -ELVEN_CLOAK
}, {0, 0}},
393 {"hardware store", TOOL_CLASS
, 3, D_SHOP
,
394 {{100, TOOL_CLASS
}, {0, 0}}, shktools
},
395 /* Actually shktools is ignored; the code specifically chooses a
396 * random implementor name (along with candle shops having
397 * random shopkeepers)
399 /* STEPHEN WHITE'S NEW CODE */
400 {"pet store", FOOD_CLASS
, 4, D_SHOP
, {
401 {67, -FIGURINE
}, {5, -LEATHER_LEASH
},{10, -TRIPE_RATION
}, {5, -LEATHER_SADDLE
},
402 {10, -TIN_WHISTLE
}, {3, -MAGIC_WHISTLE
}}, shkpet
},
403 /* Robin Johnson -- 4% taken from pet store */
404 {"frozen food store", FOOD_CLASS
, 4, D_SHOP
,
405 {{90, -ICE_BOX
}, {10, -TIN
},
406 /* shopkeeper will pay for corpses, but they aren't generated */
407 /* on the shop floor */
408 {0, -CORPSE
}, {0, 0}}, shkfoods
},
409 {"rare books", SPBOOK_CLASS
, 4, D_SHOP
,
410 {{90, SPBOOK_CLASS
}, {10, SCROLL_CLASS
}, {0, 0}}, shkbooks
},
411 {"fresh food store", FOOD_CLASS
, 1, D_SHOP
,
412 {{90, -CORPSE
}, {5, -TIN
}, {5, FOOD_CLASS
}, {0, 0}}, shkfoods
},
414 {"gun shop", WEAPON_CLASS
, 1, D_SHOP
, {
415 {16, -PISTOL
}, {17, -SUBMACHINE_GUN
}, {17, -HEAVY_MACHINE_GUN
}, {16, -RIFLE
}, {17, -ASSAULT_RIFLE
}, {17, -SNIPER_RIFLE
},
416 {0, 0}}, shkweapons
},
418 {"banging shop", WEAPON_CLASS
, 1, D_SHOP
, {
419 {24, -SHOTGUN
}, {1, -SAWED_OFF_SHOTGUN
}, {25, -AUTO_SHOTGUN
}, {25, -ROCKET_LAUNCHER
}, {25, -GRENADE_LAUNCHER
}, {0, 0}}, shkweapons
},
421 {"ammo shop", WEAPON_CLASS
, 1, D_SHOP
, {
422 {3, -PISTOL_BULLET
}, {3, -SMG_BULLET
}, {3, -RIFLE_BULLET
}, {3, -ASSAULT_RIFLE_BULLET
}, {2, -SNIPER_BULLET
}, {1, -MG_BULLET
}, {15, -SILVER_PISTOL_BULLET
}, {7, -SHOTGUN_SHELL
}, {7, -AUTO_SHOTGUN_SHELL
}, {13, -ROCKET
}, {1, -FIVE_SEVEN_BULLET
}, {14, -FRAG_GRENADE
}, {14, -GAS_GRENADE
}, {14, -STICK_OF_DYNAMITE
} }, shkweapons
},
424 {"lightning store", TOOL_CLASS
, 1, D_SHOP
,
425 {{25, -WAX_CANDLE
}, {35, -TALLOW_CANDLE
}, {5, -TORCH
}, {11, -BRASS_LANTERN
},
426 {16, -OIL_LAMP
}, {3, -MAGIC_LAMP
}, {5, -MAGIC_CANDLE
}}, shktools
},
428 {"one-stop mining shop", RANDOM_CLASS
, 1, D_SHOP
, {
429 {100, ROCK_CLASS
}, {0, 0}}, shktools
},
431 {"rock-solid store", RANDOM_CLASS
, 1, D_SHOP
, {
432 {14, -LUCKSTONE
}, {14, -HEALTHSTONE
}, {14, -TOUCHSTONE
}, {14, -LOADSTONE
}, {14, -WHETSTONE
}, {15, -FLINT
}, {15, -ROCK
}, {0, 0}}, shktools
},
434 {"weirdo shop", RANDOM_CLASS
, 1, D_SHOP
, {
435 {33, CHAIN_CLASS
}, {33, BALL_CLASS
}, {34, VENOM_CLASS
}, {0, 0}}, shktools
},
437 {"zorkmid store", RANDOM_CLASS
, 1,
438 D_SHOP
, {{100, COIN_CLASS
}, {0, 0}, {0, 0}}, shkgeneral
},
440 {"health food store", FOOD_CLASS
, 1, D_SHOP
, {
441 {20, -EUCALYPTUS_LEAF
}, {9, -CLOVE_OF_GARLIC
}, {9, -SPRIG_OF_WOLFSBANE
}, {8, -MEADOWFOAM
}, {8, -MOTHERWORT
}, {8, -WATER_HYACINTH
}, {10, -LICHOR
}, {10, -AMBROSIA
}, {5, -LUMP_OF_ROYAL_JELLY
}, {1, -HONEYCOMB
}, {4, -DIGESTION_CAKE
}, {8, -MAGIC_BANANA
}, {0, 0}}, shkfoods
},
443 {"fast food store", FOOD_CLASS
, 1, D_SHOP
, {
444 {10, -SANDWICH
}, {10, -PANCAKE
}, {10, -TORTILLA
}, {10, -PASTA
}, {40, -SLICE_OF_PIZZA
}, {10, -LUNCH_OF_BOILED_EGG
}, {10, -PIZZA
}, {0, 0}}, shkfoods
},
446 {"random store", RANDOM_CLASS
, 0,
447 D_SHOP
, {{100, COIN_CLASS
}, {0, 0}, {0, 0}}, shkgeneral
},
449 /* Shops below this point are "unique". That is they must all have a
450 * probability of zero. They are only created via the special level
453 {"lighting store", TOOL_CLASS
, 0, D_SHOP
,
454 {{25, -WAX_CANDLE
}, {35, -TALLOW_CANDLE
}, {5, -TORCH
}, {11, -BRASS_LANTERN
},
455 {16, -OIL_LAMP
}, {3, -MAGIC_LAMP
}, {5, -MAGIC_CANDLE
}}, shklight
},
456 {"black market", RANDOM_CLASS
, 0, D_SHOP
,
457 {{100, WILDCARD_CLASS
}, {0, 0}, {0, 0}}, shkblack
},
458 {(char *)0, 0, 0, 0, {{0, 0}, {0, 0}, {0, 0}}, 0}
462 /* validate shop probabilities; otherwise incorrect local changes could
463 end up provoking infinite loops or wild subscripts fetching garbage */
465 init_shop_selection()
467 register int i
, j
, item_prob
, shop_prob
;
469 for (shop_prob
= 0, i
= 0; i
< SIZE(shtypes
); i
++) {
470 shop_prob
+= shtypes
[i
].prob
;
471 for (item_prob
= 0, j
= 0; j
< SIZE(shtypes
[0].iprobs
); j
++)
472 item_prob
+= shtypes
[i
].iprobs
[j
].iprob
;
473 if (item_prob
!= 100)
474 panic("item probabilities total to %d for %s shops!",
475 item_prob
, shtypes
[i
].name
);
477 if (shop_prob
!= 100)
478 panic("shop probabilities total to %d!", shop_prob
);
483 mkshobj_at(shp
, sx
, sy
, artif
)
484 /* make an object of the appropriate type for a shop square */
485 const struct shclass
*shp
;
491 struct permonst
*ptr
;
493 /* Amy edit: since the maximum dungeon level is much higher, we need to adjust this calculation */
494 if (rn2(250) < depth(&u
.uz
) &&
495 !MON_AT(sx
, sy
) && (ptr
= mkclass(S_MIMIC
,0)) &&
496 (mtmp
= makemon(ptr
,sx
,sy
,NO_MM_FLAGS
)) != 0) {
497 /* note: makemon will set the mimic symbol to a shop item */
498 if (rn2(10) >= depth(&u
.uz
)) {
499 mtmp
->m_ap_type
= M_AP_OBJECT
;
500 mtmp
->mappearance
= STRANGE_OBJECT
;
504 if (timebasedlowerchance() && (rnd(100) > u
.shopitemreduction
) ) {
506 atype
= get_shop_item(shp
- shtypes
);
509 if (atype
== -ICE_BOX
&& artif
== TRUE
) artif
= FALSE
;
511 (void) mksobj_at(-atype
, sx
, sy
, TRUE
, artif
, TRUE
);
513 (void) mkobj_at(atype
, sx
, sy
, artif
, TRUE
);
518 if (ishaxor
&& (rn2(250) >= depth(&u
.uz
)) ) {
520 if (timebasedlowerchance() && (rnd(100) > u
.shopitemreduction
) ) {
522 atype
= get_shop_item(shp
- shtypes
);
525 if (atype
== -ICE_BOX
&& artif
== TRUE
) artif
= FALSE
;
527 (void) mksobj_at(-atype
, sx
, sy
, TRUE
, artif
, TRUE
);
529 (void) mkobj_at(atype
, sx
, sy
, artif
, TRUE
);
536 /* extract a shopkeeper name for the given shop type */
540 const char * const *nlp
;
542 int i
, trycnt
, names_avail
;
543 const char *shname
= 0;
548 if (nlp
== shklight
&& In_mines(&u
.uz
)
549 && (sptr
= Is_special(&u
.uz
)) != 0 && sptr
->flags
.town
) {
550 /* special-case minetown lighting shk */
554 /* Amy edit: Izchak is ultra special :D */
557 shk
->noegodesc
= shk
->noegodisplay
= TRUE
;
561 shk
->egotype_wallwalk
= TRUE
;
565 shk
->egotype_disenchant
= TRUE
;
569 shk
->egotype_rust
= TRUE
;
573 shk
->egotype_corrosion
= TRUE
;
577 shk
->egotype_decay
= TRUE
;
581 shk
->egotype_flamer
= TRUE
;
585 shk
->egotype_blasphemer
= TRUE
;
589 shk
->egotype_inverter
= TRUE
;
593 shk
->egotype_debtor
= TRUE
;
597 shk
->egotype_dropper
= TRUE
;
601 shk
->egotype_wither
= TRUE
;
605 shk
->egotype_grab
= TRUE
;
609 shk
->egotype_slows
= TRUE
;
613 shk
->egotype_vampire
= TRUE
;
617 shk
->egotype_wrap
= TRUE
;
621 shk
->egotype_disease
= TRUE
;
625 shk
->egotype_slime
= TRUE
;
629 shk
->egotype_engrave
= TRUE
;
633 shk
->egotype_dark
= TRUE
;
637 shk
->egotype_luck
= TRUE
;
641 shk
->egotype_arcane
= TRUE
;
645 shk
->egotype_clerical
= TRUE
;
649 shk
->egotype_armorer
= TRUE
;
653 shk
->egotype_tank
= TRUE
;
657 shk
->egotype_speedster
= TRUE
;
661 shk
->egotype_racer
= TRUE
;
665 shk
->egotype_blaster
= TRUE
;
669 shk
->egotype_gator
= TRUE
;
673 shk
->egotype_reflecting
= TRUE
;
677 shk
->egotype_farter
= TRUE
;
681 shk
->egotype_watersplasher
= TRUE
;
685 shk
->egotype_cancellator
= TRUE
;
689 shk
->egotype_shredder
= TRUE
;
693 shk
->egotype_incrementor
= TRUE
;
697 shk
->egotype_mirrorimage
= TRUE
;
701 shk
->egotype_curser
= TRUE
;
705 shk
->egotype_cullen
= TRUE
;
709 shk
->egotype_webber
= TRUE
;
713 shk
->egotype_itemporter
= TRUE
;
717 shk
->egotype_abomination
= TRUE
;
721 shk
->egotype_flickerer
= TRUE
;
725 shk
->egotype_hitter
= TRUE
;
729 shk
->egotype_piercer
= TRUE
;
733 shk
->egotype_lifesaver
= TRUE
;
737 shk
->egotype_shader
= TRUE
;
741 shk
->egotype_amnesiac
= TRUE
;
745 shk
->egotype_trapmaster
= TRUE
;
749 shk
->egotype_mastercaster
= TRUE
;
753 shk
->egotype_sinner
= TRUE
;
757 shk
->egotype_weeper
= TRUE
;
761 shk
->egotype_destructor
= TRUE
;
765 shk
->egotype_trembler
= TRUE
;
769 shk
->egotype_worldender
= TRUE
;
773 shk
->egotype_damager
= TRUE
;
777 shk
->egotype_antitype
= TRUE
;
781 shk
->egotype_statdamager
= TRUE
;
785 shk
->egotype_nastycurser
= TRUE
;
789 shk
->egotype_sanitizer
= TRUE
;
793 shk
->egotype_rogue
= TRUE
;
797 shk
->egotype_champion
= TRUE
;
801 shk
->egotype_boss
= TRUE
;
805 shk
->egotype_atomizer
= TRUE
;
809 shk
->egotype_perfumespreader
= TRUE
;
813 shk
->egotype_converter
= TRUE
;
817 shk
->egotype_alladrainer
= TRUE
;
821 shk
->egotype_stabilizer
= TRUE
;
825 shk
->egotype_spoilerproofer
= TRUE
;
829 shk
->egotype_metalmafioso
= TRUE
;
833 shk
->egotype_deepstatemember
= TRUE
;
837 shk
->egotype_wouwouer
= TRUE
;
841 shk
->egotype_badowner
= TRUE
;
845 shk
->egotype_bleeder
= TRUE
;
849 shk
->egotype_shanker
= TRUE
;
853 shk
->egotype_terrorizer
= TRUE
;
857 shk
->egotype_feminizer
= TRUE
;
861 shk
->egotype_levitator
= TRUE
;
865 shk
->egotype_illusionator
= TRUE
;
869 shk
->egotype_stealer
= TRUE
;
873 shk
->egotype_stoner
= TRUE
;
877 shk
->egotype_maecke
= TRUE
;
881 shk
->egotype_amberite
= TRUE
;
883 /* Izchak always has the laserpwnzor and datadeleter egotypes --Amy */
885 shk
->egotype_laserpwnzor
= TRUE
;
886 shk
->egotype_datadeleter
= TRUE
;
888 } else if (nlp
== shkblack
) {
889 /* special-case black marketeer */
890 shname
= "One-eyed Sam";
891 shk
->female
= shk
->data
->mflags2
& M2_MALE
? FALSE
: TRUE
;
893 /* Amy edit: Sam is even more special! */
895 shk
->noegodesc
= shk
->noegodisplay
= TRUE
;
898 shk
->egotype_wallwalk
= TRUE
;
902 shk
->egotype_disenchant
= TRUE
;
906 shk
->egotype_rust
= TRUE
;
910 shk
->egotype_corrosion
= TRUE
;
914 shk
->egotype_decay
= TRUE
;
918 shk
->egotype_flamer
= TRUE
;
922 shk
->egotype_blasphemer
= TRUE
;
926 shk
->egotype_inverter
= TRUE
;
930 shk
->egotype_debtor
= TRUE
;
934 shk
->egotype_dropper
= TRUE
;
938 shk
->egotype_wither
= TRUE
;
942 shk
->egotype_grab
= TRUE
;
946 shk
->egotype_slows
= TRUE
;
950 shk
->egotype_vampire
= TRUE
;
954 shk
->egotype_wrap
= TRUE
;
958 shk
->egotype_disease
= TRUE
;
962 shk
->egotype_slime
= TRUE
;
966 shk
->egotype_engrave
= TRUE
;
970 shk
->egotype_dark
= TRUE
;
974 shk
->egotype_luck
= TRUE
;
978 shk
->egotype_arcane
= TRUE
;
982 shk
->egotype_clerical
= TRUE
;
986 shk
->egotype_armorer
= TRUE
;
990 shk
->egotype_tank
= TRUE
;
994 shk
->egotype_speedster
= TRUE
;
998 shk
->egotype_racer
= TRUE
;
1002 shk
->egotype_blaster
= TRUE
;
1006 shk
->egotype_gator
= TRUE
;
1010 shk
->egotype_reflecting
= TRUE
;
1014 shk
->egotype_farter
= TRUE
;
1018 shk
->egotype_watersplasher
= TRUE
;
1022 shk
->egotype_cancellator
= TRUE
;
1026 shk
->egotype_shredder
= TRUE
;
1030 shk
->egotype_incrementor
= TRUE
;
1034 shk
->egotype_mirrorimage
= TRUE
;
1038 shk
->egotype_curser
= TRUE
;
1042 shk
->egotype_cullen
= TRUE
;
1046 shk
->egotype_webber
= TRUE
;
1050 shk
->egotype_itemporter
= TRUE
;
1054 shk
->egotype_abomination
= TRUE
;
1058 shk
->egotype_flickerer
= TRUE
;
1062 shk
->egotype_hitter
= TRUE
;
1066 shk
->egotype_piercer
= TRUE
;
1070 shk
->egotype_lifesaver
= TRUE
;
1074 shk
->egotype_shader
= TRUE
;
1078 shk
->egotype_amnesiac
= TRUE
;
1082 shk
->egotype_trapmaster
= TRUE
;
1086 shk
->egotype_mastercaster
= TRUE
;
1090 shk
->egotype_sinner
= TRUE
;
1094 shk
->egotype_weeper
= TRUE
;
1098 shk
->egotype_destructor
= TRUE
;
1102 shk
->egotype_datadeleter
= TRUE
;
1106 shk
->egotype_trembler
= TRUE
;
1110 shk
->egotype_worldender
= TRUE
;
1114 shk
->egotype_damager
= TRUE
;
1118 shk
->egotype_antitype
= TRUE
;
1122 shk
->egotype_statdamager
= TRUE
;
1126 shk
->egotype_nastycurser
= TRUE
;
1130 shk
->egotype_sanitizer
= TRUE
;
1134 shk
->egotype_rogue
= TRUE
;
1138 shk
->egotype_champion
= TRUE
;
1142 shk
->egotype_boss
= TRUE
;
1146 shk
->egotype_atomizer
= TRUE
;
1150 shk
->egotype_perfumespreader
= TRUE
;
1154 shk
->egotype_converter
= TRUE
;
1158 shk
->egotype_alladrainer
= TRUE
;
1162 shk
->egotype_stabilizer
= TRUE
;
1166 shk
->egotype_spoilerproofer
= TRUE
;
1170 shk
->egotype_metalmafioso
= TRUE
;
1174 shk
->egotype_deepstatemember
= TRUE
;
1178 shk
->egotype_wouwouer
= TRUE
;
1182 shk
->egotype_laserpwnzor
= TRUE
;
1186 shk
->egotype_badowner
= TRUE
;
1190 shk
->egotype_bleeder
= TRUE
;
1194 shk
->egotype_shanker
= TRUE
;
1198 shk
->egotype_terrorizer
= TRUE
;
1202 shk
->egotype_feminizer
= TRUE
;
1206 shk
->egotype_levitator
= TRUE
;
1210 shk
->egotype_illusionator
= TRUE
;
1214 shk
->egotype_stealer
= TRUE
;
1218 shk
->egotype_stoner
= TRUE
;
1222 shk
->egotype_maecke
= TRUE
;
1226 shk
->egotype_amberite
= TRUE
;
1230 /* We want variation from game to game, without needing the save
1231 and restore support which would be necessary for randomization;
1232 try not to make too many assumptions about time_t's internals;
1233 use ledger_no rather than depth to keep mine town distinct. */
1234 int nseed
= /*(int)((long)u.ubirthday / 257L);*/rnd(257);
1236 name_wanted
= ledger_no(&u
.uz
) + (nseed
% 13) - (nseed
% 5);
1237 if (name_wanted
< 0) name_wanted
+= (13 + 5);
1238 shk
->female
= name_wanted
& 1;
1240 for (names_avail
= 0; nlp
[names_avail
]; names_avail
++)
1243 for (trycnt
= 0; trycnt
< 50; trycnt
++) {
1244 if (nlp
== shktools
) {
1245 shname
= shktools
[rn2(names_avail
)];
1246 shk
->female
= (*shname
== '_');
1247 if (shk
->female
) shname
++;
1248 } else if (name_wanted
< names_avail
) {
1249 shname
= nlp
[name_wanted
];
1250 } else if ((i
= rn2(names_avail
)) != 0) {
1251 shname
= nlp
[i
- 1];
1252 } else if (nlp
!= shkgeneral
) {
1253 nlp
= shkgeneral
; /* try general names */
1254 for (names_avail
= 0; nlp
[names_avail
]; names_avail
++)
1256 continue; /* next `trycnt' iteration */
1258 shname
= shk
->female
? "Lucrezia" : "Dirk";
1261 /* is name already in use on this level? */
1262 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
1263 if (DEADMONSTER(mtmp
) || (mtmp
== shk
) || !mtmp
->isshk
) continue;
1264 if (strcmp(ESHK(mtmp
)->shknam
, shname
)) continue;
1267 if (!mtmp
) break; /* new name */
1270 (void) strncpy(ESHK(shk
)->shknam
, shname
, PL_NSIZ
);
1271 ESHK(shk
)->shknam
[PL_NSIZ
-1] = 0;
1275 shkinit(shp
, sroom
) /* create a new shopkeeper in the given room */
1276 const struct shclass
*shp
;
1277 struct mkroom
*sroom
;
1279 register int sh
, sx
, sy
;
1281 long shkmoney
; /* Temporary placeholder for Shopkeeper's initial capital */
1283 /* place the shopkeeper in the given room */
1288 /* check that the shopkeeper placement is sane */
1289 if(sroom
->irregular
) {
1290 int rmno
= (sroom
- rooms
) + ROOMOFFSET
;
1291 if (isok(sx
-1,sy
) && !levl
[sx
-1][sy
].edge
&&
1292 (int) levl
[sx
-1][sy
].roomno
== rmno
) sx
--;
1293 else if (isok(sx
+1,sy
) && !levl
[sx
+1][sy
].edge
&&
1294 (int) levl
[sx
+1][sy
].roomno
== rmno
) sx
++;
1295 else if (isok(sx
,sy
-1) && !levl
[sx
][sy
-1].edge
&&
1296 (int) levl
[sx
][sy
-1].roomno
== rmno
) sy
--;
1297 else if (isok(sx
,sy
+1) && !levl
[sx
][sy
+1].edge
&&
1298 (int) levl
[sx
][sy
+1].roomno
== rmno
) sx
++;
1299 else goto shk_failed
;
1301 else if(sx
== sroom
->lx
-1) sx
++;
1302 else if(sx
== sroom
->hx
+1) sx
--;
1303 else if(sy
== sroom
->ly
-1) sy
++;
1304 else if(sy
== sroom
->hy
+1) sy
--; else {
1308 /* Said to happen sometimes, but I have never seen it. */
1309 /* Supposedly fixed by fdoor change in mklev.c */
1311 register int j
= sroom
->doorct
;
1313 pline("Where is shopdoor?");
1314 pline("Room at (%d,%d),(%d,%d).",
1315 sroom
->lx
, sroom
->ly
, sroom
->hx
, sroom
->hy
);
1316 pline("doormax=%d doorct=%d fdoor=%d",
1317 doorindex
, sroom
->doorct
, sh
);
1319 pline("door [%d,%d]", doors
[sh
].x
, doors
[sh
].y
);
1322 display_nhwindow(WIN_MESSAGE
, FALSE
);
1329 if(MON_AT(sx
, sy
)) (void) rloc(m_at(sx
, sy
), FALSE
); /* insurance */
1331 /* now initialize the shopkeeper monster structure */
1334 if (Is_blackmarket(&u
.uz
)) {
1335 shk
= makemon(&mons
[PM_BLACK_MARKETEER
], sx
, sy
, NO_MM_FLAGS
);
1337 /* deepy wants shopkeepers to start out hostile to a venture capitalist --Amy */
1339 if(!(shk
= makemon(&mons
[((level_difficulty() + u
.pompejipermanentrecord
) > 79) ? PM_ELITE_SHOPKEEPER
: ((level_difficulty() + u
.pompejipermanentrecord
) > 59) ? PM_EXCEPTIONAL_SHOPKEEPER
: ((level_difficulty() + u
.pompejipermanentrecord
) > 39) ? PM_MASTER_SHOPKEEPER
: ((level_difficulty() + u
.pompejipermanentrecord
) > 19) ? PM_EXPERIENCED_SHOPKEEPER
: PM_SHOPKEEPER
], sx
, sy
, Race_if(PM_VENTURE_CAPITALIST
) ? MM_ANGRY
: NO_MM_FLAGS
)))
1343 shk
->isshk
= shk
->mpeaceful
= 1;
1344 if (Race_if(PM_VENTURE_CAPITALIST
)) shk
->mpeaceful
= 0;
1347 /*shk->mtrapseen = ~0;*/ /* we know all the traps already */
1348 ESHK(shk
)->shoproom
= (sroom
- rooms
) + ROOMOFFSET
;
1349 sroom
->resident
= shk
;
1350 ESHK(shk
)->shoptype
= sroom
->rtype
;
1351 assign_level(&(ESHK(shk
)->shoplevel
), &u
.uz
);
1352 ESHK(shk
)->creditlimit
= (5000 + (depth(&u
.uz
) * 1000) );
1353 ESHK(shk
)->totalcredit
= 0;
1354 ESHK(shk
)->shd
.x
= doors
[sh
].x
;
1355 ESHK(shk
)->shd
.y
= doors
[sh
].y
;
1356 ESHK(shk
)->shk
.x
= sx
;
1357 ESHK(shk
)->shk
.y
= sy
;
1358 ESHK(shk
)->robbed
= 0L;
1359 ESHK(shk
)->credit
= 0L;
1360 ESHK(shk
)->debit
= 0L;
1361 ESHK(shk
)->loan
= 0L;
1362 ESHK(shk
)->visitct
= 0;
1363 ESHK(shk
)->following
= 0;
1364 ESHK(shk
)->billct
= 0;
1365 /* WAC init services */
1366 init_shk_services(shk
);
1368 shkmoney
= 1000L + 30L*(long)rnd(100); /* initial capital */
1369 /* [CWC] Lets not create the money yet until we see if the
1370 shk is a black marketeer, else we'll have to create
1371 another money object, if GOLDOBJ is defined */
1373 if (shp
->shknms
== shkrings
)
1374 (void) mongets(shk
, TOUCHSTONE
);
1375 nameshk(shk
, shp
->shknms
);
1377 if (Is_blackmarket(&u
.uz
))
1378 shkmoney
= 7*shkmoney
+ rn2(3*shkmoney
);
1381 shk
->mgold
= shkmoney
;
1383 mkmonmoney(shk
, shkmoney
);
1386 if (Is_blackmarket(&u
.uz
)) {
1387 register struct obj
*otmp
;
1388 /* make sure black marketeer can wield Thiefbane */
1389 shk
->data
->maligntyp
= -1;
1390 /* black marketeer's equipment */
1391 otmp
= mksobj(LONG_SWORD
, FALSE
, FALSE
, FALSE
);
1393 otmp
= oname(otmp
, artiname(ART_THIEFBANE
));
1394 mpickobj(shk
, otmp
, TRUE
);
1395 if (otmp
->spe
< 5) otmp
->spe
+= rnd(5);
1397 otmp
= mksobj(SHIELD_OF_REFLECTION
, FALSE
, FALSE
, FALSE
);
1399 mpickobj(shk
, otmp
, TRUE
);
1400 if (otmp
->spe
< 5) otmp
->spe
+= rnd(5);
1402 otmp
= mksobj(GRAY_DRAGON_SCALE_MAIL
, FALSE
, FALSE
, FALSE
);
1404 mpickobj(shk
, otmp
, TRUE
);
1405 if (otmp
->spe
< 5) otmp
->spe
+= rnd(5);
1407 otmp
= mksobj(SPEED_BOOTS
, FALSE
, FALSE
, FALSE
);
1409 mpickobj(shk
, otmp
, TRUE
);
1410 if (otmp
->spe
< 5) otmp
->spe
+= rnd(5);
1412 otmp
= mksobj(AMULET_OF_MONSTER_SAVING
, FALSE
, FALSE
, FALSE
);
1414 mpickobj(shk
, otmp
, TRUE
);
1416 /* wear armor and amulet */
1417 m_dowear(shk
, TRUE
);
1418 otmp
= mksobj(SKELETON_KEY
, FALSE
, FALSE
, FALSE
);
1420 mpickobj(shk
, otmp
, TRUE
);
1424 if (Race_if(PM_VENTURE_CAPITALIST
)) hot_pursuit(shk
);
1429 /* stock a newly-created room with objects */
1431 stock_room(shp_indx
, sroom
)
1433 register struct mkroom
*sroom
;
1436 * Someday soon we'll dispatch on the shdist field of shclass to do
1437 * different placements in this routine. Currently it only supports
1438 * shop-style placement (all squares except a row nearest the first
1439 * door get objects).
1441 register int sx
, sy
, sh
;
1443 int rmno
= (sroom
- rooms
) + ROOMOFFSET
;
1444 const struct shclass
*shp
= &shtypes
[shp_indx
];
1446 /* first, try to place a shopkeeper in the room */
1447 if ((sh
= shkinit(shp
, sroom
)) < 0)
1450 /* make sure no doorways without doors, and no */
1451 /* trapped doors, in shops. */
1452 sx
= doors
[sroom
->fdoor
].x
;
1453 sy
= doors
[sroom
->fdoor
].y
;
1455 if(levl
[sx
][sy
].doormask
== D_NODOOR
) {
1456 levl
[sx
][sy
].doormask
= D_ISOPEN
;
1459 if(levl
[sx
][sy
].typ
== SDOOR
) {
1460 cvt_sdoor_to_door(&levl
[sx
][sy
]); /* .typ = DOOR */
1463 if(levl
[sx
][sy
].doormask
& D_TRAPPED
)
1464 levl
[sx
][sy
].doormask
= D_LOCKED
;
1466 if(levl
[sx
][sy
].doormask
== D_LOCKED
) {
1467 register int m
= sx
, n
= sy
;
1469 if(inside_shop(sx
+1,sy
)) m
--;
1470 else if(inside_shop(sx
-1,sy
)) m
++;
1471 if(inside_shop(sx
,sy
+1)) n
--;
1472 else if(inside_shop(sx
,sy
-1)) n
++;
1473 sprintf(buf
, "Closed for inventory");
1474 make_engr_at(m
, n
, buf
, 0L, DUST
);
1477 if (Is_blackmarket(&u
.uz
)) {
1478 stock_blkmar(shp
, sroom
, sh
);
1479 level
.flags
.has_shop
= TRUE
;
1483 for(sx
= sroom
->lx
; sx
<= sroom
->hx
; sx
++)
1484 for(sy
= sroom
->ly
; sy
<= sroom
->hy
; sy
++) {
1485 if(sroom
->irregular
) {
1486 if (levl
[sx
][sy
].edge
|| (int) levl
[sx
][sy
].roomno
!= rmno
||
1487 distmin(sx
, sy
, doors
[sh
].x
, doors
[sh
].y
) <= 1)
1489 } else if((sx
== sroom
->lx
&& doors
[sh
].x
== sx
-1) ||
1490 (sx
== sroom
->hx
&& doors
[sh
].x
== sx
+1) ||
1491 (sy
== sroom
->ly
&& doors
[sh
].y
== sy
-1) ||
1492 (sy
== sroom
->hy
&& doors
[sh
].y
== sy
+1)) continue;
1495 /* shops that stock very specific items shouldn't have hundreds of artifacts... --Amy */
1496 if (sroom
->rtype
== GUNSHOP
|| sroom
->rtype
== BANGSHOP
|| sroom
->rtype
== AMMOSHOP
)
1497 mkshobj_at(shp
, sx
, sy
, FALSE
);
1498 else mkshobj_at(shp
, sx
, sy
, TRUE
);
1503 * Special monster placements (if any) should go here: that way,
1504 * monsters will sit on top of objects and not the other way around.
1507 level
.flags
.has_shop
= TRUE
;
1510 /* stock a newly-created black market with objects */
1512 stock_blkmar(shp
, sroom
, sh
)
1513 const struct shclass
*shp
;
1514 register struct mkroom
*sroom
;
1518 * Someday soon we'll dispatch on the shdist field of shclass to do
1519 * different placements in this routine. Currently it only supports
1520 * shop-style placement (all squares except a row nearest the first
1521 * door get objects).
1523 /* [max] removed register int cl, char buf[bufsz] */
1524 int i
, sx
, sy
, first
= 0, next
= 0, total
, partial
, typ
;
1526 int blkmar_gen
[NUM_OBJECTS
+2];
1530 goodcl
[ 0] = WEAPON_CLASS
;
1531 goodcl
[ 1] = ARMOR_CLASS
;
1532 goodcl
[ 2] = RING_CLASS
;
1533 goodcl
[ 3] = AMULET_CLASS
;
1534 goodcl
[ 4] = TOOL_CLASS
;
1535 goodcl
[ 5] = FOOD_CLASS
;
1536 goodcl
[ 6] = POTION_CLASS
;
1537 goodcl
[ 7] = SCROLL_CLASS
;
1538 goodcl
[ 8] = SPBOOK_CLASS
;
1539 goodcl
[ 9] = WAND_CLASS
;
1540 goodcl
[10] = GEM_CLASS
;
1543 for (i
=0; i
< NUM_OBJECTS
; i
++) {
1548 for (clp
=goodcl
; *clp
!=0; clp
++) {
1550 first
= bases
[*clp
];
1551 /* this assumes that luckstone & loadstone comes just after the gems */
1552 next
= (*clp
==GEM_CLASS
) ? (FLINT
+1) : bases
[(*clp
)+1];
1553 total
+= next
-first
;
1555 if (total
==0) return;
1557 if (sroom
->hx
-sroom
->lx
<2) return;
1560 for(sx
= sroom
->lx
+1; sx
<= sroom
->hx
; sx
++) {
1561 if (sx
==sroom
->lx
+1 ||
1562 ((sx
-sroom
->lx
-2)*total
)/(sroom
->hx
-sroom
->lx
-1)>partial
) {
1564 if (clp
>lastclp
) clp
= lastclp
;
1565 first
= bases
[*clp
];
1566 next
= (*clp
==GEM_CLASS
) ? (FLINT
+1) : bases
[(*clp
)+1];
1567 partial
+= next
-first
;
1570 for(sy
= sroom
->ly
; sy
<= sroom
->hy
; sy
++) {
1571 if((sx
== sroom
->lx
&& doors
[sh
].x
== sx
-1) ||
1572 (sx
== sroom
->hx
&& doors
[sh
].x
== sx
+1) ||
1573 (sy
== sroom
->ly
&& doors
[sh
].y
== sy
-1) ||
1574 (sy
== sroom
->hy
&& doors
[sh
].y
== sy
+1) || (rn2(3)))
1577 for (i
=0; i
<50; i
++) {
1578 typ
= rn2(next
-first
) + first
;
1580 /* forbidden objects */
1581 if (typ
==AMULET_OF_YENDOR
|| typ
==CANDELABRUM_OF_INVOCATION
||
1582 typ
==BELL_OF_OPENING
|| typ
==SPE_BOOK_OF_THE_DEAD
||
1583 objects
[typ
].oc_nowish
|| typ
==0)
1586 otmp
= mkobj_at(WILDCARD_CLASS
,sx
,sy
,TRUE
, TRUE
);
1587 /* generate multiple copies with decreasing probabilities */
1588 /* if (rn2(blkmar_gen[typ]+1) && i<49) continue; */
1590 /* otmp = mksobj_at(typ, sx, sy, TRUE, TRUE, TRUE);
1591 blkmar_gen[typ]++;*/
1595 /* prevent wishing abuse */
1596 if (typ
==WAN_WISHING
|| typ
==WAN_ACQUIREMENT
) {
1598 otmp
->recharged
= 1;
1600 if (typ
==MAGIC_LAMP
) {
1603 if (typ
==SCR_WISHING
|| typ
==SCR_ACQUIREMENT
|| typ
==SCR_ENTHRONIZATION
|| typ
==SCR_MAKE_PENTAGRAM
|| typ
==SCR_FOUNTAIN_BUILDING
|| typ
==SCR_SINKING
|| typ
==SCR_WC
) {
1604 typ
= SCR_BLANK_PAPER
;
1614 * Special monster placements (if any) should go here: that way,
1615 * monsters will sit on top of objects and not the other way around.
1621 init_shk_services(shk
)
1624 ESHK(shk
)->services
= 0L;
1626 /* KMH, balance patch 2 -- Increase probability of shopkeeper services.
1627 * Requested by Dave <mitch45678@aol.com>
1629 if (Is_blackmarket(&u
.uz
)) {
1630 ESHK(shk
)->services
=
1631 SHK_ID_BASIC
|SHK_ID_PREMIUM
|SHK_UNCURSE
|SHK_BLESS
|SHK_APPRAISE
|
1632 SHK_SPECIAL_A
|SHK_SPECIAL_B
|SHK_SPECIAL_C
|SHK_CREDITSRV
;
1636 /* Guarantee some form of identification
1637 * 1/3 both Basic and Premium ID
1638 * 2/15 Premium ID only
1639 * 8/15 Basic ID only
1641 if (!rn2(20)) ESHK(shk
)->services
|= (SHK_ID_BASIC
|SHK_ID_PREMIUM
);
1642 else if (!rn2(10)) ESHK(shk
)->services
|= SHK_ID_BASIC
;
1643 else if (!rn2(10)) ESHK(shk
)->services
|= SHK_ID_PREMIUM
;
1645 if (!rn2(10)) ESHK(shk
)->services
|= SHK_UNCURSE
;
1646 if (!rn2(20)) ESHK(shk
)->services
|= SHK_BLESS
;
1648 if (!rn2(2) && shk_class_match(WEAPON_CLASS
, shk
))
1649 ESHK(shk
)->services
|= SHK_APPRAISE
;
1651 if ((shk_class_match(WEAPON_CLASS
, shk
) == SHK_MATCH
) ||
1652 (shk_class_match(ARMOR_CLASS
, shk
) == SHK_MATCH
) ||
1653 (shk_class_match(WAND_CLASS
, shk
) == SHK_MATCH
) ||
1654 (shk_class_match(TOOL_CLASS
, shk
) == SHK_MATCH
) ||
1655 (shk_class_match(SPBOOK_CLASS
, shk
) == SHK_MATCH
) ||
1656 (shk_class_match(RING_CLASS
, shk
) == SHK_MATCH
)) {
1657 if (!rn2(3/*5*/)) ESHK(shk
)->services
|= SHK_SPECIAL_A
;
1658 if (!rn2(3/*5*/)) ESHK(shk
)->services
|= SHK_SPECIAL_B
;
1660 if (!rn2(3/*5*/) && (shk_class_match(WEAPON_CLASS
, shk
) == SHK_MATCH
))
1661 ESHK(shk
)->services
|= SHK_SPECIAL_C
;
1663 /* establishing credit is always possible --Amy */
1664 ESHK(shk
)->services
|= SHK_CREDITSRV
;
1672 /* does shkp's shop stock this item type? */
1678 int i
, shp_indx
= ESHK(shkp
)->shoptype
- SHOPBASE
;
1679 const struct shclass
*shp
= &shtypes
[shp_indx
];
1681 if (shp
->symb
== RANDOM_CLASS
|| (uarmf
&& uarmf
->oartifact
== ART_KRISTIN_S_NOBILITY
) ) return TRUE
;
1682 else for (i
= 0; i
< SIZE(shtypes
[0].iprobs
) && shp
->iprobs
[i
].iprob
; i
++)
1683 if (shp
->iprobs
[i
].itype
< 0 ?
1684 shp
->iprobs
[i
].itype
== - obj
->otyp
:
1685 shp
->iprobs
[i
].itype
== obj
->oclass
) return TRUE
;
1690 /* positive value: class; negative value: specific object type */
1695 const struct shclass
*shp
= shtypes
+type
;
1698 /* select an appropriate object type at random */
1699 for(j
= rnd(100), i
= 0; (j
-= shp
->iprobs
[i
].iprob
) > 0; i
++)
1702 return shp
->iprobs
[i
].itype
;