OSDN Git Service

3e1838639edc51f6665035ec603bef2197352502
[hengband/hengband.git] / src / store.c
1 /*!
2  * @file store.c
3  * @brief 店の処理 / Store commands
4  * @date 2014/02/02
5  * @author
6  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7  * This software may be copied and distributed for educational, research, and\n
8  * not for profit purposes provided that this copyright and statement are\n
9  * included in all such copies.\n
10  * 2014 Deskull rearranged comment for Doxygen.
11  */
12
13 #include "angband.h"
14 #include "util.h"
15
16 #include "floor.h"
17 #include "cmd-item.h"
18 #include "cmd-smith.h"
19 #include "cmd-zapwand.h"
20 #include "cmd-magiceat.h"
21 #include "spells.h"
22 #include "store.h"
23 #include "avatar.h"
24 #include "cmd-spell.h"
25 #include "rumor.h"
26 #include "player-status.h"
27 #include "object-flavor.h"
28 #include "object-hook.h"
29 #include "floor-events.h"
30 #include "snipe.h"
31 #include "files.h"
32 #include "player-effects.h"
33 #include "mind.h"
34 #include "world.h"
35 #include "objectkind.h"
36
37 #define MIN_STOCK 12
38
39  /*!
40   * @brief 闘技場のモンスターID及び報酬アイテムテーブル /
41   * Store owners (exactly four "possible" owners per store, chosen randomly)
42   * @details
43   * <pre>
44   * { name, purse, max greed, min greed, haggle_per, tolerance, race, unused }
45   *
46   * Lifted extra shopkeepers from CthAngband (don't you just love open source
47   * development? ;-)). Since this gave less than 32 unique names for some
48   * shops, those have their first x names copied to reach 32.
49   *
50   * For the weapon and armour shops, several owners have a limit of 5k.
51   *
52   * I want to do 50k owners, but the purse is currently s16b. Perhaps
53   * we should just store 1/10th of the purse?
54   * </pre>
55   */
56 const owner_type owners[MAX_STORES][MAX_OWNERS] =
57 {
58         {
59                 /* General store - 32 unique names */
60                 /*
61                   Raistlin は dragonlance の powerful wizard 。
62                   Rincewind the Chicken は Terry Pratchett の Discworld の登場人物 上記のパロディ?、
63                   { "憶病者ラストリン",       200,    175,  108,   4,  12,  RACE_HUMAN},
64                   { "Raistlin the Chicken",       200,    175, 108,  4, 12, RACE_HUMAN},
65                 */
66
67 #ifdef JP
68                 { "フレンドリーなビルボ",       200,    170,  108,   5,  15,  RACE_HOBBIT},
69                 { "憶病者リンスウィンド",       200,    175,  108,   4,  12,  RACE_HUMAN},
70                 { "背の低いサルタン",             300,    170,  107,   5,  15,  RACE_GNOME},
71                 { "ハンサムなライア=エル",      300,    165,  107,   6,  18,  RACE_ELF},
72                 { "親切なファリルマウエン",         250,    170, 108,  5, 15, RACE_HOBBIT},
73                 { "臆病者ヴォワラン",       500,    175, 108,  4, 12, RACE_HUMAN},
74                 { "チビのエラシュナク",          750,    170, 107,  5, 15, RACE_BEASTMAN},
75                 { "ハンサムなグラッグ",        1000,    165, 107,  6, 18, RACE_HALF_TITAN},
76                 { "ケチなフォロビア",         250,    170, 108,  5, 15, RACE_HUMAN},
77                 { "馬鹿のエリス",       500,    175, 108,  4, 12, RACE_HUMAN},
78                 { "腹ペコのフィルバート",          750,    170, 107,  5, 15, RACE_VAMPIRE},
79                 { "スナーグル・サシグア",        1000,    165, 107,  6, 18, RACE_MIND_FLAYER},
80                 { "長死きエロワーズ",         250,    170, 108,  5, 15, RACE_SPECTRE},
81                 { "ノロマのフンディ",       500,    175, 108,  4, 12, RACE_ZOMBIE},
82                 { "グランサス",          750,    170, 107,  5, 15, RACE_SKELETON},
83                 { "丁寧なロラックス",        1000,    165, 107,  6, 18, RACE_VAMPIRE},
84                 { "ブッチ",         250,    170, 108,  5, 15, RACE_HALF_ORC},
85                 { "美しきエルベレス",       500,    175, 108,  4, 12, RACE_HIGH_ELF},
86                 { "こそこそサーレス",          750,    170, 107,  5, 15, RACE_GNOME},
87                 { "ナーロック",        1000,    165, 107,  6, 18, RACE_DWARF},
88                 { "チビのヘイネッカ",         250,    170, 108,  5, 15, RACE_GNOME},
89                 { "きちがいロワラン",       500,    175, 108,  4, 12, RACE_HALF_GIANT},
90                 { "毒息のウート",          750,    170, 107,  5, 15, RACE_DRACONIAN},
91                 { "でぶっちょアラァカ",        1000,    165, 107,  6, 18, RACE_DRACONIAN},
92                 { "低能なプーゴー",         250,    170, 108,  5, 15, RACE_BEASTMAN},
93                 { "フェロールフィリアン",       500,    175, 108,  4, 12, RACE_ELF},
94                 { "年寄りマロカ",          750,    170, 107,  5, 15, RACE_GNOME},
95                 { "勇敢なサシン",        1000,    165, 107,  6, 18, RACE_HALF_GIANT},
96                 { "田舎者アビエマール",         250,    170, 108,  5, 15, RACE_HUMAN},
97                 { "貧乏なハーク",       500,    175, 108,  4, 12, RACE_HALF_ORC},
98                 { "みじめなソアリン",          750,    170, 107,  5, 15, RACE_ZOMBIE},
99                 { "質素なメルラ",        1000,    165, 107,  6, 18, RACE_ELF},
100 #else
101                 { "Bilbo the Friendly",         200,    170, 108,  5, 15, RACE_HOBBIT},
102                 { "Rincewind the Chicken",       200,    175, 108,  4, 12, RACE_HUMAN},
103                 { "Sultan the Midget",          300,    170, 107,  5, 15, RACE_GNOME},
104                 { "Lyar-el the Comely",         300,    165, 107,  6, 18, RACE_ELF},
105                 { "Falilmawen the Friendly",         250,    170, 108,  5, 15, RACE_HOBBIT},
106                 { "Voirin the Cowardly",       500,    175, 108,  4, 12, RACE_HUMAN},
107                 { "Erashnak the Midget",          750,    170, 107,  5, 15, RACE_BEASTMAN},
108                 { "Grug the Comely",        1000,    165, 107,  6, 18, RACE_HALF_TITAN},
109                 { "Forovir the Cheap",         250,    170, 108,  5, 15, RACE_HUMAN},
110                 { "Ellis the Fool",       500,    175, 108,  4, 12, RACE_HUMAN},
111                 { "Filbert the Hungry",          750,    170, 107,  5, 15, RACE_VAMPIRE},
112                 { "Fthnargl Psathiggua",        1000,    165, 107,  6, 18, RACE_MIND_FLAYER},
113                 { "Eloise Long-Dead",         250,    170, 108,  5, 15, RACE_SPECTRE},
114                 { "Fundi the Slow",       500,    175, 108,  4, 12, RACE_ZOMBIE},
115                 { "Granthus",          750,    170, 107,  5, 15, RACE_SKELETON},
116                 { "Lorax the Suave",        1000,    165, 107,  6, 18, RACE_VAMPIRE},
117                 { "Butch",         250,    170, 108,  5, 15, RACE_HALF_ORC},
118                 { "Elbereth the Beautiful",       500,    175, 108,  4, 12, RACE_HIGH_ELF},
119                 { "Sarleth the Sneaky",          750,    170, 107,  5, 15, RACE_GNOME},
120                 { "Narlock",        1000,    165, 107,  6, 18, RACE_DWARF},
121                 { "Haneka the Small",         250,    170, 108,  5, 15, RACE_GNOME},
122                 { "Loirin the Mad",       500,    175, 108,  4, 12, RACE_HALF_GIANT},
123                 { "Wuto Poisonbreath",          750,    170, 107,  5, 15, RACE_DRACONIAN},
124                 { "Araaka the Rotund",        1000,    165, 107,  6, 18, RACE_DRACONIAN},
125                 { "Poogor the Dumb",         250,    170, 108,  5, 15, RACE_BEASTMAN},
126                 { "Felorfiliand",       500,    175, 108,  4, 12, RACE_ELF},
127                 { "Maroka the Aged",          750,    170, 107,  5, 15, RACE_GNOME},
128                 { "Sasin the Bold",        1000,    165, 107,  6, 18, RACE_HALF_GIANT},
129                 { "Abiemar the Peasant",         250,    170, 108,  5, 15, RACE_HUMAN},
130                 { "Hurk the Poor",       500,    175, 108,  4, 12, RACE_HALF_ORC},
131                 { "Soalin the Wretched",          750,    170, 107,  5, 15, RACE_ZOMBIE},
132                 { "Merulla the Humble",        1000,    165, 107,  6, 18, RACE_ELF},
133 #endif
134         },
135         {
136                 /* Armoury - 28 unique names */
137 #ifdef JP
138                 { "醜悪コン=ダー",      5000,   210,  115,   5,   7,  RACE_HALF_ORC},
139                 { "頑固者ダーグ=ロウ",  10000,  190,  111,   4,   9,  RACE_HUMAN},
140                 { "賢者デカド",                 25000,  200,  112,   4,  10,  RACE_DUNADAN},
141                 { "鍛冶屋のウィーランド",   30000,  200,  112,   4,   5,  RACE_DWARF},
142                 { "醜悪コン=ダー",           10000,   210, 115,  5,  7, RACE_HALF_ORC},
143                 { "頑固者ダーグ=ロウ",          15000,  190, 111,  4,  9, RACE_HUMAN},
144                 { "ハンサムなデカド",            25000,  200, 112,  4, 10, RACE_AMBERITE},
145                 { "エロー・ドラゴンスケイル",          30000,  200, 112,  4,  5, RACE_ELF},
146                 { "デリカトス",           10000,   210, 115,  5,  7, RACE_SPRITE},
147                 { "巨大なグルース",          15000,  190, 111,  4,  9, RACE_HALF_GIANT},
148                 { "アニムス",            25000,  200, 112,  4, 10, RACE_GOLEM},
149                 { "マルヴァス",          30000,  200, 112,  4,  5, RACE_HALF_TITAN},
150                 { "セラクシス",           10000,   210, 115,  5,  7, RACE_ZOMBIE},
151                 { "デス・チル",          5000,  190, 111,  4,  9, RACE_SPECTRE},
152                 { "微かなドリオス",            25000,  200, 112,  4, 10, RACE_SPECTRE},
153                 { "冷たいバスリック",          30000,  200, 112,  4,  5, RACE_VAMPIRE},
154                 { "冷酷ヴェンジェラ",           10000,   210, 115,  5,  7, RACE_HALF_TROLL},
155                 { "強者ウィラナ",          15000,  190, 111,  4,  9, RACE_HUMAN},
156                 { "ヨジョ二世",            25000,  200, 112,  4, 10, RACE_DWARF},
157                 { "優しいラナラー",          30000,  200, 112,  4,  5, RACE_AMBERITE},
158                 { "不浄のホルバグ",           5000,   210, 115,  5,  7, RACE_HALF_ORC},
159                 { "テレパスのエレレン",          15000,  190, 111,  4,  9, RACE_DARK_ELF},
160                 { "イスドリリアス",            25000,  200, 112,  4, 10, RACE_SPRITE},
161                 { "一つ目ヴェグナー",          5000,  200, 112,  4,  5, RACE_CYCLOPS},
162                 { "混沌のロディッシュ",           10000,   210, 115,  5,  7, RACE_BEASTMAN},
163                 { "剣豪ヘジン",          15000,  190, 111,  4,  9, RACE_NIBELUNG},
164                 { "ずる屋のエルベレリス",           10000,  200, 112,  4, 10, RACE_DARK_ELF},
165                 { "インプのザサス",          30000,  200, 112,  4,  5, RACE_IMP},
166                 { "醜悪コン=ダー",           5000,   210, 115,  5,  7, RACE_HALF_ORC},
167                 { "頑固者ダーグ=ロウ",          10000,  190, 111,  4,  9, RACE_HUMAN},
168                 { "ハンサムなデカド",            25000,  200, 112,  4, 10, RACE_AMBERITE},
169                 { "鍛冶屋のウィーランド",          30000,  200, 112,  4,  5, RACE_DWARF},
170 #else
171                 { "Kon-Dar the Ugly",           5000,   210, 115,  5,  7, RACE_HALF_ORC},
172                 { "Darg-Low the Grim",          10000,  190, 111,  4,  9, RACE_HUMAN},
173                 { "Decado the Handsome",            25000,  200, 112,  4, 10, RACE_DUNADAN},
174                 { "Wieland the Smith",          30000,  200, 112,  4,  5, RACE_DWARF},
175                 { "Kon-Dar the Ugly",           10000,   210, 115,  5,  7, RACE_HALF_ORC},
176                 { "Darg-Low the Grim",          15000,  190, 111,  4,  9, RACE_HUMAN},
177                 { "Decado the Handsome",            25000,  200, 112,  4, 10, RACE_AMBERITE},
178                 { "Elo Dragonscale",          30000,  200, 112,  4,  5, RACE_ELF},
179                 { "Delicatus",           10000,   210, 115,  5,  7, RACE_SPRITE},
180                 { "Gruce the Huge",          15000,  190, 111,  4,  9, RACE_HALF_GIANT},
181                 { "Animus",            25000,  200, 112,  4, 10, RACE_GOLEM},
182                 { "Malvus",          30000,  200, 112,  4,  5, RACE_HALF_TITAN},
183                 { "Selaxis",           10000,   210, 115,  5,  7, RACE_ZOMBIE},
184                 { "Deathchill",          5000,  190, 111,  4,  9, RACE_SPECTRE},
185                 { "Drios the Faint",            25000,  200, 112,  4, 10, RACE_SPECTRE},
186                 { "Bathric the Cold",          30000,  200, 112,  4,  5, RACE_VAMPIRE},
187                 { "Vengella the Cruel",           10000,   210, 115,  5,  7, RACE_HALF_TROLL},
188                 { "Wyrana the Mighty",          15000,  190, 111,  4,  9, RACE_HUMAN},
189                 { "Yojo II",            25000,  200, 112,  4, 10, RACE_DWARF},
190                 { "Ranalar the Sweet",          30000,  200, 112,  4,  5, RACE_AMBERITE},
191                 { "Horbag the Unclean",           5000,   210, 115,  5,  7, RACE_HALF_ORC},
192                 { "Elelen the Telepath",          15000,  190, 111,  4,  9, RACE_DARK_ELF},
193                 { "Isedrelias",            25000,  200, 112,  4, 10, RACE_SPRITE},
194                 { "Vegnar One-eye",          5000,  200, 112,  4,  5, RACE_CYCLOPS},
195                 { "Rodish the Chaotic",           10000,   210, 115,  5,  7, RACE_BEASTMAN},
196                 { "Hesin Swordmaster",          15000,  190, 111,  4,  9, RACE_NIBELUNG},
197                 { "Elvererith the Cheat",           10000,  200, 112,  4, 10, RACE_DARK_ELF},
198                 { "Zzathath the Imp",          30000,  200, 112,  4,  5, RACE_IMP},
199                 { "Kon-Dar the Ugly",           5000,   210, 115,  5,  7, RACE_HALF_ORC},
200                 { "Darg-Low the Grim",          10000,  190, 111,  4,  9, RACE_HUMAN},
201                 { "Decado the Handsome",            25000,  200, 112,  4, 10, RACE_AMBERITE},
202                 { "Wieland the Smith",          30000,  200, 112,  4,  5, RACE_DWARF},
203 #endif
204         },
205
206         {
207                 /* Weapon Smith - 28 unique names */
208 #ifdef JP
209                 { "残忍なるアーノルド",        5000,   210,  115,   6,   6,  RACE_HALF_TROLL},
210                 { "獣殺しのアーンダル", 10000,  185,  110,   5,   9,  RACE_HALF_ELF},
211                 { "獣マスターのエディー", 25000,  190,  115,   5,   7,  RACE_HOBBIT},
212                 { "竜殺しのオグライン", 30000,  195,  112,   4,   8,  RACE_DWARF},
213                 { "熟練者ドリュー",      10000,   210, 115,  6,  6, RACE_HUMAN},
214                 { "龍の子オラックス",        15000,  185, 110,  5,  9, RACE_DRACONIAN},
215                 { "病気持ちのアンスラックス",         25000,  190, 115,  5,  7, RACE_BEASTMAN},
216                 { "頑丈者アルコス",       30000,  195, 112,  4,  8, RACE_DWARF},
217                 { "腐れ者のサリアス",      5000,   210, 115,  6,  6, RACE_ZOMBIE},
218                 { "晒し骨のトゥエシク",        15000,  185, 110,  5,  9, RACE_SKELETON},
219                 { "ビリオス",         25000,  190, 115,  5,  7, RACE_BEASTMAN},
220                 { "ファスガル",       30000,  195, 112,  4,  8, RACE_ZOMBIE},
221                 { "パラディンのエレフリス",      10000,   210, 115,  6,  6, RACE_BARBARIAN},
222                 { "キ'トリッ'ク",        15000,  185, 110,  5,  9, RACE_KLACKON},
223                 { "蜘蛛の友ドゥロカス",         25000,  190, 115,  5,  7, RACE_DARK_ELF},
224                 { "巨人殺しのフングス",       30000,  195, 112,  4,  8, RACE_DWARF},
225                 { "デランサ",      10000,   210, 115,  6,  6, RACE_ELF},
226                 { "レンジャーのソルビスタニ",        15000,  185, 110,  5,  9, RACE_HALF_ELF},
227                 { "ノロマのゾリル",         25000,  190, 115,  5,  7, RACE_GOLEM},
228                 { "イーオン・フラックス",       20000,  195, 112,  4,  8, RACE_HALF_ELF},
229                 { "強者ナドック",      10000,   210, 115,  6,  6, RACE_HOBBIT},
230                 { "弱虫エラモグ",        15000,  185, 110,  5,  9, RACE_KOBOLD},
231                 { "公正なエオウィリス",         25000,  190, 115,  5,  7, RACE_VAMPIRE},
232                 { "バルログ殺しのヒュイモグ",       30000,  195, 112,  4,  8, RACE_HALF_ORC},
233                 { "冷酷ピーダス",      5000,   210, 115,  6,  6, RACE_HUMAN},
234                 { "ヴァモグ スレイヤー",        15000,  185, 110,  5,  9, RACE_HALF_OGRE},
235                 { "性悪フーシュナク",         25000,  190, 115,  5,  7, RACE_BEASTMAN},
236                 { "舞闘バレン",       30000,  195, 112,  4,  8, RACE_BARBARIAN},
237                 { "残忍なるアーノルド",      5000,   210, 115,  6,  6, RACE_BARBARIAN},
238                 { "獣殺しのアーンダル",        10000,  185, 110,  5,  9, RACE_HALF_ELF},
239                 { "ビーストマスター・エディー",         25000,  190, 115,  5,  7, RACE_HALF_ORC},
240                 { "竜殺しのオグライン",       30000,  195, 112,  4,  8, RACE_DWARF},
241 #else
242                 { "Arnold the Beastly",      5000,   210, 115,  6,  6, RACE_BARBARIAN},
243                 { "Arndal Beast-Slayer",        10000,  185, 110,  5,  9, RACE_HALF_ELF},
244                 { "Eddie Beast-Master",         25000,  190, 115,  5,  7, RACE_HALF_ORC},
245                 { "Oglign Dragon-Slayer",       30000,  195, 112,  4,  8, RACE_DWARF},
246                 { "Drew the Skilled",      10000,   210, 115,  6,  6, RACE_HUMAN},
247                 { "Orrax Dragonson",        15000,  185, 110,  5,  9, RACE_DRACONIAN},
248                 { "Anthrax Disease-Carrier",         25000,  190, 115,  5,  7, RACE_BEASTMAN},
249                 { "Arkhoth the Stout",       30000,  195, 112,  4,  8, RACE_DWARF},
250                 { "Sarlyas the Rotten",      5000,   210, 115,  6,  6, RACE_ZOMBIE},
251                 { "Tuethic Bare-Bones",        15000,  185, 110,  5,  9, RACE_SKELETON},
252                 { "Bilious",         25000,  190, 115,  5,  7, RACE_BEASTMAN},
253                 { "Fasgul",       30000,  195, 112,  4,  8, RACE_ZOMBIE},
254                 { "Ellefris the Paladin",      10000,   210, 115,  6,  6, RACE_BARBARIAN},
255                 { "K'trrik'k",        15000,  185, 110,  5,  9, RACE_KLACKON},
256                 { "Drocus Spiderfriend",         25000,  190, 115,  5,  7, RACE_DARK_ELF},
257                 { "Fungus Giant-Slayer",       30000,  195, 112,  4,  8, RACE_DWARF},
258                 { "Delantha",      10000,   210, 115,  6,  6, RACE_ELF},
259                 { "Solvistani the Ranger",        15000,  185, 110,  5,  9, RACE_HALF_ELF},
260                 { "Xoril the Slow",         25000,  190, 115,  5,  7, RACE_GOLEM},
261                 { "Aeon Flux",       20000,  195, 112,  4,  8, RACE_HALF_ELF},
262                 { "Nadoc the Strong",      10000,   210, 115,  6,  6, RACE_HOBBIT},
263                 { "Eramog the Weak",        15000,  185, 110,  5,  9, RACE_KOBOLD},
264                 { "Eowilith the Fair",         25000,  190, 115,  5,  7, RACE_VAMPIRE},
265                 { "Huimog Balrog-Slayer",       30000,  195, 112,  4,  8, RACE_HALF_ORC},
266                 { "Peadus the Cruel",      5000,   210, 115,  6,  6, RACE_HUMAN},
267                 { "Vamog Slayer",        15000,  185, 110,  5,  9, RACE_HALF_OGRE},
268                 { "Hooshnak the Vicious",         25000,  190, 115,  5,  7, RACE_BEASTMAN},
269                 { "Balenn War-Dancer",       30000,  195, 112,  4,  8, RACE_BARBARIAN},
270                 { "Arnold the Beastly",      5000,   210, 115,  6,  6, RACE_BARBARIAN},
271                 { "Arndal Beast-Slayer",        10000,  185, 110,  5,  9, RACE_HALF_ELF},
272                 { "Eddie Beast-Master",         25000,  190, 115,  5,  7, RACE_HALF_ORC},
273                 { "Oglign Dragon-Slayer",       30000,  195, 112,  4,  8, RACE_DWARF},
274 #endif
275         },
276         {
277                 /* Temple - 22 unique names */
278 #ifdef JP
279                 { "質素なルードヴィヒ",         5000,   175,  109,   6,  15,  RACE_HUMAN},
280                 { "パラディンのガンナー",       10000,  185,  110,   5,  23,  RACE_HUMAN},
281                 { "選ばれしトリン",                     25000,  180,  107,   6,  20,  RACE_ELF},
282                 { "賢明なるサラストロ",                     30000,  185,  109,   5,  15,  RACE_DWARF},
283                 { "パーシヴァル卿",           25000,  180, 107,  6, 20, RACE_HIGH_ELF},
284                 { "神聖なるアセナス",          30000,  185, 109,  5, 15, RACE_HUMAN},
285                 { "マッキノン",         10000,   175, 109,  6, 15, RACE_HUMAN},
286                 { "謹み婦人",         15000,  185, 110,  5, 23, RACE_HIGH_ELF},
287                 { "ドルイドのハシュニック",           25000,  180, 107,  6, 20, RACE_HOBBIT},
288                 { "フィナク",          30000,  185, 109,  5, 15, RACE_YEEK},
289                 { "クリキック",         10000,   175, 109,  6, 15, RACE_KLACKON},
290                 { "荒くれ者モリヴァル",         15000,  185, 110,  5, 23, RACE_ELF},
291                 { "暗きホシャック",           25000,  180, 107,  6, 20, RACE_IMP},
292                 { "賢者アタール",          30000,  185, 109,  5, 15, RACE_HUMAN},
293                 { "清きイベニッド",         10000,   175, 109,  6, 15, RACE_HUMAN},
294                 { "エリディシュ",         15000,  185, 110,  5, 23, RACE_HALF_TROLL},
295                 { "呪術師ヴルドゥシュ",           25000,  180, 107,  6, 20, RACE_HALF_OGRE},
296                 { "狂戦士ハオブ",          30000,  185, 109,  5, 15, RACE_BARBARIAN},
297                 { "若きプルーグディシュ",         10000,   175, 109,  6, 15, RACE_HALF_OGRE},
298                 { "きちがいラムワイズ",         15000,  185, 110,  5, 23, RACE_YEEK},
299                 { "有徳者ムワート",           25000,  180, 107,  6, 20, RACE_KOBOLD},
300                 { "弱虫ダードバード",          30000,  185, 109,  5, 15, RACE_SPECTRE},
301                 { "質素なルードヴィヒ",         5000,   175,  109,   6,  15,  RACE_HUMAN},
302                 { "パラディンのガンナー",       10000,  185,  110,   5,  23,  RACE_HUMAN},
303                 { "選ばれしトリン",                     25000,  180,  107,   6,  20,  RACE_ELF},
304                 { "賢明なるサラストロ",                     30000,  185,  109,   5,  15,  RACE_DWARF},
305                 { "パーシヴァル卿",           25000,  180, 107,  6, 20, RACE_HIGH_ELF},
306                 { "神聖なるアセナス",          30000,  185, 109,  5, 15, RACE_HUMAN},
307                 { "マッキノン",         10000,   175, 109,  6, 15, RACE_HUMAN},
308                 { "謹み婦人",         15000,  185, 110,  5, 23, RACE_HIGH_ELF},
309                 { "ドルイドのハシュニック",           25000,  180, 107,  6, 20, RACE_HOBBIT},
310                 { "フィナク",          30000,  185, 109,  5, 15, RACE_YEEK},
311 #else
312                 { "Ludwig the Humble",          5000,   175, 109,  6, 15, RACE_DWARF},
313                 { "Gunnar the Paladin",         10000,  185, 110,  5, 23, RACE_HALF_TROLL},
314                 { "Torin the Chosen",           25000,  180, 107,  6, 20, RACE_HIGH_ELF},
315                 { "Sarastro the Wise",          30000,  185, 109,  5, 15, RACE_HUMAN},
316                 { "Sir Parsival the Pure",           25000,  180, 107,  6, 20, RACE_HIGH_ELF},
317                 { "Asenath the Holy",          30000,  185, 109,  5, 15, RACE_HUMAN},
318                 { "McKinnon",         10000,   175, 109,  6, 15, RACE_HUMAN},
319                 { "Mistress Chastity",         15000,  185, 110,  5, 23, RACE_HIGH_ELF},
320                 { "Hashnik the Druid",           25000,  180, 107,  6, 20, RACE_HOBBIT},
321                 { "Finak",          30000,  185, 109,  5, 15, RACE_YEEK},
322                 { "Krikkik",         10000,   175, 109,  6, 15, RACE_KLACKON},
323                 { "Morival the Wild",         15000,  185, 110,  5, 23, RACE_ELF},
324                 { "Hoshak the Dark",           25000,  180, 107,  6, 20, RACE_IMP},
325                 { "Atal the Wise",          30000,  185, 109,  5, 15, RACE_HUMAN},
326                 { "Ibenidd the Chaste",         10000,   175, 109,  6, 15, RACE_HUMAN},
327                 { "Eridish",         15000,  185, 110,  5, 23, RACE_HALF_TROLL},
328                 { "Vrudush the Shaman",           25000,  180, 107,  6, 20, RACE_HALF_OGRE},
329                 { "Haob the Berserker",          30000,  185, 109,  5, 15, RACE_BARBARIAN},
330                 { "Proogdish the Youthfull",         10000,   175, 109,  6, 15, RACE_HALF_OGRE},
331                 { "Lumwise the Mad",         15000,  185, 110,  5, 23, RACE_YEEK},
332                 { "Muirt the Virtuous",           25000,  180, 107,  6, 20, RACE_KOBOLD},
333                 { "Dardobard the Weak",          30000,  185, 109,  5, 15, RACE_SPECTRE},
334                 { "Ludwig the Humble",          5000,   175, 109,  6, 15, RACE_DWARF},
335                 { "Gunnar the Paladin",         10000,  185, 110,  5, 23, RACE_HALF_TROLL},
336                 { "Torin the Chosen",           25000,  180, 107,  6, 20, RACE_HIGH_ELF},
337                 { "Sarastro the Wise",          30000,  185, 109,  5, 15, RACE_HUMAN},
338                 { "Sir Parsival the Pure",           25000,  180, 107,  6, 20, RACE_HIGH_ELF},
339                 { "Asenath the Holy",          30000,  185, 109,  5, 15, RACE_HUMAN},
340                 { "McKinnon",         10000,   175, 109,  6, 15, RACE_HUMAN},
341                 { "Mistress Chastity",         15000,  185, 110,  5, 23, RACE_HIGH_ELF},
342                 { "Hashnik the Druid",           25000,  180, 107,  6, 20, RACE_HOBBIT},
343                 { "Finak",          30000,  185, 109,  5, 15, RACE_YEEK},
344 #endif
345         },
346         {
347                 /* Alchemist - 26 unique names */
348 #ifdef JP
349                 { "化学者マウザー",             10000,  190,  111,   5,   8,  RACE_HALF_ELF},
350                 { "カオスのウィズル",   10000,  190,  110,   6,   8,  RACE_HOBBIT},
351                 { "強欲ミダス",              15000,  200,  116,   6,   9,  RACE_GNOME},
352                 { "貧弱ジャ=ファー",                   15000,  220,  111,   4,   9,  RACE_ELF},/*FIRST*/
353                 { "カカルラカカル",           15000,  200, 116,  6,  9, RACE_KLACKON},
354                 { "錬金術師ジャル=エス",       15000,  220, 111,  4,  9, RACE_ELF},
355                 { "用心深いファネラス",         10000,  190, 111,  5,  8, RACE_DWARF},
356                 { "キチガイのルンシー",         10000,  190, 110,  6,  8, RACE_HUMAN},
357                 { "グランブルワース",           15000,  200, 116,  6,  9, RACE_GNOME},
358                 { "フリッター",       15000,  220, 111,  4,  9, RACE_SPRITE},
359                 { "ザリルス",         10000,  190, 111,  5,  8, RACE_HUMAN},
360                 { "古きエグバート",         10000,  190, 110,  6,  8, RACE_DWARF},
361                 { "誇り高きヴァリンドラ",           15000,  200, 116,  6,  9, RACE_HIGH_ELF},
362                 { "錬金術師タエン",       15000,  220, 111,  4,  9, RACE_HUMAN},
363                 { "巧言カイド",         10000,  190, 111,  5,  8, RACE_VAMPIRE},
364                 { "暗きフリア",         10000,  190, 110,  6,  8, RACE_NIBELUNG},
365                 { "質素なドムリ",           15000,  200, 116,  6,  9, RACE_DWARF},
366                 { "魔の子ヤァジュッカ",       15000,  220, 111,  4,  9, RACE_IMP},
367                 { "薬草師ジェララルドール",         10000,  190, 111,  5,  8, RACE_HIGH_ELF},
368                 { "賢者オレラルダン",         10000,  190, 110,  6,  8, RACE_BARBARIAN},
369                 { "デモニシストのフゾグロ",           15000,  200, 116,  6,  9, RACE_IMP},
370                 { "錬金術師ドゥリアシュ",       15000,  220, 111,  4,  9, RACE_HALF_ORC},
371                 { "強者ネリア",         10000,  190, 111,  5,  8, RACE_CYCLOPS},
372                 { "辛口リグナス",         10000,  190, 110,  6,  8, RACE_HALF_ORC},
373                 { "ティルバ",           15000,  200, 116,  6,  9, RACE_HOBBIT},
374                 { "金持ちミリルドリック",       15000,  220, 111,  4,  9, RACE_HUMAN},
375
376                 { "科学者マウザー",         10000,  190, 111,  5,  8, RACE_HALF_ELF},
377                 { "カオスのウィズル",         10000,  190, 110,  6,  8, RACE_HOBBIT},
378                 { "強欲ミダス",           15000,  200, 116,  6,  9, RACE_GNOME},
379                 { "錬金術師ジャ=ファー",       15000,  220, 111,  4,  9, RACE_ELF},
380                 { "カカルラカカル",           15000,  200, 116,  6,  9, RACE_KLACKON},
381                 { "錬金術師ジャル=エス",       15000,  220, 111,  4,  9, RACE_ELF},
382 #else
383                 { "Mauser the Chemist",         10000,  190, 111,  5,  8, RACE_HALF_ELF},
384                 { "Wizzle the Chaotic",         10000,  190, 110,  6,  8, RACE_HOBBIT},
385                 { "Midas the Greedy",           15000,  200, 116,  6,  9, RACE_GNOME},
386                 { "Ja-Far the Alchemist",       15000,  220, 111,  4,  9, RACE_ELF},
387                 { "Kakalrakakal",           15000,  200, 116,  6,  9, RACE_KLACKON},
388                 { "Jal-Eth the Alchemist",       15000,  220, 111,  4,  9, RACE_ELF},
389                 { "Fanelath the Cautious",         10000,  190, 111,  5,  8, RACE_DWARF},
390                 { "Runcie the Insane",         10000,  190, 110,  6,  8, RACE_HUMAN},
391                 { "Grumbleworth",           15000,  200, 116,  6,  9, RACE_GNOME},
392                 { "Flitter",       15000,  220, 111,  4,  9, RACE_SPRITE},
393                 { "Xarillus",         10000,  190, 111,  5,  8, RACE_HUMAN},
394                 { "Egbert the Old",         10000,  190, 110,  6,  8, RACE_DWARF},
395                 { "Valindra the Proud",           15000,  200, 116,  6,  9, RACE_HIGH_ELF},
396                 { "Taen the Alchemist",       15000,  220, 111,  4,  9, RACE_HUMAN},
397                 { "Cayd the Sweet",         10000,  190, 111,  5,  8, RACE_VAMPIRE},
398                 { "Fulir the Dark",         10000,  190, 110,  6,  8, RACE_NIBELUNG},
399                 { "Domli the Humble",           15000,  200, 116,  6,  9, RACE_DWARF},
400                 { "Yaarjukka Demonspawn",       15000,  220, 111,  4,  9, RACE_IMP},
401                 { "Gelaraldor the Herbmaster",         10000,  190, 111,  5,  8, RACE_HIGH_ELF},
402                 { "Olelaldan the Wise",         10000,  190, 110,  6,  8, RACE_BARBARIAN},
403                 { "Fthoglo the Demonicist",           15000,  200, 116,  6,  9, RACE_IMP},
404                 { "Dridash the Alchemist",       15000,  220, 111,  4,  9, RACE_HALF_ORC},
405                 { "Nelir the Strong",         10000,  190, 111,  5,  8, RACE_CYCLOPS},
406                 { "Lignus the Pungent",         10000,  190, 110,  6,  8, RACE_HALF_ORC},
407                 { "Tilba",           15000,  200, 116,  6,  9, RACE_HOBBIT},
408                 { "Myrildric the Wealthy",       15000,  220, 111,  4,  9, RACE_HUMAN},
409
410                 { "Mauser the Chemist",         10000,  190, 111,  5,  8, RACE_HALF_ELF},
411                 { "Wizzle the Chaotic",         10000,  190, 110,  6,  8, RACE_HOBBIT},
412                 { "Midas the Greedy",           15000,  200, 116,  6,  9, RACE_GNOME},
413                 { "Ja-Far the Alchemist",       15000,  220, 111,  4,  9, RACE_ELF},
414                 { "Kakalrakakal",           15000,  200, 116,  6,  9, RACE_KLACKON},
415                 { "Jal-Eth the Alchemist",       15000,  220, 111,  4,  9, RACE_ELF},
416 #endif
417         },
418
419         {
420                 /* Magic Shop - 23 unique names */
421 #ifdef JP
422                 { "ソーサラーのロ=パン",       20000,  200,  110,   7,   8,  RACE_HALF_ELF},
423                 { "偉大なるブガービイ",         20000,  215,  113,   6,  10,  RACE_GNOME},
424                 { "イェンダーの魔法使い",     30000,  200,  110,   7,  10,  RACE_HUMAN},
425                 { "死霊使いリャク",30000,      175,  110,   5,  11,  RACE_HIGH_ELF},
426                 { "魔術師スキドゥニー",        15000,  200, 110,  7,  8, RACE_HALF_ELF},
427                 { "幻術師キリア",       30000,  200, 110,  7, 10, RACE_HUMAN},
428                 { "死霊術師ニッキ",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
429                 { "ソロストラン",        15000,  200, 110,  7,  8, RACE_SPRITE},
430                 { "烏賊口アチシェ",         20000,  215, 113,  6, 10, RACE_MIND_FLAYER},
431                 { "貴族のカザ",       30000,  200, 110,  7, 10, RACE_HIGH_ELF},
432                 { "暗きファジル",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
433                 { "偉大なるケルドーン",        15000,  200, 110,  7,  8, RACE_DWARF},
434                 { "フィランスロプス",         20000,  215, 113,  6, 10, RACE_HOBBIT},
435                 { "魔女のアグナー",       30000,  200, 110,  7, 10, RACE_HUMAN},
436                 { "死霊術師ビュリアンス",       30000,  175, 110,  5, 11, RACE_BEASTMAN},
437                 { "ハイメイジのヴイラク",        15000,  200, 110,  7,  8, RACE_BEASTMAN},
438                 { "知恵者マディッシュ",         20000,  215, 113,  6, 10, RACE_BEASTMAN},
439                 { "ファレブリンボール",       30000,  200, 110,  7, 10, RACE_HIGH_ELF},
440                 { "陰険フェリル=ガンド",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
441                 { "呪術師サレゴード",        15000,  200, 110,  7,  8, RACE_BARBARIAN},
442                 { "神秘家クトゥアロス",         20000,  215, 113,  6, 10, RACE_MIND_FLAYER},
443                 { "幻術師イベリ",       30000,  200, 110,  7, 10, RACE_SKELETON},
444                 { "死霊術師ヘトー",       30000,  175, 110,  5, 11, RACE_YEEK},
445                 { "魔術師ロ=パン",        20000,  200, 110,  7,  8, RACE_HALF_ELF},
446                 { "偉大なるブガービイ",         20000,  215, 113,  6, 10, RACE_GNOME},
447                 { "イェンダーの魔法使い",       30000,  200, 110,  7, 10, RACE_HUMAN},
448                 { "死霊術師リャク",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
449                 { "魔術師スキドゥニー",        15000,  200, 110,  7,  8, RACE_HALF_ELF},
450                 { "幻術師キリア",       30000,  200, 110,  7, 10, RACE_HUMAN},
451                 { "死霊術師ニッキ",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
452                 { "ソロストラン",        15000,  200, 110,  7,  8, RACE_SPRITE},
453                 { "烏賊口アチシェ",         20000,  215, 113,  6, 10, RACE_MIND_FLAYER},
454 #else
455                 { "Lo Pan the Sorcerer",        20000,  200, 110,  7,  8, RACE_HALF_ELF},
456                 { "Buggerby the Great",         20000,  215, 113,  6, 10, RACE_GNOME},
457                 { "The Wizard of Yendor",       30000,  200, 110,  7, 10, RACE_HUMAN},
458                 { "Rjak the Necromancer",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
459                 { "Skidney the Sorcerer",        15000,  200, 110,  7,  8, RACE_HALF_ELF},
460                 { "Kyria the Illusionist",       30000,  200, 110,  7, 10, RACE_HUMAN},
461                 { "Nikki the Necromancer",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
462                 { "Solostoran",        15000,  200, 110,  7,  8, RACE_SPRITE},
463                 { "Achshe the Tentacled",         20000,  215, 113,  6, 10, RACE_MIND_FLAYER},
464                 { "Kaza the Noble",       30000,  200, 110,  7, 10, RACE_HIGH_ELF},
465                 { "Fazzil the Dark",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
466                 { "Keldorn the Grand",        15000,  200, 110,  7,  8, RACE_DWARF},
467                 { "Philanthropus",         20000,  215, 113,  6, 10, RACE_HOBBIT},
468                 { "Agnar the Enchantress",       30000,  200, 110,  7, 10, RACE_HUMAN},
469                 { "Buliance the Necromancer",       30000,  175, 110,  5, 11, RACE_BEASTMAN},
470                 { "Vuirak the High-Mage",        15000,  200, 110,  7,  8, RACE_BEASTMAN},
471                 { "Madish the Smart",         20000,  215, 113,  6, 10, RACE_BEASTMAN},
472                 { "Falebrimbor",       30000,  200, 110,  7, 10, RACE_HIGH_ELF},
473                 { "Felil-Gand the Subtle",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
474                 { "Thalegord the Shaman",        15000,  200, 110,  7,  8, RACE_BARBARIAN},
475                 { "Cthoaloth the Mystic",         20000,  215, 113,  6, 10, RACE_MIND_FLAYER},
476                 { "Ibeli the Illusionist",       30000,  200, 110,  7, 10, RACE_SKELETON},
477                 { "Heto the Necromancer",       30000,  175, 110,  5, 11, RACE_YEEK},
478                 { "Lo Pan the Sorcerer",        20000,  200, 110,  7,  8, RACE_HALF_ELF},
479                 { "Buggerby the Great",         20000,  215, 113,  6, 10, RACE_GNOME},
480                 { "The Wizard of Yendor",       30000,  200, 110,  7, 10, RACE_HUMAN},
481                 { "Rjak the Necromancer",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
482                 { "Skidney the Sorcerer",        15000,  200, 110,  7,  8, RACE_HALF_ELF},
483                 { "Kyria the Illusionist",       30000,  200, 110,  7, 10, RACE_HUMAN},
484                 { "Nikki the Necromancer",       30000,  175, 110,  5, 11, RACE_DARK_ELF},
485                 { "Solostoran",        15000,  200, 110,  7,  8, RACE_SPRITE},
486                 { "Achshe the Tentacled",         20000,  215, 113,  6, 10, RACE_MIND_FLAYER},
487 #endif
488         },
489         {
490                 /* Black Market - 32 unique names */
491 #ifdef JP
492                 { "ガリー=ギガズ",            20000,  250,  150,  10,   5,  RACE_HALF_TROLL},
493                 { "ゴブリンのヒストーア",       20000,  250,  150,  10,   5,  RACE_HALF_ORC},
494                 { "フェレンギ人クアーク",           30000,  250,  150,  10,   5,  RACE_HUMAN},
495                 { "公正なる(?)トッピ",                     30000,  250,  150,  10,   5,  RACE_ELF},
496                 { "死人ヴァッサ",             20000,  250, 150, 10,  5, RACE_ZOMBIE},
497                 { "裏切り者カイン",          20000,  250, 150, 10,  5, RACE_VAMPIRE},
498                 { "ブボニカス",          30000,  250, 150, 10,  5, RACE_BEASTMAN},
499                 { "コープスライト",           30000,  250, 150, 10,  5, RACE_SPECTRE},
500                 { "血に飢えしパリッシュ",                 20000,  250, 150, 10,  5, RACE_VAMPIRE},
501                 { "ヴァイル",          20000,  250, 150, 10,  5, RACE_SKELETON},
502                 { "信頼のプレンティス",          30000,  250, 150, 10,  5, RACE_SKELETON},
503                 { "人間殺しのグリエラ",           30000,  250, 150, 10,  5, RACE_IMP},
504                 { "エンジェル",                 20000,  250, 150, 10,  5, RACE_VAMPIRE},
505                 { "水膨れフロツァム",          20000,  250, 150, 10,  5, RACE_ZOMBIE},
506                 { "ニーヴァル",          30000,  250, 150, 10,  5, RACE_VAMPIRE},
507                 { "明るいアナスタシア",           30000,  250, 150, 10,  5, RACE_SPECTRE},
508                 { "死霊術師チャリティー", 20000,  250, 150, 10,  5, RACE_DARK_ELF},
509                 { "ボクサーのプグナシオス",          20000,  250, 150, 10,  5, RACE_HALF_ORC},
510                 { "幸運なフットソア",          30000,  250, 150, 10,  5, RACE_BEASTMAN},
511                 { "光指のシドリア",           30000,  250, 150, 10,  5, RACE_HUMAN},
512                 { "手品師リアソー",                 20000,  250, 150, 10,  5, RACE_HOBBIT},
513                 { "やりくり上手のジャナッカ",          20000,  250, 150, 10,  5, RACE_GNOME},
514                 { "悪党シーナ",          30000,  250, 150, 10,  5, RACE_GNOME},
515                 { "大爪アルニッキ",           30000,  250, 150, 10,  5, RACE_DRACONIAN},
516                 { "貧乏チャエアンド",                 20000,  250, 150, 10,  5, RACE_HUMAN},
517                 { "山賊アファードーフ",          20000,  250, 150, 10,  5, RACE_BARBARIAN},
518                 { "強欲ラザクスル",          30000,  250, 150, 10,  5, RACE_MIND_FLAYER},
519                 { "ファラレウィン",           30000,  250, 150, 10,  5, RACE_SPRITE},
520                 { "しわしわヴォスール",                 20000,  250, 150, 10,  5, RACE_NIBELUNG},
521                 { "ハンサムなアラオード",          20000,  250, 150, 10,  5, RACE_AMBERITE},
522                 { "負け犬セラドフリド",          30000,  250, 150, 10,  5, RACE_HUMAN},
523                 { "片足のエルーロ",           30000,  250, 150, 10,  5, RACE_HALF_OGRE},
524 #else
525                 { "Gary Gygaz",                 20000,  250, 150, 10,  5, RACE_HALF_TROLL},
526                 { "Histor the Goblin",          20000,  250, 150, 10,  5, RACE_HALF_ORC},
527                 { "Quark the Ferengi",          30000,  250, 150, 10,  5, RACE_DWARF},
528                 { "Topi the Fair(?)",           30000,  250, 150, 10,  5, RACE_HUMAN},
529                 { "Vhassa the Dead",             20000,  250, 150, 10,  5, RACE_ZOMBIE},
530                 { "Kyn the Treacherous",          20000,  250, 150, 10,  5, RACE_VAMPIRE},
531                 { "Bubonicus",          30000,  250, 150, 10,  5, RACE_BEASTMAN},
532                 { "Corpselight",           30000,  250, 150, 10,  5, RACE_SPECTRE},
533                 { "Parrish the Bloodthirsty",                 20000,  250, 150, 10,  5, RACE_VAMPIRE},
534                 { "Vile",          20000,  250, 150, 10,  5, RACE_SKELETON},
535                 { "Prentice the Trusted",          30000,  250, 150, 10,  5, RACE_SKELETON},
536                 { "Griella Humanslayer",           30000,  250, 150, 10,  5, RACE_IMP},
537                 { "Angel",                 20000,  250, 150, 10,  5, RACE_VAMPIRE},
538                 { "Flotsam the Bloated",          20000,  250, 150, 10,  5, RACE_ZOMBIE},
539                 { "Nieval",          30000,  250, 150, 10,  5, RACE_VAMPIRE},
540                 { "Anastasia the Luminous",           30000,  250, 150, 10,  5, RACE_SPECTRE},
541                 { "Charity the Necromancer", 20000,  250, 150, 10,  5, RACE_DARK_ELF},
542                 { "Pugnacious the Pugilist",          20000,  250, 150, 10,  5, RACE_HALF_ORC},
543                 { "Footsore the Lucky",          30000,  250, 150, 10,  5, RACE_BEASTMAN},
544                 { "Sidria Lighfingered",           30000,  250, 150, 10,  5, RACE_HUMAN},
545                 { "Riatho the Juggler",                 20000,  250, 150, 10,  5, RACE_HOBBIT},
546                 { "Janaaka the Shifty",          20000,  250, 150, 10,  5, RACE_GNOME},
547                 { "Cina the Rogue",          30000,  250, 150, 10,  5, RACE_GNOME},
548                 { "Arunikki Greatclaw",           30000,  250, 150, 10,  5, RACE_DRACONIAN},
549                 { "Chaeand the Poor",                 20000,  250, 150, 10,  5, RACE_HUMAN},
550                 { "Afardorf the Brigand",          20000,  250, 150, 10,  5, RACE_BARBARIAN},
551                 { "Lathaxl the Greedy",          30000,  250, 150, 10,  5, RACE_MIND_FLAYER},
552                 { "Falarewyn",           30000,  250, 150, 10,  5, RACE_SPRITE},
553                 { "Vosur the Wrinkled",                 20000,  250, 150, 10,  5, RACE_NIBELUNG},
554                 { "Araord the Handsome",          20000,  250, 150, 10,  5, RACE_AMBERITE},
555                 { "Theradfrid the Loser",          30000,  250, 150, 10,  5, RACE_HUMAN},
556                 { "One-Legged Eroolo",           30000,  250, 150, 10,  5, RACE_HALF_OGRE},
557 #endif
558         },
559         {
560                 /* Home */
561 #ifdef JP
562                 { "我が家",                          0,      100, 100,  0, 99, 99},
563                 { "我が家",                          0,      100, 100,  0, 99, 99},
564                 { "我が家",                          0,      100, 100,  0, 99, 99},
565                 { "我が家",                          0,      100, 100,  0, 99, 99},
566                 { "我が家",                          0,      100, 100,  0, 99, 99},
567                 { "我が家",                          0,      100, 100,  0, 99, 99},
568                 { "我が家",                          0,      100, 100,  0, 99, 99},
569                 { "我が家",                          0,      100, 100,  0, 99, 99},
570                 { "我が家",                          0,      100, 100,  0, 99, 99},
571                 { "我が家",                          0,      100, 100,  0, 99, 99},
572                 { "我が家",                          0,      100, 100,  0, 99, 99},
573                 { "我が家",                          0,      100, 100,  0, 99, 99},
574                 { "我が家",                          0,      100, 100,  0, 99, 99},
575                 { "我が家",                          0,      100, 100,  0, 99, 99},
576                 { "我が家",                          0,      100, 100,  0, 99, 99},
577                 { "我が家",                          0,      100, 100,  0, 99, 99},
578                 { "我が家",                          0,      100, 100,  0, 99, 99},
579                 { "我が家",                          0,      100, 100,  0, 99, 99},
580                 { "我が家",                          0,      100, 100,  0, 99, 99},
581                 { "我が家",                          0,      100, 100,  0, 99, 99},
582                 { "我が家",                          0,      100, 100,  0, 99, 99},
583                 { "我が家",                          0,      100, 100,  0, 99, 99},
584                 { "我が家",                          0,      100, 100,  0, 99, 99},
585                 { "我が家",                          0,      100, 100,  0, 99, 99},
586                 { "我が家",                          0,      100, 100,  0, 99, 99},
587                 { "我が家",                          0,      100, 100,  0, 99, 99},
588                 { "我が家",                          0,      100, 100,  0, 99, 99},
589                 { "我が家",                          0,      100, 100,  0, 99, 99},
590                 { "我が家",                          0,      100, 100,  0, 99, 99},
591                 { "我が家",                          0,      100, 100,  0, 99, 99},
592                 { "我が家",                          0,      100, 100,  0, 99, 99},
593                 { "我が家",                          0,      100, 100,  0, 99, 99},
594 #else
595                 { "Your home",                          0,      100, 100,  0, 99, 99},
596                 { "Your home",                          0,      100, 100,  0, 99, 99},
597                 { "Your home",                          0,      100, 100,  0, 99, 99},
598                 { "Your home",                          0,      100, 100,  0, 99, 99},
599                 { "Your home",                          0,      100, 100,  0, 99, 99},
600                 { "Your home",                          0,      100, 100,  0, 99, 99},
601                 { "Your home",                          0,      100, 100,  0, 99, 99},
602                 { "Your home",                          0,      100, 100,  0, 99, 99},
603                 { "Your home",                          0,      100, 100,  0, 99, 99},
604                 { "Your home",                          0,      100, 100,  0, 99, 99},
605                 { "Your home",                          0,      100, 100,  0, 99, 99},
606                 { "Your home",                          0,      100, 100,  0, 99, 99},
607                 { "Your home",                          0,      100, 100,  0, 99, 99},
608                 { "Your home",                          0,      100, 100,  0, 99, 99},
609                 { "Your home",                          0,      100, 100,  0, 99, 99},
610                 { "Your home",                          0,      100, 100,  0, 99, 99},
611                 { "Your home",                          0,      100, 100,  0, 99, 99},
612                 { "Your home",                          0,      100, 100,  0, 99, 99},
613                 { "Your home",                          0,      100, 100,  0, 99, 99},
614                 { "Your home",                          0,      100, 100,  0, 99, 99},
615                 { "Your home",                          0,      100, 100,  0, 99, 99},
616                 { "Your home",                          0,      100, 100,  0, 99, 99},
617                 { "Your home",                          0,      100, 100,  0, 99, 99},
618                 { "Your home",                          0,      100, 100,  0, 99, 99},
619                 { "Your home",                          0,      100, 100,  0, 99, 99},
620                 { "Your home",                          0,      100, 100,  0, 99, 99},
621                 { "Your home",                          0,      100, 100,  0, 99, 99},
622                 { "Your home",                          0,      100, 100,  0, 99, 99},
623                 { "Your home",                          0,      100, 100,  0, 99, 99},
624                 { "Your home",                          0,      100, 100,  0, 99, 99},
625                 { "Your home",                          0,      100, 100,  0, 99, 99},
626                 { "Your home",                          0,      100, 100,  0, 99, 99},
627 #endif
628
629         },
630
631         {
632                 /* Bookstore - 21 unique names */
633 #ifdef JP
634                 { "強欲ドラフ", 10000, 175, 108, 4, 12, RACE_HUMAN},
635                 { "賢者オドナー", 15000, 120, 105, 6, 16, RACE_HIGH_ELF},
636                 { "中立のガンダー", 25000, 120, 110, 7, 19, RACE_DARK_ELF},
637                 { "忍耐の人ロ=シャ", 30000, 140, 105, 6, 12, RACE_ELF},
638                 { "ランドルフ・カーター", 15000, 175, 108, 4, 12, RACE_HUMAN},
639                 { "隼のサライ", 15000, 175, 108, 4, 12, RACE_HUMAN},
640                 { "千里眼ボドリル", 20000, 120, 105, 6, 16, RACE_HIGH_ELF},
641                 { "沈黙のヴェオロイン", 25000, 120, 110, 7, 19, RACE_ZOMBIE},
642                 { "学者のヴァンシラス", 30000, 140, 105, 6, 12, RACE_MIND_FLAYER},
643                 { "物書きオセイン", 15000, 175, 108, 4, 12, RACE_SKELETON},
644                 { "本の虫オルヴァー", 20000, 120, 105, 6, 16, RACE_VAMPIRE},
645                 { "浅井墓男", 25000, 120, 110, 7, 19, RACE_ZOMBIE},
646                 { "デスマスク", 30000, 140, 105, 6, 12, RACE_ZOMBIE},
647                 { "学者のアスーヌ", 15000, 175, 108, 4, 12, RACE_MIND_FLAYER},
648                 { "死人のプリランド", 20000, 120, 105, 6, 16, RACE_ZOMBIE},
649                 { "鉄のロナール", 25000, 120, 110, 7, 19, RACE_GOLEM},
650 #else
651                 { "Dolaf the Greedy", 10000, 175, 108, 4, 12, RACE_HUMAN},
652                 { "Odnar the Sage", 15000, 120, 105, 6, 16, RACE_HIGH_ELF},
653                 { "Gandar the Neutral", 25000, 120, 110, 7, 19, RACE_DARK_ELF},
654                 { "Ro-sha the Patient", 30000, 140, 105, 6, 12, RACE_ELF},
655                 { "Randolph Carter", 15000, 175, 108, 4, 12, RACE_HUMAN},
656                 { "Sarai the Swift", 15000, 175, 108, 4, 12, RACE_HUMAN},
657                 { "Bodril the Seer", 20000, 120, 105, 6, 16, RACE_HIGH_ELF},
658                 { "Veloin the Quiet", 25000, 120, 110, 7, 19, RACE_ZOMBIE},
659                 { "Vanthylas the Learned", 30000, 140, 105, 6, 12, RACE_MIND_FLAYER},
660                 { "Ossein the Literate", 15000, 175, 108, 4, 12, RACE_SKELETON},
661                 { "Olvar Bookworm", 20000, 120, 105, 6, 16, RACE_VAMPIRE},
662                 { "Shallowgrave", 25000, 120, 110, 7, 19, RACE_ZOMBIE},
663                 { "Death Mask", 30000, 140, 105, 6, 12, RACE_ZOMBIE},
664                 { "Asuunu the Learned", 15000, 175, 108, 4, 12, RACE_MIND_FLAYER},
665                 { "Prirand the Dead", 20000, 120, 105, 6, 16, RACE_ZOMBIE},
666                 { "Ronar the Iron", 25000, 120, 110, 7, 19, RACE_GOLEM},
667 #endif
668 #ifdef JP
669                 { "ガリル=ガミル", 30000, 140, 105, 6, 12, RACE_ELF},
670                 { "本食いローバグ", 15000, 175, 108, 4, 12, RACE_KOBOLD},
671                 { "キリアリキーク", 20000, 120, 105, 6, 16, RACE_KLACKON},
672                 { "静かなるリリン", 25000, 120, 110, 7, 19, RACE_DWARF},
673                 { "王者イサング", 30000, 140, 105, 6, 12, RACE_HIGH_ELF},
674                 { "強欲ドラフ", 10000, 175, 108, 4, 12, RACE_HUMAN},
675                 { "賢者オドナー", 15000, 120, 105, 6, 16, RACE_HIGH_ELF},
676                 { "中立のガンダー", 25000, 120, 110, 7, 19, RACE_DARK_ELF},
677                 { "忍耐の人ロ=シャ", 30000, 140, 105, 6, 12, RACE_ELF},
678                 { "ランドルフ・カーター", 15000, 175, 108, 4, 12, RACE_HUMAN},
679                 { "隼サライ", 15000, 175, 108, 4, 12, RACE_HUMAN},
680                 { "千里眼ボドリル", 20000, 120, 105, 6, 16, RACE_HIGH_ELF},
681                 { "沈黙のヴェオロイン", 25000, 120, 110, 7, 19, RACE_ZOMBIE},
682                 { "学者のヴァンシラス", 30000, 140, 105, 6, 12, RACE_MIND_FLAYER},
683                 { "物書きオセイン", 15000, 175, 108, 4, 12, RACE_SKELETON},
684                 { "本の虫オルヴァー", 20000, 120, 105, 6, 16, RACE_VAMPIRE},
685 #else
686                 { "Galil-Gamir", 30000, 140, 105, 6, 12, RACE_ELF},
687                 { "Rorbag Book-Eater", 15000, 175, 108, 4, 12, RACE_KOBOLD},
688                 { "Kiriarikirk", 20000, 120, 105, 6, 16, RACE_KLACKON},
689                 { "Rilin the Quiet", 25000, 120, 110, 7, 19, RACE_DWARF},
690                 { "Isung the Lord", 30000, 140, 105, 6, 12, RACE_HIGH_ELF},
691                 { "Dolaf the Greedy", 10000, 175, 108, 4, 12, RACE_HUMAN},
692                 { "Odnar the Sage", 15000, 120, 105, 6, 16, RACE_HIGH_ELF},
693                 { "Gandar the Neutral", 25000, 120, 110, 7, 19, RACE_DARK_ELF},
694                 { "Ro-sha the Patient", 30000, 140, 105, 6, 12, RACE_ELF},
695                 { "Randolph Carter", 15000, 175, 108, 4, 12, RACE_HUMAN},
696                 { "Sarai the Swift", 15000, 175, 108, 4, 12, RACE_HUMAN},
697                 { "Bodril the Seer", 20000, 120, 105, 6, 16, RACE_HIGH_ELF},
698                 { "Veloin the Quiet", 25000, 120, 110, 7, 19, RACE_ZOMBIE},
699                 { "Vanthylas the Learned", 30000, 140, 105, 6, 12, RACE_MIND_FLAYER},
700                 { "Ossein the Literate", 15000, 175, 108, 4, 12, RACE_SKELETON},
701                 { "Olvar Bookworm", 20000, 120, 105, 6, 16, RACE_VAMPIRE},
702 #endif
703         },
704
705         {
706                 /* Museum */
707 #ifdef JP
708                 { "博物館",                          0,      100, 100,  0, 99, 99},
709                 { "博物館",                          0,      100, 100,  0, 99, 99},
710                 { "博物館",                          0,      100, 100,  0, 99, 99},
711                 { "博物館",                          0,      100, 100,  0, 99, 99},
712                 { "博物館",                          0,      100, 100,  0, 99, 99},
713                 { "博物館",                          0,      100, 100,  0, 99, 99},
714                 { "博物館",                          0,      100, 100,  0, 99, 99},
715                 { "博物館",                          0,      100, 100,  0, 99, 99},
716                 { "博物館",                          0,      100, 100,  0, 99, 99},
717                 { "博物館",                          0,      100, 100,  0, 99, 99},
718                 { "博物館",                          0,      100, 100,  0, 99, 99},
719                 { "博物館",                          0,      100, 100,  0, 99, 99},
720                 { "博物館",                          0,      100, 100,  0, 99, 99},
721                 { "博物館",                          0,      100, 100,  0, 99, 99},
722                 { "博物館",                          0,      100, 100,  0, 99, 99},
723                 { "博物館",                          0,      100, 100,  0, 99, 99},
724                 { "博物館",                          0,      100, 100,  0, 99, 99},
725                 { "博物館",                          0,      100, 100,  0, 99, 99},
726                 { "博物館",                          0,      100, 100,  0, 99, 99},
727                 { "博物館",                          0,      100, 100,  0, 99, 99},
728                 { "博物館",                          0,      100, 100,  0, 99, 99},
729                 { "博物館",                          0,      100, 100,  0, 99, 99},
730                 { "博物館",                          0,      100, 100,  0, 99, 99},
731                 { "博物館",                          0,      100, 100,  0, 99, 99},
732                 { "博物館",                          0,      100, 100,  0, 99, 99},
733                 { "博物館",                          0,      100, 100,  0, 99, 99},
734                 { "博物館",                          0,      100, 100,  0, 99, 99},
735                 { "博物館",                          0,      100, 100,  0, 99, 99},
736                 { "博物館",                          0,      100, 100,  0, 99, 99},
737                 { "博物館",                          0,      100, 100,  0, 99, 99},
738                 { "博物館",                          0,      100, 100,  0, 99, 99},
739                 { "博物館",                          0,      100, 100,  0, 99, 99},
740 #else
741                 { "Museum",                          0,      100, 100,  0, 99, 99},
742                 { "Museum",                          0,      100, 100,  0, 99, 99},
743                 { "Museum",                          0,      100, 100,  0, 99, 99},
744                 { "Museum",                          0,      100, 100,  0, 99, 99},
745                 { "Museum",                          0,      100, 100,  0, 99, 99},
746                 { "Museum",                          0,      100, 100,  0, 99, 99},
747                 { "Museum",                          0,      100, 100,  0, 99, 99},
748                 { "Museum",                          0,      100, 100,  0, 99, 99},
749                 { "Museum",                          0,      100, 100,  0, 99, 99},
750                 { "Museum",                          0,      100, 100,  0, 99, 99},
751                 { "Museum",                          0,      100, 100,  0, 99, 99},
752                 { "Museum",                          0,      100, 100,  0, 99, 99},
753                 { "Museum",                          0,      100, 100,  0, 99, 99},
754                 { "Museum",                          0,      100, 100,  0, 99, 99},
755                 { "Museum",                          0,      100, 100,  0, 99, 99},
756                 { "Museum",                          0,      100, 100,  0, 99, 99},
757                 { "Museum",                          0,      100, 100,  0, 99, 99},
758                 { "Museum",                          0,      100, 100,  0, 99, 99},
759                 { "Museum",                          0,      100, 100,  0, 99, 99},
760                 { "Museum",                          0,      100, 100,  0, 99, 99},
761                 { "Museum",                          0,      100, 100,  0, 99, 99},
762                 { "Museum",                          0,      100, 100,  0, 99, 99},
763                 { "Museum",                          0,      100, 100,  0, 99, 99},
764                 { "Museum",                          0,      100, 100,  0, 99, 99},
765                 { "Museum",                          0,      100, 100,  0, 99, 99},
766                 { "Museum",                          0,      100, 100,  0, 99, 99},
767                 { "Museum",                          0,      100, 100,  0, 99, 99},
768                 { "Museum",                          0,      100, 100,  0, 99, 99},
769                 { "Museum",                          0,      100, 100,  0, 99, 99},
770                 { "Museum",                          0,      100, 100,  0, 99, 99},
771                 { "Museum",                          0,      100, 100,  0, 99, 99},
772                 { "Museum",                          0,      100, 100,  0, 99, 99},
773 #endif
774
775         },
776
777 };
778
779 static int cur_store_num = 0;
780 static int store_top = 0;
781 static int store_bottom = 0;
782 static int xtra_stock = 0;
783 static store_type *st_ptr = NULL;
784 static const owner_type *ot_ptr = NULL;
785 static s16b old_town_num = 0;
786 static s16b inner_town_num = 0;
787 #define RUMOR_CHANCE 8
788
789 #define MAX_COMMENT_1   6
790
791 static concptr comment_1[MAX_COMMENT_1] =
792 {
793 #ifdef JP
794         "オーケーだ。",
795         "結構だ。",
796         "そうしよう!",
797         "賛成だ!",
798         "よし!",
799         "わかった!"
800 #else
801         "Okay.",
802         "Fine.",
803         "Accepted!",
804         "Agreed!",
805         "Done!",
806         "Taken!"
807 #endif
808
809 };
810
811 #ifdef JP
812 /*! ブラックマーケット追加メッセージ(承諾) */
813 static concptr comment_1_B[MAX_COMMENT_1] = {
814         "まあ、それでいいや。",
815         "今日はそれで勘弁してやる。",
816         "分かったよ。",
817         "しょうがない。",
818         "それで我慢するよ。",
819         "こんなもんだろう。"
820 };
821 #endif
822 #define MAX_COMMENT_2A  2
823
824 static concptr comment_2a[MAX_COMMENT_2A] =
825 {
826 #ifdef JP
827         "私の忍耐力を試しているのかい? $%s が最後だ。",
828         "我慢にも限度があるぞ。 $%s が最後だ。"
829 #else
830         "You try my patience.  %s is final.",
831         "My patience grows thin.  %s is final."
832 #endif
833
834 };
835
836 #define MAX_COMMENT_2B  12
837
838 static concptr comment_2b[MAX_COMMENT_2B] =
839 {
840 #ifdef JP
841         " $%s ぐらいは出さなきゃダメだよ。",
842         " $%s なら受け取ってもいいが。",
843         "ハ! $%s 以下はないね。",
844         "何て奴だ! $%s 以下はあり得ないぞ。",
845         "それじゃ少なすぎる! $%s は欲しいところだ。",
846         "バカにしている! $%s はもらわないと。",
847         "嘘だろう! $%s でどうだい?",
848         "おいおい! $%s を考えてくれないか?",
849         "1000匹のオークのノミに苦しめられるがいい! $%s だ。",
850         "お前の大切なものに災いあれ! $%s でどうだ。",
851         "モルゴスに賞味されるがいい!本当は $%s なんだろう?",
852         "お前の母親はオーガか! $%s は出すつもりなんだろ?"
853 #else
854         "I can take no less than %s gold pieces.",
855         "I will accept no less than %s gold pieces.",
856         "Ha!  No less than %s gold pieces.",
857         "You knave!  No less than %s gold pieces.",
858         "That's a pittance!  I want %s gold pieces.",
859         "That's an insult!  I want %s gold pieces.",
860         "As if!  How about %s gold pieces?",
861         "My arse!  How about %s gold pieces?",
862         "May the fleas of 1000 orcs molest you!  Try %s gold pieces.",
863         "May your most favourite parts go moldy!  Try %s gold pieces.",
864         "May Morgoth find you tasty!  Perhaps %s gold pieces?",
865         "Your mother was an Ogre!  Perhaps %s gold pieces?"
866 #endif
867
868 };
869
870 #ifdef JP
871 /*! ブラックマーケット用追加メッセージ(売るとき) */
872 static concptr comment_2b_B[MAX_COMMENT_2B] = {
873         "いくら俺様がお人好しとはいえ $%s が限界だね。嫌なら帰りな。",
874         "金がないのかい、あんた?まずは家に帰って $%s 揃えてきな。",
875         "物の価値が分からん奴だな。これは $%s が普通なんだよ。",
876         "俺の付けた値段に文句があるのか? $%s が限界だ。",
877         "ひょっとして新手の冗談かい? $%s 持ってないなら帰りな。",
878         "うちは他の店とは違うんだよ。$%s ぐらいは出しな。",
879         "買う気がないなら帰りな。 $%s だと言っているんだ。",
880         "話にならないね。 $%s くらい持っているんだろ?",
881         "は?なんだそりゃ? $%s の間違いか、ひょっとして?",
882         "出口はあっちだよ。それとも $%s 出せるのかい、あんたに。",
883         "命知らずな奴だな。 $%s 出せば今日の所は勘弁してやるよ。",
884         "うちの店は貧乏人お断りだ。 $%s ぐらい出せないのかい?"
885 };
886 #endif
887 #define MAX_COMMENT_3A  2
888
889 static concptr comment_3a[MAX_COMMENT_3A] =
890 {
891 #ifdef JP
892         "私の忍耐力を試しているのかい? $%s が最後だ。",
893         "我慢にも限度があるぞ。 $%s が最後だ。"
894 #else
895         "You try my patience.  %s is final.",
896         "My patience grows thin.  %s is final."
897 #endif
898
899 };
900
901
902 #define MAX_COMMENT_3B  12
903
904 static concptr comment_3b[MAX_COMMENT_3B] =
905 {
906 #ifdef JP
907         "本音を言うと $%s でいいんだろ?",
908         " $%s でどうだい?",
909         " $%s ぐらいなら出してもいいが。",
910         " $%s 以上払うなんて考えられないね。",
911         "まあ落ちついて。 $%s でどうだい?",
912         "そのガラクタなら $%s で引き取るよ。",
913         "それじゃ高すぎる! $%s がいいとこだろ。",
914         "どうせいらないんだろ! $%s でいいだろ?",
915         "だめだめ! $%s がずっとお似合いだよ。",
916         "バカにしている! $%s がせいぜいだ。",
917         " $%s なら嬉しいところだがなあ。",
918         " $%s 、それ以上はビタ一文出さないよ!"
919 #else
920         "Perhaps %s gold pieces?",
921         "How about %s gold pieces?",
922         "I will pay no more than %s gold pieces.",
923         "I can afford no more than %s gold pieces.",
924         "Be reasonable.  How about %s gold pieces?",
925         "I'll buy it as scrap for %s gold pieces.",
926         "That is too much!  How about %s gold pieces?",
927         "That looks war surplus!  Say %s gold pieces?",
928         "Never!  %s is more like it.",
929         "That's an insult!  %s is more like it.",
930         "%s gold pieces and be thankful for it!",
931         "%s gold pieces and not a copper more!"
932 #endif
933
934 };
935
936 #ifdef JP
937 /*! ブラックマーケット用追加メッセージ(買い取り) */
938 static concptr comment_3b_B[MAX_COMMENT_3B] = {
939         " $%s ってところだね。そのどうしようもないガラクタは。",
940         "この俺が $%s って言っているんだから、その通りにした方が身のためだぞ。",
941         "俺の優しさに甘えるのもいい加減にしておけ。 $%s だ。",
942         "その品なら $%s で売ってくれているがね、常識ある紳士はみんな。",
943         "こりゃまた、がめつい奴だな。いくら俺が温厚とはいえ $%s が限界だ。",
944         " $%s だ。別に俺はそんなガラクタ欲しくはないんだから。",
945         "俺の鑑定額が気に入らないのか? $%s 、嫌なら帰りな。",
946         " $%s で引き取ってやるよ。喜んで受け取りな、貧乏人。",
947         "物の価値が分からん奴は始末におえんな。それは $%s なんだよ。",
948         "そんなに金が欲しいのか、あんた? $%s で満足できんのか?",
949         "入る店間違えてんじゃないのか? $%s で嫌なら他をあたってくれ。",
950         "俺の言い値にケチをつける奴がいるとは! その度胸に免じて $%s だ。"
951 };
952 #endif
953 #define MAX_COMMENT_4A  4
954
955 static concptr comment_4a[MAX_COMMENT_4A] =
956 {
957 #ifdef JP
958         "もうたくさんだ!何度も私をわずらわせないでくれ!",
959         "うがー!一日の我慢の限度を超えている!",
960         "もういい!時間の無駄以外のなにものでもない!",
961         "もうやってられないよ!顔も見たくない!"
962 #else
963         "Enough!  You have abused me once too often!",
964         "Arghhh!  I have had enough abuse for one day!",
965         "That does it!  You shall waste my time no more!",
966         "This is getting nowhere!  I'm going to Londis!"
967 #endif
968
969 };
970
971 #ifdef JP
972 /*! ブラックマーケット用追加メッセージ(怒りの頂点) */
973 static concptr comment_4a_B[MAX_COMMENT_4A] = {
974         "なめやがって!温厚な俺様でも限界があるってことを知れ!",
975         "俺をここまで怒らせて...命があるだけでもありがたいと思え!",
976         "ふざけてるのか!冷やかしなら相手を見てからにしろ!",
977         "いいかげんにしろ!今度こんなまねしたらただじゃおかねえぞ!"
978 };
979 #endif
980 #define MAX_COMMENT_4B  4
981
982 static concptr comment_4b[MAX_COMMENT_4B] =
983 {
984 #ifdef JP
985         "店から出て行け!",
986         "俺の前から消え失せろ!",
987         "どっかに行っちまえ!",
988         "出ろ、出ろ、出て行け!"
989 #else
990         "Leave my store!",
991         "Get out of my sight!",
992         "Begone, you scoundrel!",
993         "Out, out, out!"
994 #endif
995
996 };
997
998 #ifdef JP
999 /*! ブラックマーケット用追加メッセージ(追い出し) */
1000 static concptr comment_4b_B[MAX_COMMENT_4B] = {
1001         "二度とうちに来るんじゃねえ!!",
1002         "とっとと、どっかへ失せろ!!",
1003         "今すぐ消え失せろ!!",
1004         "出ていけ!出ていけ!!"
1005 };
1006 #endif
1007 #define MAX_COMMENT_5   8
1008
1009 static concptr comment_5[MAX_COMMENT_5] =
1010 {
1011 #ifdef JP
1012         "考え直してくれ。",
1013         "そりゃおかしい!",
1014         "もっと真面目に言ってくれ!",
1015         "交渉する気があるのかい?",
1016         "冷やかしに来たのか!",
1017         "悪い冗談だ!",
1018         "我慢くらべかい。",
1019         "ふーむ、良い天気だ。"
1020 #else
1021         "Try again.",
1022         "Ridiculous!",
1023         "You will have to do better than that!",
1024         "Do you wish to do business or not?",
1025         "You've got to be kidding!",
1026         "You'd better be kidding!",
1027         "You try my patience.",
1028         "Hmmm, nice weather we're having."
1029 #endif
1030
1031 };
1032
1033 #ifdef JP
1034 /*! ブラックマーケット用追加メッセージ(怒り) */
1035 static concptr comment_5_B[MAX_COMMENT_5] = {
1036         "時間の無駄だな、これは。",
1037         "厄介なお客様だな!",
1038         "話して分かる相手じゃなさそうだ。",
1039         "痛い目にあいたいらしいな!",
1040         "なんて強欲な奴だ!",
1041         "話にならん輩だ!",
1042         "どうしようもない貧乏人だ!",
1043         "喧嘩を売っているのか?"
1044 };
1045 #endif
1046 #define MAX_COMMENT_6   4
1047
1048 static concptr comment_6[MAX_COMMENT_6] =
1049 {
1050 #ifdef JP
1051         "どうやら聞き間違えたらしい。",
1052         "失礼、よく聞こえなかったよ。",
1053         "すまない、何だって?",
1054         "悪い、もう一度言ってくれる?"
1055 #else
1056         "I must have heard you wrong.",
1057         "I'm sorry, I missed that.",
1058         "I'm sorry, what was that?",
1059         "Sorry, what was that again?"
1060 #endif
1061
1062 };
1063
1064 /*** Initialize others ***/
1065
1066 /*!
1067  * 店舗で販売するオブジェクトを定義する / Hack -- Objects sold in the stores -- by tval/sval pair.
1068  */
1069 byte store_table[MAX_STORES][STORE_CHOICES][2] =
1070 {
1071         {
1072                 /* General Store */
1073
1074                 { TV_FOOD, SV_FOOD_RATION },
1075                 { TV_FOOD, SV_FOOD_RATION },
1076                 { TV_FOOD, SV_FOOD_RATION },
1077                 { TV_FOOD, SV_FOOD_RATION },
1078
1079                 { TV_FOOD, SV_FOOD_RATION },
1080                 { TV_FOOD, SV_FOOD_BISCUIT },
1081                 { TV_FOOD, SV_FOOD_JERKY },
1082                 { TV_FOOD, SV_FOOD_JERKY },
1083
1084                 { TV_FOOD, SV_FOOD_PINT_OF_WINE },
1085                 { TV_FOOD, SV_FOOD_PINT_OF_ALE },
1086                 { TV_LITE, SV_LITE_TORCH },
1087                 { TV_LITE, SV_LITE_TORCH },
1088
1089                 { TV_LITE, SV_LITE_TORCH },
1090                 { TV_LITE, SV_LITE_TORCH },
1091                 { TV_LITE, SV_LITE_LANTERN },
1092                 { TV_LITE, SV_LITE_LANTERN },
1093
1094                 { TV_FLASK, 0 },
1095                 { TV_FLASK, 0 },
1096                 { TV_FLASK, 0 },
1097                 { TV_FLASK, 0 },
1098
1099                 { TV_FLASK, 0 },
1100                 { TV_FLASK, 0 },
1101                 { TV_SPIKE, 0 },
1102                 { TV_SPIKE, 0 },
1103
1104                 { TV_SHOT, SV_AMMO_NORMAL },
1105                 { TV_ARROW, SV_AMMO_NORMAL },
1106                 { TV_BOLT, SV_AMMO_NORMAL },
1107                 { TV_DIGGING, SV_SHOVEL },
1108
1109                 { TV_DIGGING, SV_PICK },
1110                 { TV_CLOAK, SV_CLOAK },
1111                 { TV_CLOAK, SV_CLOAK },
1112                 { TV_CLOAK, SV_FUR_CLOAK },
1113
1114                 { TV_FOOD, SV_FOOD_RATION },
1115                 { TV_FOOD, SV_FOOD_RATION },
1116                 { TV_FOOD, SV_FOOD_RATION },
1117                 { TV_FOOD, SV_FOOD_RATION },
1118
1119                 { TV_POTION, SV_POTION_WATER },
1120                 { TV_POTION, SV_POTION_WATER },
1121                 { TV_LITE, SV_LITE_LANTERN },
1122                 { TV_LITE, SV_LITE_LANTERN },
1123
1124                 { TV_FOOD, SV_FOOD_WAYBREAD },
1125                 { TV_FOOD, SV_FOOD_WAYBREAD },
1126                 { TV_CAPTURE, 0 },
1127                 { TV_FIGURINE, 0 },
1128
1129                 { TV_SHOT, SV_AMMO_NORMAL },
1130                 { TV_ARROW, SV_AMMO_NORMAL },
1131                 { TV_BOLT, SV_AMMO_NORMAL },
1132                 { TV_DIGGING, SV_SHOVEL }
1133         },
1134
1135         {
1136                 /* Armoury */
1137
1138                 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
1139                 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
1140                 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
1141                 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
1142
1143                 { TV_HELM, SV_HARD_LEATHER_CAP },
1144                 { TV_HELM, SV_HARD_LEATHER_CAP },
1145                 { TV_HELM, SV_METAL_CAP },
1146                 { TV_HELM, SV_IRON_HELM },
1147
1148                 { TV_SOFT_ARMOR, SV_ROBE },
1149                 { TV_SOFT_ARMOR, SV_ROBE },
1150                 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1151                 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1152
1153                 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
1154                 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
1155                 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
1156                 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
1157
1158                 { TV_SOFT_ARMOR, SV_RHINO_HIDE_ARMOR },
1159                 { TV_SOFT_ARMOR, SV_LEATHER_SCALE_MAIL },
1160                 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
1161                 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1162
1163                 { TV_HARD_ARMOR, SV_DOUBLE_RING_MAIL },
1164                 { TV_HARD_ARMOR, SV_AUGMENTED_CHAIN_MAIL },
1165                 { TV_HARD_ARMOR, SV_BAR_CHAIN_MAIL },
1166                 { TV_HARD_ARMOR, SV_DOUBLE_CHAIN_MAIL },
1167
1168                 { TV_HARD_ARMOR, SV_METAL_BRIGANDINE_ARMOUR },
1169                 { TV_HARD_ARMOR, SV_SPLINT_MAIL },
1170                 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
1171                 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
1172
1173                 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
1174                 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
1175                 { TV_SHIELD, SV_LARGE_LEATHER_SHIELD },
1176                 { TV_SHIELD, SV_SMALL_METAL_SHIELD },
1177
1178                 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
1179                 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
1180                 { TV_HELM, SV_HARD_LEATHER_CAP },
1181                 { TV_HELM, SV_HARD_LEATHER_CAP },
1182
1183                 { TV_SOFT_ARMOR, SV_ROBE },
1184                 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1185                 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1186                 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
1187
1188                 { TV_SOFT_ARMOR, SV_LEATHER_JACK },
1189                 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
1190                 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1191                 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1192
1193                 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
1194                 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
1195                 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
1196                 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD }
1197         },
1198
1199         {
1200                 /* Weaponsmith */
1201
1202                 { TV_SWORD, SV_DAGGER },
1203                 { TV_SWORD, SV_MAIN_GAUCHE },
1204                 { TV_SWORD, SV_RAPIER },
1205                 { TV_SWORD, SV_SMALL_SWORD },
1206
1207                 { TV_SWORD, SV_SHORT_SWORD },
1208                 { TV_SWORD, SV_SABRE },
1209                 { TV_SWORD, SV_CUTLASS },
1210                 { TV_SWORD, SV_TULWAR },
1211
1212                 { TV_SWORD, SV_BROAD_SWORD },
1213                 { TV_SWORD, SV_LONG_SWORD },
1214                 { TV_SWORD, SV_SCIMITAR },
1215                 { TV_SWORD, SV_KATANA },
1216
1217                 { TV_SWORD, SV_BASTARD_SWORD },
1218                 { TV_POLEARM, SV_SPEAR },
1219                 { TV_POLEARM, SV_AWL_PIKE },
1220                 { TV_POLEARM, SV_TRIDENT },
1221
1222                 { TV_POLEARM, SV_PIKE },
1223                 { TV_POLEARM, SV_BEAKED_AXE },
1224                 { TV_POLEARM, SV_BROAD_AXE },
1225                 { TV_POLEARM, SV_LANCE },
1226
1227                 { TV_POLEARM, SV_BATTLE_AXE },
1228                 { TV_POLEARM, SV_HATCHET },
1229                 { TV_BOW, SV_SLING },
1230                 { TV_BOW, SV_SHORT_BOW },
1231
1232                 { TV_BOW, SV_LIGHT_XBOW },
1233                 { TV_SHOT, SV_AMMO_NORMAL },
1234                 { TV_SHOT, SV_AMMO_NORMAL },
1235                 { TV_ARROW, SV_AMMO_NORMAL },
1236
1237                 { TV_ARROW, SV_AMMO_NORMAL },
1238                 { TV_BOLT, SV_AMMO_NORMAL },
1239                 { TV_BOLT, SV_AMMO_NORMAL },
1240                 { TV_BOW, SV_LIGHT_XBOW },
1241
1242                 { TV_ARROW, SV_AMMO_NORMAL },
1243                 { TV_BOLT, SV_AMMO_NORMAL },
1244                 { TV_BOW, SV_SHORT_BOW },
1245                 { TV_BOW, SV_LIGHT_XBOW },
1246
1247                 { TV_SWORD, SV_DAGGER },
1248                 { TV_SWORD, SV_TANTO },
1249                 { TV_SWORD, SV_RAPIER },
1250                 { TV_SWORD, SV_SMALL_SWORD },
1251
1252                 { TV_SWORD, SV_SHORT_SWORD },
1253                 { TV_SWORD, SV_LONG_SWORD },
1254                 { TV_SWORD, SV_SCIMITAR },
1255                 { TV_SWORD, SV_BROAD_SWORD },
1256
1257                 { TV_HISSATSU_BOOK, 0 },
1258                 { TV_HISSATSU_BOOK, 0 },
1259                 { TV_HISSATSU_BOOK, 1 },
1260                 { TV_HISSATSU_BOOK, 1 },
1261         },
1262
1263         {
1264                 /* Temple */
1265
1266                 { TV_HAFTED, SV_NUNCHAKU },
1267                 { TV_HAFTED, SV_QUARTERSTAFF },
1268                 { TV_HAFTED, SV_MACE },
1269                 { TV_HAFTED, SV_BO_STAFF },
1270
1271                 { TV_HAFTED, SV_WAR_HAMMER },
1272                 { TV_HAFTED, SV_WAR_HAMMER },
1273                 { TV_HAFTED, SV_MORNING_STAR },
1274                 { TV_HAFTED, SV_FLAIL },
1275
1276                 { TV_HAFTED, SV_LEAD_FILLED_MACE },
1277                 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1278                 { TV_SCROLL, SV_SCROLL_BLESSING },
1279                 { TV_SCROLL, SV_SCROLL_HOLY_CHANT },
1280
1281                 { TV_POTION, SV_POTION_HEROISM },
1282                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1283                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1284                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1285
1286                 { TV_POTION, SV_POTION_CURE_LIGHT },
1287                 { TV_POTION, SV_POTION_CURE_SERIOUS },
1288                 { TV_POTION, SV_POTION_CURE_SERIOUS },
1289                 { TV_POTION, SV_POTION_CURE_CRITICAL },
1290
1291                 { TV_POTION, SV_POTION_CURE_CRITICAL },
1292                 { TV_POTION, SV_POTION_RESTORE_EXP },
1293                 { TV_POTION, SV_POTION_RESTORE_EXP },
1294                 { TV_POTION, SV_POTION_RESTORE_EXP },
1295
1296                 { TV_LIFE_BOOK, 0 },
1297                 { TV_LIFE_BOOK, 0 },
1298                 { TV_LIFE_BOOK, 1 },
1299                 { TV_LIFE_BOOK, 1 },
1300
1301                 { TV_CRUSADE_BOOK, 0 },
1302                 { TV_CRUSADE_BOOK, 0 },
1303                 { TV_CRUSADE_BOOK, 1 },
1304                 { TV_CRUSADE_BOOK, 1 },
1305
1306                 { TV_HAFTED, SV_WHIP },
1307                 { TV_HAFTED, SV_MACE },
1308                 { TV_HAFTED, SV_BALL_AND_CHAIN },
1309                 { TV_HAFTED, SV_WAR_HAMMER },
1310
1311                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1312                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1313                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1314                 { TV_POTION, SV_POTION_CURE_CRITICAL },
1315
1316                 { TV_POTION, SV_POTION_CURE_CRITICAL },
1317                 { TV_POTION, SV_POTION_RESTORE_EXP },
1318
1319                 { TV_FIGURINE, 0 },
1320                 { TV_STATUE, SV_ANY },
1321
1322                 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1323                 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1324                 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE },
1325                 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE }
1326         },
1327
1328         {
1329                 /* Alchemy shop */
1330
1331                 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
1332                 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
1333                 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1334                 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1335
1336                 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1337                 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1338                 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1339                 { TV_SCROLL, SV_SCROLL_LIGHT },
1340
1341                 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1342                 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1343                 { TV_SCROLL, SV_SCROLL_TELEPORT },
1344                 { TV_SCROLL, SV_SCROLL_MONSTER_CONFUSION },
1345
1346                 { TV_SCROLL, SV_SCROLL_MAPPING },
1347                 { TV_SCROLL, SV_SCROLL_DETECT_GOLD },
1348                 { TV_SCROLL, SV_SCROLL_DETECT_ITEM },
1349                 { TV_SCROLL, SV_SCROLL_DETECT_TRAP },
1350
1351                 { TV_SCROLL, SV_SCROLL_DETECT_INVIS },
1352                 { TV_SCROLL, SV_SCROLL_RECHARGING },
1353                 { TV_SCROLL, SV_SCROLL_TELEPORT },
1354                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1355
1356                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1357                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1358                 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1359                 { TV_SCROLL, SV_SCROLL_TELEPORT },
1360
1361                 { TV_SCROLL, SV_SCROLL_TELEPORT },
1362                 { TV_POTION, SV_POTION_RES_STR },
1363                 { TV_POTION, SV_POTION_RES_INT },
1364                 { TV_POTION, SV_POTION_RES_WIS },
1365
1366                 { TV_POTION, SV_POTION_RES_DEX },
1367                 { TV_POTION, SV_POTION_RES_CON },
1368                 { TV_POTION, SV_POTION_RES_CHR },
1369                 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1370
1371                 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1372                 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY },  /* Yep, occasionally! */
1373                 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY },
1374                 { TV_SCROLL, SV_SCROLL_LIGHT },
1375
1376                 { TV_POTION, SV_POTION_RES_STR },
1377                 { TV_POTION, SV_POTION_RES_INT },
1378                 { TV_POTION, SV_POTION_RES_WIS },
1379                 { TV_POTION, SV_POTION_RES_DEX },
1380
1381                 { TV_POTION, SV_POTION_RES_CON },
1382                 { TV_POTION, SV_POTION_RES_CHR },
1383                 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1384                 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1385
1386                 { TV_SCROLL, SV_SCROLL_RECHARGING },
1387                 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1388                 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
1389                 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
1390
1391         },
1392
1393         {
1394                 /* Magic-User store */
1395
1396                 { TV_RING, SV_RING_PROTECTION },
1397                 { TV_RING, SV_RING_LEVITATION_FALL },
1398                 { TV_RING, SV_RING_PROTECTION },
1399                 { TV_RING, SV_RING_RESIST_FIRE },
1400
1401                 { TV_RING, SV_RING_RESIST_COLD },
1402                 { TV_AMULET, SV_AMULET_CHARISMA },
1403                 { TV_RING, SV_RING_WARNING },
1404                 { TV_AMULET, SV_AMULET_RESIST_ACID },
1405
1406                 { TV_AMULET, SV_AMULET_SEARCHING },
1407                 { TV_WAND, SV_WAND_SLOW_MONSTER },
1408                 { TV_WAND, SV_WAND_CONFUSE_MONSTER },
1409                 { TV_WAND, SV_WAND_SLEEP_MONSTER },
1410
1411                 { TV_WAND, SV_WAND_MAGIC_MISSILE },
1412                 { TV_WAND, SV_WAND_STINKING_CLOUD },
1413                 { TV_WAND, SV_WAND_WONDER },
1414                 { TV_WAND, SV_WAND_DISARMING },
1415
1416                 { TV_STAFF, SV_STAFF_LITE },
1417                 { TV_STAFF, SV_STAFF_MAPPING },
1418                 { TV_STAFF, SV_STAFF_DETECT_TRAP },
1419                 { TV_STAFF, SV_STAFF_DETECT_DOOR },
1420
1421                 { TV_STAFF, SV_STAFF_DETECT_GOLD },
1422                 { TV_STAFF, SV_STAFF_DETECT_ITEM },
1423                 { TV_STAFF, SV_STAFF_DETECT_INVIS },
1424                 { TV_STAFF, SV_STAFF_DETECT_EVIL },
1425
1426                 { TV_STAFF, SV_STAFF_TELEPORTATION },
1427                 { TV_STAFF, SV_STAFF_TELEPORTATION },
1428                 { TV_STAFF, SV_STAFF_TELEPORTATION },
1429                 { TV_STAFF, SV_STAFF_TELEPORTATION },
1430
1431                 { TV_STAFF, SV_STAFF_IDENTIFY },
1432                 { TV_STAFF, SV_STAFF_IDENTIFY },
1433                 { TV_STAFF, SV_STAFF_IDENTIFY },
1434
1435                 { TV_STAFF, SV_STAFF_IDENTIFY },
1436                 { TV_STAFF, SV_STAFF_REMOVE_CURSE },
1437                 { TV_STAFF, SV_STAFF_CURE_LIGHT },
1438                 { TV_STAFF, SV_STAFF_PROBING },
1439
1440                 { TV_FIGURINE, 0 },
1441
1442                 { TV_SORCERY_BOOK, 0 },
1443                 { TV_SORCERY_BOOK, 0 },
1444                 { TV_SORCERY_BOOK, 1 },
1445                 { TV_SORCERY_BOOK, 1 },
1446
1447                 { TV_ARCANE_BOOK, 0 },
1448                 { TV_ARCANE_BOOK, 0 },
1449                 { TV_ARCANE_BOOK, 1 },
1450                 { TV_ARCANE_BOOK, 1 },
1451
1452                 { TV_ARCANE_BOOK, 2 },
1453                 { TV_ARCANE_BOOK, 2 },
1454                 { TV_ARCANE_BOOK, 3 },
1455                 { TV_ARCANE_BOOK, 3 },
1456
1457         },
1458
1459         {
1460                 /* Black Market (unused) */
1461                 { 0, 0 },
1462                 { 0, 0 },
1463                 { 0, 0 },
1464                 { 0, 0 },
1465                 { 0, 0 },
1466                 { 0, 0 },
1467                 { 0, 0 },
1468                 { 0, 0 },
1469                 { 0, 0 },
1470                 { 0, 0 },
1471                 { 0, 0 },
1472                 { 0, 0 },
1473                 { 0, 0 },
1474                 { 0, 0 },
1475                 { 0, 0 },
1476                 { 0, 0 },
1477                 { 0, 0 },
1478                 { 0, 0 },
1479                 { 0, 0 },
1480                 { 0, 0 },
1481                 { 0, 0 },
1482                 { 0, 0 },
1483                 { 0, 0 },
1484                 { 0, 0 },
1485                 { 0, 0 },
1486                 { 0, 0 },
1487                 { 0, 0 },
1488                 { 0, 0 },
1489                 { 0, 0 },
1490                 { 0, 0 },
1491                 { 0, 0 },
1492                 { 0, 0 }
1493         },
1494
1495         {
1496                 /* Home (unused) */
1497                 { 0, 0 },
1498                 { 0, 0 },
1499                 { 0, 0 },
1500                 { 0, 0 },
1501                 { 0, 0 },
1502                 { 0, 0 },
1503                 { 0, 0 },
1504                 { 0, 0 },
1505                 { 0, 0 },
1506                 { 0, 0 },
1507                 { 0, 0 },
1508                 { 0, 0 },
1509                 { 0, 0 },
1510                 { 0, 0 },
1511                 { 0, 0 },
1512                 { 0, 0 },
1513                 { 0, 0 },
1514                 { 0, 0 },
1515                 { 0, 0 },
1516                 { 0, 0 },
1517                 { 0, 0 },
1518                 { 0, 0 },
1519                 { 0, 0 },
1520                 { 0, 0 },
1521                 { 0, 0 },
1522                 { 0, 0 },
1523                 { 0, 0 },
1524                 { 0, 0 },
1525                 { 0, 0 },
1526                 { 0, 0 },
1527                 { 0, 0 },
1528                 { 0, 0 }
1529         },
1530
1531         {
1532                 /* Bookstore */
1533                 { TV_SORCERY_BOOK, 0 },
1534                 { TV_SORCERY_BOOK, 0 },
1535                 { TV_SORCERY_BOOK, 1 },
1536                 { TV_SORCERY_BOOK, 1 },
1537
1538                 { TV_NATURE_BOOK, 0 },
1539                 { TV_NATURE_BOOK, 0 },
1540                 { TV_NATURE_BOOK, 1 },
1541                 { TV_NATURE_BOOK, 1 },
1542
1543                 { TV_CHAOS_BOOK, 0 },
1544                 { TV_CHAOS_BOOK, 0 },
1545                 { TV_CHAOS_BOOK, 1 },
1546                 { TV_CHAOS_BOOK, 1 },
1547
1548                 { TV_DEATH_BOOK, 0 },
1549                 { TV_DEATH_BOOK, 0 },
1550                 { TV_DEATH_BOOK, 1 },
1551                 { TV_DEATH_BOOK, 1 },
1552
1553                 { TV_TRUMP_BOOK, 0 },           /* +16 */
1554                 { TV_TRUMP_BOOK, 0 },
1555                 { TV_TRUMP_BOOK, 1 },
1556                 { TV_TRUMP_BOOK, 1 },
1557
1558                 { TV_ARCANE_BOOK, 0 },
1559                 { TV_ARCANE_BOOK, 1 },
1560                 { TV_ARCANE_BOOK, 2 },
1561                 { TV_ARCANE_BOOK, 3 },
1562
1563                 { TV_CRAFT_BOOK, 0 },
1564                 { TV_CRAFT_BOOK, 0 },
1565                 { TV_CRAFT_BOOK, 1 },
1566                 { TV_CRAFT_BOOK, 1 },
1567
1568                 { TV_DAEMON_BOOK, 0 },
1569                 { TV_DAEMON_BOOK, 0 },
1570                 { TV_DAEMON_BOOK, 1 },
1571                 { TV_DAEMON_BOOK, 1 },
1572
1573                 { TV_MUSIC_BOOK, 0 },
1574                 { TV_MUSIC_BOOK, 0 },
1575                 { TV_MUSIC_BOOK, 1 },
1576                 { TV_MUSIC_BOOK, 1 },
1577
1578                 { TV_HEX_BOOK, 0 },
1579                 { TV_HEX_BOOK, 0 },
1580                 { TV_HEX_BOOK, 1 },
1581                 { TV_HEX_BOOK, 1 },
1582         },
1583
1584         {
1585                 /* Museum (unused) */
1586                 { 0, 0 },
1587                 { 0, 0 },
1588                 { 0, 0 },
1589                 { 0, 0 },
1590                 { 0, 0 },
1591                 { 0, 0 },
1592                 { 0, 0 },
1593                 { 0, 0 },
1594                 { 0, 0 },
1595                 { 0, 0 },
1596                 { 0, 0 },
1597                 { 0, 0 },
1598                 { 0, 0 },
1599                 { 0, 0 },
1600                 { 0, 0 },
1601                 { 0, 0 },
1602                 { 0, 0 },
1603                 { 0, 0 },
1604                 { 0, 0 },
1605                 { 0, 0 },
1606                 { 0, 0 },
1607                 { 0, 0 },
1608                 { 0, 0 },
1609                 { 0, 0 },
1610                 { 0, 0 },
1611                 { 0, 0 },
1612                 { 0, 0 },
1613                 { 0, 0 },
1614                 { 0, 0 },
1615                 { 0, 0 },
1616                 { 0, 0 },
1617                 { 0, 0 }
1618         }
1619 };
1620
1621
1622
1623 /*!
1624  * @brief 取引成功時の店主のメッセージ処理 /
1625  * Successful haggle.
1626  * @return なし
1627  */
1628 static void say_comment_1(void)
1629 {
1630 #ifdef JP
1631         /* ブラックマーケットのときは別のメッセージを出す */
1632         if ( cur_store_num == STORE_BLACK ) {
1633                 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
1634         }
1635         else{
1636                 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
1637         }
1638 #else
1639         msg_print(comment_1[randint0(MAX_COMMENT_1)]);
1640 #endif
1641
1642
1643         if (one_in_(RUMOR_CHANCE))
1644         {
1645 #ifdef JP
1646                 msg_print("店主は耳うちした:");
1647 #else
1648                 msg_print("The shopkeeper whispers something into your ear:");
1649 #endif
1650                 display_rumor(TRUE);
1651         }
1652 }
1653
1654
1655 /*!
1656  * @brief プレイヤーがアイテムを買う時の価格代案メッセージ処理 /
1657  * Continue haggling (player is buying)
1658  * @param value 店主の提示価格
1659  * @param annoyed 店主のいらつき度
1660  * @return なし
1661  */
1662 static void say_comment_2(PRICE value, int annoyed)
1663 {
1664         char    tmp_val[80];
1665
1666         /* Prepare a string to insert */
1667         sprintf(tmp_val, "%ld", (long)value);
1668
1669         /* Final offer */
1670         if (annoyed > 0)
1671         {
1672                 /* Formatted message */
1673                 msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
1674         }
1675
1676         /* Normal offer */
1677         else
1678         {
1679                 /* Formatted message */
1680 #ifdef JP
1681                 /* ブラックマーケットの時は別のメッセージを出す */
1682                 if ( cur_store_num == STORE_BLACK ){
1683                         msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
1684                 }
1685                 else{
1686                 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
1687         }
1688 #else
1689                 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
1690 #endif
1691
1692         }
1693 }
1694
1695
1696 /*!
1697  * @brief プレイヤーがアイテムを売る時の価格代案メッセージ処理 /
1698  * Continue haggling (player is selling)
1699  * @param value 店主の提示価格
1700  * @param annoyed 店主のいらつき度
1701  * @return なし
1702  */
1703 static void say_comment_3(PRICE value, int annoyed)
1704 {
1705         char    tmp_val[80];
1706
1707         /* Prepare a string to insert */
1708         sprintf(tmp_val, "%ld", (long)value);
1709
1710         /* Final offer */
1711         if (annoyed > 0)
1712         {
1713                 /* Formatted message */
1714                 msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
1715         }
1716
1717         /* Normal offer */
1718         else
1719         {
1720                 /* Formatted message */
1721 #ifdef JP
1722                 /* ブラックマーケットの時は別のメッセージを出す */
1723                 if ( cur_store_num == STORE_BLACK ){
1724                         msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
1725                 }
1726                 else{
1727                 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
1728         }
1729 #else
1730                 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
1731 #endif
1732
1733         }
1734 }
1735
1736
1737 /*!
1738  * @brief 店主がプレイヤーを追い出す時のメッセージ処理 /
1739  * Kick 'da bum out.                                    -RAK-
1740  * @return なし
1741  */
1742 static void say_comment_4(void)
1743 {
1744 #ifdef JP
1745         /* ブラックマーケットの時は別のメッセージを出す */
1746         if ( cur_store_num == STORE_BLACK ){
1747                 msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
1748                 msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
1749         }
1750         else{
1751                 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
1752                 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
1753         }
1754 #else
1755         msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
1756         msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
1757 #endif
1758
1759 }
1760
1761
1762 /*!
1763  * @brief 店主がプレイヤーに取り合わない時のメッセージ処理 /
1764  * You are insulting me
1765  * @return なし
1766  */
1767 static void say_comment_5(void)
1768 {
1769 #ifdef JP
1770         /* ブラックマーケットの時は別のメッセージを出す */
1771         if ( cur_store_num == STORE_BLACK ){
1772                 msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
1773         }
1774         else{
1775                 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
1776         }
1777 #else
1778         msg_print(comment_5[randint0(MAX_COMMENT_5)]);
1779 #endif
1780
1781 }
1782
1783
1784 /*!
1785  * @brief 店主がプレイヤーの提示を理解できなかった時のメッセージ処理 /
1786  * That makes no sense.
1787  * @return なし
1788  */
1789 static void say_comment_6(void)
1790 {
1791         msg_print(comment_6[randint0(MAX_COMMENT_6)]);
1792 }
1793
1794
1795 #define MAX_COMMENT_7A  4
1796
1797 static concptr comment_7a[MAX_COMMENT_7A] =
1798 {
1799 #ifdef JP
1800         "うわああぁぁ!",
1801         "なんてこった!",
1802         "誰かがむせび泣く声が聞こえる...。",
1803         "店主が悔しげにわめいている!"
1804 #else
1805         "Arrgghh!",
1806         "You bastard!",
1807         "You hear someone sobbing...",
1808         "The shopkeeper howls in agony!"
1809 #endif
1810
1811 };
1812
1813 #define MAX_COMMENT_7B  4
1814
1815 static concptr comment_7b[MAX_COMMENT_7B] =
1816 {
1817 #ifdef JP
1818         "くそう!",
1819         "この悪魔め!",
1820         "店主が恨めしそうに見ている。",
1821         "店主が睨んでいる。"
1822 #else
1823         "Damn!",
1824         "You fiend!",
1825         "The shopkeeper curses at you.",
1826         "The shopkeeper glares at you."
1827 #endif
1828
1829 };
1830
1831 #define MAX_COMMENT_7C  4
1832
1833 static concptr comment_7c[MAX_COMMENT_7C] =
1834 {
1835 #ifdef JP
1836         "すばらしい!",
1837         "君が天使に見えるよ!",
1838         "店主がクスクス笑っている。",
1839         "店主が大声で笑っている。"
1840 #else
1841         "Cool!",
1842         "You've made my day!",
1843         "The shopkeeper giggles.",
1844         "The shopkeeper laughs loudly."
1845 #endif
1846
1847 };
1848
1849 #define MAX_COMMENT_7D  4
1850
1851 static concptr comment_7d[MAX_COMMENT_7D] =
1852 {
1853 #ifdef JP
1854         "やっほぅ!",
1855         "こんなおいしい思いをしたら、真面目に働けなくなるなぁ。",
1856         "店主は嬉しくて跳ね回っている。",
1857         "店主は満面に笑みをたたえている。"
1858 #else
1859         "Yipee!",
1860         "I think I'll retire!",
1861         "The shopkeeper jumps for joy.",
1862         "The shopkeeper smiles gleefully."
1863 #endif
1864
1865 };
1866
1867
1868 /*!
1869  * @brief 店主が交渉を終えた際の反応を返す処理 /
1870  * Let a shop-keeper React to a purchase
1871  * @param price アイテムの取引額
1872  * @param value アイテムの実際価値
1873  * @param guess 店主が当初予想していた価値
1874  * @return なし
1875  * @details 
1876  * We paid "price", it was worth "value", and we thought it was worth "guess"
1877  */
1878 static void purchase_analyze(PRICE price, PRICE value, PRICE guess)
1879 {
1880         /* Item was worthless, but we bought it */
1881         if ((value <= 0) && (price > value))
1882         {
1883                 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
1884                 chg_virtue(V_HONOUR, -1);
1885                 chg_virtue(V_JUSTICE, -1);
1886                 sound(SOUND_STORE1);
1887         }
1888
1889         /* Item was cheaper than we thought, and we paid more than necessary */
1890         else if ((value < guess) && (price > value))
1891         {
1892                 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
1893                 chg_virtue(V_JUSTICE, -1);
1894                 if (one_in_(4)) chg_virtue(V_HONOUR, -1);
1895                 sound(SOUND_STORE2);
1896         }
1897
1898         /* Item was a good bargain, and we got away with it */
1899         else if ((value > guess) && (value < (4 * guess)) && (price < value))
1900         {
1901                 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
1902                 if (one_in_(4)) chg_virtue(V_HONOUR, -1);
1903                 else if (one_in_(4)) chg_virtue(V_HONOUR, 1);
1904                 sound(SOUND_STORE3);
1905         }
1906
1907         /* Item was a great bargain, and we got away with it */
1908         else if ((value > guess) && (price < value))
1909         {
1910                 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
1911                 if (one_in_(2)) chg_virtue(V_HONOUR, -1);
1912                 if (one_in_(4)) chg_virtue(V_HONOUR, 1);
1913                 if (10 * price < value) chg_virtue(V_SACRIFICE, 1);
1914                 sound(SOUND_STORE4);
1915         }
1916 }
1917
1918
1919
1920 /*
1921  * We store the current "store feat" here so everyone can access it
1922  */
1923 static int cur_store_feat;
1924
1925
1926 /*
1927  * Buying and selling adjustments for race combinations.
1928  * Entry[owner][player] gives the basic "cost inflation".
1929  */
1930 static byte rgold_adj[MAX_RACES][MAX_RACES] =
1931 {
1932         /*Hum, HfE, Elf,  Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
1933          HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
1934          Imp,  Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
1935          Angel, Demon, Kutar, Android, Merfolk */
1936
1937         /* Human */
1938         { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
1939           124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
1940           115, 105, 125, 125, 125, 125, 105, 120, 105,  95, 140,
1941           100, 120, 110, 105, 110 },
1942
1943         /* Half-Elf */
1944         { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
1945           120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
1946           120, 110, 110, 110, 120, 110, 100, 125, 100,  95, 140,
1947           110, 115, 110, 110, 110 },
1948
1949         /* Elf */
1950         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
1951           120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
1952           120, 115, 110, 110, 120, 110, 100, 125, 100,  95, 140,
1953           110, 110, 105, 110, 110 },
1954
1955         /* Halfling */
1956         { 115, 110, 105,  95, 105, 110, 115, 130, 115, 105, 115,
1957           125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
1958           120, 110, 120, 120, 130, 110, 110, 130, 110,  95, 140,
1959           115, 120, 105, 115, 105 },
1960
1961         /* Gnome */
1962         { 115, 115, 110, 105,  95, 110, 115, 130, 115, 110, 115,
1963           120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
1964           120, 101, 110, 110, 120, 120, 115, 130, 115,  95, 140,
1965           115, 110, 110, 115, 110 },
1966
1967         /* Dwarf */
1968         { 115, 120, 120, 110, 110,  95, 125, 135, 115, 120, 115,
1969           125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
1970           120, 105, 115, 115, 115, 115, 120, 130, 120,  95, 140,
1971           115, 110, 115, 115, 120 },
1972
1973         /* Half-Orc */
1974         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
1975           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
1976           115, 125, 120, 120, 115, 120, 125, 115, 125,  95, 140,
1977           115, 110, 115, 115, 125 },
1978
1979         /* Half-Troll */
1980         { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
1981           110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
1982           110, 115, 112, 112, 115, 112, 120, 110, 120,  95, 140,
1983           110, 110, 115, 110, 130 },
1984
1985         /* Amberite */
1986         { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
1987           120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
1988           120, 105, 120, 120, 125, 120, 105, 135, 105,  95, 140,
1989           100, 110, 110, 100, 110 },
1990
1991         /* High_Elf */
1992         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
1993           125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
1994           125, 115, 120, 120, 125, 120, 100, 125, 100,  95, 140,
1995           110, 110, 105, 110, 110 },
1996
1997         /* Human / Barbarian (copied from human) */
1998         { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
1999           124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
2000           115, 105, 125, 125, 130, 125, 115, 120, 115,  95, 140,
2001           100, 120, 110, 100, 110 },
2002
2003         /* Half-Ogre: theoretical, copied from half-troll */
2004         { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
2005           110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
2006           110, 115, 112, 112, 115, 112, 120, 110, 120,  95, 140,
2007           110, 110, 115, 110, 120 },
2008
2009         /* Half-Giant: theoretical, copied from half-troll */
2010         { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
2011           110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
2012           110, 115, 112, 112, 115, 112, 130, 120, 130,  95, 140,
2013           110, 110, 115, 110, 115 },
2014
2015         /* Half-Titan: theoretical, copied from High_Elf */
2016         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
2017           125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
2018           125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2019           110, 110, 115, 110, 108 },
2020
2021         /* Cyclops: theoretical, copied from half-troll */
2022         { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
2023           110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
2024           110, 115, 112, 112, 115, 112, 130, 130, 130,  95, 140,
2025           110, 110, 115, 110, 115 },
2026
2027         /* Yeek: theoretical, copied from Half-Orc */
2028         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2029           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2030           115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2031           115, 110, 115, 115, 110 },
2032
2033         /* Klackon: theoretical, copied from Gnome */
2034         { 115, 115, 110, 105,  95, 110, 115, 130, 115, 110, 115,
2035           120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
2036           120, 101, 110, 110, 120, 120, 130, 130, 130,  95, 140,
2037           115, 110, 115, 115, 110 },
2038
2039         /* Kobold: theoretical, copied from Half-Orc */
2040         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2041           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2042           115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2043           115, 110, 115, 115, 120 },
2044
2045         /* Nibelung: theoretical, copied from Dwarf */
2046         { 115, 120, 120, 110, 110,  95, 125, 135, 115, 120, 115,
2047           125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
2048           120, 105, 115, 115, 120, 120, 130, 130, 130,  95, 140,
2049           115, 135, 115, 115, 120 },
2050
2051         /* Dark Elf */
2052         { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
2053           115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
2054           110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
2055           110, 101, 115, 110, 115 },
2056
2057         /* Draconian: theoretical, copied from High_Elf */
2058         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
2059           125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
2060           125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2061           110, 110, 115, 110, 115 },
2062
2063         /* Mind Flayer: theoretical, copied from High_Elf */
2064         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
2065           125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
2066           125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2067           110, 110, 115, 110, 110 },
2068
2069         /* Imp: theoretical, copied from High_Elf */
2070         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
2071           125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
2072           125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
2073           110, 110, 115, 110, 120 },
2074
2075         /* Golem: theoretical, copied from High_Elf */
2076         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
2077           125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
2078           125, 115, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2079           110, 110, 115, 110, 110 },
2080
2081         /* Skeleton: theoretical, copied from half-orc */
2082         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2083           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2084           115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
2085           115, 110, 125, 115, 110 },
2086
2087         /* Zombie: Theoretical, copied from half-orc */
2088         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2089           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2090           115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
2091           115, 110, 125, 115, 110 },
2092
2093         /* Vampire: Theoretical, copied from half-orc */
2094         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2095           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2096           115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
2097           115, 110, 125, 115, 120 },
2098
2099         /* Spectre: Theoretical, copied from half-orc */
2100         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2101           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2102           115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
2103           115, 110, 125, 115, 110 },
2104
2105         /* Sprite: Theoretical, copied from half-orc */
2106         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2107           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2108           115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2109           115, 110, 105, 115, 110 },
2110
2111         /* Beastman: Theoretical, copied from half-orc */
2112         { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
2113           110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
2114           115, 125, 120, 120, 120, 120, 130, 130, 130,  95, 140,
2115           115, 110, 115, 115, 125 },
2116
2117         /* Ent */
2118         { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
2119           120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
2120           120, 115, 110, 110, 120, 110, 100, 125, 100,  95, 140,
2121           110, 110, 105, 110, 110 },
2122
2123         /* Angel */
2124         {  95,  95,  95,  95,  95,  95,  95,  95,  95,  95,  95,
2125            95,  95,  95,  95,  95,  95,  95,  95,  95,  95,  95,
2126            95,  95,  95,  95,  95,  95,  95,  95,  95,  95, 160,
2127            95,  95,  95,  95,  95 },
2128
2129         /* Demon */
2130         { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
2131           140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
2132           140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
2133           140, 140, 140, 140, 140 },
2134
2135         /* Dunadan */
2136         { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
2137           124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
2138           115, 105, 125, 125, 125, 125, 105, 120, 105,  95, 140,
2139           100, 120, 110, 100, 110 },
2140
2141         /* Shadow Fairy */
2142         { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
2143           115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
2144           110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
2145           110, 101, 115, 110, 115 },
2146
2147         /* Kutar */
2148         { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
2149           115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
2150           115, 115, 125, 125, 125, 125, 105, 115, 105,  95, 140,
2151           110, 115, 100, 110, 110 },
2152
2153         /* Android */
2154         { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
2155           124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
2156           115, 105, 125, 125, 125, 125, 105, 120, 105,  95, 140,
2157           100, 120, 110, 100, 110 },
2158
2159         /* Merfolk */
2160         { 110, 110, 110, 105, 110, 120, 125, 130, 110, 110, 110,
2161           120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
2162           120, 110, 110, 110, 120, 110, 110, 125, 110,  95, 140,
2163           110, 115, 110, 110, 100 },
2164 };
2165
2166
2167
2168 /*!
2169  * @brief 店舗価格を決定する /
2170  * Determine the price of an item (qty one) in a store.
2171  * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
2172  * @param greed 店主の強欲度
2173  * @param flip TRUEならば店主にとっての買取価格、FALSEなら売出価格を計算
2174  * @return なし
2175  * @details 
2176  * <pre>
2177  * This function takes into account the player's charisma, and the
2178  * shop-keepers friendliness, and the shop-keeper's base greed, but
2179  * never lets a shop-keeper lose money in a transaction.
2180  * The "greed" value should exceed 100 when the player is "buying" the
2181  * item, and should be less than 100 when the player is "selling" it.
2182  * Hack -- the black market always charges twice as much as it should.
2183  * Charisma adjustment runs from 80 to 130
2184  * Racial adjustment runs from 95 to 130
2185  * Since greed/charisma/racial adjustments are centered at 100, we need
2186  * to adjust (by 200) to extract a usable multiplier.  Note that the
2187  * "greed" value is always something (?).
2188  * </pre>
2189  */
2190 static s32b price_item(object_type *o_ptr, int greed, bool flip)
2191 {
2192         int     factor;
2193         int     adjust;
2194         s32b    price;
2195
2196
2197         /* Get the value of one of the items */
2198         price = object_value(o_ptr);
2199
2200         /* Worthless items */
2201         if (price <= 0) return (0L);
2202
2203
2204         /* Compute the racial factor */
2205         factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
2206
2207         /* Add in the charisma factor */
2208         factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]];
2209
2210
2211         /* Shop is buying */
2212         if (flip)
2213         {
2214                 /* Adjust for greed */
2215                 adjust = 100 + (300 - (greed + factor));
2216
2217                 /* Never get "silly" */
2218                 if (adjust > 100) adjust = 100;
2219
2220                 /* Mega-Hack -- Black market sucks */
2221                 if (cur_store_num == STORE_BLACK)
2222                         price = price / 2;
2223
2224                 /* Compute the final price (with rounding) */
2225                 /* Hack -- prevent underflow */
2226                 price = (price * adjust + 50L) / 100L;
2227         }
2228
2229         /* Shop is selling */
2230         else
2231         {
2232                 /* Adjust for greed */
2233                 adjust = 100 + ((greed + factor) - 300);
2234
2235                 /* Never get "silly" */
2236                 if (adjust < 100) adjust = 100;
2237
2238                 /* Mega-Hack -- Black market sucks */
2239                 if (cur_store_num == STORE_BLACK)
2240                         price = price * 2;
2241
2242                 /* Compute the final price (with rounding) */
2243                 /* Hack -- prevent overflow */
2244                 price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
2245         }
2246
2247         /* Note -- Never become "free" */
2248         if (price <= 0L) return (1L);
2249
2250         /* Return the price */
2251         return (price);
2252 }
2253
2254
2255 /*!
2256  * @brief 安価な消耗品の販売数を増やし、低確率で割引にする /
2257  * Certain "cheap" objects should be created in "piles"
2258  * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
2259  * @return なし
2260  * @details 
2261  * <pre>
2262  * Some objects can be sold at a "discount" (in small piles)
2263  * </pre>
2264  */
2265 static void mass_produce(object_type *o_ptr)
2266 {
2267         int size = 1;
2268         DISCOUNT_RATE discount = 0;
2269
2270         PRICE cost = object_value(o_ptr);
2271
2272
2273         /* Analyze the type */
2274         switch (o_ptr->tval)
2275         {
2276                 /* Food, Flasks, and Lites */
2277                 case TV_FOOD:
2278                 case TV_FLASK:
2279                 case TV_LITE:
2280                 {
2281                         if (cost <= 5L) size += damroll(3, 5);
2282                         if (cost <= 20L) size += damroll(3, 5);
2283                         if (cost <= 50L) size += damroll(2, 2);
2284                         break;
2285                 }
2286
2287                 case TV_POTION:
2288                 case TV_SCROLL:
2289                 {
2290                         if (cost <= 60L) size += damroll(3, 5);
2291                         if (cost <= 240L) size += damroll(1, 5);
2292                         if (o_ptr->sval == SV_SCROLL_STAR_IDENTIFY) size += damroll(3, 5);
2293                         if (o_ptr->sval == SV_SCROLL_STAR_REMOVE_CURSE) size += damroll(1, 4);
2294                         break;
2295                 }
2296
2297                 case TV_LIFE_BOOK:
2298                 case TV_SORCERY_BOOK:
2299                 case TV_NATURE_BOOK:
2300                 case TV_CHAOS_BOOK:
2301                 case TV_DEATH_BOOK:
2302                 case TV_TRUMP_BOOK:
2303                 case TV_ARCANE_BOOK:
2304                 case TV_CRAFT_BOOK:
2305                 case TV_DAEMON_BOOK:
2306                 case TV_CRUSADE_BOOK:
2307                 case TV_MUSIC_BOOK:
2308                 case TV_HISSATSU_BOOK:
2309                 case TV_HEX_BOOK:
2310                 {
2311                         if (cost <= 50L) size += damroll(2, 3);
2312                         if (cost <= 500L) size += damroll(1, 3);
2313                         break;
2314                 }
2315
2316                 case TV_SOFT_ARMOR:
2317                 case TV_HARD_ARMOR:
2318                 case TV_SHIELD:
2319                 case TV_GLOVES:
2320                 case TV_BOOTS:
2321                 case TV_CLOAK:
2322                 case TV_HELM:
2323                 case TV_CROWN:
2324                 case TV_SWORD:
2325                 case TV_POLEARM:
2326                 case TV_HAFTED:
2327                 case TV_DIGGING:
2328                 case TV_BOW:
2329                 {
2330                         if (object_is_artifact(o_ptr)) break;
2331                         if (object_is_ego(o_ptr)) break;
2332                         if (cost <= 10L) size += damroll(3, 5);
2333                         if (cost <= 100L) size += damroll(3, 5);
2334                         break;
2335                 }
2336
2337                 case TV_SPIKE:
2338                 case TV_SHOT:
2339                 case TV_ARROW:
2340                 case TV_BOLT:
2341                 {
2342                         if (cost <= 5L) size += damroll(5, 5);
2343                         if (cost <= 50L) size += damroll(5, 5);
2344                         if (cost <= 500L) size += damroll(5, 5);
2345                         break;
2346                 }
2347
2348                 case TV_FIGURINE:
2349                 {
2350                         if (cost <= 100L) size += damroll(2, 2);
2351                         if (cost <= 1000L) size += damroll(2, 2);
2352                         break;
2353                 }
2354
2355                 case TV_CAPTURE:
2356                 case TV_STATUE:
2357                 case TV_CARD:
2358                 {
2359                         size = 1;
2360                         break;
2361                 }
2362
2363                 /*
2364                  * Because many rods (and a few wands and staffs) are useful mainly
2365                  * in quantity, the Black Market will occasionally have a bunch of
2366                  * one kind. -LM-
2367                  */
2368                 case TV_ROD:
2369                 case TV_WAND:
2370                 case TV_STAFF:
2371                 {
2372                         if ((cur_store_num == STORE_BLACK) && one_in_(3))
2373                         {
2374                                 if (cost < 1601L) size += damroll(1, 5);
2375                                 else if (cost < 3201L) size += damroll(1, 3);
2376                         }
2377                         break;
2378                 }
2379         }
2380
2381
2382         /* Pick a discount */
2383         if (cost < 5)
2384         {
2385                 discount = 0;
2386         }
2387         else if (one_in_(25))
2388         {
2389                 discount = 25;
2390         }
2391         else if (one_in_(150))
2392         {
2393                 discount = 50;
2394         }
2395         else if (one_in_(300))
2396         {
2397                 discount = 75;
2398         }
2399         else if (one_in_(500))
2400         {
2401                 discount = 90;
2402         }
2403
2404         if (o_ptr->art_name)
2405         {
2406                 discount = 0;
2407         }
2408
2409         /* Save the discount */
2410         o_ptr->discount = discount;
2411
2412         /* Save the total pile size */
2413         o_ptr->number = size - (size * discount / 100);
2414
2415         /* Ensure that mass-produced rods and wands get the correct pvals. */
2416         if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
2417         {
2418                 o_ptr->pval *= (PARAMETER_VALUE)o_ptr->number;
2419         }
2420 }
2421
2422
2423
2424 /*!
2425  * @brief 店舗に並べた品を同一品であるかどうか判定する /
2426  * Determine if a store item can "absorb" another item
2427  * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
2428  * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
2429  * @return 同一扱いできるならTRUEを返す
2430  * @details 
2431  * <pre>
2432  * See "object_similar()" for the same function for the "player"
2433  * </pre>
2434  */
2435 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
2436 {
2437         int i;
2438
2439         /* Hack -- Identical items cannot be stacked */
2440         if (o_ptr == j_ptr) return (0);
2441
2442         /* Different objects cannot be stacked */
2443         if (o_ptr->k_idx != j_ptr->k_idx) return (0);
2444
2445         /* Different charges (etc) cannot be stacked, unless wands or rods. */
2446         if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
2447
2448         /* Require many identical values */
2449         if (o_ptr->to_h != j_ptr->to_h) return (0);
2450         if (o_ptr->to_d != j_ptr->to_d) return (0);
2451         if (o_ptr->to_a != j_ptr->to_a) return (0);
2452
2453         /* Require identical "ego-item" names */
2454         if (o_ptr->name2 != j_ptr->name2) return (0);
2455
2456         /* Artifacts don't stack! */
2457         if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
2458
2459         /* Hack -- Identical art_flags! */
2460         for (i = 0; i < TR_FLAG_SIZE; i++)
2461                 if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
2462
2463         /* Hack -- Never stack "powerful" items */
2464         if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
2465
2466         /* Hack -- Never stack recharging items */
2467         if (o_ptr->timeout || j_ptr->timeout) return (0);
2468
2469         /* Require many identical values */
2470         if (o_ptr->ac != j_ptr->ac)   return (0);
2471         if (o_ptr->dd != j_ptr->dd)   return (0);
2472         if (o_ptr->ds != j_ptr->ds)   return (0);
2473
2474         /* Hack -- Never stack chests */
2475         if (o_ptr->tval == TV_CHEST) return (0);
2476         if (o_ptr->tval == TV_STATUE) return (0);
2477         if (o_ptr->tval == TV_CAPTURE) return (0);
2478
2479         /* Require matching discounts */
2480         if (o_ptr->discount != j_ptr->discount) return (0);
2481
2482         /* They match, so they must be similar */
2483         return (TRUE);
2484 }
2485
2486
2487 /*!
2488  * @brief 店舗に並べた品を重ね合わせできるかどうか判定する /
2489  * Allow a store item to absorb another item
2490  * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
2491  * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
2492  * @return 重ね合わせできるならTRUEを返す
2493  * @details 
2494  * <pre>
2495  * See "object_similar()" for the same function for the "player"
2496  * </pre>
2497  */
2498 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
2499 {
2500         int max_num = (o_ptr->tval == TV_ROD) ?
2501                 MIN(99, MAX_SHORT / k_info[o_ptr->k_idx].pval) : 99;
2502         int total = o_ptr->number + j_ptr->number;
2503         int diff = (total > max_num) ? total - max_num : 0;
2504
2505         /* Combine quantity, lose excess items */
2506         o_ptr->number = (total > max_num) ? max_num : total;
2507
2508         /* Hack -- if rods are stacking, add the pvals (maximum timeouts) together. -LM- */
2509         if (o_ptr->tval == TV_ROD)
2510         {
2511                 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
2512         }
2513
2514         /* Hack -- if wands are stacking, combine the charges. -LM- */
2515         if (o_ptr->tval == TV_WAND)
2516         {
2517                 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
2518         }
2519 }
2520
2521
2522 /*!
2523  * @brief 店舗に品を置くスペースがあるかどうかの判定を返す /
2524  * Check to see if the shop will be carrying too many objects   -RAK-
2525  * @param o_ptr 店舗に置きたいオブジェクト構造体の参照ポインタ
2526  * @return 置き場がないなら0、重ね合わせできるアイテムがあるなら-1、スペースがあるなら1を返す。
2527  * @details 
2528  * <pre>
2529  * Note that the shop, just like a player, will not accept things
2530  * it cannot hold.      Before, one could "nuke" potions this way.
2531  * Return value is now int:
2532  *  0 : No space
2533  * -1 : Can be combined to existing slot.
2534  *  1 : Cannot be combined but there are empty spaces.
2535  * </pre>
2536  */
2537 static int store_check_num(object_type *o_ptr)
2538 {
2539         int i;
2540         object_type *j_ptr;
2541
2542         /* The "home" acts like the player */
2543         if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
2544         {
2545                 bool old_stack_force_notes = stack_force_notes;
2546                 bool old_stack_force_costs = stack_force_costs;
2547
2548                 if (cur_store_num != STORE_HOME)
2549                 {
2550                         stack_force_notes = FALSE;
2551                         stack_force_costs = FALSE;
2552                 }
2553
2554                 /* Check all the items */
2555                 for (i = 0; i < st_ptr->stock_num; i++)
2556                 {
2557                         /* Get the existing item */
2558                         j_ptr = &st_ptr->stock[i];
2559
2560                         /* Can the new object be combined with the old one? */
2561                         if (object_similar(j_ptr, o_ptr))
2562                         {
2563                                 if (cur_store_num != STORE_HOME)
2564                                 {
2565                                         stack_force_notes = old_stack_force_notes;
2566                                         stack_force_costs = old_stack_force_costs;
2567                                 }
2568
2569                                 return -1;
2570                         }
2571                 }
2572
2573                 if (cur_store_num != STORE_HOME)
2574                 {
2575                         stack_force_notes = old_stack_force_notes;
2576                         stack_force_costs = old_stack_force_costs;
2577                 }
2578         }
2579
2580         /* Normal stores do special stuff */
2581         else
2582         {
2583                 /* Check all the items */
2584                 for (i = 0; i < st_ptr->stock_num; i++)
2585                 {
2586                         /* Get the existing item */
2587                         j_ptr = &st_ptr->stock[i];
2588
2589                         /* Can the new object be combined with the old one? */
2590                         if (store_object_similar(j_ptr, o_ptr)) return -1;
2591                 }
2592         }
2593
2594         /* Free space is always usable */
2595         /*
2596          * オプション powerup_home が設定されていると
2597          * 我が家が 20 ページまで使える
2598          */
2599         if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
2600                 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
2601                         return 1;
2602                 }
2603         }
2604         else{
2605                 if (st_ptr->stock_num < st_ptr->stock_size) {
2606                         return 1;
2607                 }
2608         }
2609
2610         /* But there was no room at the inn... */
2611         return 0;
2612 }
2613
2614 /*!
2615  * @brief オブジェクトが祝福されているかの判定を返す /
2616  * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
2617  * @return アイテムが祝福されたアイテムならばTRUEを返す
2618  */
2619 static bool is_blessed(object_type *o_ptr)
2620 {
2621         BIT_FLAGS flgs[TR_FLAG_SIZE];
2622         object_flags(o_ptr, flgs);
2623         if (have_flag(flgs, TR_BLESSED)) return (TRUE);
2624         else return (FALSE);
2625 }
2626
2627
2628
2629 /*!
2630  * @brief オブジェクトが所定の店舗で引き取れるかどうかを返す /
2631  * Determine if the current store will purchase the given item
2632  * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
2633  * @return アイテムが買い取れるならばTRUEを返す
2634  * @note
2635  * Note that a shop-keeper must refuse to buy "worthless" items
2636  */
2637 static bool store_will_buy(object_type *o_ptr)
2638 {
2639         /* Hack -- The Home is simple */
2640         if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
2641
2642         /* Switch on the store */
2643         switch (cur_store_num)
2644         {
2645                 /* General Store */
2646                 case STORE_GENERAL:
2647                 {
2648                         /* Analyze the type */
2649                         switch (o_ptr->tval)
2650                         {
2651                                 case TV_POTION:
2652                                         if (o_ptr->sval != SV_POTION_WATER) return FALSE;
2653
2654                                 case TV_WHISTLE:
2655                                 case TV_FOOD:
2656                                 case TV_LITE:
2657                                 case TV_FLASK:
2658                                 case TV_SPIKE:
2659                                 case TV_SHOT:
2660                                 case TV_ARROW:
2661                                 case TV_BOLT:
2662                                 case TV_DIGGING:
2663                                 case TV_CLOAK:
2664                                 case TV_BOTTLE: /* 'Green', recycling Angband */
2665                                 case TV_FIGURINE:
2666                                 case TV_STATUE:
2667                                 case TV_CAPTURE:
2668                                 case TV_CARD:
2669                                 break;
2670                                 default:
2671                                 return (FALSE);
2672                         }
2673                         break;
2674                 }
2675
2676                 /* Armoury */
2677                 case STORE_ARMOURY:
2678                 {
2679                         /* Analyze the type */
2680                         switch (o_ptr->tval)
2681                         {
2682                                 case TV_BOOTS:
2683                                 case TV_GLOVES:
2684                                 case TV_CROWN:
2685                                 case TV_HELM:
2686                                 case TV_SHIELD:
2687                                 case TV_CLOAK:
2688                                 case TV_SOFT_ARMOR:
2689                                 case TV_HARD_ARMOR:
2690                                 case TV_DRAG_ARMOR:
2691                                 break;
2692                                 default:
2693                                 return (FALSE);
2694                         }
2695                         break;
2696                 }
2697
2698                 /* Weapon Shop */
2699                 case STORE_WEAPON:
2700                 {
2701                         /* Analyze the type */
2702                         switch (o_ptr->tval)
2703                         {
2704                                 case TV_SHOT:
2705                                 case TV_BOLT:
2706                                 case TV_ARROW:
2707                                 case TV_BOW:
2708                                 case TV_DIGGING:
2709                                 case TV_POLEARM:
2710                                 case TV_SWORD:
2711                                 case TV_HISSATSU_BOOK:
2712                                 break;
2713                                 case TV_HAFTED:
2714                                 {
2715                                         if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
2716                                 }
2717                                 break;
2718                                 default:
2719                                 return (FALSE);
2720                         }
2721                         break;
2722                 }
2723
2724                 /* Temple */
2725                 case STORE_TEMPLE:
2726                 {
2727                         /* Analyze the type */
2728                         switch (o_ptr->tval)
2729                         {
2730                                 case TV_LIFE_BOOK:
2731                                 case TV_CRUSADE_BOOK:
2732                                 case TV_SCROLL:
2733                                 case TV_POTION:
2734                                 case TV_HAFTED:
2735                                 {
2736                                         break;
2737                                 }
2738                                 case TV_FIGURINE:
2739                                 case TV_STATUE:
2740                                 {
2741                                         monster_race *r_ptr = &r_info[o_ptr->pval];
2742
2743                                         /* Decline evil */
2744                                         if (!(r_ptr->flags3 & RF3_EVIL))
2745                                         {
2746                                                 /* Accept good */
2747                                                 if (r_ptr->flags3 & RF3_GOOD) break;
2748
2749                                                 /* Accept animals */
2750                                                 if (r_ptr->flags3 & RF3_ANIMAL) break;
2751
2752                                                 /* Accept mimics */
2753                                                 if (my_strchr("?!", r_ptr->d_char)) break;
2754                                         }
2755                                 }
2756                                 case TV_POLEARM:
2757                                 case TV_SWORD:
2758                                 {
2759                                         if (is_blessed(o_ptr)) break;
2760                                 }
2761                                 default:
2762                                 return (FALSE);
2763                         }
2764                         break;
2765                 }
2766
2767                 /* Alchemist */
2768                 case STORE_ALCHEMIST:
2769                 {
2770                         /* Analyze the type */
2771                         switch (o_ptr->tval)
2772                         {
2773                                 case TV_SCROLL:
2774                                 case TV_POTION:
2775                                 break;
2776                                 default:
2777                                 return (FALSE);
2778                         }
2779                         break;
2780                 }
2781
2782                 /* Magic Shop */
2783                 case STORE_MAGIC:
2784                 {
2785                         /* Analyze the type */
2786                         switch (o_ptr->tval)
2787                         {
2788                                 case TV_SORCERY_BOOK:
2789                                 case TV_NATURE_BOOK:
2790                                 case TV_CHAOS_BOOK:
2791                                 case TV_DEATH_BOOK:
2792                                 case TV_TRUMP_BOOK:
2793                                 case TV_ARCANE_BOOK:
2794                                 case TV_CRAFT_BOOK:
2795                                 case TV_DAEMON_BOOK:
2796                                 case TV_MUSIC_BOOK:
2797                                 case TV_HEX_BOOK:
2798                                 case TV_AMULET:
2799                                 case TV_RING:
2800                                 case TV_STAFF:
2801                                 case TV_WAND:
2802                                 case TV_ROD:
2803                                 case TV_SCROLL:
2804                                 case TV_POTION:
2805                                 case TV_FIGURINE:
2806                                 break;
2807                                 case TV_HAFTED:
2808                                 {
2809                                         if(o_ptr->sval == SV_WIZSTAFF) break;
2810                                         else return (FALSE);
2811                                 }
2812                                 default:
2813                                 return (FALSE);
2814                         }
2815                         break;
2816                 }
2817                 /* Bookstore Shop */
2818                 case STORE_BOOK:
2819                 {
2820                         /* Analyze the type */
2821                         switch (o_ptr->tval)
2822                         {
2823                                 case TV_SORCERY_BOOK:
2824                                 case TV_NATURE_BOOK:
2825                                 case TV_CHAOS_BOOK:
2826                                 case TV_DEATH_BOOK:
2827                                 case TV_LIFE_BOOK:
2828                                 case TV_TRUMP_BOOK:
2829                                 case TV_ARCANE_BOOK:
2830                                 case TV_CRAFT_BOOK:
2831                                 case TV_DAEMON_BOOK:
2832                                 case TV_CRUSADE_BOOK:
2833                                 case TV_MUSIC_BOOK:
2834                                 case TV_HEX_BOOK:
2835                                         break;
2836                                 default:
2837                                         return (FALSE);
2838                         }
2839                         break;
2840                 }
2841         }
2842
2843         /* Ignore "worthless" items */
2844         if (object_value(o_ptr) <= 0) return (FALSE);
2845
2846         /* Assume okay */
2847         return (TRUE);
2848 }
2849
2850
2851 /*!
2852  * @brief 現在の町の指定された店舗のアイテムを整理する /
2853  * Combine and reorder items in store.
2854  * @param store_num 店舗ID
2855  * @return 実際に整理が行われたならばTRUEを返す。
2856  */
2857 bool combine_and_reorder_home(int store_num)
2858 {
2859         int         i, j, k;
2860         s32b        o_value;
2861         object_type forge, *o_ptr, *j_ptr;
2862         bool        flag = FALSE, combined;
2863         store_type  *old_st_ptr = st_ptr;
2864         bool        old_stack_force_notes = stack_force_notes;
2865         bool        old_stack_force_costs = stack_force_costs;
2866
2867         st_ptr = &town_info[1].store[store_num];
2868         if (store_num != STORE_HOME)
2869         {
2870                 stack_force_notes = FALSE;
2871                 stack_force_costs = FALSE;
2872         }
2873
2874         do
2875         {
2876                 combined = FALSE;
2877
2878                 /* Combine the items in the home (backwards) */
2879                 for (i = st_ptr->stock_num - 1; i > 0; i--)
2880                 {
2881                         o_ptr = &st_ptr->stock[i];
2882
2883                         /* Skip empty items */
2884                         if (!o_ptr->k_idx) continue;
2885
2886                         /* Scan the items above that item */
2887                         for (j = 0; j < i; j++)
2888                         {
2889                                 int max_num;
2890
2891                                 j_ptr = &st_ptr->stock[j];
2892
2893                                 /* Skip empty items */
2894                                 if (!j_ptr->k_idx) continue;
2895
2896                                 /*
2897                                  * Get maximum number of the stack if these
2898                                  * are similar, get zero otherwise.
2899                                  */
2900                                 max_num = object_similar_part(j_ptr, o_ptr);
2901
2902                                 /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
2903                                 if (max_num && j_ptr->number < max_num)
2904                                 {
2905                                         if (o_ptr->number + j_ptr->number <= max_num)
2906                                         {
2907                                                 /* Add together the item counts */
2908                                                 object_absorb(j_ptr, o_ptr);
2909
2910                                                 /* One object is gone */
2911                                                 st_ptr->stock_num--;
2912
2913                                                 /* Slide everything down */
2914                                                 for (k = i; k < st_ptr->stock_num; k++)
2915                                                 {
2916                                                         /* Structure copy */
2917                                                         st_ptr->stock[k] = st_ptr->stock[k + 1];
2918                                                 }
2919
2920                                                 /* Erase the "final" slot */
2921                                                 object_wipe(&st_ptr->stock[k]);
2922                                         }
2923                                         else
2924                                         {
2925                                                 ITEM_NUMBER old_num = o_ptr->number;
2926                                                 ITEM_NUMBER remain = j_ptr->number + o_ptr->number - max_num;
2927
2928                                                 /* Add together the item counts */
2929                                                 object_absorb(j_ptr, o_ptr);
2930
2931                                                 o_ptr->number = remain;
2932
2933                                                 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
2934                                                 if (o_ptr->tval == TV_ROD)
2935                                                 {
2936                                                         o_ptr->pval =  o_ptr->pval * remain / old_num;
2937                                                         o_ptr->timeout = o_ptr->timeout * remain / old_num;
2938                                                 }
2939
2940                                                 /* Hack -- if wands are stacking, combine the charges. -LM- */
2941                                                 else if (o_ptr->tval == TV_WAND)
2942                                                 {
2943                                                         o_ptr->pval = o_ptr->pval * remain / old_num;
2944                                                 }
2945                                         }
2946
2947                                         /* Take note */
2948                                         combined = TRUE;
2949                                         break;
2950                                 }
2951                         }
2952                 }
2953
2954                 flag |= combined;
2955         }
2956         while (combined);
2957
2958         /* Re-order the items in the home (forwards) */
2959         for (i = 0; i < st_ptr->stock_num; i++)
2960         {
2961                 o_ptr = &st_ptr->stock[i];
2962
2963                 /* Skip empty slots */
2964                 if (!o_ptr->k_idx) continue;
2965
2966                 /* Get the "value" of the item */
2967                 o_value = object_value(o_ptr);
2968
2969                 /* Scan every occupied slot */
2970                 for (j = 0; j < st_ptr->stock_num; j++)
2971                 {
2972                         if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
2973                 }
2974
2975                 /* Never move down */
2976                 if (j >= i) continue;
2977
2978                 /* Take note */
2979                 flag = TRUE;
2980                 j_ptr = &forge;
2981
2982                 /* Save a copy of the moving item */
2983                 object_copy(j_ptr, &st_ptr->stock[i]);
2984
2985                 /* Slide the objects */
2986                 for (k = i; k > j; k--)
2987                 {
2988                         /* Slide the item */
2989                         object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
2990                 }
2991
2992                 /* Insert the moving item */
2993                 object_copy(&st_ptr->stock[j], j_ptr);
2994         }
2995
2996         st_ptr = old_st_ptr;
2997         if (store_num != STORE_HOME)
2998         {
2999                 stack_force_notes = old_stack_force_notes;
3000                 stack_force_costs = old_stack_force_costs;
3001         }
3002
3003         return flag;
3004 }
3005
3006
3007 /*!
3008  * @brief 我が家にオブジェクトを加える /
3009  * Add the item "o_ptr" to the p_ptr->inventory_list of the "Home"
3010  * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
3011  * @return 収めた先のID
3012  * @details
3013  * <pre>
3014  * In all cases, return the slot (or -1) where the object was placed
3015  * Note that this is a hacked up version of "inven_carry()".
3016  * Also note that it may not correctly "adapt" to "knowledge" bacoming
3017  * known, the player may have to pick stuff up and drop it again.
3018  * </pre>
3019  */
3020 static int home_carry(object_type *o_ptr)
3021 {
3022         int slot;
3023         PRICE value;
3024         int i;
3025         object_type *j_ptr;
3026         bool old_stack_force_notes = stack_force_notes;
3027         bool old_stack_force_costs = stack_force_costs;
3028
3029         if (cur_store_num != STORE_HOME)
3030         {
3031                 stack_force_notes = FALSE;
3032                 stack_force_costs = FALSE;
3033         }
3034
3035         /* Check each existing item (try to combine) */
3036         for (slot = 0; slot < st_ptr->stock_num; slot++)
3037         {
3038                 /* Get the existing item */
3039                 j_ptr = &st_ptr->stock[slot];
3040
3041                 /* The home acts just like the player */
3042                 if (object_similar(j_ptr, o_ptr))
3043                 {
3044                         /* Save the new number of items */
3045                         object_absorb(j_ptr, o_ptr);
3046
3047                         if (cur_store_num != STORE_HOME)
3048                         {
3049                                 stack_force_notes = old_stack_force_notes;
3050                                 stack_force_costs = old_stack_force_costs;
3051                         }
3052
3053                         /* All done */
3054                         return (slot);
3055                 }
3056         }
3057
3058         if (cur_store_num != STORE_HOME)
3059         {
3060                 stack_force_notes = old_stack_force_notes;
3061                 stack_force_costs = old_stack_force_costs;
3062         }
3063
3064         /* No space? */
3065         /*
3066          * 隠し機能: オプション powerup_home が設定されていると
3067          *           我が家が 20 ページまで使える
3068          */
3069         /* No space? */
3070         if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
3071                 if (st_ptr->stock_num >= st_ptr->stock_size) {
3072                         return (-1);
3073                 }
3074         }
3075         else{
3076                 if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
3077                         return (-1);
3078                 }
3079         }
3080
3081
3082         /* Determine the "value" of the item */
3083         value = object_value(o_ptr);
3084
3085         /* Check existing slots to see if we must "slide" */
3086         for (slot = 0; slot < st_ptr->stock_num; slot++)
3087         {
3088                 if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
3089         }
3090
3091         /* Slide the others up */
3092         for (i = st_ptr->stock_num; i > slot; i--)
3093         {
3094                 st_ptr->stock[i] = st_ptr->stock[i-1];
3095         }
3096
3097         /* More stuff now */
3098         st_ptr->stock_num++;
3099
3100         /* Insert the new item */
3101         st_ptr->stock[slot] = *o_ptr;
3102
3103         chg_virtue(V_SACRIFICE, -1);
3104
3105         (void)combine_and_reorder_home(cur_store_num);
3106
3107         /* Return the location */
3108         return (slot);
3109 }
3110
3111
3112 /*!
3113  * @brief 店舗にオブジェクトを加える /
3114  * Add the item "o_ptr" to a real stores p_ptr->inventory_list.
3115  * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
3116  * @return 収めた先のID
3117  * @details
3118  * <pre>
3119  * In all cases, return the slot (or -1) where the object was placed
3120  * Note that this is a hacked up version of "inven_carry()".
3121  * Also note that it may not correctly "adapt" to "knowledge" bacoming
3122  * known, the player may have to pick stuff up and drop it again.
3123  * </pre>
3124  */
3125 static int store_carry(object_type *o_ptr)
3126 {
3127         int i, slot;
3128         PRICE value, j_value;
3129         object_type *j_ptr;
3130
3131
3132         /* Evaluate the object */
3133         value = object_value(o_ptr);
3134
3135         /* Cursed/Worthless items "disappear" when sold */
3136         if (value <= 0) return (-1);
3137
3138         /* All store items are fully *identified* */
3139         o_ptr->ident |= IDENT_MENTAL;
3140
3141         /* Erase the inscription */
3142         o_ptr->inscription = 0;
3143
3144         /* Erase the "feeling" */
3145         o_ptr->feeling = FEEL_NONE;
3146
3147         /* Check each existing item (try to combine) */
3148         for (slot = 0; slot < st_ptr->stock_num; slot++)
3149         {
3150                 /* Get the existing item */
3151                 j_ptr = &st_ptr->stock[slot];
3152
3153                 /* Can the existing items be incremented? */
3154                 if (store_object_similar(j_ptr, o_ptr))
3155                 {
3156                         /* Hack -- extra items disappear */
3157                         store_object_absorb(j_ptr, o_ptr);
3158
3159                         /* All done */
3160                         return (slot);
3161                 }
3162         }
3163
3164         /* No space? */
3165         if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
3166
3167
3168         /* Check existing slots to see if we must "slide" */
3169         for (slot = 0; slot < st_ptr->stock_num; slot++)
3170         {
3171                 /* Get that item */
3172                 j_ptr = &st_ptr->stock[slot];
3173
3174                 /* Objects sort by decreasing type */
3175                 if (o_ptr->tval > j_ptr->tval) break;
3176                 if (o_ptr->tval < j_ptr->tval) continue;
3177
3178                 /* Objects sort by increasing sval */
3179                 if (o_ptr->sval < j_ptr->sval) break;
3180                 if (o_ptr->sval > j_ptr->sval) continue;
3181
3182                 /*
3183                  * Hack:  otherwise identical rods sort by
3184                  * increasing recharge time --dsb
3185                  */
3186                 if (o_ptr->tval == TV_ROD)
3187                 {
3188                         if (o_ptr->pval < j_ptr->pval) break;
3189                         if (o_ptr->pval > j_ptr->pval) continue;
3190                 }
3191
3192                 /* Evaluate that slot */
3193                 j_value = object_value(j_ptr);
3194
3195                 /* Objects sort by decreasing value */
3196                 if (value > j_value) break;
3197                 if (value < j_value) continue;
3198         }
3199
3200         /* Slide the others up */
3201         for (i = st_ptr->stock_num; i > slot; i--)
3202         {
3203                 st_ptr->stock[i] = st_ptr->stock[i-1];
3204         }
3205
3206         /* More stuff now */
3207         st_ptr->stock_num++;
3208
3209         /* Insert the new item */
3210         st_ptr->stock[slot] = *o_ptr;
3211
3212         /* Return the location */
3213         return (slot);
3214 }
3215
3216
3217 /*!
3218  * @brief 店舗のオブジェクト数を増やす /
3219  * Add the item "o_ptr" to a real stores p_ptr->inventory_list.
3220  * @param item 増やしたいアイテムのID
3221  * @param num 増やしたい数
3222  * @return なし
3223  * @details
3224  * <pre>
3225  * Increase, by a given amount, the number of a certain item
3226  * in a certain store.  This can result in zero items.
3227  * </pre>
3228  * @todo numは本来ITEM_NUMBER型にしたい。
3229  */
3230 static void store_item_increase(INVENTORY_IDX item, int num)
3231 {
3232         int             cnt;
3233         object_type *o_ptr;
3234
3235         o_ptr = &st_ptr->stock[item];
3236
3237         /* Verify the number */
3238         cnt = o_ptr->number + num;
3239         if (cnt > 255) cnt = 255;
3240         else if (cnt < 0) cnt = 0;
3241         num = cnt - o_ptr->number;
3242
3243         /* Save the new number */
3244         o_ptr->number += (ITEM_NUMBER)num;
3245 }
3246
3247
3248 /*!
3249  * @brief 店舗のオブジェクト数を削除する /
3250  * Remove a slot if it is empty
3251  * @param item 削除したいアイテムのID
3252  * @return なし
3253  */
3254 static void store_item_optimize(INVENTORY_IDX item)
3255 {
3256         int             j;
3257         object_type *o_ptr;
3258
3259         o_ptr = &st_ptr->stock[item];
3260
3261         /* Must exist */
3262         if (!o_ptr->k_idx) return;
3263
3264         /* Must have no items */
3265         if (o_ptr->number) return;
3266
3267         /* One less item */
3268         st_ptr->stock_num--;
3269
3270         /* Slide everyone */
3271         for (j = item; j < st_ptr->stock_num; j++)
3272         {
3273                 st_ptr->stock[j] = st_ptr->stock[j + 1];
3274         }
3275
3276         /* Nuke the final slot */
3277         object_wipe(&st_ptr->stock[j]);
3278 }
3279
3280 /*!
3281  * @brief ブラックマーケット用の無価値品の排除判定 /
3282  * This function will keep 'crap' out of the black market.
3283  * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
3284  * @return ブラックマーケットにとって無価値な品ならばTRUEを返す
3285  * @details
3286  * <pre>
3287  * Crap is defined as any item that is "available" elsewhere
3288  * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
3289  * </pre>
3290  */
3291 static bool black_market_crap(object_type *o_ptr)
3292 {
3293         int i, j;
3294
3295         /* Ego items are never crap */
3296         if (object_is_ego(o_ptr)) return (FALSE);
3297
3298         /* Good items are never crap */
3299         if (o_ptr->to_a > 0) return (FALSE);
3300         if (o_ptr->to_h > 0) return (FALSE);
3301         if (o_ptr->to_d > 0) return (FALSE);
3302
3303         /* Check all stores */
3304         for (i = 0; i < MAX_STORES; i++)
3305         {
3306                 if (i == STORE_HOME) continue;
3307                 if (i == STORE_MUSEUM) continue;
3308
3309                 /* Check every item in the store */
3310                 for (j = 0; j < town_info[p_ptr->town_num].store[i].stock_num; j++)
3311                 {
3312                         object_type *j_ptr = &town_info[p_ptr->town_num].store[i].stock[j];
3313
3314                         /* Duplicate item "type", assume crappy */
3315                         if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
3316                 }
3317         }
3318
3319         /* Assume okay */
3320         return (FALSE);
3321 }
3322
3323
3324 /*!
3325  * @brief 店舗の品揃え変化のためにアイテムを削除する /
3326  * Attempt to delete (some of) a random item from the store
3327  * @return なし
3328  * @details
3329  * <pre>
3330  * Hack -- we attempt to "maintain" piles of items when possible.
3331  * </pre>
3332  */
3333 static void store_delete(void)
3334 {
3335         INVENTORY_IDX what;
3336         int num;
3337
3338         /* Pick a random slot */
3339         what = (INVENTORY_IDX)randint0(st_ptr->stock_num);
3340
3341         /* Determine how many items are here */
3342         num = st_ptr->stock[what].number;
3343
3344         /* Hack -- sometimes, only destroy half the items */
3345         if (randint0(100) < 50) num = (num + 1) / 2;
3346
3347         /* Hack -- sometimes, only destroy a single item */
3348         if (randint0(100) < 50) num = 1;
3349
3350         /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
3351         if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
3352         {
3353                 st_ptr->stock[what].pval -= num * st_ptr->stock[what].pval / st_ptr->stock[what].number;
3354         }
3355
3356         /* Actually destroy (part of) the item */
3357         store_item_increase(what, -num);
3358         store_item_optimize(what);
3359 }
3360
3361
3362 /*!
3363  * @brief 店舗の品揃え変化のためにアイテムを追加する /
3364  * Creates a random item and gives it to a store
3365  * @return なし
3366  * @details
3367  * <pre>
3368  * This algorithm needs to be rethought.  A lot.
3369  * Currently, "normal" stores use a pre-built array.
3370  * Note -- the "level" given to "obj_get_num()" is a "favored"
3371  * level, that is, there is a much higher chance of getting
3372  * items with a level approaching that of the given level...
3373  * Should we check for "permission" to have the given item?
3374  * </pre>
3375  */
3376 static void store_create(void)
3377 {
3378         OBJECT_IDX i;
3379         int tries;
3380         DEPTH level;
3381
3382         object_type forge;
3383         object_type *q_ptr;
3384
3385
3386         /* Paranoia -- no room left */
3387         if (st_ptr->stock_num >= st_ptr->stock_size) return;
3388
3389
3390         /* Hack -- consider up to four items */
3391         for (tries = 0; tries < 4; tries++)
3392         {
3393                 /* Black Market */
3394                 if (cur_store_num == STORE_BLACK)
3395                 {
3396                         /* Pick a level for object/magic */
3397                         level = 25 + randint0(25);
3398
3399                         /* Random item (usually of given level) */
3400                         i = get_obj_num(level);
3401
3402                         /* Handle failure */
3403                         if (!i) continue;
3404                 }
3405
3406                 /* Normal Store */
3407                 else
3408                 {
3409                         /* Hack -- Pick an item to sell */
3410                         i = st_ptr->table[randint0(st_ptr->table_num)];
3411
3412                         /* Hack -- fake level for apply_magic() */
3413                         level = rand_range(1, STORE_OBJ_LEVEL);
3414                 }
3415
3416                 q_ptr = &forge;
3417
3418                 /* Create a new object of the chosen kind */
3419                 object_prep(q_ptr, i);
3420
3421                 /* Apply some "low-level" magic (no artifacts) */
3422                 apply_magic(q_ptr, level, AM_NO_FIXED_ART);
3423
3424                 /* Require valid object */
3425                 if (!store_will_buy(q_ptr)) continue;
3426
3427                 /* Hack -- Charge lite's */
3428                 if (q_ptr->tval == TV_LITE)
3429                 {
3430                         if (q_ptr->sval == SV_LITE_TORCH) q_ptr->xtra4 = FUEL_TORCH / 2;
3431                         if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->xtra4 = FUEL_LAMP / 2;
3432                 }
3433
3434
3435                 /* The item is "known" */
3436                 object_known(q_ptr);
3437
3438                 /* Mark it storebought */
3439                 q_ptr->ident |= IDENT_STORE;
3440
3441                 /* Mega-Hack -- no chests in stores */
3442                 if (q_ptr->tval == TV_CHEST) continue;
3443
3444                 /* Prune the black market */
3445                 if (cur_store_num == STORE_BLACK)
3446                 {
3447                         /* Hack -- No "crappy" items */
3448                         if (black_market_crap(q_ptr)) continue;
3449
3450                         /* Hack -- No "cheap" items */
3451                         if (object_value(q_ptr) < 10) continue;
3452
3453                         /* No "worthless" items */
3454                         /* if (object_value(q_ptr) <= 0) continue; */
3455                 }
3456
3457                 /* Prune normal stores */
3458                 else
3459                 {
3460                         /* No "worthless" items */
3461                         if (object_value(q_ptr) <= 0) continue;
3462                 }
3463
3464
3465                 /* Mass produce and/or Apply discount */
3466                 mass_produce(q_ptr);
3467
3468                 /* Attempt to carry the (known) item */
3469                 (void)store_carry(q_ptr);
3470
3471                 /* Definitely done */
3472                 break;
3473         }
3474 }
3475
3476
3477 /*!
3478  * @brief 店舗の割引対象外にするかどうかを判定 /
3479  * Eliminate need to bargain if player has haggled well in the past
3480  * @param minprice アイテムの最低販売価格
3481  * @return 割引を禁止するならTRUEを返す。
3482  */
3483 static bool noneedtobargain(PRICE minprice)
3484 {
3485         PRICE good = st_ptr->good_buy;
3486         PRICE bad = st_ptr->bad_buy;
3487
3488         /* Cheap items are "boring" */
3489         if (minprice < 10L) return (TRUE);
3490
3491         /* Perfect haggling */
3492         if (good == MAX_SHORT) return (TRUE);
3493
3494         /* Reward good haggles, punish bad haggles, notice price */
3495         if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
3496
3497         /* Return the flag */
3498         return (FALSE);
3499 }
3500
3501
3502 /*!
3503  * @brief 店主の持つプレイヤーに対する売買の良し悪し経験を記憶する /
3504  * Update the bargain info
3505  * @param price 実際の取引価格
3506  * @param minprice 店主の提示した価格
3507  * @param num 売買数 
3508  * @return なし
3509  */
3510 static void updatebargain(PRICE price, PRICE minprice, int num)
3511 {
3512         /* Hack -- auto-haggle */
3513         if (!manual_haggle) return;
3514
3515         /* Cheap items are "boring" */
3516         if ((minprice/num) < 10L) return;
3517
3518         /* Count the successful haggles */
3519         if (price == minprice)
3520         {
3521                 /* Just count the good haggles */
3522                 if (st_ptr->good_buy < MAX_SHORT)
3523                 {
3524                         st_ptr->good_buy++;
3525                 }
3526         }
3527
3528         /* Count the failed haggles */
3529         else
3530         {
3531                 /* Just count the bad haggles */
3532                 if (st_ptr->bad_buy < MAX_SHORT)
3533                 {
3534                         st_ptr->bad_buy++;
3535                 }
3536         }
3537 }
3538
3539
3540 /*!
3541  * @brief 店の商品リストを再表示する /
3542  * Re-displays a single store entry
3543  * @param pos 表示行
3544  * @return なし
3545  */
3546 static void display_entry(int pos)
3547 {
3548         int i, cur_col;
3549         object_type *o_ptr;
3550         s32b x;
3551
3552         GAME_TEXT o_name[MAX_NLEN];
3553         char out_val[160];
3554
3555         int maxwid = 75;
3556
3557         o_ptr = &st_ptr->stock[pos];
3558
3559         /* Get the "offset" */
3560         i = (pos % store_bottom);
3561
3562         /* Label it, clear the line --(-- */
3563         (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
3564         prt(out_val, i+6, 0);
3565
3566         cur_col = 3;
3567         if (show_item_graph)
3568         {
3569                 TERM_COLOR a = object_attr(o_ptr);
3570                 SYMBOL_CODE c = object_char(o_ptr);
3571
3572                 Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
3573                 if (use_bigtile) cur_col++;
3574
3575                 cur_col += 2;
3576         }
3577
3578         /* Describe an item in the home */
3579         if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
3580         {
3581                 maxwid = 75;
3582
3583                 /* Leave room for weights, if necessary -DRS- */
3584                 if (show_weights) maxwid -= 10;
3585
3586                 object_desc(o_name, o_ptr, 0);
3587                 o_name[maxwid] = '\0';
3588                 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
3589
3590                 /* Show weights */
3591                 if(show_weights)
3592                 {
3593                         /* Only show the weight of an individual item */
3594                         WEIGHT wgt = o_ptr->weight;
3595 #ifdef JP
3596                         sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
3597                         put_str(out_val, i+6, 67);
3598 #else
3599                         (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10);
3600                         put_str(out_val, i+6, 68);
3601 #endif
3602
3603                 }
3604         }
3605
3606         /* Describe an item (fully) in a store */
3607         else
3608         {
3609                 /* Must leave room for the "price" */
3610                 maxwid = 65;
3611
3612                 /* Leave room for weights, if necessary -DRS- */
3613                 if (show_weights) maxwid -= 7;
3614
3615                 /* Describe the object (fully) */
3616                 object_desc(o_name, o_ptr, 0);
3617                 o_name[maxwid] = '\0';
3618                 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
3619
3620                 /* Show weights */
3621                 if (show_weights)
3622                 {
3623                         /* Only show the weight of an individual item */
3624                         int wgt = o_ptr->weight;
3625 #ifdef JP
3626                         sprintf(out_val, "%3d.%1d", lbtokg1(wgt) , lbtokg2(wgt) );
3627                         put_str(out_val, i+6, 60);
3628 #else
3629                         (void)sprintf(out_val, "%3d.%d", wgt / 10, wgt % 10);
3630                         put_str(out_val, i+6, 61);
3631 #endif
3632
3633                 }
3634
3635                 /* Display a "fixed" cost */
3636                 if (o_ptr->ident & (IDENT_FIXED))
3637                 {
3638                         /* Extract the "minimum" price */
3639                         x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3640
3641                         /* Actually draw the price (not fixed) */
3642 #ifdef JP
3643                         (void)sprintf(out_val, "%9ld固", (long)x);
3644 #else
3645                         (void)sprintf(out_val, "%9ld F", (long)x);
3646 #endif
3647                         put_str(out_val, i+6, 68);
3648                 }
3649
3650                 /* Display a "taxed" cost */
3651                 else if (!manual_haggle)
3652                 {
3653                         /* Extract the "minimum" price */
3654                         x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3655
3656                         /* Hack -- Apply Sales Tax if needed */
3657                         if (!noneedtobargain(x)) x += x / 10;
3658
3659                         /* Actually draw the price (with tax) */
3660                         (void)sprintf(out_val, "%9ld  ", (long)x);
3661                         put_str(out_val, i+6, 68);
3662                 }
3663
3664                 /* Display a "haggle" cost */
3665                 else
3666                 {
3667                         /* Extrect the "maximum" price */
3668                         x = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
3669
3670                         /* Actually draw the price (not fixed) */
3671                         (void)sprintf(out_val, "%9ld  ", (long)x);
3672                         put_str(out_val, i+6, 68);
3673                 }
3674         }
3675 }
3676
3677
3678 /*!
3679  * @brief 店の商品リストを表示する /
3680  * Displays a store's p_ptr->inventory_list             -RAK-
3681  * @return なし
3682  * @details
3683  * All prices are listed as "per individual object".  -BEN-
3684  */
3685 static void display_inventory(void)
3686 {
3687         int i, k;
3688
3689         /* Display the next 12 items */
3690         for (k = 0; k < store_bottom; k++)
3691         {
3692                 /* Do not display "dead" items */
3693                 if (store_top + k >= st_ptr->stock_num) break;
3694
3695                 /* Display that line */
3696                 display_entry(store_top + k);
3697         }
3698
3699         /* Erase the extra lines and the "more" prompt */
3700         for (i = k; i < store_bottom + 1; i++) prt("", i + 6, 0);
3701
3702         /* Assume "no current page" */
3703 #ifdef JP
3704         put_str("          ", 5, 20);
3705 #else
3706         put_str("        ", 5, 20);
3707 #endif
3708
3709
3710         /* Visual reminder of "more items" */
3711         if (st_ptr->stock_num > store_bottom)
3712         {
3713                 /* Show "more" reminder (after the last item) */
3714                 prt(_("-続く-", "-more-"), k + 6, 3);
3715
3716                 /* Indicate the "current page" */
3717                 /* Trailing spaces are to display (Page xx) and (Page x) */
3718                 put_str(format(_("(%dページ)  ", "(Page %d)  "), store_top/store_bottom + 1), 5, 20);
3719         }
3720
3721         if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
3722         {
3723                 k = st_ptr->stock_size;
3724
3725                 if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
3726 #ifdef JP
3727                 put_str(format("アイテム数:  %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
3728 #else
3729                 put_str(format("Objects:  %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
3730 #endif
3731         }
3732 }
3733
3734
3735 /*!
3736  * @brief プレイヤーの所持金を表示する /
3737  * Displays players gold                                        -RAK-
3738  * @return なし
3739  * @details
3740  */
3741 static void store_prt_gold(void)
3742 {
3743         char out_val[64];
3744
3745         prt(_("手持ちのお金: ", "Gold Remaining: "), 19 + xtra_stock, 53);
3746         sprintf(out_val, "%9ld", (long)p_ptr->au);
3747         prt(out_val, 19 + xtra_stock, 68);
3748 }
3749
3750 /*!
3751  * @brief 店舗情報全体を表示するメインルーチン /
3752  * Displays store (after clearing screen)               -RAK-
3753  * @return なし
3754  * @details
3755  */
3756 static void display_store(void)
3757 {
3758         char buf[80];
3759
3760         Term_clear();
3761
3762         /* The "Home" is special */
3763         if (cur_store_num == STORE_HOME)
3764         {
3765                 /* Put the owner name */
3766                 put_str(_("我が家", "Your Home"), 3, 31);
3767
3768                 /* Label the item descriptions */
3769                 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
3770
3771                 /* If showing weights, show label */
3772                 if (show_weights)
3773                 {
3774                         put_str(_("  重さ", "Weight"), 5, 70);
3775                 }
3776         }
3777
3778         /* The "Home" is special */
3779         else if (cur_store_num == STORE_MUSEUM)
3780         {
3781                 /* Put the owner name */
3782                 put_str(_("博物館", "Museum"), 3, 31);
3783
3784                 /* Label the item descriptions */
3785                 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
3786
3787                 /* If showing weights, show label */
3788                 if (show_weights)
3789                 {
3790                         put_str(_("  重さ", "Weight"), 5, 70);
3791                 }
3792         }
3793
3794         /* Normal stores */
3795         else
3796         {
3797                 concptr store_name = (f_name + f_info[cur_store_feat].name);
3798                 concptr owner_name = (ot_ptr->owner_name);
3799                 concptr race_name = race_info[ot_ptr->owner_race].title;
3800
3801                 /* Put the owner name and race */
3802                 sprintf(buf, "%s (%s)", owner_name, race_name);
3803                 put_str(buf, 3, 10);
3804
3805                 /* Show the max price in the store (above prices) */
3806                 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
3807                 prt(buf, 3, 50);
3808
3809                 /* Label the item descriptions */
3810                 put_str(_("商品の一覧", "Item Description"), 5, 5);
3811
3812
3813                 /* If showing weights, show label */
3814                 if (show_weights)
3815                 {
3816                         put_str(_("  重さ", "Weight"), 5, 60);
3817                 }
3818
3819                 /* Label the asking price (in stores) */
3820                 put_str(_(" 価格", "Price"), 5, 72);
3821         }
3822
3823         /* Display the current gold */
3824         store_prt_gold();
3825
3826         /* Draw in the p_ptr->inventory_list */
3827         display_inventory();
3828 }
3829
3830
3831
3832 /*!
3833  * @brief 店舗からアイテムを選択する /
3834  * Get the ID of a store item and return its value      -RAK-
3835  * @param com_val 選択IDを返す参照ポインタ
3836  * @param pmt メッセージキャプション
3837  * @param i 選択範囲の最小値
3838  * @param j 選択範囲の最大値
3839  * @return 実際に選択したらTRUE、キャンセルしたらFALSE
3840  */
3841 static int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
3842 {
3843         char command;
3844         char out_val[160];
3845         char lo, hi;
3846
3847         /* Get the item index */
3848         if (repeat_pull(com_val))
3849         {
3850                 /* Verify the item */
3851                 if ((*com_val >= i) && (*com_val <= j))
3852                 {
3853                         /* Success */
3854                         return (TRUE);
3855                 }
3856         }
3857         msg_print(NULL);
3858
3859         /* Assume failure */
3860         *com_val = (-1);
3861
3862         /* Build the prompt */
3863         lo = I2A(i);
3864         hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
3865 #ifdef JP
3866         (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s",
3867                 (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"), 
3868                                   lo, hi, pmt);
3869 #else
3870         (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s",
3871                                   lo, hi, pmt);
3872 #endif
3873
3874
3875         /* Ask until done */
3876         while (TRUE)
3877         {
3878                 COMMAND_CODE k;
3879
3880                 /* Escape */
3881                 if (!get_com(out_val, &command, FALSE)) break;
3882
3883                 /* Convert */
3884                 if (islower(command))
3885                         k = A2I(command);
3886                 else if (isupper(command))
3887                         k = A2I(tolower(command)) + 26;
3888                 else
3889                         k = -1;
3890
3891                 /* Legal responses */
3892                 if ((k >= i) && (k <= j))
3893                 {
3894                         *com_val = k;
3895                         break;
3896                 }
3897
3898                 bell();
3899         }
3900
3901         /* Clear the prompt */
3902         prt("", 0, 0);
3903
3904         if (command == ESCAPE) return (FALSE);
3905
3906         repeat_push(*com_val);
3907
3908         /* Success */
3909         return (TRUE);
3910 }
3911
3912
3913 /*!
3914  * @brief 店主の不満度を増やし、プレイヤーを締め出す判定と処理を行う /
3915  * Increase the insult counter and get angry if too many -RAK-
3916  * @return プレイヤーを締め出す場合TRUEを返す
3917  */
3918 static int increase_insults(void)
3919 {
3920         /* Increase insults */
3921         st_ptr->insult_cur++;
3922
3923         /* Become insulted */
3924         if (st_ptr->insult_cur > ot_ptr->insult_max)
3925         {
3926                 /* Complain */
3927                 say_comment_4();
3928
3929                 /* Reset insults */
3930                 st_ptr->insult_cur = 0;
3931                 st_ptr->good_buy = 0;
3932                 st_ptr->bad_buy = 0;
3933
3934                 /* Open tomorrow */
3935                 st_ptr->store_open = current_world_ptr->game_turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
3936
3937                 /* Closed */
3938                 return (TRUE);
3939         }
3940
3941         /* Not closed */
3942         return (FALSE);
3943 }
3944
3945
3946 /*!
3947  * @brief 店主の不満度を減らす /
3948  * Decrease insults                             -RAK-
3949  * @return プレイヤーを締め出す場合TRUEを返す
3950  */
3951 static void decrease_insults(void)
3952 {
3953         /* Decrease insults */
3954         if (st_ptr->insult_cur) st_ptr->insult_cur--;
3955 }
3956
3957
3958 /*!
3959  * @brief 店主の不満度が増えた場合のみのメッセージを表示する /
3960  * Have insulted while haggling                         -RAK-
3961  * @return プレイヤーを締め出す場合TRUEを返す
3962  */
3963 static int haggle_insults(void)
3964 {
3965         /* Increase insults */
3966         if (increase_insults()) return (TRUE);
3967
3968         /* Display and flush insult */
3969         say_comment_5();
3970
3971         /* Still okay */
3972         return (FALSE);
3973 }
3974
3975
3976 /*
3977  * Mega-Hack -- Enable "increments"
3978  */
3979 static bool allow_inc = FALSE;
3980
3981 /*
3982  * Mega-Hack -- Last "increment" during haggling
3983  */
3984 static s32b last_inc = 0L;
3985
3986
3987 /*!
3988  * @brief 交渉価格を確認と認証の是非を行う /
3989  * Get a haggle
3990  * @param pmt メッセージ
3991  * @param poffer 別途価格提示をした場合の値を返す参照ポインタ
3992  * @param price 現在の交渉価格
3993  * @param final 最終確定価格ならばTRUE
3994  * @return プレイヤーを締め出す場合TRUEを返す
3995  */
3996 static int get_haggle(concptr pmt, s32b *poffer, PRICE price, int final)
3997 {
3998         s32b i;
3999         concptr p;
4000         GAME_TEXT buf[128];
4001         GAME_TEXT out_val[160];
4002
4003         /* Clear old increment if necessary */
4004         if (!allow_inc) last_inc = 0L;
4005
4006         /* Final offer */
4007         if (final)
4008         {
4009                 sprintf(buf, _("%s [承諾] ", "%s [accept] "), pmt);
4010         }
4011
4012         /* Old (negative) increment, and not final */
4013         else if (last_inc < 0)
4014         {
4015                 sprintf(buf, _("%s [-$%ld] ", "%s [-%ld] "), pmt, (long)(ABS(last_inc)));
4016         }
4017
4018         /* Old (positive) increment, and not final */
4019         else if (last_inc > 0)
4020         {
4021                 sprintf(buf, _("%s [+$%ld] ", "%s [+%ld] "), pmt, (long)(ABS(last_inc)));
4022         }
4023
4024         /* Normal haggle */
4025         else
4026         {
4027                 sprintf(buf, "%s ", pmt);
4028         }
4029         msg_print(NULL);
4030
4031         /* Ask until done */
4032         while (TRUE)
4033         {
4034                 bool res;
4035
4036                 /* Display prompt */
4037                 prt(buf, 0, 0);
4038
4039                 /* Default */
4040                 strcpy(out_val, "");
4041
4042                 /*
4043                  * Ask the user for a response.
4044                  * Don't allow to use numpad as cursor key.
4045                  */
4046                 res = askfor_aux(out_val, 32, FALSE);
4047
4048                 /* Clear prompt */
4049                 prt("", 0, 0);
4050
4051                 /* Cancelled */
4052                 if (!res) return FALSE;
4053
4054                 /* Skip leading spaces */
4055                 for (p = out_val; *p == ' '; p++) /* loop */;
4056
4057                 /* Empty response */
4058                 if (*p == '\0')
4059                 {
4060                         /* Accept current price */
4061                         if (final)
4062                         {
4063                                 *poffer = price;
4064                                 last_inc = 0L;
4065                                 break;
4066                         }
4067
4068                         /* Use previous increment */
4069                         if (allow_inc && last_inc)
4070                         {
4071                                 *poffer += last_inc;
4072                                 break;
4073                         }
4074                 }
4075
4076                 /* Normal response */
4077                 else
4078                 {
4079                         /* Extract a number */
4080                         i = atol(p);
4081
4082                         /* Handle "incremental" number */
4083                         if ((*p == '+' || *p == '-'))
4084                         {
4085                                 /* Allow increments */
4086                                 if (allow_inc)
4087                                 {
4088                                         /* Use the given "increment" */
4089                                         *poffer += i;
4090                                         last_inc = i;
4091                                         break;
4092                                 }
4093                         }
4094
4095                         /* Handle normal number */
4096                         else
4097                         {
4098                                 /* Use the given "number" */
4099                                 *poffer = i;
4100                                 last_inc = 0L;
4101                                 break;
4102                         }
4103                 }
4104
4105                 /* Warning */
4106                 msg_print(_("値がおかしいです。", "Invalid response."));
4107                 msg_print(NULL);
4108         }
4109
4110         /* Success */
4111         return (TRUE);
4112 }
4113
4114
4115 /*!
4116  * @brief 店主がプレイヤーからの交渉価格を判断する /
4117  * Receive an offer (from the player)
4118  * @param pmt メッセージ
4119  * @param poffer 店主からの交渉価格を返す参照ポインタ
4120  * @param last_offer 現在の交渉価格
4121  * @param factor 店主の価格基準倍率
4122  * @param price アイテムの実価値
4123  * @param final 最終価格確定ならばTRUE
4124  * @return プレイヤーの価格に対して不服ならばTRUEを返す /
4125  * Return TRUE if offer is NOT okay
4126  */
4127 static bool receive_offer(concptr pmt, s32b *poffer,
4128                           s32b last_offer, int factor,
4129                           PRICE price, int final)
4130 {
4131         /* Haggle till done */
4132         while (TRUE)
4133         {
4134                 /* Get a haggle (or cancel) */
4135                 if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
4136
4137                 /* Acceptable offer */
4138                 if (((*poffer) * factor) >= (last_offer * factor)) break;
4139
4140                 /* Insult, and check for kicked out */
4141                 if (haggle_insults()) return (TRUE);
4142
4143                 /* Reject offer (correctly) */
4144                 (*poffer) = last_offer;
4145         }
4146
4147         /* Success */
4148         return (FALSE);
4149 }
4150
4151
4152 /*!
4153  * @brief プレイヤーが購入する時の値切り処理メインルーチン /
4154  * Haggling routine                             -RAK-
4155  * @param o_ptr オブジェクトの構造体参照ポインタ
4156  * @param price 最終価格を返す参照ポインタ
4157  * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
4158  * Return TRUE if purchase is NOT successful
4159  */
4160 static bool purchase_haggle(object_type *o_ptr, s32b *price)
4161 {
4162         s32b                       cur_ask, final_ask;
4163         s32b                       last_offer, offer;
4164         s32b                       x1, x2, x3;
4165         s32b                       min_per, max_per;
4166         int                        flag, loop_flag, noneed;
4167         int                        annoyed = 0, final = FALSE;
4168         bool            cancel = FALSE;
4169         char            out_val[160];
4170         *price = 0;
4171
4172         concptr pmt = _("提示価格", "Asking");
4173
4174         /* Extract the starting offer and the final offer */
4175         cur_ask = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
4176         final_ask = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
4177
4178         /* Determine if haggling is necessary */
4179         noneed = noneedtobargain(final_ask);
4180
4181         /* No need to haggle */
4182         if (noneed || !manual_haggle)
4183         {
4184                 /* No need to haggle */
4185                 if (noneed)
4186                 {
4187                         /* Message summary */
4188                         msg_print(_("結局この金額にまとまった。", "You eventually agree upon the price."));
4189                         msg_print(NULL);
4190                 }
4191
4192                 /* No haggle option */
4193                 else
4194                 {
4195                         /* Message summary */
4196                         msg_print(_("すんなりとこの金額にまとまった。", "You quickly agree upon the price."));
4197                         msg_print(NULL);
4198
4199                         /* Apply Sales Tax */
4200                         final_ask += final_ask / 10;
4201                 }
4202
4203                 /* Final price */
4204                 cur_ask = final_ask;
4205
4206                 /* Go to final offer */
4207                 pmt = _("最終提示価格", "Final Offer");
4208                 final = TRUE;
4209         }
4210
4211
4212         /* Haggle for the whole pile */
4213         cur_ask *= o_ptr->number;
4214         final_ask *= o_ptr->number;
4215
4216
4217         /* Haggle parameters */
4218         min_per = ot_ptr->haggle_per;
4219         max_per = min_per * 3;
4220
4221         /* Mega-Hack -- artificial "last offer" value */
4222         last_offer = object_value(o_ptr) * o_ptr->number;
4223         last_offer = last_offer * (200 - (int)(ot_ptr->max_inflate)) / 100L;
4224         if (last_offer <= 0) last_offer = 1;
4225
4226         /* No offer yet */
4227         offer = 0;
4228
4229         /* No incremental haggling yet */
4230         allow_inc = FALSE;
4231
4232         /* Haggle until done */
4233         for (flag = FALSE; !flag; )
4234         {
4235                 loop_flag = TRUE;
4236
4237                 while (!flag && loop_flag)
4238                 {
4239                         (void)sprintf(out_val, "%s :  %ld", pmt, (long)cur_ask);
4240                         put_str(out_val, 1, 0);
4241                         cancel = receive_offer(_("提示する金額? ", "What do you offer? "), &offer, last_offer, 1, cur_ask, final);
4242                         if (cancel)
4243                         {
4244                                 flag = TRUE;
4245                         }
4246                         else if (offer > cur_ask)
4247                         {
4248                                 say_comment_6();
4249                                 offer = last_offer;
4250                         }
4251                         else if (offer == cur_ask)
4252                         {
4253                                 flag = TRUE;
4254                                 *price = offer;
4255                         }
4256                         else
4257                         {
4258                                 loop_flag = FALSE;
4259                         }
4260                 }
4261
4262                 if (!flag)
4263                 {
4264                         x1 = 100 * (offer - last_offer) / (cur_ask - last_offer);
4265                         if (x1 < min_per)
4266                         {
4267                                 if (haggle_insults())
4268                                 {
4269                                         flag = TRUE;
4270                                         cancel = TRUE;
4271                                 }
4272                         }
4273                         else if (x1 > max_per)
4274                         {
4275                                 x1 = x1 * 3 / 4;
4276                                 if (x1 < max_per) x1 = max_per;
4277                         }
4278                         x2 = rand_range(x1-2, x1+2);
4279                         x3 = ((cur_ask - offer) * x2 / 100L) + 1;
4280                         /* don't let the price go up */
4281                         if (x3 < 0) x3 = 0;
4282                         cur_ask -= x3;
4283
4284                         /* Too little */
4285                         if (cur_ask < final_ask)
4286                         {
4287                                 final = TRUE;
4288                                 cur_ask = final_ask;
4289                                 pmt = _("最終提示価格", "What do you offer? ");
4290                                 annoyed++;
4291                                 if (annoyed > 3)
4292                                 {
4293                                         (void)(increase_insults());
4294                                         cancel = TRUE;
4295                                         flag = TRUE;
4296                                 }
4297                         }
4298                         else if (offer >= cur_ask)
4299                         {
4300                                 flag = TRUE;
4301                                 *price = offer;
4302                         }
4303
4304                         if (!flag)
4305                         {
4306                                 last_offer = offer;
4307                                 allow_inc = TRUE;
4308                                 prt("", 1, 0);
4309                                 (void)sprintf(out_val, _("前回の提示金額: $%ld", "Your last offer: %ld"), (long)last_offer);
4310                                 put_str(out_val, 1, 39);
4311                                 say_comment_2(cur_ask, annoyed);
4312                         }
4313                 }
4314         }
4315
4316         if (cancel) return (TRUE);
4317
4318         updatebargain(*price, final_ask, o_ptr->number);
4319
4320         /* Do not cancel */
4321         return (FALSE);
4322 }
4323
4324
4325 /*!
4326  * @brief プレイヤーが売却する時の値切り処理メインルーチン /
4327  * Haggling routine                             -RAK-
4328  * @param o_ptr オブジェクトの構造体参照ポインタ
4329  * @param price 最終価格を返す参照ポインタ
4330  * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
4331  * Return TRUE if purchase is NOT successful
4332  */
4333 static bool sell_haggle(object_type *o_ptr, s32b *price)
4334 {
4335         s32b    purse, cur_ask, final_ask;
4336         s32b    last_offer = 0, offer = 0;
4337         s32b    x1, x2, x3;
4338         s32b    min_per, max_per;
4339         int     flag, loop_flag, noneed;
4340         int     annoyed = 0, final = FALSE;
4341         bool    cancel = FALSE;
4342         concptr pmt = _("提示金額", "Offer");
4343
4344         char    out_val[160];
4345
4346         *price = 0;
4347
4348         /* Obtain the starting offer and the final offer */
4349         cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
4350         final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
4351
4352         /* Determine if haggling is necessary */
4353         noneed = noneedtobargain(final_ask);
4354
4355         /* Get the owner's payout limit */
4356         purse = (s32b)(ot_ptr->max_cost);
4357
4358         /* No need to haggle */
4359         if (noneed || !manual_haggle || (final_ask >= purse))
4360         {
4361                 /* Apply Sales Tax (if needed) */
4362                 if (!manual_haggle && !noneed)
4363                 {
4364                         final_ask -= final_ask / 10;
4365                 }
4366
4367                 /* No reason to haggle */
4368                 if (final_ask >= purse)
4369                 {
4370                         msg_print(_("即座にこの金額にまとまった。", "You instantly agree upon the price."));
4371                         msg_print(NULL);
4372
4373                         /* Offer full purse */
4374                         final_ask = purse;
4375                 }
4376
4377                 /* No need to haggle */
4378                 else if (noneed)
4379                 {
4380                         msg_print(_("結局この金額にまとまった。", "You eventually agree upon the price."));
4381                         msg_print(NULL);
4382                 }
4383
4384                 /* No haggle option */
4385                 else
4386                 {
4387                         /* Message summary */
4388                         msg_print(_("すんなりとこの金額にまとまった。", "You quickly agree upon the price."));
4389                         msg_print(NULL);
4390                 }
4391
4392                 /* Final price */
4393                 cur_ask = final_ask;
4394
4395                 /* Final offer */
4396                 final = TRUE;
4397                 pmt = _("最終提示金額", "Final Offer");
4398         }
4399
4400         /* Haggle for the whole pile */
4401         cur_ask *= o_ptr->number;
4402         final_ask *= o_ptr->number;
4403
4404
4405         /* Display commands */
4406
4407         /* Haggling parameters */
4408         min_per = ot_ptr->haggle_per;
4409         max_per = min_per * 3;
4410
4411         /* Mega-Hack -- artificial "last offer" value */
4412         last_offer = object_value(o_ptr) * o_ptr->number;
4413         last_offer = last_offer * ot_ptr->max_inflate / 100L;
4414
4415         /* No offer yet */
4416         offer = 0;
4417
4418         /* No incremental haggling yet */
4419         allow_inc = FALSE;
4420
4421         /* Haggle */
4422         for (flag = FALSE; !flag; )
4423         {
4424                 while (1)
4425                 {
4426                         loop_flag = TRUE;
4427
4428                         (void)sprintf(out_val, "%s :  %ld", pmt, (long)cur_ask);
4429                         put_str(out_val, 1, 0);
4430                         cancel = receive_offer(_("提示する価格? ", "What price do you ask? "),
4431                                                                    &offer, last_offer, -1, cur_ask, final);
4432
4433                         if (cancel)
4434                         {
4435                                 flag = TRUE;
4436                         }
4437                         else if (offer < cur_ask)
4438                         {
4439                                 say_comment_6();
4440                                 /* rejected, reset offer for incremental haggling */
4441                                 offer = last_offer;
4442                         }
4443                         else if (offer == cur_ask)
4444                         {
4445                                 flag = TRUE;
4446                                 *price = offer;
4447                         }
4448                         else
4449                         {
4450                                 loop_flag = FALSE;
4451                         }
4452
4453                         /* Stop */
4454                         if (flag || !loop_flag) break;
4455                 }
4456
4457                 if (!flag)
4458                 {
4459                         x1 = 100 * (last_offer - offer) / (last_offer - cur_ask);
4460                         if (x1 < min_per)
4461                         {
4462                                 if (haggle_insults())
4463                                 {
4464                                         flag = TRUE;
4465                                         cancel = TRUE;
4466                                 }
4467                         }
4468                         else if (x1 > max_per)
4469                         {
4470                                 x1 = x1 * 3 / 4;
4471                                 if (x1 < max_per) x1 = max_per;
4472                         }
4473                         x2 = rand_range(x1-2, x1+2);
4474                         x3 = ((offer - cur_ask) * x2 / 100L) + 1;
4475                         /* don't let the price go down */
4476                         if (x3 < 0) x3 = 0;
4477                         cur_ask += x3;
4478
4479                         if (cur_ask > final_ask)
4480                         {
4481                                 cur_ask = final_ask;
4482                                 final = TRUE;
4483                                 pmt = _("最終提示金額", "Final Offer");
4484
4485                                 annoyed++;
4486                                 if (annoyed > 3)
4487                                 {
4488                                         flag = TRUE;
4489 #ifdef JP
4490                                 /* 追加 $0 で買い取られてしまうのを防止 By FIRST*/
4491                                         cancel = TRUE;
4492 #endif
4493                                         (void)(increase_insults());
4494                                 }
4495                         }
4496                         else if (offer <= cur_ask)
4497                         {
4498                                 flag = TRUE;
4499                                 *price = offer;
4500                         }
4501
4502                         if (!flag)
4503                         {
4504                                 last_offer = offer;
4505                                 allow_inc = TRUE;
4506                                 prt("", 1, 0);
4507                                 (void)sprintf(out_val,
4508                                         _("前回の提示価格 $%ld", "Your last bid %ld"), (long)last_offer);
4509                                 put_str(out_val, 1, 39);
4510                                 say_comment_3(cur_ask, annoyed);
4511                         }
4512                 }
4513         }
4514
4515         if (cancel) return (TRUE);
4516
4517         updatebargain(*price, final_ask, o_ptr->number);
4518
4519         /* Do not cancel */
4520         return (FALSE);
4521 }
4522
4523
4524 /*!
4525  * @brief 店からの購入処理のメインルーチン /
4526  * Buy an item from a store                     -RAK-
4527  * @return なし
4528  */
4529 static void store_purchase(void)
4530 {
4531         int i, choice;
4532         COMMAND_CODE item, item_new;
4533
4534         ITEM_NUMBER amt;
4535
4536         PRICE price, best;
4537
4538         object_type forge;
4539         object_type *j_ptr;
4540
4541         object_type *o_ptr;
4542
4543         GAME_TEXT o_name[MAX_NLEN];
4544
4545         char out_val[160];
4546
4547         if (cur_store_num == STORE_MUSEUM)
4548         {
4549                 msg_print(_("博物館から取り出すことはできません。", "Museum."));
4550                 return;
4551         }
4552
4553         /* Empty? */
4554         if (st_ptr->stock_num <= 0)
4555         {
4556                 if (cur_store_num == STORE_HOME)
4557                         msg_print(_("我が家には何も置いてありません。", "Your home is empty."));
4558                 else
4559                         msg_print(_("現在商品の在庫を切らしています。", "I am currently out of stock."));
4560                 return;
4561         }
4562
4563         /* Find the number of objects on this and following pages */
4564         i = (st_ptr->stock_num - store_top);
4565
4566         /* And then restrict it to the current page */
4567         if (i > store_bottom) i = store_bottom;
4568
4569         /* Prompt */
4570 #ifdef JP
4571         /* ブラックマーケットの時は別のメッセージ */
4572         switch( cur_store_num ) {
4573                 case 7:
4574                         sprintf(out_val, "どのアイテムを取りますか? ");
4575                         break;
4576                 case 6:
4577                         sprintf(out_val, "どれ? ");
4578                         break;
4579                 default:
4580                         sprintf(out_val, "どの品物が欲しいんだい? ");
4581                         break;
4582         }
4583 #else
4584         if (cur_store_num == STORE_HOME)
4585         {
4586                 sprintf(out_val, "Which item do you want to take? ");
4587         }
4588         else
4589         {
4590                 sprintf(out_val, "Which item are you interested in? ");
4591         }
4592 #endif
4593
4594
4595         /* Get the item number to be bought */
4596         if (!get_stock(&item, out_val, 0, i - 1)) return;
4597
4598         /* Get the actual index */
4599         item = item + store_top;
4600
4601         /* Get the actual item */
4602         o_ptr = &st_ptr->stock[item];
4603
4604         /* Assume the player wants just one of them */
4605         amt = 1;
4606         j_ptr = &forge;
4607
4608         /* Get a copy of the object */
4609         object_copy(j_ptr, o_ptr);
4610
4611         /*
4612          * If a rod or wand, allocate total maximum timeouts or charges
4613          * between those purchased and left on the shelf.
4614          */
4615         reduce_charges(j_ptr, o_ptr->number - amt);
4616
4617         /* Modify quantity */
4618         j_ptr->number = amt;
4619
4620         /* Hack -- require room in pack */
4621         if (!inven_carry_okay(j_ptr))
4622         {
4623                 msg_print(_("そんなにアイテムを持てない。", "You cannot carry that many different items."));
4624                 return;
4625         }
4626
4627         /* Determine the "best" price (per item) */
4628         best = price_item(j_ptr, ot_ptr->min_inflate, FALSE);
4629
4630         /* Find out how many the player wants */
4631         if (o_ptr->number > 1)
4632         {
4633                 /* Hack -- note cost of "fixed" items */
4634                 if ((cur_store_num != STORE_HOME) &&
4635                     (o_ptr->ident & IDENT_FIXED))
4636                 {
4637                         msg_format(_("一つにつき $%ldです。", "That costs %ld gold per item."), (long)(best));
4638                 }
4639                 amt = get_quantity(NULL, o_ptr->number);
4640                 if (amt <= 0) return;
4641         }
4642         j_ptr = &forge;
4643
4644         /* Get desired object */
4645         object_copy(j_ptr, o_ptr);
4646
4647         /*
4648          * If a rod or wand, allocate total maximum timeouts or charges
4649          * between those purchased and left on the shelf.
4650          */
4651         reduce_charges(j_ptr, o_ptr->number - amt);
4652
4653         /* Modify quantity */
4654         j_ptr->number = amt;
4655
4656         /* Hack -- require room in pack */
4657         if (!inven_carry_okay(j_ptr))
4658         {
4659                 msg_print(_("ザックにそのアイテムを入れる隙間がない。", "You cannot carry that many items."));
4660                 return;
4661         }
4662
4663         /* Attempt to buy it */
4664         if (cur_store_num != STORE_HOME)
4665         {
4666                 /* Fixed price, quick buy */
4667                 if (o_ptr->ident & (IDENT_FIXED))
4668                 {
4669                         /* Assume accept */
4670                         choice = 0;
4671
4672                         /* Go directly to the "best" deal */
4673                         price = (best * j_ptr->number);
4674                 }
4675
4676                 /* Haggle for it */
4677                 else
4678                 {
4679                         /* Describe the object (fully) */
4680                         object_desc(o_name, j_ptr, 0);
4681                         msg_format(_("%s(%c)を購入する。", "Buying %s (%c)."), o_name, I2A(item));
4682                         msg_print(NULL);
4683
4684                         /* Haggle for a final price */
4685                         choice = purchase_haggle(j_ptr, &price);
4686
4687                         /* Hack -- Got kicked out */
4688                         if (st_ptr->store_open >= current_world_ptr->game_turn) return;
4689                 }
4690
4691                 /* Player wants it */
4692                 if (choice == 0)
4693                 {
4694                         /* Fix the item price (if "correctly" haggled) */
4695                         if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
4696
4697                         /* Player can afford it */
4698                         if (p_ptr->au >= price)
4699                         {
4700                                 /* Say "okay" */
4701                                 say_comment_1();
4702
4703                                 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
4704                                         chg_virtue(V_JUSTICE, -1);
4705                                 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
4706                                         chg_virtue(V_NATURE, -1);
4707
4708                                 /* Make a sound */
4709                                 sound(SOUND_BUY);
4710
4711                                 /* Be happy */
4712                                 decrease_insults();
4713
4714                                 /* Spend the money */
4715                                 p_ptr->au -= price;
4716
4717                                 /* Update the display */
4718                                 store_prt_gold();
4719
4720                                 /* Hack -- buying an item makes you aware of it */
4721                                 object_aware(j_ptr);
4722
4723                                 /* Hack -- clear the "fixed" flag from the item */
4724                                 j_ptr->ident &= ~(IDENT_FIXED);
4725
4726                                 /* Describe the transaction */
4727                                 object_desc(o_name, j_ptr, 0);
4728
4729                                 msg_format(_("%sを $%ldで購入しました。", "You bought %s for %ld gold."), o_name, (long)price);
4730
4731                                 strcpy(record_o_name, o_name);
4732                                 record_turn = current_world_ptr->game_turn;
4733
4734                                 if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
4735                                 object_desc(o_name, o_ptr, OD_NAME_ONLY);
4736                                 if(record_rand_art && o_ptr->art_name)
4737                                         do_cmd_write_nikki(NIKKI_ART, 0, o_name);
4738
4739                                 /* Erase the inscription */
4740                                 j_ptr->inscription = 0;
4741
4742                                 /* Erase the "feeling" */
4743                                 j_ptr->feeling = FEEL_NONE;
4744                                 j_ptr->ident &= ~(IDENT_STORE);
4745                                 /* Give it to the player */
4746                                 item_new = inven_carry(j_ptr);
4747
4748                                 /* Describe the final result */
4749                                 object_desc(o_name, &p_ptr->inventory_list[item_new], 0);
4750                                 msg_format(_("%s(%c)を手に入れた。", "You have %s (%c)."), o_name, index_to_label(item_new));
4751
4752                                 /* Auto-inscription */
4753                                 autopick_alter_item(item_new, FALSE);
4754
4755                                 /* Now, reduce the original stack's pval. */
4756                                 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4757                                 {
4758                                         o_ptr->pval -= j_ptr->pval;
4759                                 }
4760                                 handle_stuff();
4761
4762                                 /* Note how many slots the store used to have */
4763                                 i = st_ptr->stock_num;
4764
4765                                 /* Remove the bought items from the store */
4766                                 store_item_increase(item, -amt);
4767                                 store_item_optimize(item);
4768
4769                                 /* Store is empty */
4770                                 if (st_ptr->stock_num == 0)
4771                                 {
4772                                         /* Shuffle */
4773                                         if (one_in_(STORE_SHUFFLE))
4774                                         {
4775                                                 char buf[80];
4776                                                 msg_print(_("店主は引退した。", "The shopkeeper retires."));
4777
4778                                                 /* Shuffle the store */
4779                                                 store_shuffle(cur_store_num);
4780
4781                                                 prt("",3,0);
4782                                                 sprintf(buf, "%s (%s)",
4783                                                         ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
4784                                                 put_str(buf, 3, 10);
4785                                                 sprintf(buf, "%s (%ld)",
4786                                                         (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
4787                                                 prt(buf, 3, 50);
4788                                         }
4789
4790                                         /* Maintain */
4791                                         else
4792                                         {
4793                                                 msg_print(_("店主は新たな在庫を取り出した。", "The shopkeeper brings out some new stock."));
4794                                         }
4795
4796                                         /* New p_ptr->inventory_list */
4797                                         for (i = 0; i < 10; i++)
4798                                         {
4799                                                 /* Maintain the store */
4800                                                 store_maint(p_ptr->town_num, cur_store_num);
4801                                         }
4802
4803                                         /* Start over */
4804                                         store_top = 0;
4805                                         display_inventory();
4806                                 }
4807
4808                                 /* The item is gone */
4809                                 else if (st_ptr->stock_num != i)
4810                                 {
4811                                         /* Pick the correct screen */
4812                                         if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4813                                         display_inventory();
4814                                 }
4815
4816                                 /* Item is still here */
4817                                 else
4818                                 {
4819                                         /* Redraw the item */
4820                                         display_entry(item);
4821                                 }
4822                         }
4823
4824                         /* Player cannot afford it */
4825                         else
4826                         {
4827                                 /* Simple message (no insult) */
4828                                 msg_print(_("お金が足りません。", "You do not have enough gold."));
4829                         }
4830                 }
4831         }
4832
4833         /* Home is much easier */
4834         else
4835         {
4836                 bool combined_or_reordered;
4837
4838                 /* Distribute charges of wands/rods */
4839                 distribute_charges(o_ptr, j_ptr, amt);
4840
4841                 /* Give it to the player */
4842                 item_new = inven_carry(j_ptr);
4843
4844                 /* Describe just the result */
4845                 object_desc(o_name, &p_ptr->inventory_list[item_new], 0);
4846
4847                 msg_format(_("%s(%c)を取った。", "You have %s (%c)."), o_name, index_to_label(item_new));
4848                 handle_stuff();
4849
4850                 /* Take note if we take the last one */
4851                 i = st_ptr->stock_num;
4852
4853                 /* Remove the items from the home */
4854                 store_item_increase(item, -amt);
4855                 store_item_optimize(item);
4856
4857                 combined_or_reordered = combine_and_reorder_home(STORE_HOME);
4858
4859                 /* Hack -- Item is still here */
4860                 if (i == st_ptr->stock_num)
4861                 {
4862                         if (combined_or_reordered) display_inventory();
4863
4864                         /* Redraw the item */
4865                         else display_entry(item);
4866                 }
4867
4868                 /* The item is gone */
4869                 else
4870                 {
4871                         /* Nothing left */
4872                         if (st_ptr->stock_num == 0) store_top = 0;
4873
4874                         /* Nothing left on that screen */
4875                         else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4876                         display_inventory();
4877
4878                         chg_virtue(V_SACRIFICE, 1);
4879                 }
4880         }
4881
4882         /* Not kicked out */
4883         return;
4884 }
4885
4886
4887 /*!
4888  * @brief 店からの売却処理のメインルーチン /
4889  * Sell an item to the store (or home)
4890  * @return なし
4891  */
4892 static void store_sell(void)
4893 {
4894         int choice;
4895         OBJECT_IDX item;
4896         int item_pos;
4897         int amt;
4898
4899         PRICE price, value, dummy;
4900
4901         object_type forge;
4902         object_type *q_ptr;
4903         object_type *o_ptr;
4904
4905         concptr q, s;
4906
4907         GAME_TEXT o_name[MAX_NLEN];
4908
4909
4910         /* Prepare a prompt */
4911         if (cur_store_num == STORE_HOME)
4912                 q = _("どのアイテムを置きますか? ", "Drop which item? ");
4913
4914         else if (cur_store_num == STORE_MUSEUM)
4915                 q = _("どのアイテムを寄贈しますか? ", "Give which item? ");
4916
4917         else
4918                 q = _("どのアイテムを売りますか? ", "Sell which item? ");
4919
4920         /* Only allow items the store will buy */
4921         item_tester_hook = store_will_buy;
4922
4923         /* 我が家でおかしなメッセージが出るオリジナルのバグを修正 */
4924         if (cur_store_num == STORE_HOME)
4925         {
4926                 s = _("置けるアイテムを持っていません。", "You don't have any item to drop.");
4927         }
4928         else if (cur_store_num == STORE_MUSEUM)
4929         {
4930                 s = _("寄贈できるアイテムを持っていません。", "You don't have any item to give.");
4931         }
4932         else
4933         {
4934                 s = _("欲しい物がないですねえ。", "You have nothing that I want.");
4935         }
4936
4937         o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4938         if (!o_ptr) return;
4939
4940         /* Hack -- Cannot remove cursed items */
4941         if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
4942         {
4943                 msg_print(_("ふーむ、どうやらそれは呪われているようだね。", "Hmmm, it seems to be cursed."));
4944                 return;
4945         }
4946
4947         /* Assume one item */
4948         amt = 1;
4949
4950         if (o_ptr->number > 1)
4951         {
4952                 amt = get_quantity(NULL, o_ptr->number);
4953                 if (amt <= 0) return;
4954         }
4955         q_ptr = &forge;
4956
4957         /* Get a copy of the object */
4958         object_copy(q_ptr, o_ptr);
4959
4960         /* Modify quantity */
4961         q_ptr->number = amt;
4962
4963         /*
4964          * Hack -- If a rod or wand, allocate total maximum
4965          * timeouts or charges to those being sold. -LM-
4966          */
4967         if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4968         {
4969                 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4970         }
4971
4972         /* Get a full description */
4973         object_desc(o_name, q_ptr, 0);
4974
4975         /* Remove any inscription, feeling for stores */
4976         if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4977         {
4978                 q_ptr->inscription = 0;
4979                 q_ptr->feeling = FEEL_NONE;
4980         }
4981
4982         /* Is there room in the store (or the home?) */
4983         if (!store_check_num(q_ptr))
4984         {
4985                 if (cur_store_num == STORE_HOME)
4986                         msg_print(_("我が家にはもう置く場所がない。", "Your home is full."));
4987
4988                 else if (cur_store_num == STORE_MUSEUM)
4989                         msg_print(_("博物館はもう満杯だ。", "Museum is full."));
4990
4991                 else
4992                         msg_print(_("すいませんが、店にはもう置く場所がありません。", "I have not the room in my store to keep it."));
4993
4994                 return;
4995         }
4996
4997
4998         /* Real store */
4999         if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
5000         {
5001                 /* Describe the transaction */
5002                 msg_format(_("%s(%c)を売却する。", "Selling %s (%c)."), o_name, index_to_label(item));
5003
5004                 msg_print(NULL);
5005
5006                 /* Haggle for it */
5007                 choice = sell_haggle(q_ptr, &price);
5008
5009                 /* Kicked out */
5010                 if (st_ptr->store_open >= current_world_ptr->game_turn) return;
5011
5012                 /* Sold... */
5013                 if (choice == 0)
5014                 {
5015                         /* Say "okay" */
5016                         say_comment_1();
5017
5018                         /* Make a sound */
5019                         sound(SOUND_SELL);
5020
5021                         /* Be happy */
5022                         if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
5023                                 chg_virtue(V_JUSTICE, -1);
5024
5025                         if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
5026                                 chg_virtue(V_NATURE, 1);
5027                         decrease_insults();
5028
5029                         /* Get some money */
5030                         p_ptr->au += price;
5031
5032                         /* Update the display */
5033                         store_prt_gold();
5034
5035                         /* Get the "apparent" value */
5036                         dummy = object_value(q_ptr) * q_ptr->number;
5037
5038                         identify_item(o_ptr);
5039                         q_ptr = &forge;
5040
5041                         /* Get a copy of the object */
5042                         object_copy(q_ptr, o_ptr);
5043
5044                         /* Modify quantity */
5045                         q_ptr->number = amt;
5046
5047                         /* Make it look like to be known */
5048                         q_ptr->ident |= IDENT_STORE;
5049
5050                         /*
5051                          * Hack -- If a rod or wand, let the shopkeeper know just
5052                          * how many charges he really paid for. -LM-
5053                          */
5054                         if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
5055                         {
5056                                 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
5057                         }
5058
5059                         /* Get the "actual" value */
5060                         value = object_value(q_ptr) * q_ptr->number;
5061
5062                         /* Get the description all over again */
5063                         object_desc(o_name, q_ptr, 0);
5064
5065                         /* Describe the result (in message buffer) */
5066                         msg_format(_("%sを $%ldで売却しました。", "You sold %s for %ld gold."), o_name, (long)price);
5067
5068                         if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
5069
5070                         if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
5071                         {
5072                          /* Analyze the prices (and comment verbally) unless a figurine*/
5073                         purchase_analyze(price, value, dummy);
5074                         }
5075
5076                         /*
5077                          * Hack -- Allocate charges between those wands or rods sold
5078                          * and retained, unless all are being sold. -LM-
5079                          */
5080                         distribute_charges(o_ptr, q_ptr, amt);
5081
5082                         /* Reset timeouts of the sold items */
5083                         q_ptr->timeout = 0;
5084
5085                         /* Take the item from the player, describe the result */
5086                         inven_item_increase(item, -amt);
5087                         inven_item_describe(item);
5088
5089                         /* If items remain, auto-inscribe before optimizing */
5090                         if (o_ptr->number > 0)
5091                                 autopick_alter_item(item, FALSE);
5092
5093                         inven_item_optimize(item);
5094                         handle_stuff();
5095
5096                         /* The store gets that (known) item */
5097                         item_pos = store_carry(q_ptr);
5098
5099                         /* Re-display if item is now in store */
5100                         if (item_pos >= 0)
5101                         {
5102                                 store_top = (item_pos / store_bottom) * store_bottom;
5103                                 display_inventory();
5104                         }
5105                 }
5106         }
5107
5108         /* Player is at museum */
5109         else if (cur_store_num == STORE_MUSEUM)
5110         {
5111                 char o2_name[MAX_NLEN];
5112                 object_desc(o2_name, q_ptr, OD_NAME_ONLY);
5113
5114                 if (-1 == store_check_num(q_ptr))
5115                 {
5116                         msg_print(_("それと同じ品物は既に博物館にあるようです。", "The same object as it is already in the Museum."));
5117                 }
5118                 else
5119                 {
5120                         msg_print(_("博物館に寄贈したものは取り出すことができません!!", "You cannot take items which is given to the Museum back!!"));
5121                 }
5122
5123                 if (!get_check(format(_("本当に%sを寄贈しますか?", "Really give %s to the Museum? "), o2_name))) return;
5124
5125                 identify_item(q_ptr);
5126                 q_ptr->ident |= IDENT_MENTAL;
5127
5128                 /* Distribute charges of wands/rods */
5129                 distribute_charges(o_ptr, q_ptr, amt);
5130                 msg_format(_("%sを置いた。(%c)", "You drop %s (%c)."), o_name, index_to_label(item));
5131                 choice = 0;
5132
5133                 /* Take it from the players p_ptr->inventory_list */
5134                 inven_item_increase(item, -amt);
5135                 inven_item_describe(item);
5136                 inven_item_optimize(item);
5137                 handle_stuff();
5138
5139                 /* Let the home carry it */
5140                 item_pos = home_carry(q_ptr);
5141
5142                 /* Update store display */
5143                 if (item_pos >= 0)
5144                 {
5145                         store_top = (item_pos / store_bottom) * store_bottom;
5146                         display_inventory();
5147                 }
5148         }
5149         /* Player is at home */
5150         else
5151         {
5152                 /* Distribute charges of wands/rods */
5153                 distribute_charges(o_ptr, q_ptr, amt);
5154                 msg_format(_("%sを置いた。(%c)", "You drop %s (%c)."), o_name, index_to_label(item));
5155
5156                 choice = 0;
5157
5158                 /* Take it from the players p_ptr->inventory_list */
5159                 inven_item_increase(item, -amt);
5160                 inven_item_describe(item);
5161                 inven_item_optimize(item);
5162                 handle_stuff();
5163
5164                 /* Let the home carry it */
5165                 item_pos = home_carry(q_ptr);
5166
5167                 /* Update store display */
5168                 if (item_pos >= 0)
5169                 {
5170                         store_top = (item_pos / store_bottom) * store_bottom;
5171                         display_inventory();
5172                 }
5173         }
5174
5175         if ((choice == 0) && (item >= INVEN_RARM))
5176         {
5177                 calc_android_exp();
5178                 kamaenaoshi(item);
5179         }
5180 }
5181
5182
5183 /*!
5184  * @brief 店のアイテムを調べるコマンドのメインルーチン /
5185  * Examine an item in a store                      -JDL-
5186  * @return なし
5187  */
5188 static void store_examine(void)
5189 {
5190         int         i;
5191         COMMAND_CODE item;
5192         object_type *o_ptr;
5193         GAME_TEXT o_name[MAX_NLEN];
5194         char        out_val[160];
5195
5196         /* Empty? */
5197         if (st_ptr->stock_num <= 0)
5198         {
5199                 if (cur_store_num == STORE_HOME)
5200                         msg_print(_("我が家には何も置いてありません。", "Your home is empty."));
5201                 else if (cur_store_num == STORE_MUSEUM)
5202                         msg_print(_("博物館には何も置いてありません。", "Museum is empty."));
5203                 else
5204                         msg_print(_("現在商品の在庫を切らしています。", "I am currently out of stock."));
5205                 return;
5206         }
5207
5208         /* Find the number of objects on this and following pages */
5209         i = (st_ptr->stock_num - store_top);
5210
5211         /* And then restrict it to the current page */
5212         if (i > store_bottom) i = store_bottom;
5213
5214         /* Prompt */
5215         sprintf(out_val, _("どれを調べますか?", "Which item do you want to examine? "));
5216
5217         /* Get the item number to be examined */
5218         if (!get_stock(&item, out_val, 0, i - 1)) return;
5219
5220         /* Get the actual index */
5221         item = item + store_top;
5222
5223         /* Get the actual item */
5224         o_ptr = &st_ptr->stock[item];
5225
5226         /* Require full knowledge */
5227         if (!(o_ptr->ident & IDENT_MENTAL))
5228         {
5229                 /* This can only happen in the home */
5230                 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
5231                 return;
5232         }
5233
5234         object_desc(o_name, o_ptr, 0);
5235         msg_format(_("%sを調べている...", "Examining %s..."), o_name);
5236
5237         if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
5238                 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
5239
5240         return;
5241 }
5242
5243
5244 /*!
5245  * @brief 博物館のアイテムを除去するコマンドのメインルーチン /
5246  * Remove an item from museum (Originally from TOband)
5247  * @return なし
5248  */
5249 static void museum_remove_object(void)
5250 {
5251         int i;
5252         COMMAND_CODE item;
5253         object_type *o_ptr;
5254         GAME_TEXT o_name[MAX_NLEN];
5255         char out_val[160];
5256
5257         /* Empty? */
5258         if (st_ptr->stock_num <= 0)
5259         {
5260                 msg_print(_("博物館には何も置いてありません。", "Museum is empty."));
5261                 return;
5262         }
5263
5264         /* Find the number of objects on this and following pages */
5265         i = st_ptr->stock_num - store_top;
5266
5267         /* And then restrict it to the current page */
5268         if (i > store_bottom) i = store_bottom;
5269
5270         /* Prompt */
5271         sprintf(out_val, _("どのアイテムの展示をやめさせますか?", "Which item do you want to order to remove? "));
5272
5273         /* Get the item number to be removed */
5274         if (!get_stock(&item, out_val, 0, i - 1)) return;
5275
5276         /* Get the actual index */
5277         item = item + store_top;
5278
5279         /* Get the actual item */
5280         o_ptr = &st_ptr->stock[item];
5281
5282         object_desc(o_name, o_ptr, 0);
5283
5284         msg_print(_("展示をやめさせたアイテムは二度と見ることはできません!", "You cannot see items which is removed from the Museum!"));
5285         if (!get_check(format(_("本当に%sの展示をやめさせますか?", "Really order to remove %s from the Museum? "), o_name))) return;
5286
5287         msg_format(_("%sの展示をやめさせた。", "You ordered to remove %s."), o_name);
5288
5289         /* Remove the items from the home */
5290         store_item_increase(item, -o_ptr->number);
5291         store_item_optimize(item);
5292
5293         (void)combine_and_reorder_home(STORE_MUSEUM);
5294
5295         /* The item is gone */
5296
5297         /* Nothing left */
5298         if (st_ptr->stock_num == 0) store_top = 0;
5299
5300         /* Nothing left on that screen */
5301         else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
5302         display_inventory();
5303
5304         return;
5305 }
5306
5307
5308 /*
5309  * Hack -- set this to leave the store
5310  */
5311 static bool leave_store = FALSE;
5312
5313
5314 /*!
5315  * @brief 店舗処理コマンド選択のメインルーチン /
5316  * Process a command in a store
5317  * @return なし
5318  * @note
5319  * <pre>
5320  * Note that we must allow the use of a few "special" commands
5321  * in the stores which are not allowed in the dungeon, and we
5322  * must disable some commands which are allowed in the dungeon
5323  * but not in the stores, to prevent chaos.
5324  * </pre>
5325  */
5326 static void store_process_command(void)
5327 {
5328         /* Handle repeating the last command */
5329         repeat_check();
5330
5331         if (rogue_like_commands && command_cmd == 'l')
5332         {
5333                 command_cmd = 'x';      /* hack! */
5334         }
5335
5336         /* Parse the command */
5337         switch (command_cmd)
5338         {
5339                 /* Leave */
5340                 case ESCAPE:
5341                 {
5342                         leave_store = TRUE;
5343                         break;
5344                 }
5345
5346                 /* 日本語版追加 */
5347                 /* 1 ページ戻るコマンド: 我が家のページ数が多いので重宝するはず By BUG */
5348                 case '-':
5349                 {
5350                         if (st_ptr->stock_num <= store_bottom) {
5351                                 msg_print(_("これで全部です。", "Entire p_ptr->inventory_list is shown."));
5352                         }
5353                         else{
5354                                 store_top -= store_bottom;
5355                                 if ( store_top < 0 )
5356                                         store_top = ((st_ptr->stock_num - 1 )/store_bottom) * store_bottom;
5357                                 if ( (cur_store_num == STORE_HOME) && (powerup_home == FALSE) )
5358                                         if ( store_top >= store_bottom ) store_top = store_bottom;
5359                                 display_inventory();
5360                         }
5361                         break;
5362                 }
5363
5364                 /* Browse */
5365                 case ' ':
5366                 {
5367                         if (st_ptr->stock_num <= store_bottom)
5368                         {
5369                                 msg_print(_("これで全部です。", "Entire p_ptr->inventory_list is shown."));
5370                         }
5371                         else
5372                         {
5373                                 store_top += store_bottom;
5374                                 /*
5375                                  * 隠しオプション(powerup_home)がセットされていないときは
5376                                  * 我が家では 2 ページまでしか表示しない
5377                                  */
5378                                 if ((cur_store_num == STORE_HOME) && 
5379                                     (powerup_home == FALSE) && 
5380                                         (st_ptr->stock_num >= STORE_INVEN_MAX))
5381                                 {
5382                                         if (store_top >= (STORE_INVEN_MAX - 1))
5383                                         {
5384                                                 store_top = 0;
5385                                         }
5386                                 }
5387                                 else
5388                                 {
5389                                         if (store_top >= st_ptr->stock_num) store_top = 0;
5390                                 }
5391
5392                                 display_inventory();
5393                         }
5394                         break;
5395                 }
5396
5397                 case KTRL('R'):
5398                 {
5399                         do_cmd_redraw();
5400                         display_store();
5401                         break;
5402                 }
5403
5404                 /* Get (purchase) */
5405                 case 'g':
5406                 {
5407                         store_purchase();
5408                         break;
5409                 }
5410
5411                 /* Drop (Sell) */
5412                 case 'd':
5413                 {
5414                         store_sell();
5415                         break;
5416                 }
5417
5418                 /* Examine */
5419                 case 'x':
5420                 {
5421                         store_examine();
5422                         break;
5423                 }
5424
5425                 /* Ignore return */
5426                 case '\r':
5427                 {
5428                         break;
5429                 }
5430
5431                 /*** Inventory Commands ***/
5432
5433                 /* Wear/wield equipment */
5434                 case 'w':
5435                 {
5436                         do_cmd_wield();
5437                         break;
5438                 }
5439
5440                 /* Take off equipment */
5441                 case 't':
5442                 {
5443                         do_cmd_takeoff();
5444                         break;
5445                 }
5446
5447                 /* Destroy an item */
5448                 case 'k':
5449                 {
5450                         do_cmd_destroy();
5451                         break;
5452                 }
5453
5454                 /* Equipment list */
5455                 case 'e':
5456                 {
5457                         do_cmd_equip();
5458                         break;
5459                 }
5460
5461                 /* Inventory list */
5462                 case 'i':
5463                 {
5464                         do_cmd_inven();
5465                         break;
5466                 }
5467
5468
5469                 /*** Various commands ***/
5470
5471                 /* Identify an object */
5472                 case 'I':
5473                 {
5474                         do_cmd_observe();
5475                         break;
5476                 }
5477
5478                 /* Hack -- toggle windows */
5479                 case KTRL('I'):
5480                 {
5481                         toggle_inven_equip();
5482                         break;
5483                 }
5484
5485                 /*** Use various objects ***/
5486
5487                 /* Browse a book */
5488                 case 'b':
5489                 {
5490                         if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
5491                              (p_ptr->pclass == CLASS_BERSERKER) ||
5492                              (p_ptr->pclass == CLASS_NINJA) ||
5493                              (p_ptr->pclass == CLASS_MIRROR_MASTER) 
5494                              ) do_cmd_mind_browse();
5495                         else if (p_ptr->pclass == CLASS_SMITH)
5496                                 do_cmd_kaji(TRUE);
5497                         else if (p_ptr->pclass == CLASS_MAGIC_EATER)
5498                                 do_cmd_magic_eater(TRUE, FALSE);
5499                         else if (p_ptr->pclass == CLASS_SNIPER)
5500                                 do_cmd_snipe_browse();
5501                         else do_cmd_browse();
5502                         break;
5503                 }
5504
5505                 /* Inscribe an object */
5506                 case '{':
5507                 {
5508                         do_cmd_inscribe();
5509                         break;
5510                 }
5511
5512                 /* Uninscribe an object */
5513                 case '}':
5514                 {
5515                         do_cmd_uninscribe();
5516                         break;
5517                 }
5518
5519
5520
5521                 /*** Help and Such ***/
5522
5523                 /* Help */
5524                 case '?':
5525                 {
5526                         do_cmd_help();
5527                         break;
5528                 }
5529
5530                 /* Identify symbol */
5531                 case '/':
5532                 {
5533                         do_cmd_query_symbol();
5534                         break;
5535                 }
5536
5537                 /* Character description */
5538                 case 'C':
5539                 {
5540                         p_ptr->town_num = old_town_num;
5541                         do_cmd_change_name();
5542                         p_ptr->town_num = inner_town_num;
5543                         display_store();
5544                         break;
5545                 }
5546
5547
5548                 /*** System Commands ***/
5549
5550                 /* Hack -- User interface */
5551                 case '!':
5552                 {
5553                         (void)Term_user(0);
5554                         break;
5555                 }
5556
5557                 /* Single line from a pref file */
5558                 case '"':
5559                 {
5560                         p_ptr->town_num = old_town_num;
5561                         do_cmd_pref();
5562                         p_ptr->town_num = inner_town_num;
5563                         break;
5564                 }
5565
5566                 /* Interact with macros */
5567                 case '@':
5568                 {
5569                         p_ptr->town_num = old_town_num;
5570                         do_cmd_macros();
5571                         p_ptr->town_num = inner_town_num;
5572                         break;
5573                 }
5574
5575                 /* Interact with visuals */
5576                 case '%':
5577                 {
5578                         p_ptr->town_num = old_town_num;
5579                         do_cmd_visuals();
5580                         p_ptr->town_num = inner_town_num;
5581                         break;
5582                 }
5583
5584                 /* Interact with colors */
5585                 case '&':
5586                 {
5587                         p_ptr->town_num = old_town_num;
5588                         do_cmd_colors();
5589                         p_ptr->town_num = inner_town_num;
5590                         break;
5591                 }
5592
5593                 /* Interact with options */
5594                 case '=':
5595                 {
5596                         do_cmd_options();
5597                         (void)combine_and_reorder_home(STORE_HOME);
5598                         do_cmd_redraw();
5599                         display_store();
5600                         break;
5601                 }
5602
5603                 /*** Misc Commands ***/
5604
5605                 /* Take notes */
5606                 case ':':
5607                 {
5608                         do_cmd_note();
5609                         break;
5610                 }
5611
5612                 /* Version info */
5613                 case 'V':
5614                 {
5615                         do_cmd_version();
5616                         break;
5617                 }
5618
5619                 /* Repeat level feeling */
5620                 case KTRL('F'):
5621                 {
5622                         do_cmd_feeling();
5623                         break;
5624                 }
5625
5626                 /* Show previous message */
5627                 case KTRL('O'):
5628                 {
5629                         do_cmd_message_one();
5630                         break;
5631                 }
5632
5633                 /* Show previous messages */
5634                 case KTRL('P'):
5635                 {
5636                         do_cmd_messages(0);
5637                         break;
5638                 }
5639
5640                 case '|':
5641                 {
5642                         do_cmd_nikki();
5643                         break;
5644                 }
5645
5646                 /* Check artifacts, uniques etc. */
5647                 case '~':
5648                 {
5649                         do_cmd_knowledge();
5650                         break;
5651                 }
5652
5653                 /* Load "screen dump" */
5654                 case '(':
5655                 {
5656                         do_cmd_load_screen();
5657                         break;
5658                 }
5659
5660                 /* Save "screen dump" */
5661                 case ')':
5662                 {
5663                         do_cmd_save_screen();
5664                         break;
5665                 }
5666
5667                 /* Hack -- Unknown command */
5668                 default:
5669                 {
5670                         if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
5671                         {
5672                                 museum_remove_object();
5673                         }
5674                         else
5675                         {
5676                                 msg_print(_("そのコマンドは店の中では使えません。", "That command does not work in stores."));
5677                         }
5678                         break;
5679                 }
5680         }
5681 }
5682
5683
5684 /*!
5685  * @brief 店舗処理全体のメインルーチン /
5686  * Enter a store, and interact with it. *
5687  * @return なし
5688  * @note
5689  * <pre>
5690  * Note that we use the standard "request_command()" function
5691  * to get a command, allowing us to use "command_arg" and all
5692  * command macros and other nifty stuff, but we use the special
5693  * "shopping" argument, to force certain commands to be converted
5694  * into other commands, normally, we convert "p" (pray) and "m"
5695  * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
5696  * </pre>
5697  */
5698 void do_cmd_store(void)
5699 {
5700         int which;
5701         int maintain_num;
5702         int i;
5703         grid_type *g_ptr;
5704         bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
5705         TERM_LEN w, h;
5706
5707         if(p_ptr->wild_mode) return;
5708         Term_get_size(&w, &h);
5709
5710         /* Calculate stocks per 1 page */
5711         xtra_stock = MIN(14+26, ((h > 24) ? (h - 24) : 0));
5712         store_bottom = MIN_STOCK + xtra_stock;
5713
5714         /* Access the player grid */
5715         g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
5716
5717         /* Verify a store */
5718         if (!cave_have_flag_grid(g_ptr, FF_STORE))
5719         {
5720                 msg_print(_("ここには店がありません。", "You see no store here."));
5721                 return;
5722         }
5723
5724         /* Extract the store code */
5725         which = f_info[g_ptr->feat].subtype;
5726
5727         old_town_num = p_ptr->town_num;
5728         if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
5729         if (current_floor_ptr->dun_level) p_ptr->town_num = NO_TOWN;
5730         inner_town_num = p_ptr->town_num;
5731
5732         /* Hack -- Check the "locked doors" */
5733         if ((town_info[p_ptr->town_num].store[which].store_open >= current_world_ptr->game_turn) ||
5734             (ironman_shops))
5735         {
5736                 msg_print(_("ドアに鍵がかかっている。", "The doors are locked."));
5737                 p_ptr->town_num = old_town_num;
5738                 return;
5739         }
5740
5741         /* Calculate the number of store maintainances since the last visit */
5742         maintain_num = (current_world_ptr->game_turn - town_info[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
5743
5744         /* Maintain the store max. 10 times */
5745         if (maintain_num > 10) maintain_num = 10;
5746
5747         if (maintain_num)
5748         {
5749                 /* Maintain the store */
5750                 for (i = 0; i < maintain_num; i++)
5751                         store_maint(p_ptr->town_num, which);
5752
5753                 /* Save the visit */
5754                 town_info[p_ptr->town_num].store[which].last_visit = current_world_ptr->game_turn;
5755         }
5756
5757         forget_lite();
5758         forget_view();
5759
5760         /* Hack -- Character is in "icky" mode */
5761         character_icky = TRUE;
5762
5763         /* command reset */
5764         command_arg = 0;
5765         command_rep = 0;
5766         command_new = 0;
5767
5768         /* Do not expand macros */
5769         get_com_no_macros = TRUE;
5770
5771         /* Save the store number */
5772         cur_store_num = which;
5773
5774         /* Hack -- save the store feature */
5775         cur_store_feat = g_ptr->feat;
5776
5777         /* Save the store and owner pointers */
5778         st_ptr = &town_info[p_ptr->town_num].store[cur_store_num];
5779         ot_ptr = &owners[cur_store_num][st_ptr->owner];
5780
5781         /* Start at the beginning */
5782         store_top = 0;
5783
5784         play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
5785
5786         display_store();
5787
5788         /* Do not leave */
5789         leave_store = FALSE;
5790
5791         /* Interact with player */
5792         while (!leave_store)
5793         {
5794                 /* Hack -- Clear line 1 */
5795                 prt("", 1, 0);
5796
5797                 /* Clear */
5798                 clear_from(20 + xtra_stock);
5799
5800                 /* Basic commands */
5801                 prt(_(" ESC) 建物から出る", " ESC) Exit from Building."), 21 + xtra_stock, 0);
5802
5803                 /* Browse if necessary */
5804                 if (st_ptr->stock_num > store_bottom)
5805                 {
5806                         prt(_(" -)前ページ", " -) Previous page"), 22 + xtra_stock, 0);
5807                         prt(_(" スペース) 次ページ", " SPACE) Next page"), 23 + xtra_stock, 0);
5808                 }
5809
5810                 /* Home commands */
5811                 if (cur_store_num == STORE_HOME)
5812                 {
5813                         prt(_("g) アイテムを取る", "g) Get an item."), 21 + xtra_stock, 27);
5814                         prt(_("d) アイテムを置く", "d) Drop an item."), 22 + xtra_stock, 27);
5815                         prt(_("x) 家のアイテムを調べる", "x) eXamine an item in the home."), 23 + xtra_stock, 27);
5816                 }
5817
5818                 /* Museum commands */
5819                 else if (cur_store_num == STORE_MUSEUM)
5820                 {
5821                         prt(_("d) アイテムを置く", "d) Drop an item."), 21 + xtra_stock, 27);
5822                         prt(_("r) アイテムの展示をやめる", "r) order to Remove an item."), 22 + xtra_stock, 27);
5823                         prt(_("x) 博物館のアイテムを調べる", "x) eXamine an item in the museum."), 23 + xtra_stock, 27);
5824                 }
5825
5826                 /* Shop commands */
5827                 else
5828                 {
5829                         prt(_("p) 商品を買う", "p) Purchase an item."), 21 + xtra_stock, 30);
5830                         prt(_("s) アイテムを売る", "s) Sell an item."), 22 + xtra_stock, 30);
5831                         prt(_("x) 商品を調べる", "x) eXamine an item in the shop"), 23 + xtra_stock,30);
5832                 }
5833
5834                 /* 基本的なコマンドの追加表示 */
5835                 prt(_("i/e) 持ち物/装備の一覧", "i/e) Inventry/Equipment list"), 21 + xtra_stock, 56);
5836
5837                 if (rogue_like_commands)
5838                 {
5839                         prt(_("w/T) 装備する/はずす", "w/T) Wear/Take off equipment"), 22 + xtra_stock, 56);
5840                 }
5841                 else
5842                 {
5843                         prt(_("w/t) 装備する/はずす", "w/t) Wear/Take off equipment"), 22 + xtra_stock, 56);
5844                 }
5845
5846                 /* Prompt */
5847                 prt(_("コマンド:", "You may: "), 20 + xtra_stock, 0);
5848
5849                 request_command(TRUE);
5850
5851                 /* Process the command */
5852                 store_process_command();
5853
5854                 /*
5855                  * Hack -- To redraw missiles damage and prices in store
5856                  * If player's charisma changes, or if player changes a bow, PU_BONUS is set
5857                  */
5858                 need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
5859
5860                 /* Hack -- Character is still in "icky" mode */
5861                 character_icky = TRUE;
5862
5863                 handle_stuff();
5864
5865                 /* Pack Overflow */
5866                 if (p_ptr->inventory_list[INVEN_PACK].k_idx)
5867                 {
5868                         INVENTORY_IDX item = INVEN_PACK;
5869
5870                         object_type *o_ptr = &p_ptr->inventory_list[item];
5871
5872                         /* Hack -- Flee from the store */
5873                         if (cur_store_num != STORE_HOME)
5874                         {
5875                                 if (cur_store_num == STORE_MUSEUM)
5876                                         msg_print(_("ザックからアイテムがあふれそうなので、あわてて博物館から出た...", "Your pack is so full that you flee the Museum..."));
5877                                 else
5878                                         msg_print(_("ザックからアイテムがあふれそうなので、あわてて店から出た...", "Your pack is so full that you flee the store..."));
5879
5880                                 /* Leave */
5881                                 leave_store = TRUE;
5882                         }
5883
5884                         /* Hack -- Flee from the home */
5885                         else if (!store_check_num(o_ptr))
5886                         {
5887                                 msg_print(_("ザックからアイテムがあふれそうなので、あわてて家から出た...", "Your pack is so full that you flee your home..."));
5888                                 /* Leave */
5889                                 leave_store = TRUE;
5890                         }
5891
5892                         /* Hack -- Drop items into the home */
5893                         else
5894                         {
5895                                 int item_pos;
5896
5897                                 object_type forge;
5898                                 object_type *q_ptr;
5899
5900                                 GAME_TEXT o_name[MAX_NLEN];
5901
5902                                 /* Give a message */
5903                                 msg_print(_("ザックからアイテムがあふれてしまった!", "Your pack overflows!"));
5904
5905                                 q_ptr = &forge;
5906
5907                                 object_copy(q_ptr, o_ptr);
5908                                 object_desc(o_name, q_ptr, 0);
5909
5910                                 msg_format(_("%sが落ちた。(%c)", "You drop %s (%c)."), o_name, index_to_label(item));
5911
5912                                 /* Remove it from the players p_ptr->inventory_list */
5913                                 inven_item_increase(item, -255);
5914                                 inven_item_describe(item);
5915                                 inven_item_optimize(item);
5916                                 handle_stuff();
5917
5918                                 /* Let the home carry it */
5919                                 item_pos = home_carry(q_ptr);
5920
5921                                 /* Redraw the home */
5922                                 if (item_pos >= 0)
5923                                 {
5924                                         store_top = (item_pos / store_bottom) * store_bottom;
5925                                         display_inventory();
5926                                 }
5927                         }
5928                 }
5929
5930                 /* Hack -- Redisplay store prices if charisma changes */
5931                 /* Hack -- Redraw missiles damage if player changes bow */
5932                 if (need_redraw_store_inv) display_inventory();
5933
5934                 /* Hack -- get kicked out of the store */
5935                 if (st_ptr->store_open >= current_world_ptr->game_turn) leave_store = TRUE;
5936         }
5937
5938         select_floor_music();
5939
5940         p_ptr->town_num = old_town_num;
5941
5942         take_turn(p_ptr, 100);
5943
5944         /* Hack -- Character is no longer in "icky" mode */
5945         character_icky = FALSE;
5946
5947         /* Hack -- Cancel automatic command */
5948         command_new = 0;
5949
5950         /* Hack -- Cancel "see" mode */
5951         command_see = FALSE;
5952
5953         /* Allow expanding macros */
5954         get_com_no_macros = FALSE;
5955
5956         msg_erase();
5957         Term_clear();
5958
5959         /* Update everything */
5960         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
5961         p_ptr->update |= (PU_MONSTERS);
5962
5963         /* Redraw entire screen */
5964         p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5965         p_ptr->redraw |= (PR_MAP);
5966         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5967 }
5968
5969
5970
5971 /*!
5972  * @brief 現在の町の店主を交代させる /
5973  * Shuffle one of the stores.
5974  * @param which 店舗種類のID
5975  * @return なし
5976  */
5977 void store_shuffle(int which)
5978 {
5979         int i, j;
5980
5981
5982         /* Ignore home */
5983         if (which == STORE_HOME) return;
5984         if (which == STORE_MUSEUM) return;
5985
5986
5987         /* Save the store index */
5988         cur_store_num = which;
5989
5990         /* Activate that store */
5991         st_ptr = &town_info[p_ptr->town_num].store[cur_store_num];
5992
5993         j = st_ptr->owner;
5994         /* Pick a new owner */
5995         while(1)
5996         {
5997                 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5998                 if (j == st_ptr->owner) continue;
5999                 for (i = 1;i < max_towns; i++)
6000                 {
6001                         if (i == p_ptr->town_num) continue;
6002                         if (st_ptr->owner == town_info[i].store[cur_store_num].owner) break;
6003                 }
6004                 if (i == max_towns) break;
6005         }
6006
6007         /* Activate the new owner */
6008         ot_ptr = &owners[cur_store_num][st_ptr->owner];
6009
6010
6011         /* Reset the owner data */
6012         st_ptr->insult_cur = 0;
6013         st_ptr->store_open = 0;
6014         st_ptr->good_buy = 0;
6015         st_ptr->bad_buy = 0;
6016
6017
6018         /* Hack -- discount all the items */
6019         for (i = 0; i < st_ptr->stock_num; i++)
6020         {
6021                 object_type *o_ptr;
6022
6023                 o_ptr = &st_ptr->stock[i];
6024
6025                 if (!object_is_artifact(o_ptr))
6026                 {
6027                         /* Hack -- Sell all non-artifact old items for "half price" */
6028                         o_ptr->discount = 50;
6029
6030                         /* Hack -- Items are no longer "fixed price" */
6031                         o_ptr->ident &= ~(IDENT_FIXED);
6032
6033                         /* Mega-Hack -- Note that the item is "on sale" */
6034                         o_ptr->inscription = quark_add(_("売出中", "on sale"));
6035                 }
6036         }
6037 }
6038
6039
6040 /*!
6041  * @brief 店の品揃えを変化させる /
6042  * Maintain the p_ptr->inventory_list at the stores.
6043  * @param town_num 町のID
6044  * @param store_num 店舗種類のID
6045  * @return なし
6046  */
6047 void store_maint(int town_num, int store_num)
6048 {
6049         INVENTORY_IDX j;
6050
6051         cur_store_num = store_num;
6052
6053         /* Ignore home */
6054         if (store_num == STORE_HOME) return;
6055         if (store_num == STORE_MUSEUM) return;
6056
6057         /* Activate that store */
6058         st_ptr = &town_info[town_num].store[store_num];
6059
6060         /* Activate the owner */
6061         ot_ptr = &owners[store_num][st_ptr->owner];
6062
6063         /* Store keeper forgives the player */
6064         st_ptr->insult_cur = 0;
6065
6066         /* Mega-Hack -- prune the black market */
6067         if (store_num == STORE_BLACK)
6068         {
6069                 /* Destroy crappy black market items */
6070                 for (j = st_ptr->stock_num - 1; j >= 0; j--)
6071                 {
6072                         object_type *o_ptr = &st_ptr->stock[j];
6073
6074                         /* Destroy crappy items */
6075                         if (black_market_crap(o_ptr))
6076                         {
6077                                 /* Destroy the item */
6078                                 store_item_increase(j, 0 - o_ptr->number);
6079                                 store_item_optimize(j);
6080                         }
6081                 }
6082         }
6083
6084
6085         /* Choose the number of slots to keep */
6086         j = st_ptr->stock_num;
6087
6088         /* Sell a few items */
6089         j = j - randint1(STORE_TURNOVER);
6090
6091         /* Never keep more than "STORE_MAX_KEEP" slots */
6092         if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
6093
6094         /* Always "keep" at least "STORE_MIN_KEEP" items */
6095         if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
6096
6097         /* Hack -- prevent "underflow" */
6098         if (j < 0) j = 0;
6099
6100         /* Destroy objects until only "j" slots are left */
6101         while (st_ptr->stock_num > j) store_delete();
6102
6103
6104         /* Choose the number of slots to fill */
6105         j = st_ptr->stock_num;
6106
6107         /* Buy some more items */
6108         j = j + randint1(STORE_TURNOVER);
6109
6110         /* Never keep more than "STORE_MAX_KEEP" slots */
6111         if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
6112
6113         /* Always "keep" at least "STORE_MIN_KEEP" items */
6114         if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
6115
6116         /* Hack -- prevent "overflow" */
6117         if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1;
6118
6119         /* Acquire some new items */
6120         while (st_ptr->stock_num < j) store_create();
6121 }
6122
6123
6124 /*!
6125  * @brief 店舗情報を初期化する /
6126  * Initialize the stores
6127  * @param town_num 町のID
6128  * @param store_num 店舗種類のID
6129  * @return なし
6130  */
6131 void store_init(int town_num, int store_num)
6132 {
6133         int k;
6134         cur_store_num = store_num;
6135
6136         /* Activate that store */
6137         st_ptr = &town_info[town_num].store[store_num];
6138
6139
6140         /* Pick an owner */
6141         while(1)
6142         {
6143                 int i;
6144
6145                 st_ptr->owner = (byte)randint0(MAX_OWNERS);
6146                 for (i = 1;i < max_towns; i++)
6147                 {
6148                         if (i == town_num) continue;
6149                         if (st_ptr->owner == town_info[i].store[store_num].owner) break;
6150                 }
6151                 if (i == max_towns) break;
6152         }
6153
6154         /* Activate the new owner */
6155         ot_ptr = &owners[store_num][st_ptr->owner];
6156
6157
6158         /* Initialize the store */
6159         st_ptr->store_open = 0;
6160         st_ptr->insult_cur = 0;
6161         st_ptr->good_buy = 0;
6162         st_ptr->bad_buy = 0;
6163
6164         /* Nothing in stock */
6165         st_ptr->stock_num = 0;
6166
6167         /*
6168          * MEGA-HACK - Last visit to store is
6169          * BEFORE player birth to enable store restocking
6170          */
6171         st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
6172
6173         /* Clear any old items */
6174         for (k = 0; k < st_ptr->stock_size; k++)
6175         {
6176                 object_wipe(&st_ptr->stock[k]);
6177         }
6178 }
6179
6180
6181 /*!
6182  * @brief アイテムを町のブラックマーケットに移動させる /
6183  * @param o_ptr 移動させたいオブジェクトの構造体参照ポインタ
6184  * @return なし
6185  */
6186 void move_to_black_market(object_type *o_ptr)
6187 {
6188         /* Not in town */
6189         if (!p_ptr->town_num) return;
6190
6191         st_ptr = &town_info[p_ptr->town_num].store[STORE_BLACK];
6192
6193         o_ptr->ident |= IDENT_STORE;
6194
6195         (void)store_carry(o_ptr);
6196
6197         object_wipe(o_ptr); /* Don't leave a bogus object behind... */
6198 }
6199