OSDN Git Service

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