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.
15 #include "cmd-zapwand.h"
16 #include "cmd-magiceat.h"
20 static int cur_store_num = 0;
21 static int store_top = 0;
22 static int store_bottom = 0;
23 static int xtra_stock = 0;
24 static store_type *st_ptr = NULL;
25 static const owner_type *ot_ptr = NULL;
26 static s16b old_town_num = 0;
27 static s16b inner_town_num = 0;
28 #define RUMOR_CHANCE 8
30 #define MAX_COMMENT_1 6
32 static cptr comment_1[MAX_COMMENT_1] =
53 /*! ブラックマーケット追加メッセージ(承諾) */
54 static cptr comment_1_B[MAX_COMMENT_1] = {
63 #define MAX_COMMENT_2A 2
65 static cptr comment_2a[MAX_COMMENT_2A] =
68 "私の忍耐力を試しているのかい? $%s が最後だ。",
69 "我慢にも限度があるぞ。 $%s が最後だ。"
71 "You try my patience. %s is final.",
72 "My patience grows thin. %s is final."
77 #define MAX_COMMENT_2B 12
79 static cptr comment_2b[MAX_COMMENT_2B] =
82 " $%s ぐらいは出さなきゃダメだよ。",
85 "何て奴だ! $%s 以下はあり得ないぞ。",
86 "それじゃ少なすぎる! $%s は欲しいところだ。",
87 "バカにしている! $%s はもらわないと。",
89 "おいおい! $%s を考えてくれないか?",
90 "1000匹のオークのノミに苦しめられるがいい! $%s だ。",
91 "お前の大切なものに災いあれ! $%s でどうだ。",
92 "モルゴスに賞味されるがいい!本当は $%s なんだろう?",
93 "お前の母親はオーガか! $%s は出すつもりなんだろ?"
95 "I can take no less than %s gold pieces.",
96 "I will accept no less than %s gold pieces.",
97 "Ha! No less than %s gold pieces.",
98 "You knave! No less than %s gold pieces.",
99 "That's a pittance! I want %s gold pieces.",
100 "That's an insult! I want %s gold pieces.",
101 "As if! How about %s gold pieces?",
102 "My arse! How about %s gold pieces?",
103 "May the fleas of 1000 orcs molest you! Try %s gold pieces.",
104 "May your most favourite parts go moldy! Try %s gold pieces.",
105 "May Morgoth find you tasty! Perhaps %s gold pieces?",
106 "Your mother was an Ogre! Perhaps %s gold pieces?"
112 /*! ブラックマーケット用追加メッセージ(売るとき) */
113 static cptr comment_2b_B[MAX_COMMENT_2B] = {
114 "いくら俺様がお人好しとはいえ $%s が限界だね。嫌なら帰りな。",
115 "金がないのかい、あんた?まずは家に帰って $%s 揃えてきな。",
116 "物の価値が分からん奴だな。これは $%s が普通なんだよ。",
117 "俺の付けた値段に文句があるのか? $%s が限界だ。",
118 "ひょっとして新手の冗談かい? $%s 持ってないなら帰りな。",
119 "うちは他の店とは違うんだよ。$%s ぐらいは出しな。",
120 "買う気がないなら帰りな。 $%s だと言っているんだ。",
121 "話にならないね。 $%s くらい持っているんだろ?",
122 "は?なんだそりゃ? $%s の間違いか、ひょっとして?",
123 "出口はあっちだよ。それとも $%s 出せるのかい、あんたに。",
124 "命知らずな奴だな。 $%s 出せば今日の所は勘弁してやるよ。",
125 "うちの店は貧乏人お断りだ。 $%s ぐらい出せないのかい?"
128 #define MAX_COMMENT_3A 2
130 static cptr comment_3a[MAX_COMMENT_3A] =
133 "私の忍耐力を試しているのかい? $%s が最後だ。",
134 "我慢にも限度があるぞ。 $%s が最後だ。"
136 "You try my patience. %s is final.",
137 "My patience grows thin. %s is final."
143 #define MAX_COMMENT_3B 12
145 static cptr comment_3b[MAX_COMMENT_3B] =
148 "本音を言うと $%s でいいんだろ?",
150 " $%s ぐらいなら出してもいいが。",
151 " $%s 以上払うなんて考えられないね。",
152 "まあ落ちついて。 $%s でどうだい?",
153 "そのガラクタなら $%s で引き取るよ。",
154 "それじゃ高すぎる! $%s がいいとこだろ。",
155 "どうせいらないんだろ! $%s でいいだろ?",
156 "だめだめ! $%s がずっとお似合いだよ。",
157 "バカにしている! $%s がせいぜいだ。",
158 " $%s なら嬉しいところだがなあ。",
159 " $%s 、それ以上はビタ一文出さないよ!"
161 "Perhaps %s gold pieces?",
162 "How about %s gold pieces?",
163 "I will pay no more than %s gold pieces.",
164 "I can afford no more than %s gold pieces.",
165 "Be reasonable. How about %s gold pieces?",
166 "I'll buy it as scrap for %s gold pieces.",
167 "That is too much! How about %s gold pieces?",
168 "That looks war surplus! Say %s gold pieces?",
169 "Never! %s is more like it.",
170 "That's an insult! %s is more like it.",
171 "%s gold pieces and be thankful for it!",
172 "%s gold pieces and not a copper more!"
178 /*! ブラックマーケット用追加メッセージ(買い取り) */
179 static cptr comment_3b_B[MAX_COMMENT_3B] = {
180 " $%s ってところだね。そのどうしようもないガラクタは。",
181 "この俺が $%s って言っているんだから、その通りにした方が身のためだぞ。",
182 "俺の優しさに甘えるのもいい加減にしておけ。 $%s だ。",
183 "その品なら $%s で売ってくれているがね、常識ある紳士はみんな。",
184 "こりゃまた、がめつい奴だな。いくら俺が温厚とはいえ $%s が限界だ。",
185 " $%s だ。別に俺はそんなガラクタ欲しくはないんだから。",
186 "俺の鑑定額が気に入らないのか? $%s 、嫌なら帰りな。",
187 " $%s で引き取ってやるよ。喜んで受け取りな、貧乏人。",
188 "物の価値が分からん奴は始末におえんな。それは $%s なんだよ。",
189 "そんなに金が欲しいのか、あんた? $%s で満足できんのか?",
190 "入る店間違えてんじゃないのか? $%s で嫌なら他をあたってくれ。",
191 "俺の言い値にケチをつける奴がいるとは! その度胸に免じて $%s だ。"
194 #define MAX_COMMENT_4A 4
196 static cptr comment_4a[MAX_COMMENT_4A] =
199 "もうたくさんだ!何度も私をわずらわせないでくれ!",
200 "うがー!一日の我慢の限度を超えている!",
201 "もういい!時間の無駄以外のなにものでもない!",
202 "もうやってられないよ!顔も見たくない!"
204 "Enough! You have abused me once too often!",
205 "Arghhh! I have had enough abuse for one day!",
206 "That does it! You shall waste my time no more!",
207 "This is getting nowhere! I'm going to Londis!"
213 /*! ブラックマーケット用追加メッセージ(怒りの頂点) */
214 static cptr comment_4a_B[MAX_COMMENT_4A] = {
215 "なめやがって!温厚な俺様でも限界があるってことを知れ!",
216 "俺をここまで怒らせて...命があるだけでもありがたいと思え!",
217 "ふざけてるのか!冷やかしなら相手を見てからにしろ!",
218 "いいかげんにしろ!今度こんなまねしたらただじゃおかねえぞ!"
221 #define MAX_COMMENT_4B 4
223 static cptr comment_4b[MAX_COMMENT_4B] =
232 "Get out of my sight!",
233 "Begone, you scoundrel!",
240 /*! ブラックマーケット用追加メッセージ(追い出し) */
241 static cptr comment_4b_B[MAX_COMMENT_4B] = {
248 #define MAX_COMMENT_5 8
250 static cptr comment_5[MAX_COMMENT_5] =
264 "You will have to do better than that!",
265 "Do you wish to do business or not?",
266 "You've got to be kidding!",
267 "You'd better be kidding!",
268 "You try my patience.",
269 "Hmmm, nice weather we're having."
275 /*! ブラックマーケット用追加メッセージ(怒り) */
276 static cptr comment_5_B[MAX_COMMENT_5] = {
287 #define MAX_COMMENT_6 4
289 static cptr comment_6[MAX_COMMENT_6] =
297 "I must have heard you wrong.",
298 "I'm sorry, I missed that.",
299 "I'm sorry, what was that?",
300 "Sorry, what was that again?"
308 * @brief 取引成功時の店主のメッセージ処理 /
312 static void say_comment_1(void)
315 /* ブラックマーケットのときは別のメッセージを出す */
316 if ( cur_store_num == STORE_BLACK ) {
317 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
320 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
323 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
327 if (one_in_(RUMOR_CHANCE))
330 msg_print("店主は耳うちした:");
332 msg_print("The shopkeeper whispers something into your ear:");
340 * @brief プレイヤーがアイテムを買う時の価格代案メッセージ処理 /
341 * Continue haggling (player is buying)
342 * @param value 店主の提示価格
343 * @param annoyed 店主のいらつき度
346 static void say_comment_2(s32b value, int annoyed)
350 /* Prepare a string to insert */
351 sprintf(tmp_val, "%ld", (long)value);
356 /* Formatted message */
357 msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
363 /* Formatted message */
365 /* ブラックマーケットの時は別のメッセージを出す */
366 if ( cur_store_num == STORE_BLACK ){
367 msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
370 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
373 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
381 * @brief プレイヤーがアイテムを売る時の価格代案メッセージ処理 /
382 * Continue haggling (player is selling)
383 * @param value 店主の提示価格
384 * @param annoyed 店主のいらつき度
387 static void say_comment_3(s32b value, int annoyed)
391 /* Prepare a string to insert */
392 sprintf(tmp_val, "%ld", (long)value);
397 /* Formatted message */
398 msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
404 /* Formatted message */
406 /* ブラックマーケットの時は別のメッセージを出す */
407 if ( cur_store_num == STORE_BLACK ){
408 msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
411 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
414 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
422 * @brief 店主がプレイヤーを追い出す時のメッセージ処理 /
423 * Kick 'da bum out. -RAK-
426 static void say_comment_4(void)
429 /* ブラックマーケットの時は別のメッセージを出す */
430 if ( cur_store_num == STORE_BLACK ){
431 msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
432 msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
435 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
436 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
439 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
440 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
447 * @brief 店主がプレイヤーに取り合わない時のメッセージ処理 /
448 * You are insulting me
451 static void say_comment_5(void)
454 /* ブラックマーケットの時は別のメッセージを出す */
455 if ( cur_store_num == STORE_BLACK ){
456 msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
459 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
462 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
469 * @brief 店主がプレイヤーの提示を理解できなかった時のメッセージ処理 /
470 * That makes no sense.
473 static void say_comment_6(void)
475 msg_print(comment_6[randint0(MAX_COMMENT_6)]);
479 #define MAX_COMMENT_7A 4
481 static cptr comment_7a[MAX_COMMENT_7A] =
486 "誰かがむせび泣く声が聞こえる...。",
491 "You hear someone sobbing...",
492 "The shopkeeper howls in agony!"
497 #define MAX_COMMENT_7B 4
499 static cptr comment_7b[MAX_COMMENT_7B] =
509 "The shopkeeper curses at you.",
510 "The shopkeeper glares at you."
515 #define MAX_COMMENT_7C 4
517 static cptr comment_7c[MAX_COMMENT_7C] =
526 "You've made my day!",
527 "The shopkeeper giggles.",
528 "The shopkeeper laughs loudly."
533 #define MAX_COMMENT_7D 4
535 static cptr comment_7d[MAX_COMMENT_7D] =
539 "こんなおいしい思いをしたら、真面目に働けなくなるなぁ。",
544 "I think I'll retire!",
545 "The shopkeeper jumps for joy.",
546 "The shopkeeper smiles gleefully."
553 * @brief 店主が交渉を終えた際の反応を返す処理 /
554 * Let a shop-keeper React to a purchase
555 * @param price アイテムの取引額
556 * @param value アイテムの実際価値
557 * @param guess 店主が当初予想していた価値
560 * We paid "price", it was worth "value", and we thought it was worth "guess"
562 static void purchase_analyze(s32b price, s32b value, s32b guess)
564 /* Item was worthless, but we bought it */
565 if ((value <= 0) && (price > value))
568 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
570 chg_virtue(V_HONOUR, -1);
571 chg_virtue(V_JUSTICE, -1);
577 /* Item was cheaper than we thought, and we paid more than necessary */
578 else if ((value < guess) && (price > value))
581 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
583 chg_virtue(V_JUSTICE, -1);
585 chg_virtue(V_HONOUR, -1);
591 /* Item was a good bargain, and we got away with it */
592 else if ((value > guess) && (value < (4 * guess)) && (price < value))
595 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
598 chg_virtue(V_HONOUR, -1);
600 chg_virtue(V_HONOUR, 1);
606 /* Item was a great bargain, and we got away with it */
607 else if ((value > guess) && (price < value))
610 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
613 chg_virtue(V_HONOUR, -1);
615 chg_virtue(V_HONOUR, 1);
617 if (10 * price < value)
618 chg_virtue(V_SACRIFICE, 1);
628 * We store the current "store feat" here so everyone can access it
630 static int cur_store_feat;
634 * Buying and selling adjustments for race combinations.
635 * Entry[owner][player] gives the basic "cost inflation".
637 static byte rgold_adj[MAX_RACES][MAX_RACES] =
639 /*Hum, HfE, Elf, Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
640 HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
641 Imp, Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
642 Angel, Demon, Kutar */
645 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
646 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
647 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
648 100, 120, 110, 105 },
651 { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
652 120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
653 120, 110, 110, 110, 120, 110, 100, 125, 100, 95, 140,
654 110, 115, 110, 110 },
657 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
658 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
659 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
660 110, 110, 105, 110 },
663 { 115, 110, 105, 95, 105, 110, 115, 130, 115, 105, 115,
664 125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
665 120, 110, 120, 120, 130, 110, 110, 130, 110, 95, 140,
666 115, 120, 105, 115 },
669 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
670 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
671 120, 101, 110, 110, 120, 120, 115, 130, 115, 95, 140,
672 115, 110, 110, 115 },
675 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
676 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
677 120, 105, 115, 115, 115, 115, 120, 130, 120, 95, 140,
678 115, 110, 115, 115 },
681 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
682 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
683 115, 125, 120, 120, 115, 120, 125, 115, 125, 95, 140,
684 115, 110, 115, 115 },
687 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
688 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
689 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
690 110, 110, 115, 110 },
693 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
694 120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
695 120, 105, 120, 120, 125, 120, 105, 135, 105, 95, 140,
696 100, 110, 110, 100 },
699 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
700 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
701 125, 115, 120, 120, 125, 120, 100, 125, 100, 95, 140,
702 110, 110, 105, 110 },
704 /* Human / Barbarian (copied from human) */
705 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
706 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
707 115, 105, 125, 125, 130, 125, 115, 120, 115, 95, 140,
708 100, 120, 110, 100 },
710 /* Half-Ogre: theoretical, copied from half-troll */
711 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
712 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
713 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
714 110, 110, 115, 110 },
716 /* Half-Giant: theoretical, copied from half-troll */
717 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
718 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
719 110, 115, 112, 112, 115, 112, 130, 120, 130, 95, 140,
720 110, 110, 115, 110 },
722 /* Half-Titan: theoretical, copied from High_Elf */
723 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
724 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
725 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
726 110, 110, 115, 110 },
728 /* Cyclops: theoretical, copied from half-troll */
729 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
730 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
731 110, 115, 112, 112, 115, 112, 130, 130, 130, 95, 140,
732 110, 110, 115, 110 },
734 /* Yeek: theoretical, copied from Half-Orc */
735 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
736 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
737 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
738 115, 110, 115, 115 },
740 /* Klackon: theoretical, copied from Gnome */
741 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
742 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
743 120, 101, 110, 110, 120, 120, 130, 130, 130, 95, 140,
744 115, 110, 115, 115 },
746 /* Kobold: theoretical, copied from Half-Orc */
747 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
748 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
749 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
750 115, 110, 115, 115 },
752 /* Nibelung: theoretical, copied from Dwarf */
753 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
754 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
755 120, 105, 115, 115, 120, 120, 130, 130, 130, 95, 140,
756 115, 135, 115, 115 },
759 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
760 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
761 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
762 110, 101, 115, 110 },
764 /* Draconian: theoretical, copied from High_Elf */
765 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
766 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
767 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
768 110, 110, 115, 110 },
770 /* Mind Flayer: theoretical, copied from High_Elf */
771 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
772 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
773 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
774 110, 110, 115, 110 },
776 /* Imp: theoretical, copied from High_Elf */
777 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
778 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
779 125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
780 110, 110, 115, 110 },
782 /* Golem: theoretical, copied from High_Elf */
783 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
784 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
785 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
786 110, 110, 115, 110 },
788 /* Skeleton: theoretical, copied from half-orc */
789 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
790 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
791 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
792 115, 110, 125, 115 },
794 /* Zombie: Theoretical, copied from half-orc */
795 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
796 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
797 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
798 115, 110, 125, 115 },
800 /* Vampire: Theoretical, copied from half-orc */
801 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
802 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
803 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
804 115, 110, 125, 115 },
806 /* Spectre: Theoretical, copied from half-orc */
807 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
808 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
809 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
810 115, 110, 125, 115 },
812 /* Sprite: Theoretical, copied from half-orc */
813 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
814 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
815 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
816 115, 110, 105, 115 },
818 /* Beastman: Theoretical, copied from half-orc */
819 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
820 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
821 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
822 115, 110, 115, 115 },
825 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
826 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
827 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
828 110, 110, 105, 110 },
831 { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
832 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
833 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 160,
837 { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
838 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
839 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
840 140, 140, 140, 140 },
843 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
844 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
845 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
846 100, 120, 110, 100 },
849 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
850 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
851 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
852 110, 101, 115, 110 },
855 { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
856 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
857 115, 115, 125, 125, 125, 125, 105, 115, 105, 95, 140,
858 110, 115, 100, 110 },
861 { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
862 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
863 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
864 100, 120, 110, 100 },
871 * Determine the price of an item (qty one) in a store.
872 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
873 * @param greed 店主の強欲度
874 * @param flip TRUEならば店主にとっての買取価格、FALSEなら売出価格を計算
878 * This function takes into account the player's charisma, and the
879 * shop-keepers friendliness, and the shop-keeper's base greed, but
880 * never lets a shop-keeper lose money in a transaction.
881 * The "greed" value should exceed 100 when the player is "buying" the
882 * item, and should be less than 100 when the player is "selling" it.
883 * Hack -- the black market always charges twice as much as it should.
884 * Charisma adjustment runs from 80 to 130
885 * Racial adjustment runs from 95 to 130
886 * Since greed/charisma/racial adjustments are centered at 100, we need
887 * to adjust (by 200) to extract a usable multiplier. Note that the
888 * "greed" value is always something (?).
891 static s32b price_item(object_type *o_ptr, int greed, bool flip)
898 /* Get the value of one of the items */
899 price = object_value(o_ptr);
901 /* Worthless items */
902 if (price <= 0) return (0L);
905 /* Compute the racial factor */
906 factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
908 /* Add in the charisma factor */
909 factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]];
915 /* Adjust for greed */
916 adjust = 100 + (300 - (greed + factor));
918 /* Never get "silly" */
919 if (adjust > 100) adjust = 100;
921 /* Mega-Hack -- Black market sucks */
922 if (cur_store_num == STORE_BLACK)
925 /* Compute the final price (with rounding) */
926 /* Hack -- prevent underflow */
927 price = (price * adjust + 50L) / 100L;
930 /* Shop is selling */
933 /* Adjust for greed */
934 adjust = 100 + ((greed + factor) - 300);
936 /* Never get "silly" */
937 if (adjust < 100) adjust = 100;
939 /* Mega-Hack -- Black market sucks */
940 if (cur_store_num == STORE_BLACK)
943 /* Compute the final price (with rounding) */
944 /* Hack -- prevent overflow */
945 price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
948 /* Note -- Never become "free" */
949 if (price <= 0L) return (1L);
951 /* Return the price */
957 * @brief 安価な消耗品の販売数を増やし、低確率で割引にする /
958 * Certain "cheap" objects should be created in "piles"
959 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
963 * Some objects can be sold at a "discount" (in small piles)
966 static void mass_produce(object_type *o_ptr)
969 DISCOUNT_RATE discount = 0;
971 s32b cost = object_value(o_ptr);
974 /* Analyze the type */
977 /* Food, Flasks, and Lites */
982 if (cost <= 5L) size += damroll(3, 5);
983 if (cost <= 20L) size += damroll(3, 5);
984 if (cost <= 50L) size += damroll(2, 2);
991 if (cost <= 60L) size += damroll(3, 5);
992 if (cost <= 240L) size += damroll(1, 5);
993 if (o_ptr->sval == SV_SCROLL_STAR_IDENTIFY) size += damroll(3, 5);
994 if (o_ptr->sval == SV_SCROLL_STAR_REMOVE_CURSE) size += damroll(1, 4);
999 case TV_SORCERY_BOOK:
1000 case TV_NATURE_BOOK:
1004 case TV_ARCANE_BOOK:
1006 case TV_DAEMON_BOOK:
1007 case TV_CRUSADE_BOOK:
1009 case TV_HISSATSU_BOOK:
1012 if (cost <= 50L) size += damroll(2, 3);
1013 if (cost <= 500L) size += damroll(1, 3);
1031 if (object_is_artifact(o_ptr)) break;
1032 if (object_is_ego(o_ptr)) break;
1033 if (cost <= 10L) size += damroll(3, 5);
1034 if (cost <= 100L) size += damroll(3, 5);
1043 if (cost <= 5L) size += damroll(5, 5);
1044 if (cost <= 50L) size += damroll(5, 5);
1045 if (cost <= 500L) size += damroll(5, 5);
1051 if (cost <= 100L) size += damroll(2, 2);
1052 if (cost <= 1000L) size += damroll(2, 2);
1065 * Because many rods (and a few wands and staffs) are useful mainly
1066 * in quantity, the Black Market will occasionally have a bunch of
1073 if ((cur_store_num == STORE_BLACK) && one_in_(3))
1075 if (cost < 1601L) size += damroll(1, 5);
1076 else if (cost < 3201L) size += damroll(1, 3);
1083 /* Pick a discount */
1088 else if (one_in_(25))
1092 else if (one_in_(150))
1096 else if (one_in_(300))
1100 else if (one_in_(500))
1105 if (o_ptr->art_name)
1110 /* Save the discount */
1111 o_ptr->discount = discount;
1113 /* Save the total pile size */
1114 o_ptr->number = size - (size * discount / 100);
1116 /* Ensure that mass-produced rods and wands get the correct pvals. */
1117 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1119 o_ptr->pval *= (PARAMETER_VALUE)o_ptr->number;
1126 * @brief 店舗に並べた品を同一品であるかどうか判定する /
1127 * Determine if a store item can "absorb" another item
1128 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1129 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1130 * @return 同一扱いできるならTRUEを返す
1133 * See "object_similar()" for the same function for the "player"
1136 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
1140 /* Hack -- Identical items cannot be stacked */
1141 if (o_ptr == j_ptr) return (0);
1143 /* Different objects cannot be stacked */
1144 if (o_ptr->k_idx != j_ptr->k_idx) return (0);
1146 /* Different charges (etc) cannot be stacked, unless wands or rods. */
1147 if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
1149 /* Require many identical values */
1150 if (o_ptr->to_h != j_ptr->to_h) return (0);
1151 if (o_ptr->to_d != j_ptr->to_d) return (0);
1152 if (o_ptr->to_a != j_ptr->to_a) return (0);
1154 /* Require identical "ego-item" names */
1155 if (o_ptr->name2 != j_ptr->name2) return (0);
1157 /* Artifacts don't stack! */
1158 if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
1160 /* Hack -- Identical art_flags! */
1161 for (i = 0; i < TR_FLAG_SIZE; i++)
1162 if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
1164 /* Hack -- Never stack "powerful" items */
1165 if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
1167 /* Hack -- Never stack recharging items */
1168 if (o_ptr->timeout || j_ptr->timeout) return (0);
1170 /* Require many identical values */
1171 if (o_ptr->ac != j_ptr->ac) return (0);
1172 if (o_ptr->dd != j_ptr->dd) return (0);
1173 if (o_ptr->ds != j_ptr->ds) return (0);
1175 /* Hack -- Never stack chests */
1176 if (o_ptr->tval == TV_CHEST) return (0);
1177 if (o_ptr->tval == TV_STATUE) return (0);
1178 if (o_ptr->tval == TV_CAPTURE) return (0);
1180 /* Require matching discounts */
1181 if (o_ptr->discount != j_ptr->discount) return (0);
1183 /* They match, so they must be similar */
1189 * @brief 店舗に並べた品を重ね合わせできるかどうか判定する /
1190 * Allow a store item to absorb another item
1191 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1192 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1193 * @return 重ね合わせできるならTRUEを返す
1196 * See "object_similar()" for the same function for the "player"
1199 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
1201 int max_num = (o_ptr->tval == TV_ROD) ?
1202 MIN(99, MAX_SHORT / k_info[o_ptr->k_idx].pval) : 99;
1203 int total = o_ptr->number + j_ptr->number;
1204 int diff = (total > max_num) ? total - max_num : 0;
1206 /* Combine quantity, lose excess items */
1207 o_ptr->number = (total > max_num) ? max_num : total;
1209 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) together. -LM- */
1210 if (o_ptr->tval == TV_ROD)
1212 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1215 /* Hack -- if wands are stacking, combine the charges. -LM- */
1216 if (o_ptr->tval == TV_WAND)
1218 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1224 * @brief 店舗に品を置くスペースがあるかどうかの判定を返す /
1225 * Check to see if the shop will be carrying too many objects -RAK-
1226 * @param o_ptr 店舗に置きたいオブジェクト構造体の参照ポインタ
1227 * @return 置き場がないなら0、重ね合わせできるアイテムがあるなら-1、スペースがあるなら1を返す。
1230 * Note that the shop, just like a player, will not accept things
1231 * it cannot hold. Before, one could "nuke" potions this way.
1232 * Return value is now int:
1234 * -1 : Can be combined to existing slot.
1235 * 1 : Cannot be combined but there are empty spaces.
1238 static int store_check_num(object_type *o_ptr)
1243 /* The "home" acts like the player */
1244 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
1246 bool old_stack_force_notes = stack_force_notes;
1247 bool old_stack_force_costs = stack_force_costs;
1249 if (cur_store_num != STORE_HOME)
1251 stack_force_notes = FALSE;
1252 stack_force_costs = FALSE;
1255 /* Check all the items */
1256 for (i = 0; i < st_ptr->stock_num; i++)
1258 /* Get the existing item */
1259 j_ptr = &st_ptr->stock[i];
1261 /* Can the new object be combined with the old one? */
1262 if (object_similar(j_ptr, o_ptr))
1264 if (cur_store_num != STORE_HOME)
1266 stack_force_notes = old_stack_force_notes;
1267 stack_force_costs = old_stack_force_costs;
1274 if (cur_store_num != STORE_HOME)
1276 stack_force_notes = old_stack_force_notes;
1277 stack_force_costs = old_stack_force_costs;
1281 /* Normal stores do special stuff */
1284 /* Check all the items */
1285 for (i = 0; i < st_ptr->stock_num; i++)
1287 /* Get the existing item */
1288 j_ptr = &st_ptr->stock[i];
1290 /* Can the new object be combined with the old one? */
1291 if (store_object_similar(j_ptr, o_ptr)) return -1;
1295 /* Free space is always usable */
1297 * オプション powerup_home が設定されていると
1300 if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
1301 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
1306 if (st_ptr->stock_num < st_ptr->stock_size) {
1311 /* But there was no room at the inn... */
1316 * @brief オブジェクトが祝福されているかの判定を返す /
1317 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1318 * @return アイテムが祝福されたアイテムならばTRUEを返す
1320 static bool is_blessed(object_type *o_ptr)
1322 u32b flgs[TR_FLAG_SIZE];
1323 object_flags(o_ptr, flgs);
1324 if (have_flag(flgs, TR_BLESSED)) return (TRUE);
1325 else return (FALSE);
1331 * @brief オブジェクトが所定の店舗で引き取れるかどうかを返す /
1332 * Determine if the current store will purchase the given item
1333 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1334 * @return アイテムが買い取れるならばTRUEを返す
1336 * Note that a shop-keeper must refuse to buy "worthless" items
1338 static bool store_will_buy(object_type *o_ptr)
1340 /* Hack -- The Home is simple */
1341 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
1343 /* Switch on the store */
1344 switch (cur_store_num)
1349 /* Analyze the type */
1350 switch (o_ptr->tval)
1353 if (o_ptr->sval != SV_POTION_WATER) return FALSE;
1365 case TV_BOTTLE: /* 'Green', recycling Angband */
1380 /* Analyze the type */
1381 switch (o_ptr->tval)
1402 /* Analyze the type */
1403 switch (o_ptr->tval)
1412 case TV_HISSATSU_BOOK:
1416 if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
1428 /* Analyze the type */
1429 switch (o_ptr->tval)
1432 case TV_CRUSADE_BOOK:
1442 monster_race *r_ptr = &r_info[o_ptr->pval];
1445 if (!(r_ptr->flags3 & RF3_EVIL))
1448 if (r_ptr->flags3 & RF3_GOOD) break;
1450 /* Accept animals */
1451 if (r_ptr->flags3 & RF3_ANIMAL) break;
1454 if (my_strchr("?!", r_ptr->d_char)) break;
1460 if (is_blessed(o_ptr)) break;
1469 case STORE_ALCHEMIST:
1471 /* Analyze the type */
1472 switch (o_ptr->tval)
1486 /* Analyze the type */
1487 switch (o_ptr->tval)
1489 case TV_SORCERY_BOOK:
1490 case TV_NATURE_BOOK:
1494 case TV_ARCANE_BOOK:
1496 case TV_DAEMON_BOOK:
1510 if(o_ptr->sval == SV_WIZSTAFF) break;
1511 else return (FALSE);
1518 /* Bookstore Shop */
1521 /* Analyze the type */
1522 switch (o_ptr->tval)
1524 case TV_SORCERY_BOOK:
1525 case TV_NATURE_BOOK:
1530 case TV_ARCANE_BOOK:
1532 case TV_DAEMON_BOOK:
1533 case TV_CRUSADE_BOOK:
1544 /* XXX XXX XXX Ignore "worthless" items */
1545 if (object_value(o_ptr) <= 0) return (FALSE);
1553 * @brief 現在の町の指定された店舗のアイテムを整理する /
1554 * Combine and reorder items in store.
1555 * @param store_num 店舗ID
1556 * @return 実際に整理が行われたならばTRUEを返す。
1558 bool combine_and_reorder_home(int store_num)
1562 object_type forge, *o_ptr, *j_ptr;
1563 bool flag = FALSE, combined;
1564 store_type *old_st_ptr = st_ptr;
1565 bool old_stack_force_notes = stack_force_notes;
1566 bool old_stack_force_costs = stack_force_costs;
1568 st_ptr = &town[1].store[store_num];
1569 if (store_num != STORE_HOME)
1571 stack_force_notes = FALSE;
1572 stack_force_costs = FALSE;
1579 /* Combine the items in the home (backwards) */
1580 for (i = st_ptr->stock_num - 1; i > 0; i--)
1583 o_ptr = &st_ptr->stock[i];
1585 /* Skip empty items */
1586 if (!o_ptr->k_idx) continue;
1588 /* Scan the items above that item */
1589 for (j = 0; j < i; j++)
1594 j_ptr = &st_ptr->stock[j];
1596 /* Skip empty items */
1597 if (!j_ptr->k_idx) continue;
1600 * Get maximum number of the stack if these
1601 * are similar, get zero otherwise.
1603 max_num = object_similar_part(j_ptr, o_ptr);
1605 /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
1606 if (max_num && j_ptr->number < max_num)
1608 if (o_ptr->number + j_ptr->number <= max_num)
1610 /* Add together the item counts */
1611 object_absorb(j_ptr, o_ptr);
1613 /* One object is gone */
1614 st_ptr->stock_num--;
1616 /* Slide everything down */
1617 for (k = i; k < st_ptr->stock_num; k++)
1619 /* Structure copy */
1620 st_ptr->stock[k] = st_ptr->stock[k + 1];
1623 /* Erase the "final" slot */
1624 object_wipe(&st_ptr->stock[k]);
1628 ITEM_NUMBER old_num = o_ptr->number;
1629 ITEM_NUMBER remain = j_ptr->number + o_ptr->number - max_num;
1631 /* Add together the item counts */
1632 object_absorb(j_ptr, o_ptr);
1634 o_ptr->number = remain;
1636 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
1637 if (o_ptr->tval == TV_ROD)
1639 o_ptr->pval = o_ptr->pval * remain / old_num;
1640 o_ptr->timeout = o_ptr->timeout * remain / old_num;
1643 /* Hack -- if wands are stacking, combine the charges. -LM- */
1644 else if (o_ptr->tval == TV_WAND)
1646 o_ptr->pval = o_ptr->pval * remain / old_num;
1663 /* Re-order the items in the home (forwards) */
1664 for (i = 0; i < st_ptr->stock_num; i++)
1667 o_ptr = &st_ptr->stock[i];
1669 /* Skip empty slots */
1670 if (!o_ptr->k_idx) continue;
1672 /* Get the "value" of the item */
1673 o_value = object_value(o_ptr);
1675 /* Scan every occupied slot */
1676 for (j = 0; j < st_ptr->stock_num; j++)
1678 if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
1681 /* Never move down */
1682 if (j >= i) continue;
1687 /* Get local object */
1690 /* Save a copy of the moving item */
1691 object_copy(j_ptr, &st_ptr->stock[i]);
1693 /* Slide the objects */
1694 for (k = i; k > j; k--)
1696 /* Slide the item */
1697 object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
1700 /* Insert the moving item */
1701 object_copy(&st_ptr->stock[j], j_ptr);
1704 st_ptr = old_st_ptr;
1705 if (store_num != STORE_HOME)
1707 stack_force_notes = old_stack_force_notes;
1708 stack_force_costs = old_stack_force_costs;
1716 * @brief 我が家にオブジェクトを加える /
1717 * Add the item "o_ptr" to the inventory of the "Home"
1718 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1722 * In all cases, return the slot (or -1) where the object was placed
1723 * Note that this is a hacked up version of "inven_carry()".
1724 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1725 * known, the player may have to pick stuff up and drop it again.
1728 static int home_carry(object_type *o_ptr)
1734 bool old_stack_force_notes = stack_force_notes;
1735 bool old_stack_force_costs = stack_force_costs;
1737 if (cur_store_num != STORE_HOME)
1739 stack_force_notes = FALSE;
1740 stack_force_costs = FALSE;
1743 /* Check each existing item (try to combine) */
1744 for (slot = 0; slot < st_ptr->stock_num; slot++)
1746 /* Get the existing item */
1747 j_ptr = &st_ptr->stock[slot];
1749 /* The home acts just like the player */
1750 if (object_similar(j_ptr, o_ptr))
1752 /* Save the new number of items */
1753 object_absorb(j_ptr, o_ptr);
1755 if (cur_store_num != STORE_HOME)
1757 stack_force_notes = old_stack_force_notes;
1758 stack_force_costs = old_stack_force_costs;
1766 if (cur_store_num != STORE_HOME)
1768 stack_force_notes = old_stack_force_notes;
1769 stack_force_costs = old_stack_force_costs;
1774 * 隠し機能: オプション powerup_home が設定されていると
1778 if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
1779 if (st_ptr->stock_num >= st_ptr->stock_size) {
1784 if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
1790 /* Determine the "value" of the item */
1791 value = object_value(o_ptr);
1793 /* Check existing slots to see if we must "slide" */
1794 for (slot = 0; slot < st_ptr->stock_num; slot++)
1796 if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
1799 /* Slide the others up */
1800 for (i = st_ptr->stock_num; i > slot; i--)
1802 st_ptr->stock[i] = st_ptr->stock[i-1];
1805 /* More stuff now */
1806 st_ptr->stock_num++;
1808 /* Insert the new item */
1809 st_ptr->stock[slot] = *o_ptr;
1811 chg_virtue(V_SACRIFICE, -1);
1813 (void)combine_and_reorder_home(cur_store_num);
1815 /* Return the location */
1821 * @brief 店舗にオブジェクトを加える /
1822 * Add the item "o_ptr" to a real stores inventory.
1823 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1827 * In all cases, return the slot (or -1) where the object was placed
1828 * Note that this is a hacked up version of "inven_carry()".
1829 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1830 * known, the player may have to pick stuff up and drop it again.
1833 static int store_carry(object_type *o_ptr)
1836 s32b value, j_value;
1840 /* Evaluate the object */
1841 value = object_value(o_ptr);
1843 /* Cursed/Worthless items "disappear" when sold */
1844 if (value <= 0) return (-1);
1846 /* All store items are fully *identified* */
1847 o_ptr->ident |= IDENT_MENTAL;
1849 /* Erase the inscription */
1850 o_ptr->inscription = 0;
1852 /* Erase the "feeling" */
1853 o_ptr->feeling = FEEL_NONE;
1855 /* Check each existing item (try to combine) */
1856 for (slot = 0; slot < st_ptr->stock_num; slot++)
1858 /* Get the existing item */
1859 j_ptr = &st_ptr->stock[slot];
1861 /* Can the existing items be incremented? */
1862 if (store_object_similar(j_ptr, o_ptr))
1864 /* Hack -- extra items disappear */
1865 store_object_absorb(j_ptr, o_ptr);
1873 if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
1876 /* Check existing slots to see if we must "slide" */
1877 for (slot = 0; slot < st_ptr->stock_num; slot++)
1880 j_ptr = &st_ptr->stock[slot];
1882 /* Objects sort by decreasing type */
1883 if (o_ptr->tval > j_ptr->tval) break;
1884 if (o_ptr->tval < j_ptr->tval) continue;
1886 /* Objects sort by increasing sval */
1887 if (o_ptr->sval < j_ptr->sval) break;
1888 if (o_ptr->sval > j_ptr->sval) continue;
1891 * Hack: otherwise identical rods sort by
1892 * increasing recharge time --dsb
1894 if (o_ptr->tval == TV_ROD)
1896 if (o_ptr->pval < j_ptr->pval) break;
1897 if (o_ptr->pval > j_ptr->pval) continue;
1900 /* Evaluate that slot */
1901 j_value = object_value(j_ptr);
1903 /* Objects sort by decreasing value */
1904 if (value > j_value) break;
1905 if (value < j_value) continue;
1908 /* Slide the others up */
1909 for (i = st_ptr->stock_num; i > slot; i--)
1911 st_ptr->stock[i] = st_ptr->stock[i-1];
1914 /* More stuff now */
1915 st_ptr->stock_num++;
1917 /* Insert the new item */
1918 st_ptr->stock[slot] = *o_ptr;
1920 /* Return the location */
1926 * @brief 店舗のオブジェクト数を増やす /
1927 * Add the item "o_ptr" to a real stores inventory.
1928 * @param item 増やしたいアイテムのID
1933 * Increase, by a given amount, the number of a certain item
1934 * in a certain store. This can result in zero items.
1936 * @todo numは本来ITEM_NUMBER型にしたい。
1938 static void store_item_increase(int item, int num)
1944 o_ptr = &st_ptr->stock[item];
1946 /* Verify the number */
1947 cnt = o_ptr->number + num;
1948 if (cnt > 255) cnt = 255;
1949 else if (cnt < 0) cnt = 0;
1950 num = cnt - o_ptr->number;
1952 /* Save the new number */
1953 o_ptr->number += (ITEM_NUMBER)num;
1958 * @brief 店舗のオブジェクト数を削除する /
1959 * Remove a slot if it is empty
1960 * @param item 削除したいアイテムのID
1963 static void store_item_optimize(int item)
1969 o_ptr = &st_ptr->stock[item];
1972 if (!o_ptr->k_idx) return;
1974 /* Must have no items */
1975 if (o_ptr->number) return;
1978 st_ptr->stock_num--;
1980 /* Slide everyone */
1981 for (j = item; j < st_ptr->stock_num; j++)
1983 st_ptr->stock[j] = st_ptr->stock[j + 1];
1986 /* Nuke the final slot */
1987 object_wipe(&st_ptr->stock[j]);
1991 * @brief ブラックマーケット用の無価値品の排除判定 /
1992 * This function will keep 'crap' out of the black market.
1993 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1994 * @return ブラックマーケットにとって無価値な品ならばTRUEを返す
1997 * Crap is defined as any item that is "available" elsewhere
1998 * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
2001 static bool black_market_crap(object_type *o_ptr)
2005 /* Ego items are never crap */
2006 if (object_is_ego(o_ptr)) return (FALSE);
2008 /* Good items are never crap */
2009 if (o_ptr->to_a > 0) return (FALSE);
2010 if (o_ptr->to_h > 0) return (FALSE);
2011 if (o_ptr->to_d > 0) return (FALSE);
2013 /* Check all stores */
2014 for (i = 0; i < MAX_STORES; i++)
2016 if (i == STORE_HOME) continue;
2017 if (i == STORE_MUSEUM) continue;
2019 /* Check every item in the store */
2020 for (j = 0; j < town[p_ptr->town_num].store[i].stock_num; j++)
2022 object_type *j_ptr = &town[p_ptr->town_num].store[i].stock[j];
2024 /* Duplicate item "type", assume crappy */
2025 if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
2035 * @brief 店舗の品揃え変化のためにアイテムを削除する /
2036 * Attempt to delete (some of) a random item from the store
2040 * Hack -- we attempt to "maintain" piles of items when possible.
2043 static void store_delete(void)
2047 /* Pick a random slot */
2048 what = randint0(st_ptr->stock_num);
2050 /* Determine how many items are here */
2051 num = st_ptr->stock[what].number;
2053 /* Hack -- sometimes, only destroy half the items */
2054 if (randint0(100) < 50) num = (num + 1) / 2;
2056 /* Hack -- sometimes, only destroy a single item */
2057 if (randint0(100) < 50) num = 1;
2059 /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
2060 if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
2062 st_ptr->stock[what].pval -= num * st_ptr->stock[what].pval / st_ptr->stock[what].number;
2065 /* Actually destroy (part of) the item */
2066 store_item_increase(what, -num);
2067 store_item_optimize(what);
2072 * @brief 店舗の品揃え変化のためにアイテムを追加する /
2073 * Creates a random item and gives it to a store
2077 * This algorithm needs to be rethought. A lot.
2078 * Currently, "normal" stores use a pre-built array.
2079 * Note -- the "level" given to "obj_get_num()" is a "favored"
2080 * level, that is, there is a much higher chance of getting
2081 * items with a level approaching that of the given level...
2082 * Should we check for "permission" to have the given item?
2085 static void store_create(void)
2095 /* Paranoia -- no room left */
2096 if (st_ptr->stock_num >= st_ptr->stock_size) return;
2099 /* Hack -- consider up to four items */
2100 for (tries = 0; tries < 4; tries++)
2103 if (cur_store_num == STORE_BLACK)
2105 /* Pick a level for object/magic */
2106 level = 25 + randint0(25);
2108 /* Random item (usually of given level) */
2109 i = get_obj_num(level);
2111 /* Handle failure */
2118 /* Hack -- Pick an item to sell */
2119 i = st_ptr->table[randint0(st_ptr->table_num)];
2121 /* Hack -- fake level for apply_magic() */
2122 level = rand_range(1, STORE_OBJ_LEVEL);
2126 /* Get local object */
2129 /* Create a new object of the chosen kind */
2130 object_prep(q_ptr, i);
2132 /* Apply some "low-level" magic (no artifacts) */
2133 apply_magic(q_ptr, level, AM_NO_FIXED_ART);
2135 /* Require valid object */
2136 if (!store_will_buy(q_ptr)) continue;
2138 /* Hack -- Charge lite's */
2139 if (q_ptr->tval == TV_LITE)
2141 if (q_ptr->sval == SV_LITE_TORCH) q_ptr->xtra4 = FUEL_TORCH / 2;
2142 if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->xtra4 = FUEL_LAMP / 2;
2146 /* The item is "known" */
2147 object_known(q_ptr);
2149 /* Mark it storebought */
2150 q_ptr->ident |= IDENT_STORE;
2152 /* Mega-Hack -- no chests in stores */
2153 if (q_ptr->tval == TV_CHEST) continue;
2155 /* Prune the black market */
2156 if (cur_store_num == STORE_BLACK)
2158 /* Hack -- No "crappy" items */
2159 if (black_market_crap(q_ptr)) continue;
2161 /* Hack -- No "cheap" items */
2162 if (object_value(q_ptr) < 10) continue;
2164 /* No "worthless" items */
2165 /* if (object_value(q_ptr) <= 0) continue; */
2168 /* Prune normal stores */
2171 /* No "worthless" items */
2172 if (object_value(q_ptr) <= 0) continue;
2176 /* Mass produce and/or Apply discount */
2177 mass_produce(q_ptr);
2179 /* Attempt to carry the (known) item */
2180 (void)store_carry(q_ptr);
2182 /* Definitely done */
2189 * @brief 店舗の割引対象外にするかどうかを判定 /
2190 * Eliminate need to bargain if player has haggled well in the past
2191 * @param minprice アイテムの最低販売価格
2192 * @return 割引を禁止するならTRUEを返す。
2194 static bool noneedtobargain(s32b minprice)
2196 s32b good = st_ptr->good_buy;
2197 s32b bad = st_ptr->bad_buy;
2199 /* Cheap items are "boring" */
2200 if (minprice < 10L) return (TRUE);
2202 /* Perfect haggling */
2203 if (good == MAX_SHORT) return (TRUE);
2205 /* Reward good haggles, punish bad haggles, notice price */
2206 if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
2208 /* Return the flag */
2214 * @brief 店主の持つプレイヤーに対する売買の良し悪し経験を記憶する /
2215 * Update the bargain info
2216 * @param price 実際の取引価格
2217 * @param minprice 店主の提示した価格
2221 static void updatebargain(s32b price, s32b minprice, int num)
2223 /* Hack -- auto-haggle */
2224 if (!manual_haggle) return;
2226 /* Cheap items are "boring" */
2227 if ((minprice/num) < 10L) return;
2229 /* Count the successful haggles */
2230 if (price == minprice)
2232 /* Just count the good haggles */
2233 if (st_ptr->good_buy < MAX_SHORT)
2239 /* Count the failed haggles */
2242 /* Just count the bad haggles */
2243 if (st_ptr->bad_buy < MAX_SHORT)
2252 * @brief 店の商品リストを再表示する /
2253 * Re-displays a single store entry
2257 static void display_entry(int pos)
2263 char o_name[MAX_NLEN];
2270 o_ptr = &st_ptr->stock[pos];
2272 /* Get the "offset" */
2273 i = (pos % store_bottom);
2275 /* Label it, clear the line --(-- */
2276 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
2277 prt(out_val, i+6, 0);
2280 if (show_item_graph)
2282 byte a = object_attr(o_ptr);
2283 char c = object_char(o_ptr);
2285 Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
2286 if (use_bigtile) cur_col++;
2291 /* Describe an item in the home */
2292 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
2296 /* Leave room for weights, if necessary -DRS- */
2297 if (show_weights) maxwid -= 10;
2299 /* Describe the object */
2300 object_desc(o_name, o_ptr, 0);
2301 o_name[maxwid] = '\0';
2302 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2307 /* Only show the weight of an individual item */
2308 int wgt = o_ptr->weight;
2310 sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2311 put_str(out_val, i+6, 67);
2313 (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10);
2314 put_str(out_val, i+6, 68);
2320 /* Describe an item (fully) in a store */
2323 /* Must leave room for the "price" */
2326 /* Leave room for weights, if necessary -DRS- */
2327 if (show_weights) maxwid -= 7;
2329 /* Describe the object (fully) */
2330 object_desc(o_name, o_ptr, 0);
2331 o_name[maxwid] = '\0';
2332 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2337 /* Only show the weight of an individual item */
2338 int wgt = o_ptr->weight;
2340 sprintf(out_val, "%3d.%1d", lbtokg1(wgt) , lbtokg2(wgt) );
2341 put_str(out_val, i+6, 60);
2343 (void)sprintf(out_val, "%3d.%d", wgt / 10, wgt % 10);
2344 put_str(out_val, i+6, 61);
2349 /* Display a "fixed" cost */
2350 if (o_ptr->ident & (IDENT_FIXED))
2352 /* Extract the "minimum" price */
2353 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2355 /* Actually draw the price (not fixed) */
2357 (void)sprintf(out_val, "%9ld固", (long)x);
2359 (void)sprintf(out_val, "%9ld F", (long)x);
2362 put_str(out_val, i+6, 68);
2365 /* Display a "taxed" cost */
2366 else if (!manual_haggle)
2368 /* Extract the "minimum" price */
2369 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2371 /* Hack -- Apply Sales Tax if needed */
2372 if (!noneedtobargain(x)) x += x / 10;
2374 /* Actually draw the price (with tax) */
2375 (void)sprintf(out_val, "%9ld ", (long)x);
2376 put_str(out_val, i+6, 68);
2379 /* Display a "haggle" cost */
2382 /* Extrect the "maximum" price */
2383 x = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
2385 /* Actually draw the price (not fixed) */
2386 (void)sprintf(out_val, "%9ld ", (long)x);
2387 put_str(out_val, i+6, 68);
2394 * @brief 店の商品リストを表示する /
2395 * Displays a store's inventory -RAK-
2398 * All prices are listed as "per individual object". -BEN-
2400 static void display_inventory(void)
2404 /* Display the next 12 items */
2405 for (k = 0; k < store_bottom; k++)
2407 /* Do not display "dead" items */
2408 if (store_top + k >= st_ptr->stock_num) break;
2410 /* Display that line */
2411 display_entry(store_top + k);
2414 /* Erase the extra lines and the "more" prompt */
2415 for (i = k; i < store_bottom + 1; i++) prt("", i + 6, 0);
2417 /* Assume "no current page" */
2419 put_str(" ", 5, 20);
2421 put_str(" ", 5, 20);
2425 /* Visual reminder of "more items" */
2426 if (st_ptr->stock_num > store_bottom)
2428 /* Show "more" reminder (after the last item) */
2430 prt("-続く-", k + 6, 3);
2432 prt("-more-", k + 6, 3);
2436 /* Indicate the "current page" */
2437 /* Trailing spaces are to display (Page xx) and (Page x) */
2439 put_str(format("(%dページ) ", store_top/store_bottom + 1), 5, 20);
2441 put_str(format("(Page %d) ", store_top/store_bottom + 1), 5, 20);
2446 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
2448 k = st_ptr->stock_size;
2450 if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
2452 put_str(format("アイテム数: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
2454 put_str(format("Objects: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
2461 * @brief プレイヤーの所持金を表示する /
2462 * Displays players gold -RAK-
2466 static void store_prt_gold(void)
2471 prt("手持ちのお金: ", 19 + xtra_stock, 53);
2473 prt("Gold Remaining: ", 19 + xtra_stock, 53);
2477 sprintf(out_val, "%9ld", (long)p_ptr->au);
2478 prt(out_val, 19 + xtra_stock, 68);
2482 * @brief 店舗情報全体を表示するメインルーチン /
2483 * Displays store (after clearing screen) -RAK-
2487 static void display_store(void)
2495 /* The "Home" is special */
2496 if (cur_store_num == STORE_HOME)
2498 /* Put the owner name */
2500 put_str("我が家", 3, 31);
2502 put_str("Your Home", 3, 30);
2506 /* Label the item descriptions */
2508 put_str("アイテムの一覧", 5, 4);
2510 put_str("Item Description", 5, 3);
2514 /* If showing weights, show label */
2518 put_str("重さ", 5, 72);
2520 put_str("Weight", 5, 70);
2526 /* The "Home" is special */
2527 else if (cur_store_num == STORE_MUSEUM)
2529 /* Put the owner name */
2531 put_str("博物館", 3, 31);
2533 put_str("Museum", 3, 30);
2537 /* Label the item descriptions */
2539 put_str("アイテムの一覧", 5, 4);
2541 put_str("Item Description", 5, 3);
2545 /* If showing weights, show label */
2549 put_str("重さ", 5, 72);
2551 put_str("Weight", 5, 70);
2560 cptr store_name = (f_name + f_info[cur_store_feat].name);
2561 cptr owner_name = (ot_ptr->owner_name);
2562 cptr race_name = race_info[ot_ptr->owner_race].title;
2564 /* Put the owner name and race */
2565 sprintf(buf, "%s (%s)", owner_name, race_name);
2566 put_str(buf, 3, 10);
2568 /* Show the max price in the store (above prices) */
2569 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
2572 /* Label the item descriptions */
2574 put_str("商品の一覧", 5, 7);
2576 put_str("Item Description", 5, 3);
2580 /* If showing weights, show label */
2584 put_str("重さ", 5, 62);
2586 put_str("Weight", 5, 60);
2591 /* Label the asking price (in stores) */
2593 put_str("価格", 5, 73);
2595 put_str("Price", 5, 72);
2600 /* Display the current gold */
2603 /* Draw in the inventory */
2604 display_inventory();
2610 * @brief 店舗からアイテムを選択する /
2611 * Get the ID of a store item and return its value -RAK-
2612 * @param com_val 選択IDを返す参照ポインタ
2613 * @param pmt メッセージキャプション
2616 * @return 実際に選択したらTRUE、キャンセルしたらFALSE
2618 static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
2624 #ifdef ALLOW_REPEAT /* TNB */
2626 /* Get the item index */
2627 if (repeat_pull(com_val))
2629 /* Verify the item */
2630 if ((*com_val >= i) && (*com_val <= j))
2637 #endif /* ALLOW_REPEAT -- TNB */
2639 /* Paranoia XXX XXX XXX */
2643 /* Assume failure */
2646 /* Build the prompt */
2648 hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
2650 (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s",
2651 (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"),
2654 (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s",
2659 /* Ask until done */
2665 if (!get_com(out_val, &command, FALSE)) break;
2668 if (islower(command))
2670 else if (isupper(command))
2671 k = A2I(tolower(command)) + 26;
2675 /* Legal responses */
2676 if ((k >= i) && (k <= j))
2686 /* Clear the prompt */
2690 if (command == ESCAPE) return (FALSE);
2692 #ifdef ALLOW_REPEAT /* TNB */
2694 repeat_push(*com_val);
2696 #endif /* ALLOW_REPEAT -- TNB */
2704 * @brief 店主の不満度を増やし、プレイヤーを締め出す判定と処理を行う /
2705 * Increase the insult counter and get angry if too many -RAK-
2706 * @return プレイヤーを締め出す場合TRUEを返す
2708 static int increase_insults(void)
2710 /* Increase insults */
2711 st_ptr->insult_cur++;
2713 /* Become insulted */
2714 if (st_ptr->insult_cur > ot_ptr->insult_max)
2720 st_ptr->insult_cur = 0;
2721 st_ptr->good_buy = 0;
2722 st_ptr->bad_buy = 0;
2725 st_ptr->store_open = turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
2737 * @brief 店主の不満度を減らす /
2738 * Decrease insults -RAK-
2739 * @return プレイヤーを締め出す場合TRUEを返す
2741 static void decrease_insults(void)
2743 /* Decrease insults */
2744 if (st_ptr->insult_cur) st_ptr->insult_cur--;
2749 * @brief 店主の不満度が増えた場合のみのメッセージを表示する /
2750 * Have insulted while haggling -RAK-
2751 * @return プレイヤーを締め出す場合TRUEを返す
2753 static int haggle_insults(void)
2755 /* Increase insults */
2756 if (increase_insults()) return (TRUE);
2758 /* Display and flush insult */
2767 * Mega-Hack -- Enable "increments"
2769 static bool allow_inc = FALSE;
2772 * Mega-Hack -- Last "increment" during haggling
2774 static s32b last_inc = 0L;
2778 * @brief 交渉価格を確認と認証の是非を行う /
2781 * @param poffer 別途価格提示をした場合の値を返す参照ポインタ
2782 * @param price 現在の交渉価格
2783 * @param final 最終確定価格ならばTRUE
2784 * @return プレイヤーを締め出す場合TRUEを返す
2786 static int get_haggle(cptr pmt, s32b *poffer, s32b price, int final)
2796 /* Clear old increment if necessary */
2797 if (!allow_inc) last_inc = 0L;
2804 sprintf(buf, "%s [承諾] ", pmt);
2806 sprintf(buf, "%s [accept] ", pmt);
2811 /* Old (negative) increment, and not final */
2812 else if (last_inc < 0)
2815 sprintf(buf, "%s [-$%ld] ", pmt, (long)(ABS(last_inc)));
2817 sprintf(buf, "%s [-%ld] ", pmt, (long)(ABS(last_inc)));
2822 /* Old (positive) increment, and not final */
2823 else if (last_inc > 0)
2826 sprintf(buf, "%s [+$%ld] ", pmt, (long)(ABS(last_inc)));
2828 sprintf(buf, "%s [+%ld] ", pmt, (long)(ABS(last_inc)));
2836 sprintf(buf, "%s ", pmt);
2840 /* Paranoia XXX XXX XXX */
2844 /* Ask until done */
2849 /* Display prompt */
2853 strcpy(out_val, "");
2856 * Ask the user for a response.
2857 * Don't allow to use numpad as cursor key.
2859 res = askfor_aux(out_val, 32, FALSE);
2865 if (!res) return FALSE;
2867 /* Skip leading spaces */
2868 for (p = out_val; *p == ' '; p++) /* loop */;
2870 /* Empty response */
2873 /* Accept current price */
2881 /* Use previous increment */
2882 if (allow_inc && last_inc)
2884 *poffer += last_inc;
2889 /* Normal response */
2892 /* Extract a number */
2895 /* Handle "incremental" number */
2896 if ((*p == '+' || *p == '-'))
2898 /* Allow increments */
2901 /* Use the given "increment" */
2908 /* Handle normal number */
2911 /* Use the given "number" */
2920 msg_print("値がおかしいです。");
2922 msg_print("Invalid response.");
2934 * @brief 店主がプレイヤーからの交渉価格を判断する /
2935 * Receive an offer (from the player)
2937 * @param poffer 店主からの交渉価格を返す参照ポインタ
2938 * @param last_offer 現在の交渉価格
2939 * @param factor 店主の価格基準倍率
2940 * @param price アイテムの実価値
2941 * @param final 最終価格確定ならばTRUE
2942 * @return プレイヤーの価格に対して不服ならばTRUEを返す /
2943 * Return TRUE if offer is NOT okay
2945 static bool receive_offer(cptr pmt, s32b *poffer,
2946 s32b last_offer, int factor,
2947 s32b price, int final)
2949 /* Haggle till done */
2952 /* Get a haggle (or cancel) */
2953 if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
2955 /* Acceptable offer */
2956 if (((*poffer) * factor) >= (last_offer * factor)) break;
2958 /* Insult, and check for kicked out */
2959 if (haggle_insults()) return (TRUE);
2961 /* Reject offer (correctly) */
2962 (*poffer) = last_offer;
2971 * @brief プレイヤーが購入する時の値切り処理メインルーチン /
2972 * Haggling routine -RAK-
2973 * @param o_ptr オブジェクトの構造体参照ポインタ
2974 * @param price 最終価格を返す参照ポインタ
2975 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
2976 * Return TRUE if purchase is NOT successful
2978 static bool purchase_haggle(object_type *o_ptr, s32b *price)
2980 s32b cur_ask, final_ask;
2981 s32b last_offer, offer;
2983 s32b min_per, max_per;
2984 int flag, loop_flag, noneed;
2985 int annoyed = 0, final = FALSE;
2987 bool cancel = FALSE;
2992 cptr pmt = "Asking";
3002 /* Extract the starting offer and the final offer */
3003 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
3004 final_ask = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3006 /* Determine if haggling is necessary */
3007 noneed = noneedtobargain(final_ask);
3009 /* No need to haggle */
3010 if (noneed || !manual_haggle)
3012 /* No need to haggle */
3015 /* Message summary */
3017 msg_print("結局この金額にまとまった。");
3019 msg_print("You eventually agree upon the price.");
3025 /* No haggle option */
3028 /* Message summary */
3030 msg_print("すんなりとこの金額にまとまった。");
3032 msg_print("You quickly agree upon the price.");
3037 /* Apply Sales Tax */
3038 final_ask += final_ask / 10;
3042 cur_ask = final_ask;
3044 /* Go to final offer */
3048 pmt = "Final Offer";
3055 /* Haggle for the whole pile */
3056 cur_ask *= o_ptr->number;
3057 final_ask *= o_ptr->number;
3060 /* Haggle parameters */
3061 min_per = ot_ptr->haggle_per;
3062 max_per = min_per * 3;
3064 /* Mega-Hack -- artificial "last offer" value */
3065 last_offer = object_value(o_ptr) * o_ptr->number;
3066 last_offer = last_offer * (200 - (int)(ot_ptr->max_inflate)) / 100L;
3067 if (last_offer <= 0) last_offer = 1;
3072 /* No incremental haggling yet */
3075 /* Haggle until done */
3076 for (flag = FALSE; !flag; )
3080 while (!flag && loop_flag)
3082 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3083 put_str(out_val, 1, 0);
3085 cancel = receive_offer("提示する金額? ",
3087 cancel = receive_offer("What do you offer? ",
3090 &offer, last_offer, 1, cur_ask, final);
3096 else if (offer > cur_ask)
3101 else if (offer == cur_ask)
3114 x1 = 100 * (offer - last_offer) / (cur_ask - last_offer);
3117 if (haggle_insults())
3123 else if (x1 > max_per)
3126 if (x1 < max_per) x1 = max_per;
3128 x2 = rand_range(x1-2, x1+2);
3129 x3 = ((cur_ask - offer) * x2 / 100L) + 1;
3130 /* don't let the price go up */
3135 if (cur_ask < final_ask)
3138 cur_ask = final_ask;
3142 pmt = "Final Offer";
3148 (void)(increase_insults());
3153 else if (offer >= cur_ask)
3165 (void)sprintf(out_val, "前回の提示金額: $%ld",
3167 (void)sprintf(out_val, "Your last offer: %ld",
3171 put_str(out_val, 1, 39);
3172 say_comment_2(cur_ask, annoyed);
3178 if (cancel) return (TRUE);
3180 /* Update bargaining info */
3181 updatebargain(*price, final_ask, o_ptr->number);
3189 * @brief プレイヤーが売却する時の値切り処理メインルーチン /
3190 * Haggling routine -RAK-
3191 * @param o_ptr オブジェクトの構造体参照ポインタ
3192 * @param price 最終価格を返す参照ポインタ
3193 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
3194 * Return TRUE if purchase is NOT successful
3196 static bool sell_haggle(object_type *o_ptr, s32b *price)
3198 s32b purse, cur_ask, final_ask;
3199 s32b last_offer = 0, offer = 0;
3201 s32b min_per, max_per;
3202 int flag, loop_flag, noneed;
3203 int annoyed = 0, final = FALSE;
3204 bool cancel = FALSE;
3217 /* Obtain the starting offer and the final offer */
3218 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
3219 final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
3221 /* Determine if haggling is necessary */
3222 noneed = noneedtobargain(final_ask);
3224 /* Get the owner's payout limit */
3225 purse = (s32b)(ot_ptr->max_cost);
3227 /* No need to haggle */
3228 if (noneed || !manual_haggle || (final_ask >= purse))
3230 /* Apply Sales Tax (if needed) */
3231 if (!manual_haggle && !noneed)
3233 final_ask -= final_ask / 10;
3236 /* No reason to haggle */
3237 if (final_ask >= purse)
3241 msg_print("即座にこの金額にまとまった。");
3243 msg_print("You instantly agree upon the price.");
3248 /* Offer full purse */
3252 /* No need to haggle */
3257 msg_print("結局この金額にまとまった。");
3259 msg_print("You eventually agree upon the price.");
3265 /* No haggle option */
3268 /* Message summary */
3270 msg_print("すんなりとこの金額にまとまった。");
3272 msg_print("You quickly agree upon the price.");
3279 cur_ask = final_ask;
3286 pmt = "Final Offer";
3291 /* Haggle for the whole pile */
3292 cur_ask *= o_ptr->number;
3293 final_ask *= o_ptr->number;
3296 /* XXX XXX XXX Display commands */
3298 /* Haggling parameters */
3299 min_per = ot_ptr->haggle_per;
3300 max_per = min_per * 3;
3302 /* Mega-Hack -- artificial "last offer" value */
3303 last_offer = object_value(o_ptr) * o_ptr->number;
3304 last_offer = last_offer * ot_ptr->max_inflate / 100L;
3309 /* No incremental haggling yet */
3313 for (flag = FALSE; !flag; )
3319 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3320 put_str(out_val, 1, 0);
3322 cancel = receive_offer("提示する価格? ",
3324 cancel = receive_offer("What price do you ask? ",
3327 &offer, last_offer, -1, cur_ask, final);
3333 else if (offer < cur_ask)
3336 /* rejected, reset offer for incremental haggling */
3339 else if (offer == cur_ask)
3350 if (flag || !loop_flag) break;
3355 x1 = 100 * (last_offer - offer) / (last_offer - cur_ask);
3358 if (haggle_insults())
3364 else if (x1 > max_per)
3367 if (x1 < max_per) x1 = max_per;
3369 x2 = rand_range(x1-2, x1+2);
3370 x3 = ((offer - cur_ask) * x2 / 100L) + 1;
3371 /* don't let the price go down */
3375 if (cur_ask > final_ask)
3377 cur_ask = final_ask;
3382 pmt = "Final Offer";
3390 /* 追加 $0 で買い取られてしまうのを防止 By FIRST*/
3393 (void)(increase_insults());
3396 else if (offer <= cur_ask)
3407 (void)sprintf(out_val,
3409 "前回の提示価格 $%ld", (long)last_offer);
3411 "Your last bid %ld", (long)last_offer);
3414 put_str(out_val, 1, 39);
3415 say_comment_3(cur_ask, annoyed);
3421 if (cancel) return (TRUE);
3423 /* Update bargaining info */
3424 updatebargain(*price, final_ask, o_ptr->number);
3432 * @brief 店からの購入処理のメインルーチン /
3433 * Buy an item from a store -RAK-
3436 static void store_purchase(void)
3439 COMMAND_CODE item, item_new;
3450 char o_name[MAX_NLEN];
3454 if (cur_store_num == STORE_MUSEUM)
3457 msg_print("博物館から取り出すことはできません。");
3459 msg_print("Museum.");
3465 if (st_ptr->stock_num <= 0)
3467 if (cur_store_num == STORE_HOME)
3469 msg_print("我が家には何も置いてありません。");
3471 msg_print("Your home is empty.");
3476 msg_print("現在商品の在庫を切らしています。");
3478 msg_print("I am currently out of stock.");
3485 /* Find the number of objects on this and following pages */
3486 i = (st_ptr->stock_num - store_top);
3488 /* And then restrict it to the current page */
3489 if (i > store_bottom) i = store_bottom;
3493 /* ブラックマーケットの時は別のメッセージ */
3494 switch( cur_store_num ) {
3496 sprintf(out_val, "どのアイテムを取りますか? ");
3499 sprintf(out_val, "どれ? ");
3502 sprintf(out_val, "どの品物が欲しいんだい? ");
3506 if (cur_store_num == STORE_HOME)
3508 sprintf(out_val, "Which item do you want to take? ");
3512 sprintf(out_val, "Which item are you interested in? ");
3517 /* Get the item number to be bought */
3518 if (!get_stock(&item, out_val, 0, i - 1)) return;
3520 /* Get the actual index */
3521 item = item + store_top;
3523 /* Get the actual item */
3524 o_ptr = &st_ptr->stock[item];
3526 /* Assume the player wants just one of them */
3529 /* Get local object */
3532 /* Get a copy of the object */
3533 object_copy(j_ptr, o_ptr);
3536 * If a rod or wand, allocate total maximum timeouts or charges
3537 * between those purchased and left on the shelf.
3539 reduce_charges(j_ptr, o_ptr->number - amt);
3541 /* Modify quantity */
3542 j_ptr->number = amt;
3544 /* Hack -- require room in pack */
3545 if (!inven_carry_okay(j_ptr))
3548 msg_print("そんなにアイテムを持てない。");
3550 msg_print("You cannot carry that many different items.");
3556 /* Determine the "best" price (per item) */
3557 best = price_item(j_ptr, ot_ptr->min_inflate, FALSE);
3559 /* Find out how many the player wants */
3560 if (o_ptr->number > 1)
3562 /* Hack -- note cost of "fixed" items */
3563 if ((cur_store_num != STORE_HOME) &&
3564 (o_ptr->ident & IDENT_FIXED))
3567 msg_format("一つにつき $%ldです。", (long)(best));
3569 msg_format("That costs %ld gold per item.", (long)(best));
3574 /* Get a quantity */
3575 amt = get_quantity(NULL, o_ptr->number);
3577 /* Allow user abort */
3578 if (amt <= 0) return;
3581 /* Get local object */
3584 /* Get desired object */
3585 object_copy(j_ptr, o_ptr);
3588 * If a rod or wand, allocate total maximum timeouts or charges
3589 * between those purchased and left on the shelf.
3591 reduce_charges(j_ptr, o_ptr->number - amt);
3593 /* Modify quantity */
3594 j_ptr->number = amt;
3596 /* Hack -- require room in pack */
3597 if (!inven_carry_okay(j_ptr))
3600 msg_print("ザックにそのアイテムを入れる隙間がない。");
3602 msg_print("You cannot carry that many items.");
3608 /* Attempt to buy it */
3609 if (cur_store_num != STORE_HOME)
3611 /* Fixed price, quick buy */
3612 if (o_ptr->ident & (IDENT_FIXED))
3617 /* Go directly to the "best" deal */
3618 price = (best * j_ptr->number);
3624 /* Describe the object (fully) */
3625 object_desc(o_name, j_ptr, 0);
3629 msg_format("%s(%c)を購入する。", o_name, I2A(item));
3631 msg_format("Buying %s (%c).", o_name, I2A(item));
3636 /* Haggle for a final price */
3637 choice = purchase_haggle(j_ptr, &price);
3639 /* Hack -- Got kicked out */
3640 if (st_ptr->store_open >= turn) return;
3643 /* Player wants it */
3646 /* Fix the item price (if "correctly" haggled) */
3647 if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
3649 /* Player can afford it */
3650 if (p_ptr->au >= price)
3655 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
3656 chg_virtue(V_JUSTICE, -1);
3657 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
3658 chg_virtue(V_NATURE, -1);
3666 /* Spend the money */
3669 /* Update the display */
3672 /* Hack -- buying an item makes you aware of it */
3673 object_aware(j_ptr);
3675 /* Hack -- clear the "fixed" flag from the item */
3676 j_ptr->ident &= ~(IDENT_FIXED);
3678 /* Describe the transaction */
3679 object_desc(o_name, j_ptr, 0);
3683 msg_format("%sを $%ldで購入しました。", o_name, (long)price);
3685 msg_format("You bought %s for %ld gold.", o_name, (long)price);
3688 strcpy(record_o_name, o_name);
3691 if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
3692 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3693 if(record_rand_art && o_ptr->art_name)
3694 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
3696 /* Erase the inscription */
3697 j_ptr->inscription = 0;
3699 /* Erase the "feeling" */
3700 j_ptr->feeling = FEEL_NONE;
3701 j_ptr->ident &= ~(IDENT_STORE);
3702 /* Give it to the player */
3703 item_new = inven_carry(j_ptr);
3705 /* Describe the final result */
3706 object_desc(o_name, &inventory[item_new], 0);
3710 msg_format("%s(%c)を手に入れた。", o_name, index_to_label(item_new));
3712 msg_format("You have %s (%c).",
3713 o_name, index_to_label(item_new));
3716 /* Auto-inscription */
3717 autopick_alter_item(item_new, FALSE);
3719 /* Now, reduce the original stack's pval. */
3720 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3722 o_ptr->pval -= j_ptr->pval;
3728 /* Note how many slots the store used to have */
3729 i = st_ptr->stock_num;
3731 /* Remove the bought items from the store */
3732 store_item_increase(item, -amt);
3733 store_item_optimize(item);
3735 /* Store is empty */
3736 if (st_ptr->stock_num == 0)
3739 if (one_in_(STORE_SHUFFLE))
3744 msg_print("店主は引退した。");
3746 msg_print("The shopkeeper retires.");
3750 /* Shuffle the store */
3751 store_shuffle(cur_store_num);
3754 sprintf(buf, "%s (%s)",
3755 ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
3756 put_str(buf, 3, 10);
3757 sprintf(buf, "%s (%ld)",
3758 (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
3767 msg_print("店主は新たな在庫を取り出した。");
3769 msg_print("The shopkeeper brings out some new stock.");
3775 for (i = 0; i < 10; i++)
3777 /* Maintain the store */
3778 store_maint(p_ptr->town_num, cur_store_num);
3784 /* Redraw everything */
3785 display_inventory();
3788 /* The item is gone */
3789 else if (st_ptr->stock_num != i)
3791 /* Pick the correct screen */
3792 if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3794 /* Redraw everything */
3795 display_inventory();
3798 /* Item is still here */
3801 /* Redraw the item */
3802 display_entry(item);
3806 /* Player cannot afford it */
3809 /* Simple message (no insult) */
3811 msg_print("お金が足りません。");
3813 msg_print("You do not have enough gold.");
3820 /* Home is much easier */
3823 bool combined_or_reordered;
3825 /* Distribute charges of wands/rods */
3826 distribute_charges(o_ptr, j_ptr, amt);
3828 /* Give it to the player */
3829 item_new = inven_carry(j_ptr);
3831 /* Describe just the result */
3832 object_desc(o_name, &inventory[item_new], 0);
3836 msg_format("%s(%c)を取った。",
3838 msg_format("You have %s (%c).",
3840 o_name, index_to_label(item_new));
3845 /* Take note if we take the last one */
3846 i = st_ptr->stock_num;
3848 /* Remove the items from the home */
3849 store_item_increase(item, -amt);
3850 store_item_optimize(item);
3852 combined_or_reordered = combine_and_reorder_home(STORE_HOME);
3854 /* Hack -- Item is still here */
3855 if (i == st_ptr->stock_num)
3857 /* Redraw everything */
3858 if (combined_or_reordered) display_inventory();
3860 /* Redraw the item */
3861 else display_entry(item);
3864 /* The item is gone */
3868 if (st_ptr->stock_num == 0) store_top = 0;
3870 /* Nothing left on that screen */
3871 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3873 /* Redraw everything */
3874 display_inventory();
3876 chg_virtue(V_SACRIFICE, 1);
3880 /* Not kicked out */
3886 * @brief 店からの売却処理のメインルーチン /
3887 * Sell an item to the store (or home)
3890 static void store_sell(void)
3897 s32b price, value, dummy;
3906 char o_name[MAX_NLEN];
3909 /* Prepare a prompt */
3910 if (cur_store_num == STORE_HOME)
3912 q = "どのアイテムを置きますか? ";
3914 q = "Drop which item? ";
3917 else if (cur_store_num == STORE_MUSEUM)
3919 q = "どのアイテムを寄贈しますか? ";
3921 q = "Give which item? ";
3926 q = "どのアイテムを売りますか? ";
3928 q = "Sell which item? ";
3932 item_tester_no_ryoute = TRUE;
3933 /* Only allow items the store will buy */
3934 item_tester_hook = store_will_buy;
3937 /* 我が家でおかしなメッセージが出るオリジナルのバグを修正 */
3938 if (cur_store_num == STORE_HOME)
3941 s = "置けるアイテムを持っていません。";
3943 s = "You don't have any item to drop.";
3946 else if (cur_store_num == STORE_MUSEUM)
3949 s = "寄贈できるアイテムを持っていません。";
3951 s = "You don't have any item to give.";
3959 s = "You have nothing that I want.";
3963 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
3965 /* Get the item (in the pack) */
3968 o_ptr = &inventory[item];
3971 /* Get the item (on the floor) */
3974 o_ptr = &o_list[0 - item];
3978 /* Hack -- Cannot remove cursed items */
3979 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
3983 msg_print("ふーむ、どうやらそれは呪われているようだね。");
3985 msg_print("Hmmm, it seems to be cursed.");
3994 /* Assume one item */
3997 /* Find out how many the player wants (letter means "all") */
3998 if (o_ptr->number > 1)
4000 /* Get a quantity */
4001 amt = get_quantity(NULL, o_ptr->number);
4003 /* Allow user abort */
4004 if (amt <= 0) return;
4007 /* Get local object */
4010 /* Get a copy of the object */
4011 object_copy(q_ptr, o_ptr);
4013 /* Modify quantity */
4014 q_ptr->number = amt;
4017 * Hack -- If a rod or wand, allocate total maximum
4018 * timeouts or charges to those being sold. -LM-
4020 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4022 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4025 /* Get a full description */
4026 object_desc(o_name, q_ptr, 0);
4028 /* Remove any inscription, feeling for stores */
4029 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4031 q_ptr->inscription = 0;
4032 q_ptr->feeling = FEEL_NONE;
4035 /* Is there room in the store (or the home?) */
4036 if (!store_check_num(q_ptr))
4038 if (cur_store_num == STORE_HOME)
4040 msg_print("我が家にはもう置く場所がない。");
4042 msg_print("Your home is full.");
4045 else if (cur_store_num == STORE_MUSEUM)
4047 msg_print("博物館はもう満杯だ。");
4049 msg_print("Museum is full.");
4054 msg_print("すいませんが、店にはもう置く場所がありません。");
4056 msg_print("I have not the room in my store to keep it.");
4064 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4066 /* Describe the transaction */
4068 msg_format("%s(%c)を売却する。", o_name, index_to_label(item));
4070 msg_format("Selling %s (%c).", o_name, index_to_label(item));
4076 choice = sell_haggle(q_ptr, &price);
4079 if (st_ptr->store_open >= turn) return;
4091 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
4092 chg_virtue(V_JUSTICE, -1);
4094 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
4095 chg_virtue(V_NATURE, 1);
4098 /* Get some money */
4101 /* Update the display */
4104 /* Get the "apparent" value */
4105 dummy = object_value(q_ptr) * q_ptr->number;
4108 identify_item(o_ptr);
4110 /* Get local object */
4113 /* Get a copy of the object */
4114 object_copy(q_ptr, o_ptr);
4116 /* Modify quantity */
4117 q_ptr->number = amt;
4119 /* Make it look like to be known */
4120 q_ptr->ident |= IDENT_STORE;
4123 * Hack -- If a rod or wand, let the shopkeeper know just
4124 * how many charges he really paid for. -LM-
4126 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4128 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4131 /* Get the "actual" value */
4132 value = object_value(q_ptr) * q_ptr->number;
4134 /* Get the description all over again */
4135 object_desc(o_name, q_ptr, 0);
4137 /* Describe the result (in message buffer) */
4139 msg_format("%sを $%ldで売却しました。", o_name, (long)price);
4141 msg_format("You sold %s for %ld gold.", o_name, (long)price);
4144 if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
4146 if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
4148 /* Analyze the prices (and comment verbally) unless a figurine*/
4149 purchase_analyze(price, value, dummy);
4153 * Hack -- Allocate charges between those wands or rods sold
4154 * and retained, unless all are being sold. -LM-
4156 distribute_charges(o_ptr, q_ptr, amt);
4158 /* Reset timeouts of the sold items */
4161 /* Take the item from the player, describe the result */
4162 inven_item_increase(item, -amt);
4163 inven_item_describe(item);
4165 /* If items remain, auto-inscribe before optimizing */
4166 if (o_ptr->number > 0)
4167 autopick_alter_item(item, FALSE);
4169 inven_item_optimize(item);
4174 /* The store gets that (known) item */
4175 item_pos = store_carry(q_ptr);
4177 /* Re-display if item is now in store */
4180 store_top = (item_pos / store_bottom) * store_bottom;
4181 display_inventory();
4186 /* Player is at museum */
4187 else if (cur_store_num == STORE_MUSEUM)
4189 char o2_name[MAX_NLEN];
4190 object_desc(o2_name, q_ptr, OD_NAME_ONLY);
4192 if (-1 == store_check_num(q_ptr))
4195 msg_print("それと同じ品物は既に博物館にあるようです。");
4197 msg_print("The same object as it is already in the Museum.");
4203 msg_print("博物館に寄贈したものは取り出すことができません!!");
4205 msg_print("You cannot take items which is given to the Museum back!!");
4209 if (!get_check(format("本当に%sを寄贈しますか?", o2_name))) return;
4211 if (!get_check(format("Really give %s to the Museum? ", o2_name))) return;
4215 identify_item(q_ptr);
4216 q_ptr->ident |= IDENT_MENTAL;
4218 /* Distribute charges of wands/rods */
4219 distribute_charges(o_ptr, q_ptr, amt);
4223 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4225 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4230 /* Take it from the players inventory */
4231 inven_item_increase(item, -amt);
4232 inven_item_describe(item);
4233 inven_item_optimize(item);
4238 /* Let the home carry it */
4239 item_pos = home_carry(q_ptr);
4241 /* Update store display */
4244 store_top = (item_pos / store_bottom) * store_bottom;
4245 display_inventory();
4248 /* Player is at home */
4251 /* Distribute charges of wands/rods */
4252 distribute_charges(o_ptr, q_ptr, amt);
4256 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4258 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4263 /* Take it from the players inventory */
4264 inven_item_increase(item, -amt);
4265 inven_item_describe(item);
4266 inven_item_optimize(item);
4271 /* Let the home carry it */
4272 item_pos = home_carry(q_ptr);
4274 /* Update store display */
4277 store_top = (item_pos / store_bottom) * store_bottom;
4278 display_inventory();
4282 if ((choice == 0) && (item >= INVEN_RARM))
4291 * @brief 店のアイテムを調べるコマンドのメインルーチン /
4292 * Examine an item in a store -JDL-
4295 static void store_examine(void)
4300 char o_name[MAX_NLEN];
4305 if (st_ptr->stock_num <= 0)
4307 if (cur_store_num == STORE_HOME)
4309 msg_print("我が家には何も置いてありません。");
4311 msg_print("Your home is empty.");
4314 else if (cur_store_num == STORE_MUSEUM)
4316 msg_print("博物館には何も置いてありません。");
4318 msg_print("Museum is empty.");
4323 msg_print("現在商品の在庫を切らしています。");
4325 msg_print("I am currently out of stock.");
4332 /* Find the number of objects on this and following pages */
4333 i = (st_ptr->stock_num - store_top);
4335 /* And then restrict it to the current page */
4336 if (i > store_bottom) i = store_bottom;
4340 sprintf(out_val, "どれを調べますか?");
4342 sprintf(out_val, "Which item do you want to examine? ");
4346 /* Get the item number to be examined */
4347 if (!get_stock(&item, out_val, 0, i - 1)) return;
4349 /* Get the actual index */
4350 item = item + store_top;
4352 /* Get the actual item */
4353 o_ptr = &st_ptr->stock[item];
4355 /* Require full knowledge */
4356 if (!(o_ptr->ident & IDENT_MENTAL))
4358 /* This can only happen in the home */
4360 msg_print("このアイテムについて特に知っていることはない。");
4362 msg_print("You have no special knowledge about that item.");
4369 object_desc(o_name, o_ptr, 0);
4373 msg_format("%sを調べている...", o_name);
4375 msg_format("Examining %s...", o_name);
4379 /* Describe it fully */
4380 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
4382 msg_print("特に変わったところはないようだ。");
4384 msg_print("You see nothing special.");
4393 * @brief 博物館のアイテムを除去するコマンドのメインルーチン /
4394 * Remove an item from museum (Originally from TOband)
4397 static void museum_remove_object(void)
4402 char o_name[MAX_NLEN];
4406 if (st_ptr->stock_num <= 0)
4409 msg_print("博物館には何も置いてありません。");
4411 msg_print("Museum is empty.");
4417 /* Find the number of objects on this and following pages */
4418 i = st_ptr->stock_num - store_top;
4420 /* And then restrict it to the current page */
4421 if (i > store_bottom) i = store_bottom;
4425 sprintf(out_val, "どのアイテムの展示をやめさせますか?");
4427 sprintf(out_val, "Which item do you want to order to remove? ");
4430 /* Get the item number to be removed */
4431 if (!get_stock(&item, out_val, 0, i - 1)) return;
4433 /* Get the actual index */
4434 item = item + store_top;
4436 /* Get the actual item */
4437 o_ptr = &st_ptr->stock[item];
4440 object_desc(o_name, o_ptr, 0);
4443 msg_print("展示をやめさせたアイテムは二度と見ることはできません!");
4444 if (!get_check(format("本当に%sの展示をやめさせますか?", o_name))) return;
4446 msg_print("You cannot see items which is removed from the Museum!");
4447 if (!get_check(format("Really order to remove %s from the Museum? ", o_name))) return;
4452 msg_format("%sの展示をやめさせた。", o_name);
4454 msg_format("You ordered to remove %s.", o_name);
4457 /* Remove the items from the home */
4458 store_item_increase(item, -o_ptr->number);
4459 store_item_optimize(item);
4461 (void)combine_and_reorder_home(STORE_MUSEUM);
4463 /* The item is gone */
4466 if (st_ptr->stock_num == 0) store_top = 0;
4468 /* Nothing left on that screen */
4469 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4471 /* Redraw everything */
4472 display_inventory();
4479 * Hack -- set this to leave the store
4481 static bool leave_store = FALSE;
4485 * @brief 店舗処理コマンド選択のメインルーチン /
4486 * Process a command in a store
4490 * Note that we must allow the use of a few "special" commands
4491 * in the stores which are not allowed in the dungeon, and we
4492 * must disable some commands which are allowed in the dungeon
4493 * but not in the stores, to prevent chaos.
4496 static void store_process_command(void)
4498 #ifdef ALLOW_REPEAT /* TNB */
4500 /* Handle repeating the last command */
4503 #endif /* ALLOW_REPEAT -- TNB */
4505 if (rogue_like_commands && command_cmd == 'l')
4507 command_cmd = 'x'; /* hack! */
4510 /* Parse the command */
4511 switch (command_cmd)
4521 /* 1 ページ戻るコマンド: 我が家のページ数が多いので重宝するはず By BUG */
4524 if (st_ptr->stock_num <= store_bottom) {
4526 msg_print("これで全部です。");
4528 msg_print("Entire inventory is shown.");
4532 store_top -= store_bottom;
4533 if ( store_top < 0 )
4534 store_top = ((st_ptr->stock_num - 1 )/store_bottom) * store_bottom;
4535 if ( (cur_store_num == STORE_HOME) && (powerup_home == FALSE) )
4536 if ( store_top >= store_bottom ) store_top = store_bottom;
4537 display_inventory();
4545 if (st_ptr->stock_num <= store_bottom)
4548 msg_print("これで全部です。");
4550 msg_print("Entire inventory is shown.");
4556 store_top += store_bottom;
4558 * 隠しオプション(powerup_home)がセットされていないときは
4559 * 我が家では 2 ページまでしか表示しない
4561 if ((cur_store_num == STORE_HOME) &&
4562 (powerup_home == FALSE) &&
4563 (st_ptr->stock_num >= STORE_INVEN_MAX))
4565 if (store_top >= (STORE_INVEN_MAX - 1))
4572 if (store_top >= st_ptr->stock_num) store_top = 0;
4575 display_inventory();
4588 /* Get (purchase) */
4615 /*** Inventory Commands ***/
4617 /* Wear/wield equipment */
4624 /* Take off equipment */
4631 /* Destroy an item */
4638 /* Equipment list */
4645 /* Inventory list */
4653 /*** Various commands ***/
4655 /* Identify an object */
4662 /* Hack -- toggle windows */
4665 toggle_inven_equip();
4671 /*** Use various objects ***/
4676 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4677 (p_ptr->pclass == CLASS_BERSERKER) ||
4678 (p_ptr->pclass == CLASS_NINJA) ||
4679 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4680 ) do_cmd_mind_browse();
4681 else if (p_ptr->pclass == CLASS_SMITH)
4683 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4684 do_cmd_magic_eater(TRUE, FALSE);
4685 else if (p_ptr->pclass == CLASS_SNIPER)
4686 do_cmd_snipe_browse();
4687 else do_cmd_browse();
4691 /* Inscribe an object */
4698 /* Uninscribe an object */
4701 do_cmd_uninscribe();
4707 /*** Help and Such ***/
4716 /* Identify symbol */
4719 do_cmd_query_symbol();
4723 /* Character description */
4726 p_ptr->town_num = old_town_num;
4727 do_cmd_change_name();
4728 p_ptr->town_num = inner_town_num;
4734 /*** System Commands ***/
4736 /* Hack -- User interface */
4743 /* Single line from a pref file */
4746 p_ptr->town_num = old_town_num;
4748 p_ptr->town_num = inner_town_num;
4752 /* Interact with macros */
4755 p_ptr->town_num = old_town_num;
4757 p_ptr->town_num = inner_town_num;
4761 /* Interact with visuals */
4764 p_ptr->town_num = old_town_num;
4766 p_ptr->town_num = inner_town_num;
4770 /* Interact with colors */
4773 p_ptr->town_num = old_town_num;
4775 p_ptr->town_num = inner_town_num;
4779 /* Interact with options */
4783 (void)combine_and_reorder_home(STORE_HOME);
4789 /*** Misc Commands ***/
4805 /* Repeat level feeling */
4812 /* Show previous message */
4815 do_cmd_message_one();
4819 /* Show previous messages */
4832 /* Check artifacts, uniques etc. */
4839 /* Load "screen dump" */
4842 do_cmd_load_screen();
4846 /* Save "screen dump" */
4849 do_cmd_save_screen();
4853 /* Hack -- Unknown command */
4856 if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
4858 museum_remove_object();
4863 msg_print("そのコマンドは店の中では使えません。");
4865 msg_print("That command does not work in stores.");
4876 * @brief 店舗処理全体のメインルーチン /
4877 * Enter a store, and interact with it. *
4881 * Note that we use the standard "request_command()" function
4882 * to get a command, allowing us to use "command_arg" and all
4883 * command macros and other nifty stuff, but we use the special
4884 * "shopping" argument, to force certain commands to be converted
4885 * into other commands, normally, we convert "p" (pray) and "m"
4886 * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
4889 void do_cmd_store(void)
4895 bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
4899 Term_get_size(&w, &h);
4901 /* Calculate stocks per 1 page */
4902 xtra_stock = MIN(14+26, ((h > 24) ? (h - 24) : 0));
4903 store_bottom = MIN_STOCK + xtra_stock;
4905 /* Access the player grid */
4906 c_ptr = &cave[p_ptr->y][p_ptr->x];
4908 /* Verify a store */
4909 if (!cave_have_flag_grid(c_ptr, FF_STORE))
4912 msg_print("ここには店がありません。");
4914 msg_print("You see no store here.");
4920 /* Extract the store code */
4921 which = f_info[c_ptr->feat].subtype;
4923 old_town_num = p_ptr->town_num;
4924 if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
4925 if (dun_level) p_ptr->town_num = NO_TOWN;
4926 inner_town_num = p_ptr->town_num;
4928 /* Hack -- Check the "locked doors" */
4929 if ((town[p_ptr->town_num].store[which].store_open >= turn) ||
4933 msg_print("ドアに鍵がかかっている。");
4935 msg_print("The doors are locked.");
4938 p_ptr->town_num = old_town_num;
4942 /* Calculate the number of store maintainances since the last visit */
4943 maintain_num = (turn - town[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
4945 /* Maintain the store max. 10 times */
4946 if (maintain_num > 10) maintain_num = 10;
4950 /* Maintain the store */
4951 for (i = 0; i < maintain_num; i++)
4952 store_maint(p_ptr->town_num, which);
4954 /* Save the visit */
4955 town[p_ptr->town_num].store[which].last_visit = turn;
4958 /* Forget the lite */
4961 /* Forget the view */
4965 /* Hack -- Character is in "icky" mode */
4966 character_icky = TRUE;
4969 /* No command argument */
4972 /* No repeated command */
4975 /* No automatic command */
4978 /* Do not expand macros */
4979 get_com_no_macros = TRUE;
4981 /* Save the store number */
4982 cur_store_num = which;
4984 /* Hack -- save the store feature */
4985 cur_store_feat = c_ptr->feat;
4987 /* Save the store and owner pointers */
4988 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
4989 ot_ptr = &owners[cur_store_num][st_ptr->owner];
4992 /* Start at the beginning */
4995 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4997 /* Display the store */
5001 leave_store = FALSE;
5003 /* Interact with player */
5004 while (!leave_store)
5006 /* Hack -- Clear line 1 */
5010 clear_from(20 + xtra_stock);
5013 /* Basic commands */
5015 prt(" ESC) 建物から出る", 21 + xtra_stock, 0);
5017 prt(" ESC) Exit from Building.", 21 + xtra_stock, 0);
5021 /* Browse if necessary */
5022 if (st_ptr->stock_num > store_bottom)
5025 prt(" -)前ページ", 22 + xtra_stock, 0);
5026 prt(" スペース) 次ページ", 23 + xtra_stock, 0);
5028 prt(" -) Previous page", 22 + xtra_stock, 0);
5029 prt(" SPACE) Next page", 23 + xtra_stock, 0);
5035 if (cur_store_num == STORE_HOME)
5038 prt("g) アイテムを取る", 21 + xtra_stock, 27);
5039 prt("d) アイテムを置く", 22 + xtra_stock, 27);
5040 prt("x) 家のアイテムを調べる", 23 + xtra_stock, 27);
5042 prt("g) Get an item.", 21 + xtra_stock, 27);
5043 prt("d) Drop an item.", 22 + xtra_stock, 27);
5044 prt("x) eXamine an item in the home.", 23 + xtra_stock, 27);
5048 /* Museum commands */
5049 else if (cur_store_num == STORE_MUSEUM)
5052 prt("d) アイテムを置く", 21 + xtra_stock, 27);
5053 prt("r) アイテムの展示をやめる", 22 + xtra_stock, 27);
5054 prt("x) 博物館のアイテムを調べる", 23 + xtra_stock, 27);
5056 prt("d) Drop an item.", 21 + xtra_stock, 27);
5057 prt("r) order to Remove an item.", 22 + xtra_stock, 27);
5058 prt("x) eXamine an item in the museum.", 23 + xtra_stock, 27);
5062 /* Shop commands XXX XXX XXX */
5066 prt("p) 商品を買う", 21 + xtra_stock, 30);
5067 prt("s) アイテムを売る", 22 + xtra_stock, 30);
5068 prt("x) 商品を調べる", 23 + xtra_stock,30);
5070 prt("p) Purchase an item.", 21 + xtra_stock, 30);
5071 prt("s) Sell an item.", 22 + xtra_stock, 30);
5072 prt("x) eXamine an item in the shop", 23 + xtra_stock,30);
5079 prt("i/e) 持ち物/装備の一覧", 21 + xtra_stock, 56);
5081 if (rogue_like_commands)
5083 prt("w/T) 装備する/はずす", 22 + xtra_stock, 56);
5087 prt("w/t) 装備する/はずす", 22 + xtra_stock, 56);
5090 prt("i/e) Inventry/Equipment list", 21 + xtra_stock, 56);
5092 if (rogue_like_commands)
5094 prt("w/T) Wear/Take off equipment", 22 + xtra_stock, 56);
5098 prt("w/t) Wear/Take off equipment", 22 + xtra_stock, 56);
5103 prt("コマンド:", 20 + xtra_stock, 0);
5105 prt("You may: ", 20 + xtra_stock, 0);
5110 request_command(TRUE);
5112 /* Process the command */
5113 store_process_command();
5116 * Hack -- To redraw missiles damage and prices in store
5117 * If player's charisma changes, or if player changes a bow, PU_BONUS is set
5119 need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
5121 /* Hack -- Character is still in "icky" mode */
5122 character_icky = TRUE;
5130 /* XXX XXX XXX Pack Overflow */
5131 if (inventory[INVEN_PACK].k_idx)
5133 int item = INVEN_PACK;
5135 object_type *o_ptr = &inventory[item];
5137 /* Hack -- Flee from the store */
5138 if (cur_store_num != STORE_HOME)
5142 if (cur_store_num == STORE_MUSEUM)
5143 msg_print("ザックからアイテムがあふれそうなので、あわてて博物館から出た...");
5145 msg_print("ザックからアイテムがあふれそうなので、あわてて店から出た...");
5147 if (cur_store_num == STORE_MUSEUM)
5148 msg_print("Your pack is so full that you flee the Museum...");
5150 msg_print("Your pack is so full that you flee the store...");
5158 /* Hack -- Flee from the home */
5159 else if (!store_check_num(o_ptr))
5163 msg_print("ザックからアイテムがあふれそうなので、あわてて家から出た...");
5165 msg_print("Your pack is so full that you flee your home...");
5173 /* Hack -- Drop items into the home */
5181 char o_name[MAX_NLEN];
5184 /* Give a message */
5186 msg_print("ザックからアイテムがあふれてしまった!");
5188 msg_print("Your pack overflows!");
5192 /* Get local object */
5195 /* Grab a copy of the item */
5196 object_copy(q_ptr, o_ptr);
5199 object_desc(o_name, q_ptr, 0);
5203 msg_format("%sが落ちた。(%c)", o_name, index_to_label(item));
5205 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5209 /* Remove it from the players inventory */
5210 inven_item_increase(item, -255);
5211 inven_item_describe(item);
5212 inven_item_optimize(item);
5217 /* Let the home carry it */
5218 item_pos = home_carry(q_ptr);
5220 /* Redraw the home */
5223 store_top = (item_pos / store_bottom) * store_bottom;
5224 display_inventory();
5229 /* Hack -- Redisplay store prices if charisma changes */
5230 /* Hack -- Redraw missiles damage if player changes bow */
5231 if (need_redraw_store_inv) display_inventory();
5233 /* Hack -- get kicked out of the store */
5234 if (st_ptr->store_open >= turn) leave_store = TRUE;
5237 select_floor_music();
5239 p_ptr->town_num = old_town_num;
5241 /* Free turn XXX XXX XXX */
5242 p_ptr->energy_use = 100;
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 which 店舗種類の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... */