OSDN Git Service

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