OSDN Git Service

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