3 * @brief Ź¤Î½èÍý / Store commands
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.
17 static int cur_store_num = 0;
18 static int store_top = 0;
19 static int store_bottom = 0;
20 static int xtra_stock = 0;
21 static store_type *st_ptr = NULL;
22 static const owner_type *ot_ptr = NULL;
23 static s16b old_town_num = 0;
24 static s16b inner_town_num = 0;
25 #define RUMOR_CHANCE 8
27 #define MAX_COMMENT_1 6
29 static cptr comment_1[MAX_COMMENT_1] =
50 /*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÄɲåá¥Ã¥»¡¼¥¸¡Ê¾µÂú¡Ë */
51 static cptr comment_1_B[MAX_COMMENT_1] = {
52 "¤Þ¤¢¡¢¤½¤ì¤Ç¤¤¤¤¤ä¡£",
53 "º£Æü¤Ï¤½¤ì¤Ç´ªÊÛ¤·¤Æ¤ä¤ë¡£",
60 #define MAX_COMMENT_2A 2
62 static cptr comment_2a[MAX_COMMENT_2A] =
65 "»ä¤ÎǦÂÑÎϤò»î¤·¤Æ¤¤¤ë¤Î¤«¤¤¡© $%s ¤¬ºÇ¸å¤À¡£",
66 "²æËý¤Ë¤â¸ÂÅÙ¤¬¤¢¤ë¤¾¡£ $%s ¤¬ºÇ¸å¤À¡£"
68 "You try my patience. %s is final.",
69 "My patience grows thin. %s is final."
74 #define MAX_COMMENT_2B 12
76 static cptr comment_2b[MAX_COMMENT_2B] =
79 " $%s ¤°¤é¤¤¤Ï½Ð¤µ¤Ê¤¤ã¥À¥á¤À¤è¡£",
80 " $%s ¤Ê¤é¼õ¤±¼è¤Ã¤Æ¤â¤¤¤¤¤¬¡£",
81 "¥Ï¡ª $%s °Ê²¼¤Ï¤Ê¤¤¤Í¡£",
82 "²¿¤ÆÅÛ¤À¡ª $%s °Ê²¼¤Ï¤¢¤êÆÀ¤Ê¤¤¤¾¡£",
83 "¤½¤ì¤¸¤ã¾¯¤Ê¤¹¤®¤ë¡ª $%s ¤ÏÍߤ·¤¤¤È¤³¤í¤À¡£",
84 "¥Ð¥«¤Ë¤·¤Æ¤¤¤ë¡ª $%s ¤Ï¤â¤é¤ï¤Ê¤¤¤È¡£",
85 "±³¤À¤í¤¦¡ª $%s ¤Ç¤É¤¦¤À¤¤¡©",
86 "¤ª¤¤¤ª¤¤¡ª $%s ¤ò¹Í¤¨¤Æ¤¯¤ì¤Ê¤¤¤«¡©",
87 "1000ɤ¤Î¥ª¡¼¥¯¤Î¥Î¥ß¤Ë¶ì¤·¤á¤é¤ì¤ë¤¬¤¤¤¤¡ª $%s ¤À¡£",
88 "¤ªÁ°¤ÎÂçÀڤʤâ¤Î¤ËºÒ¤¤¤¢¤ì¡ª $%s ¤Ç¤É¤¦¤À¡£",
89 "¥â¥ë¥´¥¹¤Ë¾ÞÌ£¤µ¤ì¤ë¤¬¤¤¤¤¡ªËÜÅö¤Ï $%s ¤Ê¤ó¤À¤í¤¦¡©",
90 "¤ªÁ°¤ÎÊì¿Æ¤Ï¥ª¡¼¥¬¤«¡ª $%s ¤Ï½Ð¤¹¤Ä¤â¤ê¤Ê¤ó¤À¤í¡©"
92 "I can take no less than %s gold pieces.",
93 "I will accept no less than %s gold pieces.",
94 "Ha! No less than %s gold pieces.",
95 "You knave! No less than %s gold pieces.",
96 "That's a pittance! I want %s gold pieces.",
97 "That's an insult! I want %s gold pieces.",
98 "As if! How about %s gold pieces?",
99 "My arse! How about %s gold pieces?",
100 "May the fleas of 1000 orcs molest you! Try %s gold pieces.",
101 "May your most favourite parts go moldy! Try %s gold pieces.",
102 "May Morgoth find you tasty! Perhaps %s gold pieces?",
103 "Your mother was an Ogre! Perhaps %s gold pieces?"
109 /*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÇä¤ë¤È¤¡Ë */
110 static cptr comment_2b_B[MAX_COMMENT_2B] = {
111 "¤¤¤¯¤é²¶Íͤ¬¤ª¿Í¹¥¤·¤È¤Ï¤¤¤¨ $%s ¤¬¸Â³¦¤À¤Í¡£·ù¤Ê¤éµ¢¤ê¤Ê¡£",
112 "¶â¤¬¤Ê¤¤¤Î¤«¤¤¡¢¤¢¤ó¤¿¡©¤Þ¤º¤Ï²È¤Ëµ¢¤Ã¤Æ $%s ·¤¨¤Æ¤¤Ê¡£",
113 "ʪ¤Î²ÁÃͤ¬Ê¬¤«¤é¤óÅÛ¤À¤Ê¡£¤³¤ì¤Ï $%s ¤¬ÉáÄ̤ʤó¤À¤è¡£",
114 "²¶¤ÎÉÕ¤±¤¿ÃÍÃʤËʸ¶ç¤¬¤¢¤ë¤Î¤«¡© $%s ¤¬¸Â³¦¤À¡£",
115 "¤Ò¤ç¤Ã¤È¤·¤Æ¿·¼ê¤Î¾éÃ̤«¤¤¡© $%s »ý¤Ã¤Æ¤Ê¤¤¤Ê¤éµ¢¤ê¤Ê¡£",
116 "¤¦¤Á¤Ï¾¤ÎŹ¤È¤Ï°ã¤¦¤ó¤À¤è¡£$%s ¤°¤é¤¤¤Ï½Ð¤·¤Ê¡£",
117 "Ç㤦µ¤¤¬¤Ê¤¤¤Ê¤éµ¢¤ê¤Ê¡£ $%s ¤À¤È¸À¤Ã¤Æ¤¤¤ë¤ó¤À¡£",
118 "Ïäˤʤé¤Ê¤¤¤Í¡£ $%s ¤¯¤é¤¤»ý¤Ã¤Æ¤¤¤ë¤ó¤À¤í¡©",
119 "¤Ï¡©¤Ê¤ó¤À¤½¤ê¤ã¡© $%s ¤Î´Ö°ã¤¤¤«¡¢¤Ò¤ç¤Ã¤È¤·¤Æ¡©",
120 "½Ð¸ý¤Ï¤¢¤Ã¤Á¤À¤è¡£¤½¤ì¤È¤â $%s ½Ð¤»¤ë¤Î¤«¤¤¡¢¤¢¤ó¤¿¤Ë¡£",
121 "Ì¿ÃΤ餺¤ÊÅÛ¤À¤Ê¡£ $%s ½Ð¤»¤Ðº£Æü¤Î½ê¤Ï´ªÊÛ¤·¤Æ¤ä¤ë¤è¡£",
122 "¤¦¤Á¤ÎŹ¤ÏÉÏ˳¿Í¤ªÃǤê¤À¡£ $%s ¤°¤é¤¤½Ð¤»¤Ê¤¤¤Î¤«¤¤¡©"
125 #define MAX_COMMENT_3A 2
127 static cptr comment_3a[MAX_COMMENT_3A] =
130 "»ä¤ÎǦÂÑÎϤò»î¤·¤Æ¤¤¤ë¤Î¤«¤¤¡© $%s ¤¬ºÇ¸å¤À¡£",
131 "²æËý¤Ë¤â¸ÂÅÙ¤¬¤¢¤ë¤¾¡£ $%s ¤¬ºÇ¸å¤À¡£"
133 "You try my patience. %s is final.",
134 "My patience grows thin. %s is final."
140 #define MAX_COMMENT_3B 12
142 static cptr comment_3b[MAX_COMMENT_3B] =
145 "Ëܲ»¤ò¸À¤¦¤È $%s ¤Ç¤¤¤¤¤ó¤À¤í¡©",
147 " $%s ¤°¤é¤¤¤Ê¤é½Ð¤·¤Æ¤â¤¤¤¤¤¬¡£",
148 " $%s °Ê¾åʧ¤¦¤Ê¤ó¤Æ¹Í¤¨¤é¤ì¤Ê¤¤¤Í¡£",
149 "¤Þ¤¢Íî¤Á¤Ä¤¤¤Æ¡£ $%s ¤Ç¤É¤¦¤À¤¤¡©",
150 "¤½¤Î¥¬¥é¥¯¥¿¤Ê¤é $%s ¤Ç°ú¤¼è¤ë¤è¡£",
151 "¤½¤ì¤¸¤ã¹â¤¹¤®¤ë¡ª $%s ¤¬¤¤¤¤¤È¤³¤À¤í¡£",
152 "¤É¤¦¤»¤¤¤é¤Ê¤¤¤ó¤À¤í¡ª $%s ¤Ç¤¤¤¤¤À¤í¡©",
153 "¤À¤á¤À¤á¡ª $%s ¤¬¤º¤Ã¤È¤ª»÷¹ç¤¤¤À¤è¡£",
154 "¥Ð¥«¤Ë¤·¤Æ¤¤¤ë¡ª $%s ¤¬¤»¤¤¤¼¤¤¤À¡£",
155 " $%s ¤Ê¤é´ò¤·¤¤¤È¤³¤í¤À¤¬¤Ê¤¢¡£",
156 " $%s ¡¢¤½¤ì°Ê¾å¤Ï¥Ó¥¿°ìʸ½Ð¤µ¤Ê¤¤¤è¡ª"
158 "Perhaps %s gold pieces?",
159 "How about %s gold pieces?",
160 "I will pay no more than %s gold pieces.",
161 "I can afford no more than %s gold pieces.",
162 "Be reasonable. How about %s gold pieces?",
163 "I'll buy it as scrap for %s gold pieces.",
164 "That is too much! How about %s gold pieces?",
165 "That looks war surplus! Say %s gold pieces?",
166 "Never! %s is more like it.",
167 "That's an insult! %s is more like it.",
168 "%s gold pieces and be thankful for it!",
169 "%s gold pieces and not a copper more!"
175 /*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÇ㤤¼è¤ê¡Ë */
176 static cptr comment_3b_B[MAX_COMMENT_3B] = {
177 " $%s ¤Ã¤Æ¤È¤³¤í¤À¤Í¡£¤½¤Î¤É¤¦¤·¤è¤¦¤â¤Ê¤¤¥¬¥é¥¯¥¿¤Ï¡£",
178 "¤³¤Î²¶¤¬ $%s ¤Ã¤Æ¸À¤Ã¤Æ¤¤¤ë¤ó¤À¤«¤é¡¢¤½¤ÎÄ̤ê¤Ë¤·¤¿Êý¤¬¿È¤Î¤¿¤á¤À¤¾¡£",
179 "²¶¤ÎÍ¥¤·¤µ¤Ë´Å¤¨¤ë¤Î¤â¤¤¤¤²Ã¸º¤Ë¤·¤Æ¤ª¤±¡£ $%s ¤À¡£",
180 "¤½¤ÎÉʤʤé $%s ¤ÇÇä¤Ã¤Æ¤¯¤ì¤Æ¤¤¤ë¤¬¤Í¡¢¾ï¼±¤¢¤ë¿Â»Î¤Ï¤ß¤ó¤Ê¡£",
181 "¤³¤ê¤ã¤Þ¤¿¡¢¤¬¤á¤Ä¤¤ÅÛ¤À¤Ê¡£¤¤¤¯¤é²¶¤¬²¹¸ü¤È¤Ï¤¤¤¨ $%s ¤¬¸Â³¦¤À¡£",
182 " $%s ¤À¡£Ê̤˲¶¤Ï¤½¤ó¤Ê¥¬¥é¥¯¥¿Íߤ·¤¯¤Ï¤Ê¤¤¤ó¤À¤«¤é¡£",
183 "²¶¤Î´ÕÄê³Û¤¬µ¤¤ËÆþ¤é¤Ê¤¤¤Î¤«¡© $%s ¡¢·ù¤Ê¤éµ¢¤ê¤Ê¡£",
184 " $%s ¤Ç°ú¤¼è¤Ã¤Æ¤ä¤ë¤è¡£´î¤ó¤Ç¼õ¤±¼è¤ê¤Ê¡¢ÉÏ˳¿Í¡£",
185 "ʪ¤Î²ÁÃͤ¬Ê¬¤«¤é¤óÅۤϻÏËö¤Ë¤ª¤¨¤ó¤Ê¡£¤½¤ì¤Ï $%s ¤Ê¤ó¤À¤è¡£",
186 "¤½¤ó¤Ê¤Ë¶â¤¬Íߤ·¤¤¤Î¤«¡¢¤¢¤ó¤¿¡© $%s ¤ÇËþ¤Ǥ¤ó¤Î¤«¡©",
187 "Æþ¤ëŹ´Ö°ã¤¨¤Æ¤ó¤¸¤ã¤Ê¤¤¤Î¤«¡© $%s ¤Ç·ù¤Ê¤é¾¤ò¤¢¤¿¤Ã¤Æ¤¯¤ì¡£",
188 "²¶¤Î¸À¤¤Ãͤ˥±¥Á¤ò¤Ä¤±¤ëÅÛ¤¬¤¤¤ë¤È¤Ï¡ª ¤½¤ÎÅÙ¶»¤ËÌȤ¸¤Æ $%s ¤À¡£"
191 #define MAX_COMMENT_4A 4
193 static cptr comment_4a[MAX_COMMENT_4A] =
196 "¤â¤¦¤¿¤¯¤µ¤ó¤À¡ª²¿ÅÙ¤â»ä¤ò¤ï¤º¤é¤ï¤»¤Ê¤¤¤Ç¤¯¤ì¡ª",
197 "¤¦¤¬¡¼¡ª°ìÆü¤Î²æËý¤Î¸ÂÅÙ¤òĶ¤¨¤Æ¤¤¤ë¡ª",
198 "¤â¤¦¤¤¤¤¡ª»þ´Ö¤Î̵Â̰ʳ°¤Î¤Ê¤Ë¤â¤Î¤Ç¤â¤Ê¤¤¡ª",
199 "¤â¤¦¤ä¤Ã¤Æ¤é¤ì¤Ê¤¤¤è¡ª´é¤â¸«¤¿¤¯¤Ê¤¤¡ª"
201 "Enough! You have abused me once too often!",
202 "Arghhh! I have had enough abuse for one day!",
203 "That does it! You shall waste my time no more!",
204 "This is getting nowhere! I'm going to Londis!"
210 /*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÅܤê¤ÎĺÅÀ¡Ë */
211 static cptr comment_4a_B[MAX_COMMENT_4A] = {
212 "¤Ê¤á¤ä¤¬¤Ã¤Æ¡ª²¹¸ü¤Ê²¶ÍͤǤâ¸Â³¦¤¬¤¢¤ë¤Ã¤Æ¤³¤È¤òÃΤ졪",
213 "²¶¤ò¤³¤³¤Þ¤ÇÅܤ餻¤Æ...Ì¿¤¬¤¢¤ë¤À¤±¤Ç¤â¤¢¤ê¤¬¤¿¤¤¤È»×¤¨¡ª",
214 "¤Õ¤¶¤±¤Æ¤ë¤Î¤«¡ªÎä¤ä¤«¤·¤Ê¤éÁê¼ê¤ò¸«¤Æ¤«¤é¤Ë¤·¤í¡ª",
215 "¤¤¤¤¤«¤²¤ó¤Ë¤·¤í¡ªº£ÅÙ¤³¤ó¤Ê¤Þ¤Í¤·¤¿¤é¤¿¤À¤¸¤ã¤ª¤«¤Í¤¨¤¾¡ª"
218 #define MAX_COMMENT_4B 4
220 static cptr comment_4b[MAX_COMMENT_4B] =
224 "²¶¤ÎÁ°¤«¤é¾Ã¤¨¼º¤»¤í¡ª",
225 "¤É¤Ã¤«¤Ë¹Ô¤Ã¤Á¤Þ¤¨¡ª",
226 "½Ð¤í¡¢½Ð¤í¡¢½Ð¤Æ¹Ô¤±¡ª"
229 "Get out of my sight!",
230 "Begone, you scoundrel!",
237 /*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÄɤ¤½Ð¤·¡Ë */
238 static cptr comment_4b_B[MAX_COMMENT_4B] = {
239 "ÆóÅ٤Ȥ¦¤Á¤ËÍè¤ë¤ó¤¸¤ã¤Í¤¨¡ª¡ª",
240 "¤È¤Ã¤È¤È¡¢¤É¤Ã¤«¤Ø¼º¤»¤í¡ª¡ª",
241 "º£¤¹¤°¾Ã¤¨¼º¤»¤í¡ª¡ª",
242 "½Ð¤Æ¤¤¤±¡ª½Ð¤Æ¤¤¤±¡ª¡ª"
245 #define MAX_COMMENT_5 8
247 static cptr comment_5[MAX_COMMENT_5] =
252 "¤â¤Ã¤È¿¿ÌÌÌܤ˸À¤Ã¤Æ¤¯¤ì¡ª",
253 "¸ò¾Ä¤¹¤ëµ¤¤¬¤¢¤ë¤Î¤«¤¤¡©",
254 "Îä¤ä¤«¤·¤ËÍ褿¤Î¤«¡ª",
257 "¤Õ¡¼¤à¡¢Îɤ¤Å·µ¤¤À¡£"
261 "You will have to do better than that!",
262 "Do you wish to do business or not?",
263 "You've got to be kidding!",
264 "You'd better be kidding!",
265 "You try my patience.",
266 "Hmmm, nice weather we're having."
272 /*! ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍÑÄɲåá¥Ã¥»¡¼¥¸¡ÊÅܤê¡Ë */
273 static cptr comment_5_B[MAX_COMMENT_5] = {
274 "»þ´Ö¤Î̵Â̤À¤Ê¡¢¤³¤ì¤Ï¡£",
275 "Ìñ²ð¤Ê¤ªµÒÍͤÀ¤Ê¡ª",
276 "Ïä·¤Æʬ¤«¤ëÁê¼ê¤¸¤ã¤Ê¤µ¤½¤¦¤À¡£",
277 "Äˤ¤Ìܤˤ¢¤¤¤¿¤¤¤é¤·¤¤¤Ê¡ª",
278 "¤Ê¤ó¤Æ¶¯ÍߤÊÅÛ¤À¡ª",
280 "¤É¤¦¤·¤è¤¦¤â¤Ê¤¤ÉÏ˳¿Í¤À¡ª",
281 "·ö²Þ¤òÇä¤Ã¤Æ¤¤¤ë¤Î¤«¡©"
284 #define MAX_COMMENT_6 4
286 static cptr comment_6[MAX_COMMENT_6] =
289 "¤É¤¦¤ä¤éʹ¤´Ö°ã¤¨¤¿¤é¤·¤¤¡£",
290 "¼ºÎé¡¢¤è¤¯Ê¹¤³¤¨¤Ê¤«¤Ã¤¿¤è¡£",
291 "¤¹¤Þ¤Ê¤¤¡¢²¿¤À¤Ã¤Æ¡©",
292 "°¤¤¡¢¤â¤¦°ìÅÙ¸À¤Ã¤Æ¤¯¤ì¤ë¡©"
294 "I must have heard you wrong.",
295 "I'm sorry, I missed that.",
296 "I'm sorry, what was that?",
297 "Sorry, what was that again?"
305 * @brief ¼è°úÀ®¸ù»þ¤ÎŹ¼ç¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
309 static void say_comment_1(void)
312 /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î¤È¤¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
313 if ( cur_store_num == STORE_BLACK ) {
314 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
317 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
320 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
324 if (one_in_(RUMOR_CHANCE))
327 msg_print("Ź¼ç¤Ï¼ª¤¦¤Á¤·¤¿:");
329 msg_print("The shopkeeper whispers something into your ear:");
337 * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥¢¥¤¥Æ¥à¤òÇ㤦»þ¤Î²Á³ÊÂå°Æ¥á¥Ã¥»¡¼¥¸½èÍý /
338 * Continue haggling (player is buying)
339 * @param vaule Ź¼ç¤ÎÄ󼨲Á³Ê
340 * @param annoyed Ź¼ç¤Î¤¤¤é¤Ä¤ÅÙ
343 static void say_comment_2(s32b value, int annoyed)
347 /* Prepare a string to insert */
348 sprintf(tmp_val, "%ld", (long)value);
353 /* Formatted message */
354 msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
360 /* Formatted message */
362 /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
363 if ( cur_store_num == STORE_BLACK ){
364 msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
367 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
370 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
378 * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥¢¥¤¥Æ¥à¤òÇä¤ë»þ¤Î²Á³ÊÂå°Æ¥á¥Ã¥»¡¼¥¸½èÍý /
379 * Continue haggling (player is selling)
380 * @param vaule Ź¼ç¤ÎÄ󼨲Á³Ê
381 * @param annoyed Ź¼ç¤Î¤¤¤é¤Ä¤ÅÙ
384 static void say_comment_3(s32b value, int annoyed)
388 /* Prepare a string to insert */
389 sprintf(tmp_val, "%ld", (long)value);
394 /* Formatted message */
395 msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
401 /* Formatted message */
403 /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
404 if ( cur_store_num == STORE_BLACK ){
405 msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
408 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
411 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
419 * @brief Ź¼ç¤¬¥×¥ì¥¤¥ä¡¼¤òÄɤ¤½Ð¤¹»þ¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
420 * Kick 'da bum out. -RAK-
423 static void say_comment_4(void)
426 /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
427 if ( cur_store_num == STORE_BLACK ){
428 msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
429 msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
432 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
433 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
436 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
437 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
444 * @brief Ź¼ç¤¬¥×¥ì¥¤¥ä¡¼¤Ë¼è¤ê¹ç¤ï¤Ê¤¤»þ¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
445 * You are insulting me
448 static void say_comment_5(void)
451 /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
452 if ( cur_store_num == STORE_BLACK ){
453 msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
456 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
459 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
466 * @brief Ź¼ç¤¬¥×¥ì¥¤¥ä¡¼¤ÎÄ󼨤òÍý²ò¤Ç¤¤Ê¤«¤Ã¤¿»þ¤Î¥á¥Ã¥»¡¼¥¸½èÍý /
467 * That makes no sense.
470 static void say_comment_6(void)
472 msg_print(comment_6[randint0(MAX_COMMENT_6)]);
476 #define MAX_COMMENT_7A 4
478 static cptr comment_7a[MAX_COMMENT_7A] =
483 "狼¤¬¤à¤»¤Óµã¤¯À¼¤¬Ê¹¤³¤¨¤ë...¡£",
484 "Ź¼ç¤¬²ù¤·¤²¤Ë¤ï¤á¤¤¤Æ¤¤¤ë¡ª"
488 "You hear someone sobbing...",
489 "The shopkeeper howls in agony!"
494 #define MAX_COMMENT_7B 4
496 static cptr comment_7b[MAX_COMMENT_7B] =
501 "Ź¼ç¤¬º¨¤á¤·¤½¤¦¤Ë¸«¤Æ¤¤¤ë¡£",
506 "The shopkeeper curses at you.",
507 "The shopkeeper glares at you."
512 #define MAX_COMMENT_7C 4
514 static cptr comment_7c[MAX_COMMENT_7C] =
518 "·¯¤¬Å·»È¤Ë¸«¤¨¤ë¤è¡ª",
519 "Ź¼ç¤¬¥¯¥¹¥¯¥¹¾Ð¤Ã¤Æ¤¤¤ë¡£",
520 "Ź¼ç¤¬ÂçÀ¼¤Ç¾Ð¤Ã¤Æ¤¤¤ë¡£"
523 "You've made my day!",
524 "The shopkeeper giggles.",
525 "The shopkeeper laughs loudly."
530 #define MAX_COMMENT_7D 4
532 static cptr comment_7d[MAX_COMMENT_7D] =
536 "¤³¤ó¤Ê¤ª¤¤¤·¤¤»×¤¤¤ò¤·¤¿¤é¡¢¿¿ÌÌÌܤËƯ¤±¤Ê¤¯¤Ê¤ë¤Ê¤¡¡£",
537 "Ź¼ç¤Ï´ò¤·¤¯¤ÆÄ·¤Í²ó¤Ã¤Æ¤¤¤ë¡£",
538 "Ź¼ç¤ÏËþÌ̤˾Фߤò¤¿¤¿¤¨¤Æ¤¤¤ë¡£"
541 "I think I'll retire!",
542 "The shopkeeper jumps for joy.",
543 "The shopkeeper smiles gleefully."
550 * @brief Ź¼ç¤¬¸ò¾Ä¤ò½ª¤¨¤¿ºÝ¤ÎÈ¿±þ¤òÊÖ¤¹½èÍý /
551 * Let a shop-keeper React to a purchase
552 * @param price ¥¢¥¤¥Æ¥à¤Î¼è°ú³Û
553 * @param value ¥¢¥¤¥Æ¥à¤Î¼ÂºÝ²ÁÃÍ
554 * @param guess Ź¼ç¤¬Åö½éͽÁÛ¤·¤Æ¤¤¤¿²ÁÃÍ
557 * We paid "price", it was worth "value", and we thought it was worth "guess"
559 static void purchase_analyze(s32b price, s32b value, s32b guess)
561 /* Item was worthless, but we bought it */
562 if ((value <= 0) && (price > value))
565 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
567 chg_virtue(V_HONOUR, -1);
568 chg_virtue(V_JUSTICE, -1);
574 /* Item was cheaper than we thought, and we paid more than necessary */
575 else if ((value < guess) && (price > value))
578 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
580 chg_virtue(V_JUSTICE, -1);
582 chg_virtue(V_HONOUR, -1);
588 /* Item was a good bargain, and we got away with it */
589 else if ((value > guess) && (value < (4 * guess)) && (price < value))
592 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
595 chg_virtue(V_HONOUR, -1);
597 chg_virtue(V_HONOUR, 1);
603 /* Item was a great bargain, and we got away with it */
604 else if ((value > guess) && (price < value))
607 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
610 chg_virtue(V_HONOUR, -1);
612 chg_virtue(V_HONOUR, 1);
614 if (10 * price < value)
615 chg_virtue(V_SACRIFICE, 1);
625 * We store the current "store feat" here so everyone can access it
627 static int cur_store_feat;
631 * Buying and selling adjustments for race combinations.
632 * Entry[owner][player] gives the basic "cost inflation".
634 static byte rgold_adj[MAX_RACES][MAX_RACES] =
636 /*Hum, HfE, Elf, Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
637 HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
638 Imp, Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
639 Angel, Demon, Kutar */
642 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
643 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
644 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
645 100, 120, 110, 105 },
648 { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
649 120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
650 120, 110, 110, 110, 120, 110, 100, 125, 100, 95, 140,
651 110, 115, 110, 110 },
654 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
655 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
656 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
657 110, 110, 105, 110 },
660 { 115, 110, 105, 95, 105, 110, 115, 130, 115, 105, 115,
661 125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
662 120, 110, 120, 120, 130, 110, 110, 130, 110, 95, 140,
663 115, 120, 105, 115 },
666 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
667 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
668 120, 101, 110, 110, 120, 120, 115, 130, 115, 95, 140,
669 115, 110, 110, 115 },
672 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
673 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
674 120, 105, 115, 115, 115, 115, 120, 130, 120, 95, 140,
675 115, 110, 115, 115 },
678 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
679 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
680 115, 125, 120, 120, 115, 120, 125, 115, 125, 95, 140,
681 115, 110, 115, 115 },
684 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
685 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
686 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
687 110, 110, 115, 110 },
690 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
691 120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
692 120, 105, 120, 120, 125, 120, 105, 135, 105, 95, 140,
693 100, 110, 110, 100 },
696 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
697 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
698 125, 115, 120, 120, 125, 120, 100, 125, 100, 95, 140,
699 110, 110, 105, 110 },
701 /* Human / Barbarian (copied from human) */
702 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
703 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
704 115, 105, 125, 125, 130, 125, 115, 120, 115, 95, 140,
705 100, 120, 110, 100 },
707 /* Half-Ogre: theoretical, copied from half-troll */
708 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
709 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
710 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
711 110, 110, 115, 110 },
713 /* Half-Giant: theoretical, copied from half-troll */
714 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
715 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
716 110, 115, 112, 112, 115, 112, 130, 120, 130, 95, 140,
717 110, 110, 115, 110 },
719 /* Half-Titan: theoretical, copied from High_Elf */
720 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
721 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
722 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
723 110, 110, 115, 110 },
725 /* Cyclops: theoretical, copied from half-troll */
726 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
727 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
728 110, 115, 112, 112, 115, 112, 130, 130, 130, 95, 140,
729 110, 110, 115, 110 },
731 /* Yeek: theoretical, copied from Half-Orc */
732 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
733 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
734 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
735 115, 110, 115, 115 },
737 /* Klackon: theoretical, copied from Gnome */
738 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
739 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
740 120, 101, 110, 110, 120, 120, 130, 130, 130, 95, 140,
741 115, 110, 115, 115 },
743 /* Kobold: theoretical, copied from Half-Orc */
744 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
745 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
746 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
747 115, 110, 115, 115 },
749 /* Nibelung: theoretical, copied from Dwarf */
750 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
751 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
752 120, 105, 115, 115, 120, 120, 130, 130, 130, 95, 140,
753 115, 135, 115, 115 },
756 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
757 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
758 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
759 110, 101, 115, 110 },
761 /* Draconian: theoretical, copied from High_Elf */
762 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
763 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
764 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
765 110, 110, 115, 110 },
767 /* Mind Flayer: theoretical, copied from High_Elf */
768 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
769 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
770 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
771 110, 110, 115, 110 },
773 /* Imp: theoretical, copied from High_Elf */
774 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
775 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
776 125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
777 110, 110, 115, 110 },
779 /* Golem: theoretical, copied from High_Elf */
780 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
781 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
782 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
783 110, 110, 115, 110 },
785 /* Skeleton: theoretical, copied from half-orc */
786 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
787 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
788 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
789 115, 110, 125, 115 },
791 /* Zombie: Theoretical, copied from half-orc */
792 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
793 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
794 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
795 115, 110, 125, 115 },
797 /* Vampire: Theoretical, copied from half-orc */
798 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
799 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
800 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
801 115, 110, 125, 115 },
803 /* Spectre: Theoretical, copied from half-orc */
804 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
805 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
806 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
807 115, 110, 125, 115 },
809 /* Sprite: Theoretical, copied from half-orc */
810 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
811 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
812 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
813 115, 110, 105, 115 },
815 /* Beastman: Theoretical, copied from half-orc */
816 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
817 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
818 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
819 115, 110, 115, 115 },
822 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
823 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
824 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
825 110, 110, 105, 110 },
828 { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
829 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
830 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 160,
834 { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
835 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
836 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
837 140, 140, 140, 140 },
840 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
841 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
842 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
843 100, 120, 110, 100 },
846 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
847 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
848 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
849 110, 101, 115, 110 },
852 { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
853 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
854 115, 115, 125, 125, 125, 125, 105, 115, 105, 95, 140,
855 110, 115, 100, 110 },
858 { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
859 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
860 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
861 100, 120, 110, 100 },
867 * @brief ŹÊÞ²Á³Ê¤ò·èÄꤹ¤ë /
868 * Determine the price of an item (qty one) in a store.
869 * @param o_ptr ŹÊÞ¤Ëʤ٤륪¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
870 * @param greed Ź¼ç¤Î¶¯ÍßÅÙ
871 * @param flip TRUE¤Ê¤é¤ÐŹ¼ç¤Ë¤È¤Ã¤Æ¤ÎÇã¼è²Á³Ê¡¢FALSE¤Ê¤éÇä½Ð²Á³Ê¤ò·×»»
875 * This function takes into account the player's charisma, and the
876 * shop-keepers friendliness, and the shop-keeper's base greed, but
877 * never lets a shop-keeper lose money in a transaction.
878 * The "greed" value should exceed 100 when the player is "buying" the
879 * item, and should be less than 100 when the player is "selling" it.
880 * Hack -- the black market always charges twice as much as it should.
881 * Charisma adjustment runs from 80 to 130
882 * Racial adjustment runs from 95 to 130
883 * Since greed/charisma/racial adjustments are centered at 100, we need
884 * to adjust (by 200) to extract a usable multiplier. Note that the
885 * "greed" value is always something (?).
888 static s32b price_item(object_type *o_ptr, int greed, bool flip)
895 /* Get the value of one of the items */
896 price = object_value(o_ptr);
898 /* Worthless items */
899 if (price <= 0) return (0L);
902 /* Compute the racial factor */
903 factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
905 /* Add in the charisma factor */
906 factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]];
912 /* Adjust for greed */
913 adjust = 100 + (300 - (greed + factor));
915 /* Never get "silly" */
916 if (adjust > 100) adjust = 100;
918 /* Mega-Hack -- Black market sucks */
919 if (cur_store_num == STORE_BLACK)
922 /* Compute the final price (with rounding) */
923 /* Hack -- prevent underflow */
924 price = (price * adjust + 50L) / 100L;
927 /* Shop is selling */
930 /* Adjust for greed */
931 adjust = 100 + ((greed + factor) - 300);
933 /* Never get "silly" */
934 if (adjust < 100) adjust = 100;
936 /* Mega-Hack -- Black market sucks */
937 if (cur_store_num == STORE_BLACK)
940 /* Compute the final price (with rounding) */
941 /* Hack -- prevent overflow */
942 price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
945 /* Note -- Never become "free" */
946 if (price <= 0L) return (1L);
948 /* Return the price */
954 * @brief °Â²Á¤Ê¾ÃÌ×ÉʤÎÈÎÇä¿ô¤òÁý¤ä¤·¡¢Äã³ÎΨ¤Ç³ä°ú¤Ë¤¹¤ë /
955 * Certain "cheap" objects should be created in "piles"
956 * @param o_ptr ŹÊÞ¤Ëʤ٤륪¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
960 * Some objects can be sold at a "discount" (in small piles)
963 static void mass_produce(object_type *o_ptr)
968 s32b cost = object_value(o_ptr);
971 /* Analyze the type */
974 /* Food, Flasks, and Lites */
979 if (cost <= 5L) size += damroll(3, 5);
980 if (cost <= 20L) size += damroll(3, 5);
981 if (cost <= 50L) size += damroll(2, 2);
988 if (cost <= 60L) size += damroll(3, 5);
989 if (cost <= 240L) size += damroll(1, 5);
990 if (o_ptr->sval == SV_SCROLL_STAR_IDENTIFY) size += damroll(3, 5);
991 if (o_ptr->sval == SV_SCROLL_STAR_REMOVE_CURSE) size += damroll(1, 4);
996 case TV_SORCERY_BOOK:
1001 case TV_ARCANE_BOOK:
1003 case TV_DAEMON_BOOK:
1004 case TV_CRUSADE_BOOK:
1006 case TV_HISSATSU_BOOK:
1009 if (cost <= 50L) size += damroll(2, 3);
1010 if (cost <= 500L) size += damroll(1, 3);
1028 if (object_is_artifact(o_ptr)) break;
1029 if (object_is_ego(o_ptr)) break;
1030 if (cost <= 10L) size += damroll(3, 5);
1031 if (cost <= 100L) size += damroll(3, 5);
1040 if (cost <= 5L) size += damroll(5, 5);
1041 if (cost <= 50L) size += damroll(5, 5);
1042 if (cost <= 500L) size += damroll(5, 5);
1048 if (cost <= 100L) size += damroll(2, 2);
1049 if (cost <= 1000L) size += damroll(2, 2);
1062 * Because many rods (and a few wands and staffs) are useful mainly
1063 * in quantity, the Black Market will occasionally have a bunch of
1070 if ((cur_store_num == STORE_BLACK) && one_in_(3))
1072 if (cost < 1601L) size += damroll(1, 5);
1073 else if (cost < 3201L) size += damroll(1, 3);
1080 /* Pick a discount */
1085 else if (one_in_(25))
1089 else if (one_in_(150))
1093 else if (one_in_(300))
1097 else if (one_in_(500))
1103 if (o_ptr->art_name)
1105 if (cheat_peek && discount)
1108 msg_print("¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÏÃÍ°ú¤¤Ê¤·¡£");
1110 msg_print("No discount on random artifacts.");
1117 /* Save the discount */
1118 o_ptr->discount = discount;
1120 /* Save the total pile size */
1121 o_ptr->number = size - (size * discount / 100);
1123 /* Ensure that mass-produced rods and wands get the correct pvals. */
1124 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1126 o_ptr->pval *= o_ptr->number;
1133 * @brief ŹÊÞ¤Ëʤ٤¿ÉʤòƱ°ìÉʤǤ¢¤ë¤«¤É¤¦¤«È½Äꤹ¤ë /
1134 * Determine if a store item can "absorb" another item
1135 * @param o_ptr ȽÄꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿1
1136 * @param j_ptr ȽÄꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿2
1137 * @return Ʊ°ì°·¤¤¤Ç¤¤ë¤Ê¤éTRUE¤òÊÖ¤¹
1140 * See "object_similar()" for the same function for the "player"
1143 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
1147 /* Hack -- Identical items cannot be stacked */
1148 if (o_ptr == j_ptr) return (0);
1150 /* Different objects cannot be stacked */
1151 if (o_ptr->k_idx != j_ptr->k_idx) return (0);
1153 /* Different charges (etc) cannot be stacked, unless wands or rods. */
1154 if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
1156 /* Require many identical values */
1157 if (o_ptr->to_h != j_ptr->to_h) return (0);
1158 if (o_ptr->to_d != j_ptr->to_d) return (0);
1159 if (o_ptr->to_a != j_ptr->to_a) return (0);
1161 /* Require identical "ego-item" names */
1162 if (o_ptr->name2 != j_ptr->name2) return (0);
1164 /* Artifacts don't stack! */
1165 if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
1167 /* Hack -- Identical art_flags! */
1168 for (i = 0; i < TR_FLAG_SIZE; i++)
1169 if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
1171 /* Hack -- Never stack "powerful" items */
1172 if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
1174 /* Hack -- Never stack recharging items */
1175 if (o_ptr->timeout || j_ptr->timeout) return (0);
1177 /* Require many identical values */
1178 if (o_ptr->ac != j_ptr->ac) return (0);
1179 if (o_ptr->dd != j_ptr->dd) return (0);
1180 if (o_ptr->ds != j_ptr->ds) return (0);
1182 /* Hack -- Never stack chests */
1183 if (o_ptr->tval == TV_CHEST) return (0);
1184 if (o_ptr->tval == TV_STATUE) return (0);
1185 if (o_ptr->tval == TV_CAPTURE) return (0);
1187 /* Require matching discounts */
1188 if (o_ptr->discount != j_ptr->discount) return (0);
1190 /* They match, so they must be similar */
1196 * @brief ŹÊÞ¤Ëʤ٤¿Éʤò½Å¤Í¹ç¤ï¤»¤Ç¤¤ë¤«¤É¤¦¤«È½Äꤹ¤ë /
1197 * Allow a store item to absorb another item
1198 * @param o_ptr ȽÄꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿1
1199 * @param j_ptr ȽÄꤹ¤ë¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿2
1200 * @return ½Å¤Í¹ç¤ï¤»¤Ç¤¤ë¤Ê¤éTRUE¤òÊÖ¤¹
1203 * See "object_similar()" for the same function for the "player"
1206 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
1208 int max_num = (o_ptr->tval == TV_ROD) ?
1209 MIN(99, MAX_SHORT / k_info[o_ptr->k_idx].pval) : 99;
1210 int total = o_ptr->number + j_ptr->number;
1211 int diff = (total > max_num) ? total - max_num : 0;
1213 /* Combine quantity, lose excess items */
1214 o_ptr->number = (total > max_num) ? max_num : total;
1216 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) together. -LM- */
1217 if (o_ptr->tval == TV_ROD)
1219 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1222 /* Hack -- if wands are stacking, combine the charges. -LM- */
1223 if (o_ptr->tval == TV_WAND)
1225 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1231 * @brief ŹÊÞ¤ËÉʤòÃÖ¤¯¥¹¥Ú¡¼¥¹¤¬¤¢¤ë¤«¤É¤¦¤«¤ÎȽÄê¤òÊÖ¤¹ /
1232 * Check to see if the shop will be carrying too many objects -RAK-
1233 * @param o_ptr ŹÊÞ¤ËÃÖ¤¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1234 * @return ÃÖ¤¾ì¤¬¤Ê¤¤¤Ê¤é0¡¢½Å¤Í¹ç¤ï¤»¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ë¤Ê¤é-1¡¢¥¹¥Ú¡¼¥¹¤¬¤¢¤ë¤Ê¤é1¤òÊÖ¤¹¡£
1237 * Note that the shop, just like a player, will not accept things
1238 * it cannot hold. Before, one could "nuke" potions this way.
1239 * Return value is now int:
1241 * -1 : Can be combined to existing slot.
1242 * 1 : Cannot be combined but there are empty spaces.
1245 static int store_check_num(object_type *o_ptr)
1250 /* The "home" acts like the player */
1251 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
1253 bool old_stack_force_notes = stack_force_notes;
1254 bool old_stack_force_costs = stack_force_costs;
1256 if (cur_store_num != STORE_HOME)
1258 stack_force_notes = FALSE;
1259 stack_force_costs = FALSE;
1262 /* Check all the items */
1263 for (i = 0; i < st_ptr->stock_num; i++)
1265 /* Get the existing item */
1266 j_ptr = &st_ptr->stock[i];
1268 /* Can the new object be combined with the old one? */
1269 if (object_similar(j_ptr, o_ptr))
1271 if (cur_store_num != STORE_HOME)
1273 stack_force_notes = old_stack_force_notes;
1274 stack_force_costs = old_stack_force_costs;
1281 if (cur_store_num != STORE_HOME)
1283 stack_force_notes = old_stack_force_notes;
1284 stack_force_costs = old_stack_force_costs;
1288 /* Normal stores do special stuff */
1291 /* Check all the items */
1292 for (i = 0; i < st_ptr->stock_num; i++)
1294 /* Get the existing item */
1295 j_ptr = &st_ptr->stock[i];
1297 /* Can the new object be combined with the old one? */
1298 if (store_object_similar(j_ptr, o_ptr)) return -1;
1302 /* Free space is always usable */
1304 * ¥ª¥×¥·¥ç¥ó powerup_home ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤È
1305 * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë
1307 if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
1308 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
1313 if (st_ptr->stock_num < st_ptr->stock_size) {
1318 /* But there was no room at the inn... */
1323 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¤«¤ÎȽÄê¤òÊÖ¤¹ /
1324 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1325 * @return ¥¢¥¤¥Æ¥à¤¬½ËÊ¡¤µ¤ì¤¿¥¢¥¤¥Æ¥à¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
1327 static bool is_blessed(object_type *o_ptr)
1329 u32b flgs[TR_FLAG_SIZE];
1330 object_flags(o_ptr, flgs);
1331 if (have_flag(flgs, TR_BLESSED)) return (TRUE);
1332 else return (FALSE);
1338 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬½êÄê¤ÎŹÊޤǰú¤¼è¤ì¤ë¤«¤É¤¦¤«¤òÊÖ¤¹ /
1339 * Determine if the current store will purchase the given item
1340 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1341 * @return ¥¢¥¤¥Æ¥à¤¬Ç㤤¼è¤ì¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
1343 * Note that a shop-keeper must refuse to buy "worthless" items
1345 static bool store_will_buy(object_type *o_ptr)
1347 /* Hack -- The Home is simple */
1348 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
1350 /* Switch on the store */
1351 switch (cur_store_num)
1356 /* Analyze the type */
1357 switch (o_ptr->tval)
1360 if (o_ptr->sval != SV_POTION_WATER) return FALSE;
1372 case TV_BOTTLE: /* 'Green', recycling Angband */
1387 /* Analyze the type */
1388 switch (o_ptr->tval)
1409 /* Analyze the type */
1410 switch (o_ptr->tval)
1419 case TV_HISSATSU_BOOK:
1423 if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
1435 /* Analyze the type */
1436 switch (o_ptr->tval)
1439 case TV_CRUSADE_BOOK:
1449 monster_race *r_ptr = &r_info[o_ptr->pval];
1452 if (!(r_ptr->flags3 & RF3_EVIL))
1455 if (r_ptr->flags3 & RF3_GOOD) break;
1457 /* Accept animals */
1458 if (r_ptr->flags3 & RF3_ANIMAL) break;
1461 if (my_strchr("?!", r_ptr->d_char)) break;
1467 if (is_blessed(o_ptr)) break;
1476 case STORE_ALCHEMIST:
1478 /* Analyze the type */
1479 switch (o_ptr->tval)
1493 /* Analyze the type */
1494 switch (o_ptr->tval)
1496 case TV_SORCERY_BOOK:
1497 case TV_NATURE_BOOK:
1501 case TV_ARCANE_BOOK:
1503 case TV_DAEMON_BOOK:
1517 if(o_ptr->sval == SV_WIZSTAFF) break;
1518 else return (FALSE);
1525 /* Bookstore Shop */
1528 /* Analyze the type */
1529 switch (o_ptr->tval)
1531 case TV_SORCERY_BOOK:
1532 case TV_NATURE_BOOK:
1537 case TV_ARCANE_BOOK:
1539 case TV_DAEMON_BOOK:
1540 case TV_CRUSADE_BOOK:
1551 /* XXX XXX XXX Ignore "worthless" items */
1552 if (object_value(o_ptr) <= 0) return (FALSE);
1560 * @brief ¸½ºß¤ÎÄ®¤Î»ØÄꤵ¤ì¤¿Å¹ÊޤΥ¢¥¤¥Æ¥à¤òÀ°Íý¤¹¤ë /
1561 * Combine and reorder items in store.
1562 * @param store_num ŹÊÞID
1563 * @return ¼ÂºÝ¤ËÀ°Íý¤¬¹Ô¤ï¤ì¤¿¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
1565 bool combine_and_reorder_home(int store_num)
1569 object_type forge, *o_ptr, *j_ptr;
1570 bool flag = FALSE, combined;
1571 store_type *old_st_ptr = st_ptr;
1572 bool old_stack_force_notes = stack_force_notes;
1573 bool old_stack_force_costs = stack_force_costs;
1575 st_ptr = &town[1].store[store_num];
1576 if (store_num != STORE_HOME)
1578 stack_force_notes = FALSE;
1579 stack_force_costs = FALSE;
1586 /* Combine the items in the home (backwards) */
1587 for (i = st_ptr->stock_num - 1; i > 0; i--)
1590 o_ptr = &st_ptr->stock[i];
1592 /* Skip empty items */
1593 if (!o_ptr->k_idx) continue;
1595 /* Scan the items above that item */
1596 for (j = 0; j < i; j++)
1601 j_ptr = &st_ptr->stock[j];
1603 /* Skip empty items */
1604 if (!j_ptr->k_idx) continue;
1607 * Get maximum number of the stack if these
1608 * are similar, get zero otherwise.
1610 max_num = object_similar_part(j_ptr, o_ptr);
1612 /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
1613 if (max_num && j_ptr->number < max_num)
1615 if (o_ptr->number + j_ptr->number <= max_num)
1617 /* Add together the item counts */
1618 object_absorb(j_ptr, o_ptr);
1620 /* One object is gone */
1621 st_ptr->stock_num--;
1623 /* Slide everything down */
1624 for (k = i; k < st_ptr->stock_num; k++)
1626 /* Structure copy */
1627 st_ptr->stock[k] = st_ptr->stock[k + 1];
1630 /* Erase the "final" slot */
1631 object_wipe(&st_ptr->stock[k]);
1635 int old_num = o_ptr->number;
1636 int remain = j_ptr->number + o_ptr->number - max_num;
1638 /* Add together the item counts */
1639 object_absorb(j_ptr, o_ptr);
1641 o_ptr->number = remain;
1643 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
1644 if (o_ptr->tval == TV_ROD)
1646 o_ptr->pval = o_ptr->pval * remain / old_num;
1647 o_ptr->timeout = o_ptr->timeout * remain / old_num;
1650 /* Hack -- if wands are stacking, combine the charges. -LM- */
1651 else if (o_ptr->tval == TV_WAND)
1653 o_ptr->pval = o_ptr->pval * remain / old_num;
1670 /* Re-order the items in the home (forwards) */
1671 for (i = 0; i < st_ptr->stock_num; i++)
1674 o_ptr = &st_ptr->stock[i];
1676 /* Skip empty slots */
1677 if (!o_ptr->k_idx) continue;
1679 /* Get the "value" of the item */
1680 o_value = object_value(o_ptr);
1682 /* Scan every occupied slot */
1683 for (j = 0; j < st_ptr->stock_num; j++)
1685 if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
1688 /* Never move down */
1689 if (j >= i) continue;
1694 /* Get local object */
1697 /* Save a copy of the moving item */
1698 object_copy(j_ptr, &st_ptr->stock[i]);
1700 /* Slide the objects */
1701 for (k = i; k > j; k--)
1703 /* Slide the item */
1704 object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
1707 /* Insert the moving item */
1708 object_copy(&st_ptr->stock[j], j_ptr);
1711 st_ptr = old_st_ptr;
1712 if (store_num != STORE_HOME)
1714 stack_force_notes = old_stack_force_notes;
1715 stack_force_costs = old_stack_force_costs;
1723 * @brief ²æ¤¬²È¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤ò²Ã¤¨¤ë /
1724 * Add the item "o_ptr" to the inventory of the "Home"
1725 * @param o_ptr ²Ã¤¨¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1726 * @return ¼ý¤á¤¿Àè¤ÎID
1729 * In all cases, return the slot (or -1) where the object was placed
1730 * Note that this is a hacked up version of "inven_carry()".
1731 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1732 * known, the player may have to pick stuff up and drop it again.
1735 static int home_carry(object_type *o_ptr)
1741 bool old_stack_force_notes = stack_force_notes;
1742 bool old_stack_force_costs = stack_force_costs;
1744 if (cur_store_num != STORE_HOME)
1746 stack_force_notes = FALSE;
1747 stack_force_costs = FALSE;
1750 /* Check each existing item (try to combine) */
1751 for (slot = 0; slot < st_ptr->stock_num; slot++)
1753 /* Get the existing item */
1754 j_ptr = &st_ptr->stock[slot];
1756 /* The home acts just like the player */
1757 if (object_similar(j_ptr, o_ptr))
1759 /* Save the new number of items */
1760 object_absorb(j_ptr, o_ptr);
1762 if (cur_store_num != STORE_HOME)
1764 stack_force_notes = old_stack_force_notes;
1765 stack_force_costs = old_stack_force_costs;
1773 if (cur_store_num != STORE_HOME)
1775 stack_force_notes = old_stack_force_notes;
1776 stack_force_costs = old_stack_force_costs;
1781 * ±£¤·µ¡Ç½: ¥ª¥×¥·¥ç¥ó powerup_home ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤È
1782 * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë
1785 if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
1786 if (st_ptr->stock_num >= st_ptr->stock_size) {
1791 if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
1797 /* Determine the "value" of the item */
1798 value = object_value(o_ptr);
1800 /* Check existing slots to see if we must "slide" */
1801 for (slot = 0; slot < st_ptr->stock_num; slot++)
1803 if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
1806 /* Slide the others up */
1807 for (i = st_ptr->stock_num; i > slot; i--)
1809 st_ptr->stock[i] = st_ptr->stock[i-1];
1812 /* More stuff now */
1813 st_ptr->stock_num++;
1815 /* Insert the new item */
1816 st_ptr->stock[slot] = *o_ptr;
1818 chg_virtue(V_SACRIFICE, -1);
1820 (void)combine_and_reorder_home(cur_store_num);
1822 /* Return the location */
1828 * @brief ŹÊޤ˥ª¥Ö¥¸¥§¥¯¥È¤ò²Ã¤¨¤ë /
1829 * Add the item "o_ptr" to a real stores inventory.
1830 * @param o_ptr ²Ã¤¨¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1831 * @return ¼ý¤á¤¿Àè¤ÎID
1834 * In all cases, return the slot (or -1) where the object was placed
1835 * Note that this is a hacked up version of "inven_carry()".
1836 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1837 * known, the player may have to pick stuff up and drop it again.
1840 static int store_carry(object_type *o_ptr)
1843 s32b value, j_value;
1847 /* Evaluate the object */
1848 value = object_value(o_ptr);
1850 /* Cursed/Worthless items "disappear" when sold */
1851 if (value <= 0) return (-1);
1853 /* All store items are fully *identified* */
1854 o_ptr->ident |= IDENT_MENTAL;
1856 /* Erase the inscription */
1857 o_ptr->inscription = 0;
1859 /* Erase the "feeling" */
1860 o_ptr->feeling = FEEL_NONE;
1862 /* Check each existing item (try to combine) */
1863 for (slot = 0; slot < st_ptr->stock_num; slot++)
1865 /* Get the existing item */
1866 j_ptr = &st_ptr->stock[slot];
1868 /* Can the existing items be incremented? */
1869 if (store_object_similar(j_ptr, o_ptr))
1871 /* Hack -- extra items disappear */
1872 store_object_absorb(j_ptr, o_ptr);
1880 if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
1883 /* Check existing slots to see if we must "slide" */
1884 for (slot = 0; slot < st_ptr->stock_num; slot++)
1887 j_ptr = &st_ptr->stock[slot];
1889 /* Objects sort by decreasing type */
1890 if (o_ptr->tval > j_ptr->tval) break;
1891 if (o_ptr->tval < j_ptr->tval) continue;
1893 /* Objects sort by increasing sval */
1894 if (o_ptr->sval < j_ptr->sval) break;
1895 if (o_ptr->sval > j_ptr->sval) continue;
1898 * Hack: otherwise identical rods sort by
1899 * increasing recharge time --dsb
1901 if (o_ptr->tval == TV_ROD)
1903 if (o_ptr->pval < j_ptr->pval) break;
1904 if (o_ptr->pval > j_ptr->pval) continue;
1907 /* Evaluate that slot */
1908 j_value = object_value(j_ptr);
1910 /* Objects sort by decreasing value */
1911 if (value > j_value) break;
1912 if (value < j_value) continue;
1915 /* Slide the others up */
1916 for (i = st_ptr->stock_num; i > slot; i--)
1918 st_ptr->stock[i] = st_ptr->stock[i-1];
1921 /* More stuff now */
1922 st_ptr->stock_num++;
1924 /* Insert the new item */
1925 st_ptr->stock[slot] = *o_ptr;
1927 /* Return the location */
1933 * @brief ŹÊޤΥª¥Ö¥¸¥§¥¯¥È¿ô¤òÁý¤ä¤¹ /
1934 * Add the item "o_ptr" to a real stores inventory.
1935 * @param item Áý¤ä¤·¤¿¤¤¥¢¥¤¥Æ¥à¤ÎID
1936 * @param num Áý¤ä¤·¤¿¤¤¿ô
1940 * Increase, by a given amount, the number of a certain item
1941 * in a certain store. This can result in zero items.
1944 static void store_item_increase(int item, int num)
1950 o_ptr = &st_ptr->stock[item];
1952 /* Verify the number */
1953 cnt = o_ptr->number + num;
1954 if (cnt > 255) cnt = 255;
1955 else if (cnt < 0) cnt = 0;
1956 num = cnt - o_ptr->number;
1958 /* Save the new number */
1959 o_ptr->number += num;
1964 * @brief ŹÊޤΥª¥Ö¥¸¥§¥¯¥È¿ô¤òºï½ü¤¹¤ë /
1965 * Remove a slot if it is empty
1966 * @param item ºï½ü¤·¤¿¤¤¥¢¥¤¥Æ¥à¤ÎID
1969 static void store_item_optimize(int item)
1975 o_ptr = &st_ptr->stock[item];
1978 if (!o_ptr->k_idx) return;
1980 /* Must have no items */
1981 if (o_ptr->number) return;
1984 st_ptr->stock_num--;
1986 /* Slide everyone */
1987 for (j = item; j < st_ptr->stock_num; j++)
1989 st_ptr->stock[j] = st_ptr->stock[j + 1];
1992 /* Nuke the final slot */
1993 object_wipe(&st_ptr->stock[j]);
1997 * @brief ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥ÈÍѤÎ̵²ÁÃÍÉʤÎÇÓ½üȽÄê /
1998 * This function will keep 'crap' out of the black market.
1999 * @param o_ptr ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
2000 * @return ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Ë¤È¤Ã¤Æ̵²ÁÃͤÊÉʤʤé¤ÐTRUE¤òÊÖ¤¹
2003 * Crap is defined as any item that is "available" elsewhere
2004 * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
2007 static bool black_market_crap(object_type *o_ptr)
2011 /* Ego items are never crap */
2012 if (object_is_ego(o_ptr)) return (FALSE);
2014 /* Good items are never crap */
2015 if (o_ptr->to_a > 0) return (FALSE);
2016 if (o_ptr->to_h > 0) return (FALSE);
2017 if (o_ptr->to_d > 0) return (FALSE);
2019 /* Check all stores */
2020 for (i = 0; i < MAX_STORES; i++)
2022 if (i == STORE_HOME) continue;
2023 if (i == STORE_MUSEUM) continue;
2025 /* Check every item in the store */
2026 for (j = 0; j < town[p_ptr->town_num].store[i].stock_num; j++)
2028 object_type *j_ptr = &town[p_ptr->town_num].store[i].stock[j];
2030 /* Duplicate item "type", assume crappy */
2031 if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
2041 * @brief ŹÊÞ¤ÎÉÊ·¤¨ÊѲ½¤Î¤¿¤á¤Ë¥¢¥¤¥Æ¥à¤òºï½ü¤¹¤ë /
2042 * Attempt to delete (some of) a random item from the store
2046 * Hack -- we attempt to "maintain" piles of items when possible.
2049 static void store_delete(void)
2053 /* Pick a random slot */
2054 what = randint0(st_ptr->stock_num);
2056 /* Determine how many items are here */
2057 num = st_ptr->stock[what].number;
2059 /* Hack -- sometimes, only destroy half the items */
2060 if (randint0(100) < 50) num = (num + 1) / 2;
2062 /* Hack -- sometimes, only destroy a single item */
2063 if (randint0(100) < 50) num = 1;
2065 /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
2066 if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
2068 st_ptr->stock[what].pval -= num * st_ptr->stock[what].pval / st_ptr->stock[what].number;
2071 /* Actually destroy (part of) the item */
2072 store_item_increase(what, -num);
2073 store_item_optimize(what);
2078 * @brief ŹÊÞ¤ÎÉÊ·¤¨ÊѲ½¤Î¤¿¤á¤Ë¥¢¥¤¥Æ¥à¤òÄɲ乤ë /
2079 * Creates a random item and gives it to a store
2083 * This algorithm needs to be rethought. A lot.
2084 * Currently, "normal" stores use a pre-built array.
2085 * Note -- the "level" given to "obj_get_num()" is a "favored"
2086 * level, that is, there is a much higher chance of getting
2087 * items with a level approaching that of the given level...
2088 * Should we check for "permission" to have the given item?
2091 static void store_create(void)
2093 int i, tries, level;
2099 /* Paranoia -- no room left */
2100 if (st_ptr->stock_num >= st_ptr->stock_size) return;
2103 /* Hack -- consider up to four items */
2104 for (tries = 0; tries < 4; tries++)
2107 if (cur_store_num == STORE_BLACK)
2109 /* Pick a level for object/magic */
2110 level = 25 + randint0(25);
2112 /* Random item (usually of given level) */
2113 i = get_obj_num(level);
2115 /* Handle failure */
2122 /* Hack -- Pick an item to sell */
2123 i = st_ptr->table[randint0(st_ptr->table_num)];
2125 /* Hack -- fake level for apply_magic() */
2126 level = rand_range(1, STORE_OBJ_LEVEL);
2130 /* Get local object */
2133 /* Create a new object of the chosen kind */
2134 object_prep(q_ptr, i);
2136 /* Apply some "low-level" magic (no artifacts) */
2137 apply_magic(q_ptr, level, AM_NO_FIXED_ART);
2139 /* Require valid object */
2140 if (!store_will_buy(q_ptr)) continue;
2142 /* Hack -- Charge lite's */
2143 if (q_ptr->tval == TV_LITE)
2145 if (q_ptr->sval == SV_LITE_TORCH) q_ptr->xtra4 = FUEL_TORCH / 2;
2146 if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->xtra4 = FUEL_LAMP / 2;
2150 /* The item is "known" */
2151 object_known(q_ptr);
2153 /* Mark it storebought */
2154 q_ptr->ident |= IDENT_STORE;
2156 /* Mega-Hack -- no chests in stores */
2157 if (q_ptr->tval == TV_CHEST) continue;
2159 /* Prune the black market */
2160 if (cur_store_num == STORE_BLACK)
2162 /* Hack -- No "crappy" items */
2163 if (black_market_crap(q_ptr)) continue;
2165 /* Hack -- No "cheap" items */
2166 if (object_value(q_ptr) < 10) continue;
2168 /* No "worthless" items */
2169 /* if (object_value(q_ptr) <= 0) continue; */
2172 /* Prune normal stores */
2175 /* No "worthless" items */
2176 if (object_value(q_ptr) <= 0) continue;
2180 /* Mass produce and/or Apply discount */
2181 mass_produce(q_ptr);
2183 /* Attempt to carry the (known) item */
2184 (void)store_carry(q_ptr);
2186 /* Definitely done */
2193 * @brief ŹÊޤγä°úÂоݳ°¤Ë¤¹¤ë¤«¤É¤¦¤«¤òȽÄê /
2194 * Eliminate need to bargain if player has haggled well in the past
2195 * @param minprice ¥¢¥¤¥Æ¥à¤ÎºÇÄãÈÎÇä²Á³Ê
2196 * @return ³ä°ú¤ò¶Ø»ß¤¹¤ë¤Ê¤éTRUE¤òÊÖ¤¹¡£
2198 static bool noneedtobargain(s32b minprice)
2200 s32b good = st_ptr->good_buy;
2201 s32b bad = st_ptr->bad_buy;
2203 /* Cheap items are "boring" */
2204 if (minprice < 10L) return (TRUE);
2206 /* Perfect haggling */
2207 if (good == MAX_SHORT) return (TRUE);
2209 /* Reward good haggles, punish bad haggles, notice price */
2210 if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
2212 /* Return the flag */
2218 * @brief Ź¼ç¤Î»ý¤Ä¥×¥ì¥¤¥ä¡¼¤ËÂФ¹¤ëÇäÇã¤ÎÎɤ·°¤··Ð¸³¤òµ²±¤¹¤ë /
2219 * Update the bargain info
2220 * @param price ¼ÂºÝ¤Î¼è°ú²Á³Ê
2221 * @param minprice Ź¼ç¤ÎÄ󼨤·¤¿²Á³Ê
2225 static void updatebargain(s32b price, s32b minprice, int num)
2227 /* Hack -- auto-haggle */
2228 if (!manual_haggle) return;
2230 /* Cheap items are "boring" */
2231 if ((minprice/num) < 10L) return;
2233 /* Count the successful haggles */
2234 if (price == minprice)
2236 /* Just count the good haggles */
2237 if (st_ptr->good_buy < MAX_SHORT)
2243 /* Count the failed haggles */
2246 /* Just count the bad haggles */
2247 if (st_ptr->bad_buy < MAX_SHORT)
2256 * @brief Ź¤Î¾¦Éʥꥹ¥È¤òºÆɽ¼¨¤¹¤ë /
2257 * Re-displays a single store entry
2261 static void display_entry(int pos)
2267 char o_name[MAX_NLEN];
2274 o_ptr = &st_ptr->stock[pos];
2276 /* Get the "offset" */
2277 i = (pos % store_bottom);
2279 /* Label it, clear the line --(-- */
2280 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
2281 prt(out_val, i+6, 0);
2284 if (show_item_graph)
2286 byte a = object_attr(o_ptr);
2287 char c = object_char(o_ptr);
2294 Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
2295 if (use_bigtile) cur_col++;
2300 /* Describe an item in the home */
2301 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
2305 /* Leave room for weights, if necessary -DRS- */
2306 if (show_weights) maxwid -= 10;
2308 /* Describe the object */
2309 object_desc(o_name, o_ptr, 0);
2310 o_name[maxwid] = '\0';
2311 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2316 /* Only show the weight of an individual item */
2317 int wgt = o_ptr->weight;
2319 sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2320 put_str(out_val, i+6, 67);
2322 (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10);
2323 put_str(out_val, i+6, 68);
2329 /* Describe an item (fully) in a store */
2332 /* Must leave room for the "price" */
2335 /* Leave room for weights, if necessary -DRS- */
2336 if (show_weights) maxwid -= 7;
2338 /* Describe the object (fully) */
2339 object_desc(o_name, o_ptr, 0);
2340 o_name[maxwid] = '\0';
2341 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2346 /* Only show the weight of an individual item */
2347 int wgt = o_ptr->weight;
2349 sprintf(out_val, "%3d.%1d", lbtokg1(wgt) , lbtokg2(wgt) );
2350 put_str(out_val, i+6, 60);
2352 (void)sprintf(out_val, "%3d.%d", wgt / 10, wgt % 10);
2353 put_str(out_val, i+6, 61);
2358 /* Display a "fixed" cost */
2359 if (o_ptr->ident & (IDENT_FIXED))
2361 /* Extract the "minimum" price */
2362 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2364 /* Actually draw the price (not fixed) */
2366 (void)sprintf(out_val, "%9ld¸Ç", (long)x);
2368 (void)sprintf(out_val, "%9ld F", (long)x);
2371 put_str(out_val, i+6, 68);
2374 /* Display a "taxed" cost */
2375 else if (!manual_haggle)
2377 /* Extract the "minimum" price */
2378 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2380 /* Hack -- Apply Sales Tax if needed */
2381 if (!noneedtobargain(x)) x += x / 10;
2383 /* Actually draw the price (with tax) */
2384 (void)sprintf(out_val, "%9ld ", (long)x);
2385 put_str(out_val, i+6, 68);
2388 /* Display a "haggle" cost */
2391 /* Extrect the "maximum" price */
2392 x = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
2394 /* Actually draw the price (not fixed) */
2395 (void)sprintf(out_val, "%9ld ", (long)x);
2396 put_str(out_val, i+6, 68);
2403 * @brief Ź¤Î¾¦Éʥꥹ¥È¤òɽ¼¨¤¹¤ë /
2404 * Displays a store's inventory -RAK-
2407 * All prices are listed as "per individual object". -BEN-
2409 static void display_inventory(void)
2413 /* Display the next 12 items */
2414 for (k = 0; k < store_bottom; k++)
2416 /* Do not display "dead" items */
2417 if (store_top + k >= st_ptr->stock_num) break;
2419 /* Display that line */
2420 display_entry(store_top + k);
2423 /* Erase the extra lines and the "more" prompt */
2424 for (i = k; i < store_bottom + 1; i++) prt("", i + 6, 0);
2426 /* Assume "no current page" */
2428 put_str(" ", 5, 20);
2430 put_str(" ", 5, 20);
2434 /* Visual reminder of "more items" */
2435 if (st_ptr->stock_num > store_bottom)
2437 /* Show "more" reminder (after the last item) */
2439 prt("-³¤¯-", k + 6, 3);
2441 prt("-more-", k + 6, 3);
2445 /* Indicate the "current page" */
2446 /* Trailing spaces are to display (Page xx) and (Page x) */
2448 put_str(format("(%d¥Ú¡¼¥¸) ", store_top/store_bottom + 1), 5, 20);
2450 put_str(format("(Page %d) ", store_top/store_bottom + 1), 5, 20);
2455 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
2457 k = st_ptr->stock_size;
2459 if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
2461 put_str(format("¥¢¥¤¥Æ¥à¿ô: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
2463 put_str(format("Objects: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
2470 * @brief ¥×¥ì¥¤¥ä¡¼¤Î½ê»ý¶â¤òɽ¼¨¤¹¤ë /
2471 * Displays players gold -RAK-
2475 static void store_prt_gold(void)
2480 prt("¼ê»ý¤Á¤Î¤ª¶â: ", 19 + xtra_stock, 53);
2482 prt("Gold Remaining: ", 19 + xtra_stock, 53);
2486 sprintf(out_val, "%9ld", (long)p_ptr->au);
2487 prt(out_val, 19 + xtra_stock, 68);
2491 * @brief ŹÊÞ¾ðÊóÁ´ÂΤòɽ¼¨¤¹¤ë¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2492 * Displays store (after clearing screen) -RAK-
2496 static void display_store(void)
2504 /* The "Home" is special */
2505 if (cur_store_num == STORE_HOME)
2507 /* Put the owner name */
2509 put_str("²æ¤¬²È", 3, 31);
2511 put_str("Your Home", 3, 30);
2515 /* Label the item descriptions */
2517 put_str("¥¢¥¤¥Æ¥à¤Î°ìÍ÷", 5, 4);
2519 put_str("Item Description", 5, 3);
2523 /* If showing weights, show label */
2527 put_str("½Å¤µ", 5, 72);
2529 put_str("Weight", 5, 70);
2535 /* The "Home" is special */
2536 else if (cur_store_num == STORE_MUSEUM)
2538 /* Put the owner name */
2540 put_str("Çîʪ´Û", 3, 31);
2542 put_str("Museum", 3, 30);
2546 /* Label the item descriptions */
2548 put_str("¥¢¥¤¥Æ¥à¤Î°ìÍ÷", 5, 4);
2550 put_str("Item Description", 5, 3);
2554 /* If showing weights, show label */
2558 put_str("½Å¤µ", 5, 72);
2560 put_str("Weight", 5, 70);
2569 cptr store_name = (f_name + f_info[cur_store_feat].name);
2570 cptr owner_name = (ot_ptr->owner_name);
2571 cptr race_name = race_info[ot_ptr->owner_race].title;
2573 /* Put the owner name and race */
2574 sprintf(buf, "%s (%s)", owner_name, race_name);
2575 put_str(buf, 3, 10);
2577 /* Show the max price in the store (above prices) */
2578 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
2581 /* Label the item descriptions */
2583 put_str("¾¦ÉʤΰìÍ÷", 5, 7);
2585 put_str("Item Description", 5, 3);
2589 /* If showing weights, show label */
2593 put_str("½Å¤µ", 5, 62);
2595 put_str("Weight", 5, 60);
2600 /* Label the asking price (in stores) */
2602 put_str("²Á³Ê", 5, 73);
2604 put_str("Price", 5, 72);
2609 /* Display the current gold */
2612 /* Draw in the inventory */
2613 display_inventory();
2619 * @brief ŹÊÞ¤«¤é¥¢¥¤¥Æ¥à¤òÁªÂò¤¹¤ë /
2620 * Get the ID of a store item and return its value -RAK-
2621 * @param com_val ÁªÂòID¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
2622 * @param pmt ¥á¥Ã¥»¡¼¥¸¥¥ã¥×¥·¥ç¥ó
2623 * @param i ÁªÂòÈϰϤκǾ®ÃÍ
2624 * @param j ÁªÂòÈϰϤκÇÂçÃÍ
2625 * @return ¼ÂºÝ¤ËÁªÂò¤·¤¿¤éTRUE¡¢¥¥ã¥ó¥»¥ë¤·¤¿¤éFALSE
2627 static int get_stock(int *com_val, cptr pmt, int i, int j)
2633 #ifdef ALLOW_REPEAT /* TNB */
2635 /* Get the item index */
2636 if (repeat_pull(com_val))
2638 /* Verify the item */
2639 if ((*com_val >= i) && (*com_val <= j))
2646 #endif /* ALLOW_REPEAT -- TNB */
2648 /* Paranoia XXX XXX XXX */
2652 /* Assume failure */
2655 /* Build the prompt */
2657 hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
2659 (void)sprintf(out_val, "(%s:%c-%c, ESC¤ÇÃæÃÇ) %s",
2660 (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "¥¢¥¤¥Æ¥à" : "¾¦ÉÊ"),
2663 (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s",
2668 /* Ask until done */
2674 if (!get_com(out_val, &command, FALSE)) break;
2677 if (islower(command))
2679 else if (isupper(command))
2680 k = A2I(tolower(command)) + 26;
2684 /* Legal responses */
2685 if ((k >= i) && (k <= j))
2695 /* Clear the prompt */
2699 if (command == ESCAPE) return (FALSE);
2701 #ifdef ALLOW_REPEAT /* TNB */
2703 repeat_push(*com_val);
2705 #endif /* ALLOW_REPEAT -- TNB */
2713 * @brief Ź¼ç¤ÎÉÔËþÅÙ¤òÁý¤ä¤·¡¢¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹È½Äê¤È½èÍý¤ò¹Ô¤¦ /
2714 * Increase the insult counter and get angry if too many -RAK-
2715 * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
2717 static int increase_insults(void)
2719 /* Increase insults */
2720 st_ptr->insult_cur++;
2722 /* Become insulted */
2723 if (st_ptr->insult_cur > ot_ptr->insult_max)
2729 st_ptr->insult_cur = 0;
2730 st_ptr->good_buy = 0;
2731 st_ptr->bad_buy = 0;
2734 st_ptr->store_open = turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
2746 * @brief Ź¼ç¤ÎÉÔËþÅÙ¤ò¸º¤é¤¹ /
2747 * Decrease insults -RAK-
2748 * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
2750 static void decrease_insults(void)
2752 /* Decrease insults */
2753 if (st_ptr->insult_cur) st_ptr->insult_cur--;
2758 * @brief Ź¼ç¤ÎÉÔËþÅÙ¤¬Áý¤¨¤¿¾ì¹ç¤Î¤ß¤Î¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë /
2759 * Have insulted while haggling -RAK-
2760 * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
2762 static int haggle_insults(void)
2764 /* Increase insults */
2765 if (increase_insults()) return (TRUE);
2767 /* Display and flush insult */
2776 * Mega-Hack -- Enable "increments"
2778 static bool allow_inc = FALSE;
2781 * Mega-Hack -- Last "increment" during haggling
2783 static s32b last_inc = 0L;
2787 * @brief ¸ò¾Ä²Á³Ê¤ò³Îǧ¤Èǧ¾Ú¤ÎÀ§Èó¤ò¹Ô¤¦ /
2789 * @param pmt ¥á¥Ã¥»¡¼¥¸
2790 * @param poffer ÊÌÅÓ²Á³ÊÄ󼨤ò¤·¤¿¾ì¹ç¤ÎÃͤòÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
2791 * @param price ¸½ºß¤Î¸ò¾Ä²Á³Ê
2792 * @param final ºÇ½ª³ÎÄê²Á³Ê¤Ê¤é¤ÐTRUE
2793 * @return ¥×¥ì¥¤¥ä¡¼¤òÄù¤á½Ð¤¹¾ì¹çTRUE¤òÊÖ¤¹
2795 static int get_haggle(cptr pmt, s32b *poffer, s32b price, int final)
2805 /* Clear old increment if necessary */
2806 if (!allow_inc) last_inc = 0L;
2813 sprintf(buf, "%s [¾µÂú] ", pmt);
2815 sprintf(buf, "%s [accept] ", pmt);
2820 /* Old (negative) increment, and not final */
2821 else if (last_inc < 0)
2824 sprintf(buf, "%s [-$%ld] ", pmt, (long)(ABS(last_inc)));
2826 sprintf(buf, "%s [-%ld] ", pmt, (long)(ABS(last_inc)));
2831 /* Old (positive) increment, and not final */
2832 else if (last_inc > 0)
2835 sprintf(buf, "%s [+$%ld] ", pmt, (long)(ABS(last_inc)));
2837 sprintf(buf, "%s [+%ld] ", pmt, (long)(ABS(last_inc)));
2845 sprintf(buf, "%s ", pmt);
2849 /* Paranoia XXX XXX XXX */
2853 /* Ask until done */
2858 /* Display prompt */
2862 strcpy(out_val, "");
2865 * Ask the user for a response.
2866 * Don't allow to use numpad as cursor key.
2868 res = askfor_aux(out_val, 32, FALSE);
2874 if (!res) return FALSE;
2876 /* Skip leading spaces */
2877 for (p = out_val; *p == ' '; p++) /* loop */;
2879 /* Empty response */
2882 /* Accept current price */
2890 /* Use previous increment */
2891 if (allow_inc && last_inc)
2893 *poffer += last_inc;
2898 /* Normal response */
2901 /* Extract a number */
2904 /* Handle "incremental" number */
2905 if ((*p == '+' || *p == '-'))
2907 /* Allow increments */
2910 /* Use the given "increment" */
2917 /* Handle normal number */
2920 /* Use the given "number" */
2929 msg_print("Ãͤ¬¤ª¤«¤·¤¤¤Ç¤¹¡£");
2931 msg_print("Invalid response.");
2943 * @brief Ź¼ç¤¬¥×¥ì¥¤¥ä¡¼¤«¤é¤Î¸ò¾Ä²Á³Ê¤òȽÃǤ¹¤ë /
2944 * Receive an offer (from the player)
2945 * @param pmt ¥á¥Ã¥»¡¼¥¸
2946 * @param poffer Ź¼ç¤«¤é¤Î¸ò¾Ä²Á³Ê¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
2947 * @param last_offer ¸½ºß¤Î¸ò¾Ä²Á³Ê
2948 * @param factor Ź¼ç¤Î²Á³Ê´ð½àÇÜΨ
2949 * @return ¥×¥ì¥¤¥ä¡¼¤Î²Á³Ê¤ËÂФ·¤ÆÉÔÉþ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹ /
2950 * Return TRUE if offer is NOT okay
2952 static bool receive_offer(cptr pmt, s32b *poffer,
2953 s32b last_offer, int factor,
2954 s32b price, int final)
2956 /* Haggle till done */
2959 /* Get a haggle (or cancel) */
2960 if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
2962 /* Acceptable offer */
2963 if (((*poffer) * factor) >= (last_offer * factor)) break;
2965 /* Insult, and check for kicked out */
2966 if (haggle_insults()) return (TRUE);
2968 /* Reject offer (correctly) */
2969 (*poffer) = last_offer;
2978 * @brief ¥×¥ì¥¤¥ä¡¼¤¬¹ØÆþ¤¹¤ë»þ¤ÎÃÍÀÚ¤ê½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
2979 * Haggling routine -RAK-
2980 * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
2981 * @param price ºÇ½ª²Á³Ê¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
2982 * @return ¥×¥ì¥¤¥ä¡¼¤Î²Á³Ê¤ËÂФ·¤ÆŹ¼ç¤¬ÉÔÉþ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹ /
2983 * Return TRUE if purchase is NOT successful
2985 static bool purchase_haggle(object_type *o_ptr, s32b *price)
2987 s32b cur_ask, final_ask;
2988 s32b last_offer, offer;
2990 s32b min_per, max_per;
2991 int flag, loop_flag, noneed;
2992 int annoyed = 0, final = FALSE;
2994 bool cancel = FALSE;
2997 cptr pmt = "Ä󼨲Á³Ê";
2999 cptr pmt = "Asking";
3009 /* Extract the starting offer and the final offer */
3010 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
3011 final_ask = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3013 /* Determine if haggling is necessary */
3014 noneed = noneedtobargain(final_ask);
3016 /* No need to haggle */
3017 if (noneed || !manual_haggle)
3019 /* No need to haggle */
3022 /* Message summary */
3024 msg_print("·ë¶É¤³¤Î¶â³Û¤Ë¤Þ¤È¤Þ¤Ã¤¿¡£");
3026 msg_print("You eventually agree upon the price.");
3032 /* No haggle option */
3035 /* Message summary */
3037 msg_print("¤¹¤ó¤Ê¤ê¤È¤³¤Î¶â³Û¤Ë¤Þ¤È¤Þ¤Ã¤¿¡£");
3039 msg_print("You quickly agree upon the price.");
3044 /* Apply Sales Tax */
3045 final_ask += final_ask / 10;
3049 cur_ask = final_ask;
3051 /* Go to final offer */
3053 pmt = "ºÇ½ªÄ󼨲Á³Ê";
3055 pmt = "Final Offer";
3062 /* Haggle for the whole pile */
3063 cur_ask *= o_ptr->number;
3064 final_ask *= o_ptr->number;
3067 /* Haggle parameters */
3068 min_per = ot_ptr->haggle_per;
3069 max_per = min_per * 3;
3071 /* Mega-Hack -- artificial "last offer" value */
3072 last_offer = object_value(o_ptr) * o_ptr->number;
3073 last_offer = last_offer * (200 - (int)(ot_ptr->max_inflate)) / 100L;
3074 if (last_offer <= 0) last_offer = 1;
3079 /* No incremental haggling yet */
3082 /* Haggle until done */
3083 for (flag = FALSE; !flag; )
3087 while (!flag && loop_flag)
3089 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3090 put_str(out_val, 1, 0);
3092 cancel = receive_offer("Ä󼨤¹¤ë¶â³Û? ",
3094 cancel = receive_offer("What do you offer? ",
3097 &offer, last_offer, 1, cur_ask, final);
3103 else if (offer > cur_ask)
3108 else if (offer == cur_ask)
3121 x1 = 100 * (offer - last_offer) / (cur_ask - last_offer);
3124 if (haggle_insults())
3130 else if (x1 > max_per)
3133 if (x1 < max_per) x1 = max_per;
3135 x2 = rand_range(x1-2, x1+2);
3136 x3 = ((cur_ask - offer) * x2 / 100L) + 1;
3137 /* don't let the price go up */
3142 if (cur_ask < final_ask)
3145 cur_ask = final_ask;
3147 pmt = "ºÇ½ªÄ󼨲Á³Ê";
3149 pmt = "Final Offer";
3155 (void)(increase_insults());
3160 else if (offer >= cur_ask)
3172 (void)sprintf(out_val, "Á°²ó¤ÎÄ󼨶â³Û: $%ld",
3174 (void)sprintf(out_val, "Your last offer: %ld",
3178 put_str(out_val, 1, 39);
3179 say_comment_2(cur_ask, annoyed);
3185 if (cancel) return (TRUE);
3187 /* Update bargaining info */
3188 updatebargain(*price, final_ask, o_ptr->number);
3196 * @brief ¥×¥ì¥¤¥ä¡¼¤¬ÇäµÑ¤¹¤ë»þ¤ÎÃÍÀÚ¤ê½èÍý¥á¥¤¥ó¥ë¡¼¥Á¥ó /
3197 * Haggling routine -RAK-
3198 * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
3199 * @param price ºÇ½ª²Á³Ê¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
3200 * @return ¥×¥ì¥¤¥ä¡¼¤Î²Á³Ê¤ËÂФ·¤ÆŹ¼ç¤¬ÉÔÉþ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹ /
3201 * Return TRUE if purchase is NOT successful
3203 static bool sell_haggle(object_type *o_ptr, s32b *price)
3205 s32b purse, cur_ask, final_ask;
3206 s32b last_offer = 0, offer = 0;
3208 s32b min_per, max_per;
3209 int flag, loop_flag, noneed;
3210 int annoyed = 0, final = FALSE;
3211 bool cancel = FALSE;
3213 cptr pmt = "Ä󼨶â³Û";
3224 /* Obtain the starting offer and the final offer */
3225 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
3226 final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
3228 /* Determine if haggling is necessary */
3229 noneed = noneedtobargain(final_ask);
3231 /* Get the owner's payout limit */
3232 purse = (s32b)(ot_ptr->max_cost);
3234 /* No need to haggle */
3235 if (noneed || !manual_haggle || (final_ask >= purse))
3237 /* Apply Sales Tax (if needed) */
3238 if (!manual_haggle && !noneed)
3240 final_ask -= final_ask / 10;
3243 /* No reason to haggle */
3244 if (final_ask >= purse)
3248 msg_print("¨ºÂ¤Ë¤³¤Î¶â³Û¤Ë¤Þ¤È¤Þ¤Ã¤¿¡£");
3250 msg_print("You instantly agree upon the price.");
3255 /* Offer full purse */
3259 /* No need to haggle */
3264 msg_print("·ë¶É¤³¤Î¶â³Û¤Ë¤Þ¤È¤Þ¤Ã¤¿¡£");
3266 msg_print("You eventually agree upon the price.");
3272 /* No haggle option */
3275 /* Message summary */
3277 msg_print("¤¹¤ó¤Ê¤ê¤È¤³¤Î¶â³Û¤Ë¤Þ¤È¤Þ¤Ã¤¿¡£");
3279 msg_print("You quickly agree upon the price.");
3286 cur_ask = final_ask;
3291 pmt = "ºÇ½ªÄ󼨶â³Û";
3293 pmt = "Final Offer";
3298 /* Haggle for the whole pile */
3299 cur_ask *= o_ptr->number;
3300 final_ask *= o_ptr->number;
3303 /* XXX XXX XXX Display commands */
3305 /* Haggling parameters */
3306 min_per = ot_ptr->haggle_per;
3307 max_per = min_per * 3;
3309 /* Mega-Hack -- artificial "last offer" value */
3310 last_offer = object_value(o_ptr) * o_ptr->number;
3311 last_offer = last_offer * ot_ptr->max_inflate / 100L;
3316 /* No incremental haggling yet */
3320 for (flag = FALSE; !flag; )
3326 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3327 put_str(out_val, 1, 0);
3329 cancel = receive_offer("Ä󼨤¹¤ë²Á³Ê? ",
3331 cancel = receive_offer("What price do you ask? ",
3334 &offer, last_offer, -1, cur_ask, final);
3340 else if (offer < cur_ask)
3343 /* rejected, reset offer for incremental haggling */
3346 else if (offer == cur_ask)
3357 if (flag || !loop_flag) break;
3362 x1 = 100 * (last_offer - offer) / (last_offer - cur_ask);
3365 if (haggle_insults())
3371 else if (x1 > max_per)
3374 if (x1 < max_per) x1 = max_per;
3376 x2 = rand_range(x1-2, x1+2);
3377 x3 = ((offer - cur_ask) * x2 / 100L) + 1;
3378 /* don't let the price go down */
3382 if (cur_ask > final_ask)
3384 cur_ask = final_ask;
3387 pmt = "ºÇ½ªÄ󼨶â³Û";
3389 pmt = "Final Offer";
3397 /* Äɲà $0 ¤ÇÇ㤤¼è¤é¤ì¤Æ¤·¤Þ¤¦¤Î¤òËÉ»ß By FIRST*/
3400 (void)(increase_insults());
3403 else if (offer <= cur_ask)
3414 (void)sprintf(out_val,
3416 "Á°²ó¤ÎÄ󼨲Á³Ê $%ld", (long)last_offer);
3418 "Your last bid %ld", (long)last_offer);
3421 put_str(out_val, 1, 39);
3422 say_comment_3(cur_ask, annoyed);
3428 if (cancel) return (TRUE);
3430 /* Update bargaining info */
3431 updatebargain(*price, final_ask, o_ptr->number);
3439 * @brief Ź¤«¤é¤Î¹ØÆþ½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
3440 * Buy an item from a store -RAK-
3443 static void store_purchase(void)
3455 char o_name[MAX_NLEN];
3459 if (cur_store_num == STORE_MUSEUM)
3462 msg_print("Çîʪ´Û¤«¤é¼è¤ê½Ð¤¹¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£");
3464 msg_print("Museum.");
3470 if (st_ptr->stock_num <= 0)
3472 if (cur_store_num == STORE_HOME)
3474 msg_print("²æ¤¬²È¤Ë¤Ï²¿¤âÃÖ¤¤¤Æ¤¢¤ê¤Þ¤»¤ó¡£");
3476 msg_print("Your home is empty.");
3481 msg_print("¸½ºß¾¦Éʤκ߸ˤòÀڤ餷¤Æ¤¤¤Þ¤¹¡£");
3483 msg_print("I am currently out of stock.");
3490 /* Find the number of objects on this and following pages */
3491 i = (st_ptr->stock_num - store_top);
3493 /* And then restrict it to the current page */
3494 if (i > store_bottom) i = store_bottom;
3498 /* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸ */
3499 switch( cur_store_num ) {
3501 sprintf(out_val, "¤É¤Î¥¢¥¤¥Æ¥à¤ò¼è¤ê¤Þ¤¹¤«? ");
3504 sprintf(out_val, "¤É¤ì? ");
3507 sprintf(out_val, "¤É¤ÎÉÊʪ¤¬Íߤ·¤¤¤ó¤À¤¤? ");
3511 if (cur_store_num == STORE_HOME)
3513 sprintf(out_val, "Which item do you want to take? ");
3517 sprintf(out_val, "Which item are you interested in? ");
3522 /* Get the item number to be bought */
3523 if (!get_stock(&item, out_val, 0, i - 1)) return;
3525 /* Get the actual index */
3526 item = item + store_top;
3528 /* Get the actual item */
3529 o_ptr = &st_ptr->stock[item];
3531 /* Assume the player wants just one of them */
3534 /* Get local object */
3537 /* Get a copy of the object */
3538 object_copy(j_ptr, o_ptr);
3541 * If a rod or wand, allocate total maximum timeouts or charges
3542 * between those purchased and left on the shelf.
3544 reduce_charges(j_ptr, o_ptr->number - amt);
3546 /* Modify quantity */
3547 j_ptr->number = amt;
3549 /* Hack -- require room in pack */
3550 if (!inven_carry_okay(j_ptr))
3553 msg_print("¤½¤ó¤Ê¤Ë¥¢¥¤¥Æ¥à¤ò»ý¤Æ¤Ê¤¤¡£");
3555 msg_print("You cannot carry that many different items.");
3561 /* Determine the "best" price (per item) */
3562 best = price_item(j_ptr, ot_ptr->min_inflate, FALSE);
3564 /* Find out how many the player wants */
3565 if (o_ptr->number > 1)
3567 /* Hack -- note cost of "fixed" items */
3568 if ((cur_store_num != STORE_HOME) &&
3569 (o_ptr->ident & IDENT_FIXED))
3572 msg_format("°ì¤Ä¤Ë¤Ä¤ $%ld¤Ç¤¹¡£", (long)(best));
3574 msg_format("That costs %ld gold per item.", (long)(best));
3579 /* Get a quantity */
3580 amt = get_quantity(NULL, o_ptr->number);
3582 /* Allow user abort */
3583 if (amt <= 0) return;
3586 /* Get local object */
3589 /* Get desired object */
3590 object_copy(j_ptr, o_ptr);
3593 * If a rod or wand, allocate total maximum timeouts or charges
3594 * between those purchased and left on the shelf.
3596 reduce_charges(j_ptr, o_ptr->number - amt);
3598 /* Modify quantity */
3599 j_ptr->number = amt;
3601 /* Hack -- require room in pack */
3602 if (!inven_carry_okay(j_ptr))
3605 msg_print("¥¶¥Ã¥¯¤Ë¤½¤Î¥¢¥¤¥Æ¥à¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£");
3607 msg_print("You cannot carry that many items.");
3613 /* Attempt to buy it */
3614 if (cur_store_num != STORE_HOME)
3616 /* Fixed price, quick buy */
3617 if (o_ptr->ident & (IDENT_FIXED))
3622 /* Go directly to the "best" deal */
3623 price = (best * j_ptr->number);
3629 /* Describe the object (fully) */
3630 object_desc(o_name, j_ptr, 0);
3634 msg_format("%s(%c)¤ò¹ØÆþ¤¹¤ë¡£", o_name, I2A(item));
3636 msg_format("Buying %s (%c).", o_name, I2A(item));
3641 /* Haggle for a final price */
3642 choice = purchase_haggle(j_ptr, &price);
3644 /* Hack -- Got kicked out */
3645 if (st_ptr->store_open >= turn) return;
3648 /* Player wants it */
3651 /* Fix the item price (if "correctly" haggled) */
3652 if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
3654 /* Player can afford it */
3655 if (p_ptr->au >= price)
3660 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
3661 chg_virtue(V_JUSTICE, -1);
3662 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
3663 chg_virtue(V_NATURE, -1);
3671 /* Spend the money */
3674 /* Update the display */
3677 /* Hack -- buying an item makes you aware of it */
3678 object_aware(j_ptr);
3680 /* Hack -- clear the "fixed" flag from the item */
3681 j_ptr->ident &= ~(IDENT_FIXED);
3683 /* Describe the transaction */
3684 object_desc(o_name, j_ptr, 0);
3688 msg_format("%s¤ò $%ld¤Ç¹ØÆþ¤·¤Þ¤·¤¿¡£", o_name, (long)price);
3690 msg_format("You bought %s for %ld gold.", o_name, (long)price);
3693 strcpy(record_o_name, o_name);
3696 if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
3697 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3698 if(record_rand_art && o_ptr->art_name)
3699 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
3701 /* Erase the inscription */
3702 j_ptr->inscription = 0;
3704 /* Erase the "feeling" */
3705 j_ptr->feeling = FEEL_NONE;
3706 j_ptr->ident &= ~(IDENT_STORE);
3707 /* Give it to the player */
3708 item_new = inven_carry(j_ptr);
3710 /* Describe the final result */
3711 object_desc(o_name, &inventory[item_new], 0);
3715 msg_format("%s(%c)¤ò¼ê¤ËÆþ¤ì¤¿¡£", o_name, index_to_label(item_new));
3717 msg_format("You have %s (%c).",
3718 o_name, index_to_label(item_new));
3721 /* Auto-inscription */
3722 autopick_alter_item(item_new, FALSE);
3724 /* Now, reduce the original stack's pval. */
3725 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3727 o_ptr->pval -= j_ptr->pval;
3733 /* Note how many slots the store used to have */
3734 i = st_ptr->stock_num;
3736 /* Remove the bought items from the store */
3737 store_item_increase(item, -amt);
3738 store_item_optimize(item);
3740 /* Store is empty */
3741 if (st_ptr->stock_num == 0)
3744 if (one_in_(STORE_SHUFFLE))
3749 msg_print("Ź¼ç¤Ï°úÂष¤¿¡£");
3751 msg_print("The shopkeeper retires.");
3755 /* Shuffle the store */
3756 store_shuffle(cur_store_num);
3759 sprintf(buf, "%s (%s)",
3760 ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
3761 put_str(buf, 3, 10);
3762 sprintf(buf, "%s (%ld)",
3763 (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
3772 msg_print("Ź¼ç¤Ï¿·¤¿¤Êºß¸Ë¤ò¼è¤ê½Ð¤·¤¿¡£");
3774 msg_print("The shopkeeper brings out some new stock.");
3780 for (i = 0; i < 10; i++)
3782 /* Maintain the store */
3783 store_maint(p_ptr->town_num, cur_store_num);
3789 /* Redraw everything */
3790 display_inventory();
3793 /* The item is gone */
3794 else if (st_ptr->stock_num != i)
3796 /* Pick the correct screen */
3797 if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3799 /* Redraw everything */
3800 display_inventory();
3803 /* Item is still here */
3806 /* Redraw the item */
3807 display_entry(item);
3811 /* Player cannot afford it */
3814 /* Simple message (no insult) */
3816 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡£");
3818 msg_print("You do not have enough gold.");
3825 /* Home is much easier */
3828 bool combined_or_reordered;
3830 /* Distribute charges of wands/rods */
3831 distribute_charges(o_ptr, j_ptr, amt);
3833 /* Give it to the player */
3834 item_new = inven_carry(j_ptr);
3836 /* Describe just the result */
3837 object_desc(o_name, &inventory[item_new], 0);
3841 msg_format("%s(%c)¤ò¼è¤Ã¤¿¡£",
3843 msg_format("You have %s (%c).",
3845 o_name, index_to_label(item_new));
3850 /* Take note if we take the last one */
3851 i = st_ptr->stock_num;
3853 /* Remove the items from the home */
3854 store_item_increase(item, -amt);
3855 store_item_optimize(item);
3857 combined_or_reordered = combine_and_reorder_home(STORE_HOME);
3859 /* Hack -- Item is still here */
3860 if (i == st_ptr->stock_num)
3862 /* Redraw everything */
3863 if (combined_or_reordered) display_inventory();
3865 /* Redraw the item */
3866 else display_entry(item);
3869 /* The item is gone */
3873 if (st_ptr->stock_num == 0) store_top = 0;
3875 /* Nothing left on that screen */
3876 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3878 /* Redraw everything */
3879 display_inventory();
3881 chg_virtue(V_SACRIFICE, 1);
3885 /* Not kicked out */
3891 * @brief Ź¤«¤é¤ÎÇäµÑ½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
3892 * Sell an item to the store (or home)
3895 static void store_sell(void)
3901 s32b price, value, dummy;
3910 char o_name[MAX_NLEN];
3913 /* Prepare a prompt */
3914 if (cur_store_num == STORE_HOME)
3916 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÃÖ¤¤Þ¤¹¤«? ";
3918 q = "Drop which item? ";
3921 else if (cur_store_num == STORE_MUSEUM)
3923 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò´ó£¤·¤Þ¤¹¤«? ";
3925 q = "Give which item? ";
3930 q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÇä¤ê¤Þ¤¹¤«? ";
3932 q = "Sell which item? ";
3936 item_tester_no_ryoute = TRUE;
3937 /* Only allow items the store will buy */
3938 item_tester_hook = store_will_buy;
3941 /* ²æ¤¬²È¤Ç¤ª¤«¤·¤Ê¥á¥Ã¥»¡¼¥¸¤¬½Ð¤ë¥ª¥ê¥¸¥Ê¥ë¤Î¥Ð¥°¤ò½¤Àµ */
3942 if (cur_store_num == STORE_HOME)
3945 s = "ÃÖ¤±¤ë¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó¡£";
3947 s = "You don't have any item to drop.";
3950 else if (cur_store_num == STORE_MUSEUM)
3953 s = "´ó£¤Ç¤¤ë¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó¡£";
3955 s = "You don't have any item to give.";
3961 s = "Íߤ·¤¤Êª¤¬¤Ê¤¤¤Ç¤¹¤Í¤¨¡£";
3963 s = "You have nothing that I want.";
3967 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
3969 /* Get the item (in the pack) */
3972 o_ptr = &inventory[item];
3975 /* Get the item (on the floor) */
3978 o_ptr = &o_list[0 - item];
3982 /* Hack -- Cannot remove cursed items */
3983 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
3987 msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¤½¤ì¤Ï¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¤Í¡£");
3989 msg_print("Hmmm, it seems to be cursed.");
3998 /* Assume one item */
4001 /* Find out how many the player wants (letter means "all") */
4002 if (o_ptr->number > 1)
4004 /* Get a quantity */
4005 amt = get_quantity(NULL, o_ptr->number);
4007 /* Allow user abort */
4008 if (amt <= 0) return;
4011 /* Get local object */
4014 /* Get a copy of the object */
4015 object_copy(q_ptr, o_ptr);
4017 /* Modify quantity */
4018 q_ptr->number = amt;
4021 * Hack -- If a rod or wand, allocate total maximum
4022 * timeouts or charges to those being sold. -LM-
4024 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4026 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4029 /* Get a full description */
4030 object_desc(o_name, q_ptr, 0);
4032 /* Remove any inscription, feeling for stores */
4033 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4035 q_ptr->inscription = 0;
4036 q_ptr->feeling = FEEL_NONE;
4039 /* Is there room in the store (or the home?) */
4040 if (!store_check_num(q_ptr))
4042 if (cur_store_num == STORE_HOME)
4044 msg_print("²æ¤¬²È¤Ë¤Ï¤â¤¦ÃÖ¤¯¾ì½ê¤¬¤Ê¤¤¡£");
4046 msg_print("Your home is full.");
4049 else if (cur_store_num == STORE_MUSEUM)
4051 msg_print("Çîʪ´Û¤Ï¤â¤¦ËþÇÕ¤À¡£");
4053 msg_print("Museum is full.");
4058 msg_print("¤¹¤¤¤Þ¤»¤ó¤¬¡¢Å¹¤Ë¤Ï¤â¤¦ÃÖ¤¯¾ì½ê¤¬¤¢¤ê¤Þ¤»¤ó¡£");
4060 msg_print("I have not the room in my store to keep it.");
4068 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4070 /* Describe the transaction */
4072 msg_format("%s(%c)¤òÇäµÑ¤¹¤ë¡£", o_name, index_to_label(item));
4074 msg_format("Selling %s (%c).", o_name, index_to_label(item));
4080 choice = sell_haggle(q_ptr, &price);
4083 if (st_ptr->store_open >= turn) return;
4095 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
4096 chg_virtue(V_JUSTICE, -1);
4098 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
4099 chg_virtue(V_NATURE, 1);
4102 /* Get some money */
4105 /* Update the display */
4108 /* Get the "apparent" value */
4109 dummy = object_value(q_ptr) * q_ptr->number;
4112 identify_item(o_ptr);
4114 /* Get local object */
4117 /* Get a copy of the object */
4118 object_copy(q_ptr, o_ptr);
4120 /* Modify quantity */
4121 q_ptr->number = amt;
4123 /* Make it look like to be known */
4124 q_ptr->ident |= IDENT_STORE;
4127 * Hack -- If a rod or wand, let the shopkeeper know just
4128 * how many charges he really paid for. -LM-
4130 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4132 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4135 /* Get the "actual" value */
4136 value = object_value(q_ptr) * q_ptr->number;
4138 /* Get the description all over again */
4139 object_desc(o_name, q_ptr, 0);
4141 /* Describe the result (in message buffer) */
4143 msg_format("%s¤ò $%ld¤ÇÇäµÑ¤·¤Þ¤·¤¿¡£", o_name, (long)price);
4145 msg_format("You sold %s for %ld gold.", o_name, (long)price);
4148 if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
4150 if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
4152 /* Analyze the prices (and comment verbally) unless a figurine*/
4153 purchase_analyze(price, value, dummy);
4157 * Hack -- Allocate charges between those wands or rods sold
4158 * and retained, unless all are being sold. -LM-
4160 distribute_charges(o_ptr, q_ptr, amt);
4162 /* Reset timeouts of the sold items */
4165 /* Take the item from the player, describe the result */
4166 inven_item_increase(item, -amt);
4167 inven_item_describe(item);
4169 /* If items remain, auto-inscribe before optimizing */
4170 if (o_ptr->number > 0)
4171 autopick_alter_item(item, FALSE);
4173 inven_item_optimize(item);
4178 /* The store gets that (known) item */
4179 item_pos = store_carry(q_ptr);
4181 /* Re-display if item is now in store */
4184 store_top = (item_pos / store_bottom) * store_bottom;
4185 display_inventory();
4190 /* Player is at museum */
4191 else if (cur_store_num == STORE_MUSEUM)
4193 char o2_name[MAX_NLEN];
4194 object_desc(o2_name, q_ptr, OD_NAME_ONLY);
4196 if (-1 == store_check_num(q_ptr))
4199 msg_print("¤½¤ì¤ÈƱ¤¸ÉÊʪ¤Ï´û¤ËÇîʪ´Û¤Ë¤¢¤ë¤è¤¦¤Ç¤¹¡£");
4201 msg_print("The same object as it is already in the Museum.");
4207 msg_print("Çîʪ´Û¤Ë´ó£¤·¤¿¤â¤Î¤Ï¼è¤ê½Ð¤¹¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¡ª¡ª");
4209 msg_print("You cannot take items which is given to the Museum back!!");
4213 if (!get_check(format("ËÜÅö¤Ë%s¤ò´ó£¤·¤Þ¤¹¤«¡©", o2_name))) return;
4215 if (!get_check(format("Really give %s to the Museum? ", o2_name))) return;
4219 identify_item(q_ptr);
4220 q_ptr->ident |= IDENT_MENTAL;
4222 /* Distribute charges of wands/rods */
4223 distribute_charges(o_ptr, q_ptr, amt);
4227 msg_format("%s¤òÃÖ¤¤¤¿¡£(%c)", o_name, index_to_label(item));
4229 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4234 /* Take it from the players inventory */
4235 inven_item_increase(item, -amt);
4236 inven_item_describe(item);
4237 inven_item_optimize(item);
4242 /* Let the home carry it */
4243 item_pos = home_carry(q_ptr);
4245 /* Update store display */
4248 store_top = (item_pos / store_bottom) * store_bottom;
4249 display_inventory();
4252 /* Player is at home */
4255 /* Distribute charges of wands/rods */
4256 distribute_charges(o_ptr, q_ptr, amt);
4260 msg_format("%s¤òÃÖ¤¤¤¿¡£(%c)", o_name, index_to_label(item));
4262 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4267 /* Take it from the players inventory */
4268 inven_item_increase(item, -amt);
4269 inven_item_describe(item);
4270 inven_item_optimize(item);
4275 /* Let the home carry it */
4276 item_pos = home_carry(q_ptr);
4278 /* Update store display */
4281 store_top = (item_pos / store_bottom) * store_bottom;
4282 display_inventory();
4286 if ((choice == 0) && (item >= INVEN_RARM))
4295 * @brief Ź¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
4296 * Examine an item in a store -JDL-
4299 static void store_examine(void)
4304 char o_name[MAX_NLEN];
4309 if (st_ptr->stock_num <= 0)
4311 if (cur_store_num == STORE_HOME)
4313 msg_print("²æ¤¬²È¤Ë¤Ï²¿¤âÃÖ¤¤¤Æ¤¢¤ê¤Þ¤»¤ó¡£");
4315 msg_print("Your home is empty.");
4318 else if (cur_store_num == STORE_MUSEUM)
4320 msg_print("Çîʪ´Û¤Ë¤Ï²¿¤âÃÖ¤¤¤Æ¤¢¤ê¤Þ¤»¤ó¡£");
4322 msg_print("Museum is empty.");
4327 msg_print("¸½ºß¾¦Éʤκ߸ˤòÀڤ餷¤Æ¤¤¤Þ¤¹¡£");
4329 msg_print("I am currently out of stock.");
4336 /* Find the number of objects on this and following pages */
4337 i = (st_ptr->stock_num - store_top);
4339 /* And then restrict it to the current page */
4340 if (i > store_bottom) i = store_bottom;
4344 sprintf(out_val, "¤É¤ì¤òÄ´¤Ù¤Þ¤¹¤«¡©");
4346 sprintf(out_val, "Which item do you want to examine? ");
4350 /* Get the item number to be examined */
4351 if (!get_stock(&item, out_val, 0, i - 1)) return;
4353 /* Get the actual index */
4354 item = item + store_top;
4356 /* Get the actual item */
4357 o_ptr = &st_ptr->stock[item];
4359 /* Require full knowledge */
4360 if (!(o_ptr->ident & IDENT_MENTAL))
4362 /* This can only happen in the home */
4364 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ä¤¤¤ÆÆäËÃΤäƤ¤¤ë¤³¤È¤Ï¤Ê¤¤¡£");
4366 msg_print("You have no special knowledge about that item.");
4373 object_desc(o_name, o_ptr, 0);
4377 msg_format("%s¤òÄ´¤Ù¤Æ¤¤¤ë...", o_name);
4379 msg_format("Examining %s...", o_name);
4383 /* Describe it fully */
4384 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
4386 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
4388 msg_print("You see nothing special.");
4397 * @brief Çîʪ´Û¤Î¥¢¥¤¥Æ¥à¤ò½üµî¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
4398 * Remove an item from museum (Originally from TOband)
4401 static void museum_remove_object(void)
4406 char o_name[MAX_NLEN];
4410 if (st_ptr->stock_num <= 0)
4413 msg_print("Çîʪ´Û¤Ë¤Ï²¿¤âÃÖ¤¤¤Æ¤¢¤ê¤Þ¤»¤ó¡£");
4415 msg_print("Museum is empty.");
4421 /* Find the number of objects on this and following pages */
4422 i = st_ptr->stock_num - store_top;
4424 /* And then restrict it to the current page */
4425 if (i > store_bottom) i = store_bottom;
4429 sprintf(out_val, "¤É¤Î¥¢¥¤¥Æ¥à¤ÎŸ¼¨¤ò¤ä¤á¤µ¤»¤Þ¤¹¤«¡©");
4431 sprintf(out_val, "Which item do you want to order to remove? ");
4434 /* Get the item number to be removed */
4435 if (!get_stock(&item, out_val, 0, i - 1)) return;
4437 /* Get the actual index */
4438 item = item + store_top;
4440 /* Get the actual item */
4441 o_ptr = &st_ptr->stock[item];
4444 object_desc(o_name, o_ptr, 0);
4447 msg_print("Ÿ¼¨¤ò¤ä¤á¤µ¤»¤¿¥¢¥¤¥Æ¥à¤ÏÆóÅ٤ȸ«¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡ª");
4448 if (!get_check(format("ËÜÅö¤Ë%s¤ÎŸ¼¨¤ò¤ä¤á¤µ¤»¤Þ¤¹¤«¡©", o_name))) return;
4450 msg_print("You cannot see items which is removed from the Museum!");
4451 if (!get_check(format("Really order to remove %s from the Museum? ", o_name))) return;
4456 msg_format("%s¤ÎŸ¼¨¤ò¤ä¤á¤µ¤»¤¿¡£", o_name);
4458 msg_format("You ordered to remove %s.", o_name);
4461 /* Remove the items from the home */
4462 store_item_increase(item, -o_ptr->number);
4463 store_item_optimize(item);
4465 (void)combine_and_reorder_home(STORE_MUSEUM);
4467 /* The item is gone */
4470 if (st_ptr->stock_num == 0) store_top = 0;
4472 /* Nothing left on that screen */
4473 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4475 /* Redraw everything */
4476 display_inventory();
4483 * Hack -- set this to leave the store
4485 static bool leave_store = FALSE;
4489 * @brief ŹÊÞ½èÍý¥³¥Þ¥ó¥ÉÁªÂò¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
4490 * Process a command in a store
4494 * Note that we must allow the use of a few "special" commands
4495 * in the stores which are not allowed in the dungeon, and we
4496 * must disable some commands which are allowed in the dungeon
4497 * but not in the stores, to prevent chaos.
4500 static void store_process_command(void)
4502 #ifdef ALLOW_REPEAT /* TNB */
4504 /* Handle repeating the last command */
4507 #endif /* ALLOW_REPEAT -- TNB */
4509 if (rogue_like_commands && command_cmd == 'l')
4511 command_cmd = 'x'; /* hack! */
4514 /* Parse the command */
4515 switch (command_cmd)
4525 /* 1 ¥Ú¡¼¥¸Ìá¤ë¥³¥Þ¥ó¥É: ²æ¤¬²È¤Î¥Ú¡¼¥¸¿ô¤¬Â¿¤¤¤Î¤Ç½ÅÊõ¤¹¤ë¤Ï¤º By BUG */
4528 if (st_ptr->stock_num <= store_bottom) {
4530 msg_print("¤³¤ì¤ÇÁ´Éô¤Ç¤¹¡£");
4532 msg_print("Entire inventory is shown.");
4536 store_top -= store_bottom;
4537 if ( store_top < 0 )
4538 store_top = ((st_ptr->stock_num - 1 )/store_bottom) * store_bottom;
4539 if ( (cur_store_num == STORE_HOME) && (powerup_home == FALSE) )
4540 if ( store_top >= store_bottom ) store_top = store_bottom;
4541 display_inventory();
4549 if (st_ptr->stock_num <= store_bottom)
4552 msg_print("¤³¤ì¤ÇÁ´Éô¤Ç¤¹¡£");
4554 msg_print("Entire inventory is shown.");
4560 store_top += store_bottom;
4562 * ±£¤·¥ª¥×¥·¥ç¥ó(powerup_home)¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¤¤Ï
4563 * ²æ¤¬²È¤Ç¤Ï 2 ¥Ú¡¼¥¸¤Þ¤Ç¤·¤«É½¼¨¤·¤Ê¤¤
4565 if ((cur_store_num == STORE_HOME) &&
4566 (powerup_home == FALSE) &&
4567 (st_ptr->stock_num >= STORE_INVEN_MAX))
4569 if (store_top >= (STORE_INVEN_MAX - 1))
4576 if (store_top >= st_ptr->stock_num) store_top = 0;
4579 display_inventory();
4592 /* Get (purchase) */
4619 /*** Inventory Commands ***/
4621 /* Wear/wield equipment */
4628 /* Take off equipment */
4635 /* Destroy an item */
4642 /* Equipment list */
4649 /* Inventory list */
4657 /*** Various commands ***/
4659 /* Identify an object */
4666 /* Hack -- toggle windows */
4669 toggle_inven_equip();
4675 /*** Use various objects ***/
4680 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4681 (p_ptr->pclass == CLASS_BERSERKER) ||
4682 (p_ptr->pclass == CLASS_NINJA) ||
4683 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4684 ) do_cmd_mind_browse();
4685 else if (p_ptr->pclass == CLASS_SMITH)
4687 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4688 do_cmd_magic_eater(TRUE, FALSE);
4689 else if (p_ptr->pclass == CLASS_SNIPER)
4690 do_cmd_snipe_browse();
4691 else do_cmd_browse();
4695 /* Inscribe an object */
4702 /* Uninscribe an object */
4705 do_cmd_uninscribe();
4711 /*** Help and Such ***/
4720 /* Identify symbol */
4723 do_cmd_query_symbol();
4727 /* Character description */
4730 p_ptr->town_num = old_town_num;
4731 do_cmd_change_name();
4732 p_ptr->town_num = inner_town_num;
4738 /*** System Commands ***/
4740 /* Hack -- User interface */
4747 /* Single line from a pref file */
4750 p_ptr->town_num = old_town_num;
4752 p_ptr->town_num = inner_town_num;
4756 /* Interact with macros */
4759 p_ptr->town_num = old_town_num;
4761 p_ptr->town_num = inner_town_num;
4765 /* Interact with visuals */
4768 p_ptr->town_num = old_town_num;
4770 p_ptr->town_num = inner_town_num;
4774 /* Interact with colors */
4777 p_ptr->town_num = old_town_num;
4779 p_ptr->town_num = inner_town_num;
4783 /* Interact with options */
4787 (void)combine_and_reorder_home(STORE_HOME);
4793 /*** Misc Commands ***/
4809 /* Repeat level feeling */
4816 /* Show previous message */
4819 do_cmd_message_one();
4823 /* Show previous messages */
4836 /* Check artifacts, uniques etc. */
4843 /* Load "screen dump" */
4846 do_cmd_load_screen();
4850 /* Save "screen dump" */
4853 do_cmd_save_screen();
4857 /* Hack -- Unknown command */
4860 if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
4862 museum_remove_object();
4867 msg_print("¤½¤Î¥³¥Þ¥ó¥É¤ÏŹ¤ÎÃæ¤Ç¤Ï»È¤¨¤Þ¤»¤ó¡£");
4869 msg_print("That command does not work in stores.");
4880 * @brief ŹÊÞ½èÍýÁ´ÂΤΥᥤ¥ó¥ë¡¼¥Á¥ó /
4881 * Enter a store, and interact with it. *
4885 * Note that we use the standard "request_command()" function
4886 * to get a command, allowing us to use "command_arg" and all
4887 * command macros and other nifty stuff, but we use the special
4888 * "shopping" argument, to force certain commands to be converted
4889 * into other commands, normally, we convert "p" (pray) and "m"
4890 * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
4893 void do_cmd_store(void)
4899 bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
4903 Term_get_size(&w, &h);
4905 /* Calculate stocks per 1 page */
4906 xtra_stock = MIN(14+26, ((h > 24) ? (h - 24) : 0));
4907 store_bottom = MIN_STOCK + xtra_stock;
4909 /* Access the player grid */
4910 c_ptr = &cave[py][px];
4912 /* Verify a store */
4913 if (!cave_have_flag_grid(c_ptr, FF_STORE))
4916 msg_print("¤³¤³¤Ë¤ÏŹ¤¬¤¢¤ê¤Þ¤»¤ó¡£");
4918 msg_print("You see no store here.");
4924 /* Extract the store code */
4925 which = f_info[c_ptr->feat].subtype;
4927 old_town_num = p_ptr->town_num;
4928 if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
4929 if (dun_level) p_ptr->town_num = NO_TOWN;
4930 inner_town_num = p_ptr->town_num;
4932 /* Hack -- Check the "locked doors" */
4933 if ((town[p_ptr->town_num].store[which].store_open >= turn) ||
4937 msg_print("¥É¥¢¤Ë¸°¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£");
4939 msg_print("The doors are locked.");
4942 p_ptr->town_num = old_town_num;
4946 /* Calculate the number of store maintainances since the last visit */
4947 maintain_num = (turn - town[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
4949 /* Maintain the store max. 10 times */
4950 if (maintain_num > 10) maintain_num = 10;
4954 /* Maintain the store */
4955 for (i = 0; i < maintain_num; i++)
4956 store_maint(p_ptr->town_num, which);
4958 /* Save the visit */
4959 town[p_ptr->town_num].store[which].last_visit = turn;
4962 /* Forget the lite */
4965 /* Forget the view */
4969 /* Hack -- Character is in "icky" mode */
4970 character_icky = TRUE;
4973 /* No command argument */
4976 /* No repeated command */
4979 /* No automatic command */
4982 /* Do not expand macros */
4983 get_com_no_macros = TRUE;
4985 /* Save the store number */
4986 cur_store_num = which;
4988 /* Hack -- save the store feature */
4989 cur_store_feat = c_ptr->feat;
4991 /* Save the store and owner pointers */
4992 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
4993 ot_ptr = &owners[cur_store_num][st_ptr->owner];
4996 /* Start at the beginning */
4999 /* Display the store */
5003 leave_store = FALSE;
5005 /* Interact with player */
5006 while (!leave_store)
5008 /* Hack -- Clear line 1 */
5012 clear_from(20 + xtra_stock);
5015 /* Basic commands */
5017 prt(" ESC) ·úʪ¤«¤é½Ð¤ë", 21 + xtra_stock, 0);
5019 prt(" ESC) Exit from Building.", 21 + xtra_stock, 0);
5023 /* Browse if necessary */
5024 if (st_ptr->stock_num > store_bottom)
5027 prt(" -)Á°¥Ú¡¼¥¸", 22 + xtra_stock, 0);
5028 prt(" ¥¹¥Ú¡¼¥¹) ¼¡¥Ú¡¼¥¸", 23 + xtra_stock, 0);
5030 prt(" -) Previous page", 22 + xtra_stock, 0);
5031 prt(" SPACE) Next page", 23 + xtra_stock, 0);
5037 if (cur_store_num == STORE_HOME)
5040 prt("g) ¥¢¥¤¥Æ¥à¤ò¼è¤ë", 21 + xtra_stock, 27);
5041 prt("d) ¥¢¥¤¥Æ¥à¤òÃÖ¤¯", 22 + xtra_stock, 27);
5042 prt("x) ²È¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë", 23 + xtra_stock, 27);
5044 prt("g) Get an item.", 21 + xtra_stock, 27);
5045 prt("d) Drop an item.", 22 + xtra_stock, 27);
5046 prt("x) eXamine an item in the home.", 23 + xtra_stock, 27);
5050 /* Museum commands */
5051 else if (cur_store_num == STORE_MUSEUM)
5054 prt("d) ¥¢¥¤¥Æ¥à¤òÃÖ¤¯", 21 + xtra_stock, 27);
5055 prt("r) ¥¢¥¤¥Æ¥à¤ÎŸ¼¨¤ò¤ä¤á¤ë", 22 + xtra_stock, 27);
5056 prt("x) Çîʪ´Û¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤ë", 23 + xtra_stock, 27);
5058 prt("d) Drop an item.", 21 + xtra_stock, 27);
5059 prt("r) order to Remove an item.", 22 + xtra_stock, 27);
5060 prt("x) eXamine an item in the museum.", 23 + xtra_stock, 27);
5064 /* Shop commands XXX XXX XXX */
5068 prt("p) ¾¦ÉʤòÇ㤦", 21 + xtra_stock, 30);
5069 prt("s) ¥¢¥¤¥Æ¥à¤òÇä¤ë", 22 + xtra_stock, 30);
5070 prt("x) ¾¦ÉʤòÄ´¤Ù¤ë", 23 + xtra_stock,30);
5072 prt("p) Purchase an item.", 21 + xtra_stock, 30);
5073 prt("s) Sell an item.", 22 + xtra_stock, 30);
5074 prt("x) eXamine an item in the shop", 23 + xtra_stock,30);
5079 /* ´ðËÜŪ¤Ê¥³¥Þ¥ó¥É¤ÎÄɲÃɽ¼¨ */
5081 prt("i/e) »ý¤Áʪ/ÁõÈ÷¤Î°ìÍ÷", 21 + xtra_stock, 56);
5083 if (rogue_like_commands)
5085 prt("w/T) ÁõÈ÷¤¹¤ë/¤Ï¤º¤¹", 22 + xtra_stock, 56);
5089 prt("w/t) ÁõÈ÷¤¹¤ë/¤Ï¤º¤¹", 22 + xtra_stock, 56);
5092 prt("i/e) Inventry/Equipment list", 21 + xtra_stock, 56);
5094 if (rogue_like_commands)
5096 prt("w/T) Wear/Take off equipment", 22 + xtra_stock, 56);
5100 prt("w/t) Wear/Take off equipment", 22 + xtra_stock, 56);
5105 prt("¥³¥Þ¥ó¥É:", 20 + xtra_stock, 0);
5107 prt("You may: ", 20 + xtra_stock, 0);
5112 request_command(TRUE);
5114 /* Process the command */
5115 store_process_command();
5118 * Hack -- To redraw missiles damage and prices in store
5119 * If player's charisma changes, or if player changes a bow, PU_BONUS is set
5121 need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
5123 /* Hack -- Character is still in "icky" mode */
5124 character_icky = TRUE;
5132 /* XXX XXX XXX Pack Overflow */
5133 if (inventory[INVEN_PACK].k_idx)
5135 int item = INVEN_PACK;
5137 object_type *o_ptr = &inventory[item];
5139 /* Hack -- Flee from the store */
5140 if (cur_store_num != STORE_HOME)
5144 if (cur_store_num == STORE_MUSEUM)
5145 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤½¤¦¤Ê¤Î¤Ç¡¢¤¢¤ï¤Æ¤ÆÇîʪ´Û¤«¤é½Ð¤¿...");
5147 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤½¤¦¤Ê¤Î¤Ç¡¢¤¢¤ï¤Æ¤ÆŹ¤«¤é½Ð¤¿...");
5149 if (cur_store_num == STORE_MUSEUM)
5150 msg_print("Your pack is so full that you flee the Museum...");
5152 msg_print("Your pack is so full that you flee the store...");
5160 /* Hack -- Flee from the home */
5161 else if (!store_check_num(o_ptr))
5165 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤½¤¦¤Ê¤Î¤Ç¡¢¤¢¤ï¤Æ¤Æ²È¤«¤é½Ð¤¿...");
5167 msg_print("Your pack is so full that you flee your home...");
5175 /* Hack -- Drop items into the home */
5183 char o_name[MAX_NLEN];
5186 /* Give a message */
5188 msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
5190 msg_print("Your pack overflows!");
5194 /* Get local object */
5197 /* Grab a copy of the item */
5198 object_copy(q_ptr, o_ptr);
5201 object_desc(o_name, q_ptr, 0);
5205 msg_format("%s¤¬Íî¤Á¤¿¡£(%c)", o_name, index_to_label(item));
5207 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5211 /* Remove it from the players inventory */
5212 inven_item_increase(item, -255);
5213 inven_item_describe(item);
5214 inven_item_optimize(item);
5219 /* Let the home carry it */
5220 item_pos = home_carry(q_ptr);
5222 /* Redraw the home */
5225 store_top = (item_pos / store_bottom) * store_bottom;
5226 display_inventory();
5231 /* Hack -- Redisplay store prices if charisma changes */
5232 /* Hack -- Redraw missiles damage if player changes bow */
5233 if (need_redraw_store_inv) display_inventory();
5235 /* Hack -- get kicked out of the store */
5236 if (st_ptr->store_open >= turn) leave_store = TRUE;
5239 p_ptr->town_num = old_town_num;
5241 /* Free turn XXX XXX XXX */
5245 /* Hack -- Character is no longer in "icky" mode */
5246 character_icky = FALSE;
5249 /* Hack -- Cancel automatic command */
5252 /* Hack -- Cancel "see" mode */
5253 command_see = FALSE;
5255 /* Allow expanding macros */
5256 get_com_no_macros = FALSE;
5258 /* Flush messages XXX XXX XXX */
5262 /* Clear the screen */
5266 /* Update everything */
5267 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
5268 p_ptr->update |= (PU_MONSTERS);
5270 /* Redraw entire screen */
5271 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5274 p_ptr->redraw |= (PR_MAP);
5277 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5283 * @brief ¸½ºß¤ÎÄ®¤ÎŹ¼ç¤ò¸òÂ夵¤»¤ë /
5284 * Shuffle one of the stores.
5285 * @param ŹÊÞ¼ïÎà¤ÎID
5288 void store_shuffle(int which)
5294 if (which == STORE_HOME) return;
5295 if (which == STORE_MUSEUM) return;
5298 /* Save the store index */
5299 cur_store_num = which;
5301 /* Activate that store */
5302 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
5305 /* Pick a new owner */
5308 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5309 if (j == st_ptr->owner) continue;
5310 for (i = 1;i < max_towns; i++)
5312 if (i == p_ptr->town_num) continue;
5313 if (st_ptr->owner == town[i].store[cur_store_num].owner) break;
5315 if (i == max_towns) break;
5318 /* Activate the new owner */
5319 ot_ptr = &owners[cur_store_num][st_ptr->owner];
5322 /* Reset the owner data */
5323 st_ptr->insult_cur = 0;
5324 st_ptr->store_open = 0;
5325 st_ptr->good_buy = 0;
5326 st_ptr->bad_buy = 0;
5329 /* Hack -- discount all the items */
5330 for (i = 0; i < st_ptr->stock_num; i++)
5335 o_ptr = &st_ptr->stock[i];
5337 if (!object_is_artifact(o_ptr))
5339 /* Hack -- Sell all non-artifact old items for "half price" */
5340 o_ptr->discount = 50;
5342 /* Hack -- Items are no longer "fixed price" */
5343 o_ptr->ident &= ~(IDENT_FIXED);
5345 /* Mega-Hack -- Note that the item is "on sale" */
5347 o_ptr->inscription = quark_add("Çä½ÐÃæ");
5349 o_ptr->inscription = quark_add("on sale");
5357 * @brief Ź¤ÎÉÊ·¤¨¤òÊѲ½¤µ¤»¤ë /
5358 * Maintain the inventory at the stores.
5359 * @param town_num Ä®¤ÎID
5360 * @param store_num ŹÊÞ¼ïÎà¤ÎID
5363 void store_maint(int town_num, int store_num)
5367 cur_store_num = store_num;
5370 if (store_num == STORE_HOME) return;
5371 if (store_num == STORE_MUSEUM) return;
5373 /* Activate that store */
5374 st_ptr = &town[town_num].store[store_num];
5376 /* Activate the owner */
5377 ot_ptr = &owners[store_num][st_ptr->owner];
5379 /* Store keeper forgives the player */
5380 st_ptr->insult_cur = 0;
5382 /* Mega-Hack -- prune the black market */
5383 if (store_num == STORE_BLACK)
5385 /* Destroy crappy black market items */
5386 for (j = st_ptr->stock_num - 1; j >= 0; j--)
5388 object_type *o_ptr = &st_ptr->stock[j];
5390 /* Destroy crappy items */
5391 if (black_market_crap(o_ptr))
5393 /* Destroy the item */
5394 store_item_increase(j, 0 - o_ptr->number);
5395 store_item_optimize(j);
5401 /* Choose the number of slots to keep */
5402 j = st_ptr->stock_num;
5404 /* Sell a few items */
5405 j = j - randint1(STORE_TURNOVER);
5407 /* Never keep more than "STORE_MAX_KEEP" slots */
5408 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5410 /* Always "keep" at least "STORE_MIN_KEEP" items */
5411 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5413 /* Hack -- prevent "underflow" */
5416 /* Destroy objects until only "j" slots are left */
5417 while (st_ptr->stock_num > j) store_delete();
5420 /* Choose the number of slots to fill */
5421 j = st_ptr->stock_num;
5423 /* Buy some more items */
5424 j = j + randint1(STORE_TURNOVER);
5426 /* Never keep more than "STORE_MAX_KEEP" slots */
5427 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5429 /* Always "keep" at least "STORE_MIN_KEEP" items */
5430 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5432 /* Hack -- prevent "overflow" */
5433 if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1;
5435 /* Acquire some new items */
5436 while (st_ptr->stock_num < j) store_create();
5441 * @brief ŹÊÞ¾ðÊó¤ò½é´ü²½¤¹¤ë /
5442 * Initialize the stores
5443 * @param town_num Ä®¤ÎID
5444 * @param store_num ŹÊÞ¼ïÎà¤ÎID
5447 void store_init(int town_num, int store_num)
5451 cur_store_num = store_num;
5453 /* Activate that store */
5454 st_ptr = &town[town_num].store[store_num];
5462 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5463 for (i = 1;i < max_towns; i++)
5465 if (i == town_num) continue;
5466 if (st_ptr->owner == town[i].store[store_num].owner) break;
5468 if (i == max_towns) break;
5471 /* Activate the new owner */
5472 ot_ptr = &owners[store_num][st_ptr->owner];
5475 /* Initialize the store */
5476 st_ptr->store_open = 0;
5477 st_ptr->insult_cur = 0;
5478 st_ptr->good_buy = 0;
5479 st_ptr->bad_buy = 0;
5481 /* Nothing in stock */
5482 st_ptr->stock_num = 0;
5485 * MEGA-HACK - Last visit to store is
5486 * BEFORE player birth to enable store restocking
5488 st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5490 /* Clear any old items */
5491 for (k = 0; k < st_ptr->stock_size; k++)
5493 object_wipe(&st_ptr->stock[k]);
5499 * @brief ¥¢¥¤¥Æ¥à¤òÄ®¤Î¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Ë°ÜÆ°¤µ¤»¤ë /
5500 * @param o_ptr °ÜÆ°¤µ¤»¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
5503 void move_to_black_market(object_type *o_ptr)
5506 if (!p_ptr->town_num) return;
5508 st_ptr = &town[p_ptr->town_num].store[STORE_BLACK];
5510 o_ptr->ident |= IDENT_STORE;
5512 (void)store_carry(o_ptr);
5514 object_wipe(o_ptr); /* Don't leave a bogus object behind... */