OSDN Git Service

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