OSDN Git Service

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