OSDN Git Service

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