Blindfold removal fix
[slashemextended.git] / src / shknam.c
blob09819173f7a7ae5ee92facf57beaf1a2e4b01531
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 */
7 #include "hack.h"
8 #include "eshk.h"
10 #ifndef OVLB
11 extern const struct shclass shtypes[];
13 #else
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[] = {
26 /* Ukraine */
27 "Njezjin", "Tsjernigof", "Ossipewsk", "Gorlowka",
28 /* Belarus */
29 "Gomel",
30 /* N. Russia */
31 "Konosja", "Weliki Oestjoeg", "Syktywkar", "Sablja",
32 "Narodnaja", "Kyzyl",
33 /* Silezie */
34 "Walbrzych", "Swidnica", "Klodzko", "Raciborz", "Gliwice",
35 "Brzeg", "Krnov", "Hradec Kralove",
36 /* Schweiz */
37 "Leuk", "Brig", "Brienz", "Thun", "Sarnen", "Burglen", "Elm",
38 "Flims", "Vals", "Schuls", "Zum Loch",
39 /* Mythology */
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",
44 "Thespeia",
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[] = {
58 /* Eire */
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",
66 /* Deep Ones */
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[] = {
79 /* Turquie */
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[] = {
97 /* Wales */
98 "Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach",
99 "Rhaeader", "Llandrindod", "Llanfair-ym-muallt",
100 "Y-Fenni", "Maesteg", "Rhydaman", "Beddgelert",
101 "Curig", "Llanrwst", "Llanerchymedd", "Caergybi",
102 /* Scotland */
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",
122 "Ypey",
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",
133 "Whippleton",
137 static const char * const shkfoods[] = {
138 /* Indonesia */
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",
154 "Whiteknuckle",
158 static const char * const shkweapons[] = {
159 /* Perigord */
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",
173 "Hugh", "Effe",
174 /* GTA 3 */
175 "Claude", "Catalina", "8-Ball", "Salvatore",
176 /* Vice City */
177 "Tommy", "Ken", "Vance", "Sonny", "Ricardo",
178 /* San Andreas */
179 "Carl", "Sean", "Melvin", "Wilson", /* don't want "Lance" twice, sorry Soviet --Amy */
180 /* 4 */
181 "Niko", "Dimitri", "Mikhail", "Vlad",
182 /* Chinatown Wars */
183 "Huang", "Wu",
184 /* GTAV */
185 "Michael", "Franklin", "Trevor", "Steve",
186 "Weston",
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",
193 "Wickwillingham",
197 static const char * const shktools[] = {
198 /* Amy edit: allow all names, regardless of which operating system you're using, because randomness FTW */
200 /* Spmi */
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",
206 "Corsh", "Aned",
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[] = {
253 /* Romania */
254 "Zarnesti", "Slanic", "Nehoiasu", "Ludus", "Sighisoara", "Nisipitu",
255 "Razboieni", "Bicaz", "Dorohoi", "Vaslui", "Fetesti", "Tirgu Neamt",
256 "Babadag", "Zimnicea", "Zlatna", "Jiu", "Eforie", "Mamaia",
257 /* Bulgaria */
258 "Silistra", "Tulovo", "Panagyuritshte", "Smolyan", "Kirklareli",
259 "Pernik", "Lom", "Haskovo", "Dobrinishte", "Varvara", "Oryahovo",
260 "Troyan", "Lovech", "Sliven",
261 /* Brazil */
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[] = {
280 /* Suriname */
281 "Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi",
282 "Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo",
283 "Akalapi", "Sipaliwini",
284 /* Greenland */
285 "Annootok", "Upernavik", "Angmagssalik",
286 /* N. Canada */
287 "Aklavik", "Inuvik", "Tuktoyaktuk",
288 "Chicoutimi", "Ouiatchouane", "Chibougamau",
289 "Matagami", "Kipawa", "Kinojevis",
290 "Abitibi", "Maganasipi",
291 /* Iceland */
292 "Akureyri", "Kopasker", "Budereyri", "Akranes", "Bordeyri",
293 "Holmavik",
294 /* Marathi */
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",
305 "Worsley",
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",
332 /* Ant */
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
369 * a new shop type.
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}},
376 shkarmors},
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}},
389 shkrings},
390 {"quality apparel and accessories", WAND_CLASS, 4, D_SHOP,
391 {{96, WAND_CLASS}, {2, -REGULAR_GLOVES}, {2, -ELVEN_CLOAK}, {0, 0}},
392 shkwands},
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
451 * loader.
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}
461 #if 0
462 /* validate shop probabilities; otherwise incorrect local changes could
463 end up provoking infinite loops or wild subscripts fetching garbage */
464 void
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);
480 #endif /*0*/
482 STATIC_OVL void
483 mkshobj_at(shp, sx, sy, artif)
484 /* make an object of the appropriate type for a shop square */
485 const struct shclass *shp;
486 int sx, sy;
487 boolean artif;
489 struct monst *mtmp;
490 int atype;
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;
502 } else {
504 if (timebasedlowerchance() && (rnd(100) > u.shopitemreduction) ) {
506 atype = get_shop_item(shp - shtypes);
507 if (atype < 0) {
509 if (atype == -ICE_BOX && artif == TRUE) artif = FALSE;
511 (void) mksobj_at(-atype, sx, sy, TRUE, artif, TRUE);
512 } else {
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);
523 if (atype < 0) {
525 if (atype == -ICE_BOX && artif == TRUE) artif = FALSE;
527 (void) mksobj_at(-atype, sx, sy, TRUE, artif, TRUE);
528 } else {
529 (void) mkobj_at(atype, sx, sy, artif, TRUE);
536 /* extract a shopkeeper name for the given shop type */
537 STATIC_OVL void
538 nameshk(shk, nlp)
539 struct monst *shk;
540 const char * const *nlp;
542 int i, trycnt, names_avail;
543 const char *shname = 0;
544 struct monst *mtmp;
545 int name_wanted;
546 s_level *sptr;
548 if (nlp == shklight && In_mines(&u.uz)
549 && (sptr = Is_special(&u.uz)) != 0 && sptr->flags.town) {
550 /* special-case minetown lighting shk */
551 shname = "Izchak";
552 shk->female = FALSE;
554 /* Amy edit: Izchak is ultra special :D */
556 if (rn2(25)) {
557 shk->noegodesc = shk->noegodisplay = TRUE;
559 if (!rn2(20)) {
560 shk->isegotype = 1;
561 shk->egotype_wallwalk = TRUE;
563 if (!rn2(20)) {
564 shk->isegotype = 1;
565 shk->egotype_disenchant = TRUE;
567 if (!rn2(20)) {
568 shk->isegotype = 1;
569 shk->egotype_rust = TRUE;
571 if (!rn2(20)) {
572 shk->isegotype = 1;
573 shk->egotype_corrosion = TRUE;
575 if (!rn2(20)) {
576 shk->isegotype = 1;
577 shk->egotype_decay = TRUE;
579 if (!rn2(20)) {
580 shk->isegotype = 1;
581 shk->egotype_flamer = TRUE;
583 if (!rn2(20)) {
584 shk->isegotype = 1;
585 shk->egotype_blasphemer = TRUE;
587 if (!rn2(20)) {
588 shk->isegotype = 1;
589 shk->egotype_inverter = TRUE;
591 if (!rn2(20)) {
592 shk->isegotype = 1;
593 shk->egotype_debtor = TRUE;
595 if (!rn2(20)) {
596 shk->isegotype = 1;
597 shk->egotype_dropper = TRUE;
599 if (!rn2(20)) {
600 shk->isegotype = 1;
601 shk->egotype_wither = TRUE;
603 if (!rn2(20)) {
604 shk->isegotype = 1;
605 shk->egotype_grab = TRUE;
607 if (!rn2(20)) {
608 shk->isegotype = 1;
609 shk->egotype_slows = TRUE;
611 if (!rn2(20)) {
612 shk->isegotype = 1;
613 shk->egotype_vampire = TRUE;
615 if (!rn2(20)) {
616 shk->isegotype = 1;
617 shk->egotype_wrap = TRUE;
619 if (!rn2(20)) {
620 shk->isegotype = 1;
621 shk->egotype_disease = TRUE;
623 if (!rn2(20)) {
624 shk->isegotype = 1;
625 shk->egotype_slime = TRUE;
627 if (!rn2(20)) {
628 shk->isegotype = 1;
629 shk->egotype_engrave = TRUE;
631 if (!rn2(20)) {
632 shk->isegotype = 1;
633 shk->egotype_dark = TRUE;
635 if (!rn2(20)) {
636 shk->isegotype = 1;
637 shk->egotype_luck = TRUE;
639 if (!rn2(20)) {
640 shk->isegotype = 1;
641 shk->egotype_arcane = TRUE;
643 if (!rn2(20)) {
644 shk->isegotype = 1;
645 shk->egotype_clerical = TRUE;
647 if (!rn2(20)) {
648 shk->isegotype = 1;
649 shk->egotype_armorer = TRUE;
651 if (!rn2(20)) {
652 shk->isegotype = 1;
653 shk->egotype_tank = TRUE;
655 if (!rn2(20)) {
656 shk->isegotype = 1;
657 shk->egotype_speedster = TRUE;
659 if (!rn2(20)) {
660 shk->isegotype = 1;
661 shk->egotype_racer = TRUE;
663 if (!rn2(20)) {
664 shk->isegotype = 1;
665 shk->egotype_blaster = TRUE;
667 if (!rn2(20)) {
668 shk->isegotype = 1;
669 shk->egotype_gator = TRUE;
671 if (!rn2(20)) {
672 shk->isegotype = 1;
673 shk->egotype_reflecting = TRUE;
675 if (!rn2(20)) {
676 shk->isegotype = 1;
677 shk->egotype_farter = TRUE;
679 if (!rn2(20)) {
680 shk->isegotype = 1;
681 shk->egotype_watersplasher = TRUE;
683 if (!rn2(20)) {
684 shk->isegotype = 1;
685 shk->egotype_cancellator = TRUE;
687 if (!rn2(20)) {
688 shk->isegotype = 1;
689 shk->egotype_shredder = TRUE;
691 if (!rn2(20)) {
692 shk->isegotype = 1;
693 shk->egotype_incrementor = TRUE;
695 if (!rn2(20)) {
696 shk->isegotype = 1;
697 shk->egotype_mirrorimage = TRUE;
699 if (!rn2(20)) {
700 shk->isegotype = 1;
701 shk->egotype_curser = TRUE;
703 if (!rn2(20)) {
704 shk->isegotype = 1;
705 shk->egotype_cullen = TRUE;
707 if (!rn2(20)) {
708 shk->isegotype = 1;
709 shk->egotype_webber = TRUE;
711 if (!rn2(20)) {
712 shk->isegotype = 1;
713 shk->egotype_itemporter = TRUE;
715 if (!rn2(20)) {
716 shk->isegotype = 1;
717 shk->egotype_abomination = TRUE;
719 if (!rn2(20)) {
720 shk->isegotype = 1;
721 shk->egotype_flickerer = TRUE;
723 if (!rn2(20)) {
724 shk->isegotype = 1;
725 shk->egotype_hitter = TRUE;
727 if (!rn2(20)) {
728 shk->isegotype = 1;
729 shk->egotype_piercer = TRUE;
731 if (!rn2(20)) {
732 shk->isegotype = 1;
733 shk->egotype_lifesaver = TRUE;
735 if (!rn2(20)) {
736 shk->isegotype = 1;
737 shk->egotype_shader = TRUE;
739 if (!rn2(20)) {
740 shk->isegotype = 1;
741 shk->egotype_amnesiac = TRUE;
743 if (!rn2(20)) {
744 shk->isegotype = 1;
745 shk->egotype_trapmaster = TRUE;
747 if (!rn2(20)) {
748 shk->isegotype = 1;
749 shk->egotype_mastercaster = TRUE;
751 if (!rn2(20)) {
752 shk->isegotype = 1;
753 shk->egotype_sinner = TRUE;
755 if (!rn2(20)) {
756 shk->isegotype = 1;
757 shk->egotype_weeper = TRUE;
759 if (!rn2(20)) {
760 shk->isegotype = 1;
761 shk->egotype_destructor = TRUE;
763 if (!rn2(20)) {
764 shk->isegotype = 1;
765 shk->egotype_trembler = TRUE;
767 if (!rn2(20)) {
768 shk->isegotype = 1;
769 shk->egotype_worldender = TRUE;
771 if (!rn2(20)) {
772 shk->isegotype = 1;
773 shk->egotype_damager = TRUE;
775 if (!rn2(20)) {
776 shk->isegotype = 1;
777 shk->egotype_antitype = TRUE;
779 if (!rn2(20)) {
780 shk->isegotype = 1;
781 shk->egotype_statdamager = TRUE;
783 if (!rn2(20)) {
784 shk->isegotype = 1;
785 shk->egotype_nastycurser = TRUE;
787 if (!rn2(20)) {
788 shk->isegotype = 1;
789 shk->egotype_sanitizer = TRUE;
791 if (!rn2(20)) {
792 shk->isegotype = 1;
793 shk->egotype_rogue = TRUE;
795 if (!rn2(20)) {
796 shk->isegotype = 1;
797 shk->egotype_champion = TRUE;
799 if (!rn2(20)) {
800 shk->isegotype = 1;
801 shk->egotype_boss = TRUE;
803 if (!rn2(20)) {
804 shk->isegotype = 1;
805 shk->egotype_atomizer = TRUE;
807 if (!rn2(20)) {
808 shk->isegotype = 1;
809 shk->egotype_perfumespreader = TRUE;
811 if (!rn2(20)) {
812 shk->isegotype = 1;
813 shk->egotype_converter = TRUE;
815 if (!rn2(20)) {
816 shk->isegotype = 1;
817 shk->egotype_alladrainer = TRUE;
819 if (!rn2(20)) {
820 shk->isegotype = 1;
821 shk->egotype_stabilizer = TRUE;
823 if (!rn2(20)) {
824 shk->isegotype = 1;
825 shk->egotype_spoilerproofer = TRUE;
827 if (!rn2(20)) {
828 shk->isegotype = 1;
829 shk->egotype_metalmafioso = TRUE;
831 if (!rn2(20)) {
832 shk->isegotype = 1;
833 shk->egotype_deepstatemember = TRUE;
835 if (!rn2(20)) {
836 shk->isegotype = 1;
837 shk->egotype_wouwouer = TRUE;
839 if (!rn2(20)) {
840 shk->isegotype = 1;
841 shk->egotype_badowner = TRUE;
843 if (!rn2(20)) {
844 shk->isegotype = 1;
845 shk->egotype_bleeder = TRUE;
847 if (!rn2(20)) {
848 shk->isegotype = 1;
849 shk->egotype_shanker = TRUE;
851 if (!rn2(20)) {
852 shk->isegotype = 1;
853 shk->egotype_terrorizer = TRUE;
855 if (!rn2(20)) {
856 shk->isegotype = 1;
857 shk->egotype_feminizer = TRUE;
859 if (!rn2(20)) {
860 shk->isegotype = 1;
861 shk->egotype_levitator = TRUE;
863 if (!rn2(20)) {
864 shk->isegotype = 1;
865 shk->egotype_illusionator = TRUE;
867 if (!rn2(20)) {
868 shk->isegotype = 1;
869 shk->egotype_stealer = TRUE;
871 if (!rn2(20)) {
872 shk->isegotype = 1;
873 shk->egotype_stoner = TRUE;
875 if (!rn2(20)) {
876 shk->isegotype = 1;
877 shk->egotype_maecke = TRUE;
879 if (!rn2(20)) {
880 shk->isegotype = 1;
881 shk->egotype_amberite = TRUE;
883 /* Izchak always has the laserpwnzor and datadeleter egotypes --Amy */
884 shk->isegotype = 1;
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;
896 if (!rn2(10)) {
897 shk->isegotype = 1;
898 shk->egotype_wallwalk = TRUE;
900 if (!rn2(10)) {
901 shk->isegotype = 1;
902 shk->egotype_disenchant = TRUE;
904 if (!rn2(10)) {
905 shk->isegotype = 1;
906 shk->egotype_rust = TRUE;
908 if (!rn2(10)) {
909 shk->isegotype = 1;
910 shk->egotype_corrosion = TRUE;
912 if (!rn2(10)) {
913 shk->isegotype = 1;
914 shk->egotype_decay = TRUE;
916 if (!rn2(10)) {
917 shk->isegotype = 1;
918 shk->egotype_flamer = TRUE;
920 if (!rn2(10)) {
921 shk->isegotype = 1;
922 shk->egotype_blasphemer = TRUE;
924 if (!rn2(10)) {
925 shk->isegotype = 1;
926 shk->egotype_inverter = TRUE;
928 if (!rn2(10)) {
929 shk->isegotype = 1;
930 shk->egotype_debtor = TRUE;
932 if (!rn2(10)) {
933 shk->isegotype = 1;
934 shk->egotype_dropper = TRUE;
936 if (!rn2(10)) {
937 shk->isegotype = 1;
938 shk->egotype_wither = TRUE;
940 if (!rn2(10)) {
941 shk->isegotype = 1;
942 shk->egotype_grab = TRUE;
944 if (!rn2(10)) {
945 shk->isegotype = 1;
946 shk->egotype_slows = TRUE;
948 if (!rn2(10)) {
949 shk->isegotype = 1;
950 shk->egotype_vampire = TRUE;
952 if (!rn2(10)) {
953 shk->isegotype = 1;
954 shk->egotype_wrap = TRUE;
956 if (!rn2(10)) {
957 shk->isegotype = 1;
958 shk->egotype_disease = TRUE;
960 if (!rn2(10)) {
961 shk->isegotype = 1;
962 shk->egotype_slime = TRUE;
964 if (!rn2(10)) {
965 shk->isegotype = 1;
966 shk->egotype_engrave = TRUE;
968 if (!rn2(10)) {
969 shk->isegotype = 1;
970 shk->egotype_dark = TRUE;
972 if (!rn2(10)) {
973 shk->isegotype = 1;
974 shk->egotype_luck = TRUE;
976 if (!rn2(10)) {
977 shk->isegotype = 1;
978 shk->egotype_arcane = TRUE;
980 if (!rn2(10)) {
981 shk->isegotype = 1;
982 shk->egotype_clerical = TRUE;
984 if (!rn2(10)) {
985 shk->isegotype = 1;
986 shk->egotype_armorer = TRUE;
988 if (!rn2(10)) {
989 shk->isegotype = 1;
990 shk->egotype_tank = TRUE;
992 if (!rn2(10)) {
993 shk->isegotype = 1;
994 shk->egotype_speedster = TRUE;
996 if (!rn2(10)) {
997 shk->isegotype = 1;
998 shk->egotype_racer = TRUE;
1000 if (!rn2(10)) {
1001 shk->isegotype = 1;
1002 shk->egotype_blaster = TRUE;
1004 if (!rn2(10)) {
1005 shk->isegotype = 1;
1006 shk->egotype_gator = TRUE;
1008 if (!rn2(10)) {
1009 shk->isegotype = 1;
1010 shk->egotype_reflecting = TRUE;
1012 if (!rn2(10)) {
1013 shk->isegotype = 1;
1014 shk->egotype_farter = TRUE;
1016 if (!rn2(10)) {
1017 shk->isegotype = 1;
1018 shk->egotype_watersplasher = TRUE;
1020 if (!rn2(10)) {
1021 shk->isegotype = 1;
1022 shk->egotype_cancellator = TRUE;
1024 if (!rn2(10)) {
1025 shk->isegotype = 1;
1026 shk->egotype_shredder = TRUE;
1028 if (!rn2(10)) {
1029 shk->isegotype = 1;
1030 shk->egotype_incrementor = TRUE;
1032 if (!rn2(10)) {
1033 shk->isegotype = 1;
1034 shk->egotype_mirrorimage = TRUE;
1036 if (!rn2(10)) {
1037 shk->isegotype = 1;
1038 shk->egotype_curser = TRUE;
1040 if (!rn2(10)) {
1041 shk->isegotype = 1;
1042 shk->egotype_cullen = TRUE;
1044 if (!rn2(10)) {
1045 shk->isegotype = 1;
1046 shk->egotype_webber = TRUE;
1048 if (!rn2(10)) {
1049 shk->isegotype = 1;
1050 shk->egotype_itemporter = TRUE;
1052 if (!rn2(10)) {
1053 shk->isegotype = 1;
1054 shk->egotype_abomination = TRUE;
1056 if (!rn2(10)) {
1057 shk->isegotype = 1;
1058 shk->egotype_flickerer = TRUE;
1060 if (!rn2(10)) {
1061 shk->isegotype = 1;
1062 shk->egotype_hitter = TRUE;
1064 if (!rn2(10)) {
1065 shk->isegotype = 1;
1066 shk->egotype_piercer = TRUE;
1068 if (!rn2(10)) {
1069 shk->isegotype = 1;
1070 shk->egotype_lifesaver = TRUE;
1072 if (!rn2(10)) {
1073 shk->isegotype = 1;
1074 shk->egotype_shader = TRUE;
1076 if (!rn2(10)) {
1077 shk->isegotype = 1;
1078 shk->egotype_amnesiac = TRUE;
1080 if (!rn2(10)) {
1081 shk->isegotype = 1;
1082 shk->egotype_trapmaster = TRUE;
1084 if (!rn2(10)) {
1085 shk->isegotype = 1;
1086 shk->egotype_mastercaster = TRUE;
1088 if (!rn2(10)) {
1089 shk->isegotype = 1;
1090 shk->egotype_sinner = TRUE;
1092 if (!rn2(10)) {
1093 shk->isegotype = 1;
1094 shk->egotype_weeper = TRUE;
1096 if (!rn2(10)) {
1097 shk->isegotype = 1;
1098 shk->egotype_destructor = TRUE;
1100 if (!rn2(1000)) {
1101 shk->isegotype = 1;
1102 shk->egotype_datadeleter = TRUE;
1104 if (!rn2(10)) {
1105 shk->isegotype = 1;
1106 shk->egotype_trembler = TRUE;
1108 if (!rn2(10)) {
1109 shk->isegotype = 1;
1110 shk->egotype_worldender = TRUE;
1112 if (!rn2(10)) {
1113 shk->isegotype = 1;
1114 shk->egotype_damager = TRUE;
1116 if (!rn2(10)) {
1117 shk->isegotype = 1;
1118 shk->egotype_antitype = TRUE;
1120 if (!rn2(10)) {
1121 shk->isegotype = 1;
1122 shk->egotype_statdamager = TRUE;
1124 if (!rn2(10)) {
1125 shk->isegotype = 1;
1126 shk->egotype_nastycurser = TRUE;
1128 if (!rn2(10)) {
1129 shk->isegotype = 1;
1130 shk->egotype_sanitizer = TRUE;
1132 if (!rn2(10)) {
1133 shk->isegotype = 1;
1134 shk->egotype_rogue = TRUE;
1136 if (!rn2(10)) {
1137 shk->isegotype = 1;
1138 shk->egotype_champion = TRUE;
1140 if (!rn2(10)) {
1141 shk->isegotype = 1;
1142 shk->egotype_boss = TRUE;
1144 if (!rn2(10)) {
1145 shk->isegotype = 1;
1146 shk->egotype_atomizer = TRUE;
1148 if (!rn2(10)) {
1149 shk->isegotype = 1;
1150 shk->egotype_perfumespreader = TRUE;
1152 if (!rn2(10)) {
1153 shk->isegotype = 1;
1154 shk->egotype_converter = TRUE;
1156 if (!rn2(10)) {
1157 shk->isegotype = 1;
1158 shk->egotype_alladrainer = TRUE;
1160 if (!rn2(10)) {
1161 shk->isegotype = 1;
1162 shk->egotype_stabilizer = TRUE;
1164 if (!rn2(10)) {
1165 shk->isegotype = 1;
1166 shk->egotype_spoilerproofer = TRUE;
1168 if (!rn2(10)) {
1169 shk->isegotype = 1;
1170 shk->egotype_metalmafioso = TRUE;
1172 if (!rn2(10)) {
1173 shk->isegotype = 1;
1174 shk->egotype_deepstatemember = TRUE;
1176 if (!rn2(10)) {
1177 shk->isegotype = 1;
1178 shk->egotype_wouwouer = TRUE;
1180 if (!rn2(10)) {
1181 shk->isegotype = 1;
1182 shk->egotype_laserpwnzor = TRUE;
1184 if (!rn2(10)) {
1185 shk->isegotype = 1;
1186 shk->egotype_badowner = TRUE;
1188 if (!rn2(10)) {
1189 shk->isegotype = 1;
1190 shk->egotype_bleeder = TRUE;
1192 if (!rn2(10)) {
1193 shk->isegotype = 1;
1194 shk->egotype_shanker = TRUE;
1196 if (!rn2(10)) {
1197 shk->isegotype = 1;
1198 shk->egotype_terrorizer = TRUE;
1200 if (!rn2(10)) {
1201 shk->isegotype = 1;
1202 shk->egotype_feminizer = TRUE;
1204 if (!rn2(10)) {
1205 shk->isegotype = 1;
1206 shk->egotype_levitator = TRUE;
1208 if (!rn2(10)) {
1209 shk->isegotype = 1;
1210 shk->egotype_illusionator = TRUE;
1212 if (!rn2(10)) {
1213 shk->isegotype = 1;
1214 shk->egotype_stealer = TRUE;
1216 if (!rn2(10)) {
1217 shk->isegotype = 1;
1218 shk->egotype_stoner = TRUE;
1220 if (!rn2(10)) {
1221 shk->isegotype = 1;
1222 shk->egotype_maecke = TRUE;
1224 if (!rn2(10)) {
1225 shk->isegotype = 1;
1226 shk->egotype_amberite = TRUE;
1229 } else {
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++)
1241 continue;
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++)
1255 continue;
1256 continue; /* next `trycnt' iteration */
1257 } else {
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;
1265 break;
1267 if (!mtmp) break; /* new name */
1270 (void) strncpy(ESHK(shk)->shknam, shname, PL_NSIZ);
1271 ESHK(shk)->shknam[PL_NSIZ-1] = 0;
1274 STATIC_OVL int
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;
1280 struct monst *shk;
1281 long shkmoney; /* Temporary placeholder for Shopkeeper's initial capital */
1283 /* place the shopkeeper in the given room */
1284 sh = sroom->fdoor;
1285 sx = doors[sh].x;
1286 sy = doors[sh].y;
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 {
1305 shk_failed:
1306 #ifdef DEBUG
1307 # ifdef WIZARD
1308 /* Said to happen sometimes, but I have never seen it. */
1309 /* Supposedly fixed by fdoor change in mklev.c */
1310 if(wizard) {
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);
1318 while(j--) {
1319 pline("door [%d,%d]", doors[sh].x, doors[sh].y);
1320 sh++;
1322 display_nhwindow(WIN_MESSAGE, FALSE);
1324 # endif
1325 #endif
1326 return(-1);
1329 if(MON_AT(sx, sy)) (void) rloc(m_at(sx, sy), FALSE); /* insurance */
1331 /* now initialize the shopkeeper monster structure */
1333 shk = 0;
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 */
1338 if (!shk) {
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)))
1340 return(-1);
1343 shk->isshk = shk->mpeaceful = 1;
1344 if (Race_if(PM_VENTURE_CAPITALIST)) shk->mpeaceful = 0;
1345 set_malign(shk);
1346 shk->msleeping = 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);
1380 #ifndef GOLDOBJ
1381 shk->mgold = shkmoney;
1382 #else
1383 mkmonmoney(shk, shkmoney);
1384 #endif
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);
1392 if (otmp) {
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);
1398 if (otmp) {
1399 mpickobj(shk, otmp, TRUE);
1400 if (otmp->spe < 5) otmp->spe += rnd(5);
1402 otmp = mksobj(GRAY_DRAGON_SCALE_MAIL, FALSE, FALSE, FALSE);
1403 if (otmp) {
1404 mpickobj(shk, otmp, TRUE);
1405 if (otmp->spe < 5) otmp->spe += rnd(5);
1407 otmp = mksobj(SPEED_BOOTS, FALSE, FALSE, FALSE);
1408 if (otmp) {
1409 mpickobj(shk, otmp, TRUE);
1410 if (otmp->spe < 5) otmp->spe += rnd(5);
1412 otmp = mksobj(AMULET_OF_MONSTER_SAVING, FALSE, FALSE, FALSE);
1413 if (otmp) {
1414 mpickobj(shk, otmp, TRUE);
1416 /* wear armor and amulet */
1417 m_dowear(shk, TRUE);
1418 otmp = mksobj(SKELETON_KEY, FALSE, FALSE, FALSE);
1419 if (otmp) {
1420 mpickobj(shk, otmp, TRUE);
1424 if (Race_if(PM_VENTURE_CAPITALIST)) hot_pursuit(shk);
1426 return(sh);
1429 /* stock a newly-created room with objects */
1430 void
1431 stock_room(shp_indx, sroom)
1432 int shp_indx;
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;
1442 char buf[BUFSZ];
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)
1448 return;
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;
1457 newsym(sx,sy);
1459 if(levl[sx][sy].typ == SDOOR) {
1460 cvt_sdoor_to_door(&levl[sx][sy]); /* .typ = DOOR */
1461 newsym(sx,sy);
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;
1480 return;
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)
1488 continue;
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;
1493 if (rn2(10)) {
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 */
1511 static void
1512 stock_blkmar(shp, sroom, sh)
1513 const struct shclass *shp;
1514 register struct mkroom *sroom;
1515 register int sh;
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;
1525 struct obj *otmp;
1526 int blkmar_gen[NUM_OBJECTS+2];
1527 int *clp, *lastclp;
1528 int goodcl[12];
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;
1541 goodcl[11] = 0;
1543 for (i=0; i < NUM_OBJECTS; i++) {
1544 blkmar_gen[i] = 0;
1547 total = 0;
1548 for (clp=goodcl; *clp!=0; clp++) {
1549 lastclp = 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;
1558 clp = goodcl-1;
1559 partial = 0;
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) {
1563 clp++;
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)))
1575 continue;
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)
1584 continue;
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]++;*/
1593 if (!otmp) break;
1595 /* prevent wishing abuse */
1596 if (typ==WAN_WISHING || typ==WAN_ACQUIREMENT) {
1597 otmp->spe = 0;
1598 otmp->recharged = 1;
1600 if (typ==MAGIC_LAMP) {
1601 otmp->spe = 0;
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;
1607 break;
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.
1620 static void
1621 init_shk_services(shk)
1622 struct monst *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;
1633 return;
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;
1666 return;
1669 #endif /* OVLB */
1670 #ifdef OVL0
1672 /* does shkp's shop stock this item type? */
1673 boolean
1674 saleable(shkp, obj)
1675 struct monst *shkp;
1676 struct obj *obj;
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;
1686 /* not found */
1687 return FALSE;
1690 /* positive value: class; negative value: specific object type */
1692 get_shop_item(type)
1693 int type;
1695 const struct shclass *shp = shtypes+type;
1696 register int i,j;
1698 /* select an appropriate object type at random */
1699 for(j = rnd(100), i = 0; (j -= shp->iprobs[i].iprob) > 0; i++)
1700 continue;
1702 return shp->iprobs[i].itype;
1705 #endif /* OVL0 */
1707 /*shknam.c*/