OSDN Git Service

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