OSDN Git Service

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