OSDN Git Service

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