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(PRICE 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(PRICE 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(PRICE price, PRICE value, PRICE 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);
576 /* Item was cheaper than we thought, and we paid more than necessary */
577 else if ((value < guess) && (price > value))
580 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
582 chg_virtue(V_JUSTICE, -1);
584 chg_virtue(V_HONOUR, -1);
589 /* Item was a good bargain, and we got away with it */
590 else if ((value > guess) && (value < (4 * guess)) && (price < value))
593 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
596 chg_virtue(V_HONOUR, -1);
598 chg_virtue(V_HONOUR, 1);
603 /* Item was a great bargain, and we got away with it */
604 else if ((value > guess) && (price < value))
607 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
610 chg_virtue(V_HONOUR, -1);
612 chg_virtue(V_HONOUR, 1);
614 if (10 * price < value)
615 chg_virtue(V_SACRIFICE, 1);
624 * We store the current "store feat" here so everyone can access it
626 static int cur_store_feat;
630 * Buying and selling adjustments for race combinations.
631 * Entry[owner][player] gives the basic "cost inflation".
633 static byte rgold_adj[MAX_RACES][MAX_RACES] =
635 /*Hum, HfE, Elf, Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
636 HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
637 Imp, Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
638 Angel, Demon, Kutar */
641 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
642 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
643 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
644 100, 120, 110, 105 },
647 { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
648 120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
649 120, 110, 110, 110, 120, 110, 100, 125, 100, 95, 140,
650 110, 115, 110, 110 },
653 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
654 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
655 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
656 110, 110, 105, 110 },
659 { 115, 110, 105, 95, 105, 110, 115, 130, 115, 105, 115,
660 125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
661 120, 110, 120, 120, 130, 110, 110, 130, 110, 95, 140,
662 115, 120, 105, 115 },
665 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
666 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
667 120, 101, 110, 110, 120, 120, 115, 130, 115, 95, 140,
668 115, 110, 110, 115 },
671 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
672 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
673 120, 105, 115, 115, 115, 115, 120, 130, 120, 95, 140,
674 115, 110, 115, 115 },
677 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
678 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
679 115, 125, 120, 120, 115, 120, 125, 115, 125, 95, 140,
680 115, 110, 115, 115 },
683 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
684 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
685 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
686 110, 110, 115, 110 },
689 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
690 120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
691 120, 105, 120, 120, 125, 120, 105, 135, 105, 95, 140,
692 100, 110, 110, 100 },
695 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
696 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
697 125, 115, 120, 120, 125, 120, 100, 125, 100, 95, 140,
698 110, 110, 105, 110 },
700 /* Human / Barbarian (copied from human) */
701 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
702 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
703 115, 105, 125, 125, 130, 125, 115, 120, 115, 95, 140,
704 100, 120, 110, 100 },
706 /* Half-Ogre: theoretical, copied from half-troll */
707 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
708 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
709 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
710 110, 110, 115, 110 },
712 /* Half-Giant: theoretical, copied from half-troll */
713 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
714 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
715 110, 115, 112, 112, 115, 112, 130, 120, 130, 95, 140,
716 110, 110, 115, 110 },
718 /* Half-Titan: theoretical, copied from High_Elf */
719 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
720 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
721 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
722 110, 110, 115, 110 },
724 /* Cyclops: theoretical, copied from half-troll */
725 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
726 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
727 110, 115, 112, 112, 115, 112, 130, 130, 130, 95, 140,
728 110, 110, 115, 110 },
730 /* Yeek: theoretical, copied from Half-Orc */
731 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
732 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
733 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
734 115, 110, 115, 115 },
736 /* Klackon: theoretical, copied from Gnome */
737 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
738 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
739 120, 101, 110, 110, 120, 120, 130, 130, 130, 95, 140,
740 115, 110, 115, 115 },
742 /* Kobold: theoretical, copied from Half-Orc */
743 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
744 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
745 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
746 115, 110, 115, 115 },
748 /* Nibelung: theoretical, copied from Dwarf */
749 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
750 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
751 120, 105, 115, 115, 120, 120, 130, 130, 130, 95, 140,
752 115, 135, 115, 115 },
755 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
756 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
757 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
758 110, 101, 115, 110 },
760 /* Draconian: theoretical, copied from High_Elf */
761 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
762 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
763 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
764 110, 110, 115, 110 },
766 /* Mind Flayer: theoretical, copied from High_Elf */
767 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
768 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
769 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
770 110, 110, 115, 110 },
772 /* Imp: theoretical, copied from High_Elf */
773 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
774 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
775 125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
776 110, 110, 115, 110 },
778 /* Golem: theoretical, copied from High_Elf */
779 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
780 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
781 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
782 110, 110, 115, 110 },
784 /* Skeleton: theoretical, copied from half-orc */
785 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
786 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
787 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
788 115, 110, 125, 115 },
790 /* Zombie: Theoretical, copied from half-orc */
791 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
792 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
793 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
794 115, 110, 125, 115 },
796 /* Vampire: Theoretical, copied from half-orc */
797 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
798 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
799 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
800 115, 110, 125, 115 },
802 /* Spectre: Theoretical, copied from half-orc */
803 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
804 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
805 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
806 115, 110, 125, 115 },
808 /* Sprite: Theoretical, copied from half-orc */
809 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
810 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
811 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
812 115, 110, 105, 115 },
814 /* Beastman: Theoretical, copied from half-orc */
815 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
816 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
817 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
818 115, 110, 115, 115 },
821 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
822 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
823 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
824 110, 110, 105, 110 },
827 { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
828 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
829 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 160,
833 { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
834 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
835 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
836 140, 140, 140, 140 },
839 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
840 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
841 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
842 100, 120, 110, 100 },
845 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
846 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
847 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
848 110, 101, 115, 110 },
851 { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
852 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
853 115, 115, 125, 125, 125, 125, 105, 115, 105, 95, 140,
854 110, 115, 100, 110 },
857 { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
858 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
859 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
860 100, 120, 110, 100 },
867 * Determine the price of an item (qty one) in a store.
868 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
869 * @param greed 店主の強欲度
870 * @param flip TRUEならば店主にとっての買取価格、FALSEなら売出価格を計算
874 * This function takes into account the player's charisma, and the
875 * shop-keepers friendliness, and the shop-keeper's base greed, but
876 * never lets a shop-keeper lose money in a transaction.
877 * The "greed" value should exceed 100 when the player is "buying" the
878 * item, and should be less than 100 when the player is "selling" it.
879 * Hack -- the black market always charges twice as much as it should.
880 * Charisma adjustment runs from 80 to 130
881 * Racial adjustment runs from 95 to 130
882 * Since greed/charisma/racial adjustments are centered at 100, we need
883 * to adjust (by 200) to extract a usable multiplier. Note that the
884 * "greed" value is always something (?).
887 static s32b price_item(object_type *o_ptr, int greed, bool flip)
894 /* Get the value of one of the items */
895 price = object_value(o_ptr);
897 /* Worthless items */
898 if (price <= 0) return (0L);
901 /* Compute the racial factor */
902 factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
904 /* Add in the charisma factor */
905 factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]];
911 /* Adjust for greed */
912 adjust = 100 + (300 - (greed + factor));
914 /* Never get "silly" */
915 if (adjust > 100) adjust = 100;
917 /* Mega-Hack -- Black market sucks */
918 if (cur_store_num == STORE_BLACK)
921 /* Compute the final price (with rounding) */
922 /* Hack -- prevent underflow */
923 price = (price * adjust + 50L) / 100L;
926 /* Shop is selling */
929 /* Adjust for greed */
930 adjust = 100 + ((greed + factor) - 300);
932 /* Never get "silly" */
933 if (adjust < 100) adjust = 100;
935 /* Mega-Hack -- Black market sucks */
936 if (cur_store_num == STORE_BLACK)
939 /* Compute the final price (with rounding) */
940 /* Hack -- prevent overflow */
941 price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
944 /* Note -- Never become "free" */
945 if (price <= 0L) return (1L);
947 /* Return the price */
953 * @brief 安価な消耗品の販売数を増やし、低確率で割引にする /
954 * Certain "cheap" objects should be created in "piles"
955 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
959 * Some objects can be sold at a "discount" (in small piles)
962 static void mass_produce(object_type *o_ptr)
965 DISCOUNT_RATE discount = 0;
967 s32b cost = object_value(o_ptr);
970 /* Analyze the type */
973 /* Food, Flasks, and Lites */
978 if (cost <= 5L) size += damroll(3, 5);
979 if (cost <= 20L) size += damroll(3, 5);
980 if (cost <= 50L) size += damroll(2, 2);
987 if (cost <= 60L) size += damroll(3, 5);
988 if (cost <= 240L) size += damroll(1, 5);
989 if (o_ptr->sval == SV_SCROLL_STAR_IDENTIFY) size += damroll(3, 5);
990 if (o_ptr->sval == SV_SCROLL_STAR_REMOVE_CURSE) size += damroll(1, 4);
995 case TV_SORCERY_BOOK:
1000 case TV_ARCANE_BOOK:
1002 case TV_DAEMON_BOOK:
1003 case TV_CRUSADE_BOOK:
1005 case TV_HISSATSU_BOOK:
1008 if (cost <= 50L) size += damroll(2, 3);
1009 if (cost <= 500L) size += damroll(1, 3);
1027 if (object_is_artifact(o_ptr)) break;
1028 if (object_is_ego(o_ptr)) break;
1029 if (cost <= 10L) size += damroll(3, 5);
1030 if (cost <= 100L) size += damroll(3, 5);
1039 if (cost <= 5L) size += damroll(5, 5);
1040 if (cost <= 50L) size += damroll(5, 5);
1041 if (cost <= 500L) size += damroll(5, 5);
1047 if (cost <= 100L) size += damroll(2, 2);
1048 if (cost <= 1000L) size += damroll(2, 2);
1061 * Because many rods (and a few wands and staffs) are useful mainly
1062 * in quantity, the Black Market will occasionally have a bunch of
1069 if ((cur_store_num == STORE_BLACK) && one_in_(3))
1071 if (cost < 1601L) size += damroll(1, 5);
1072 else if (cost < 3201L) size += damroll(1, 3);
1079 /* Pick a discount */
1084 else if (one_in_(25))
1088 else if (one_in_(150))
1092 else if (one_in_(300))
1096 else if (one_in_(500))
1101 if (o_ptr->art_name)
1106 /* Save the discount */
1107 o_ptr->discount = discount;
1109 /* Save the total pile size */
1110 o_ptr->number = size - (size * discount / 100);
1112 /* Ensure that mass-produced rods and wands get the correct pvals. */
1113 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1115 o_ptr->pval *= (PARAMETER_VALUE)o_ptr->number;
1122 * @brief 店舗に並べた品を同一品であるかどうか判定する /
1123 * Determine if a store item can "absorb" another item
1124 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1125 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1126 * @return 同一扱いできるならTRUEを返す
1129 * See "object_similar()" for the same function for the "player"
1132 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
1136 /* Hack -- Identical items cannot be stacked */
1137 if (o_ptr == j_ptr) return (0);
1139 /* Different objects cannot be stacked */
1140 if (o_ptr->k_idx != j_ptr->k_idx) return (0);
1142 /* Different charges (etc) cannot be stacked, unless wands or rods. */
1143 if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
1145 /* Require many identical values */
1146 if (o_ptr->to_h != j_ptr->to_h) return (0);
1147 if (o_ptr->to_d != j_ptr->to_d) return (0);
1148 if (o_ptr->to_a != j_ptr->to_a) return (0);
1150 /* Require identical "ego-item" names */
1151 if (o_ptr->name2 != j_ptr->name2) return (0);
1153 /* Artifacts don't stack! */
1154 if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
1156 /* Hack -- Identical art_flags! */
1157 for (i = 0; i < TR_FLAG_SIZE; i++)
1158 if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
1160 /* Hack -- Never stack "powerful" items */
1161 if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
1163 /* Hack -- Never stack recharging items */
1164 if (o_ptr->timeout || j_ptr->timeout) return (0);
1166 /* Require many identical values */
1167 if (o_ptr->ac != j_ptr->ac) return (0);
1168 if (o_ptr->dd != j_ptr->dd) return (0);
1169 if (o_ptr->ds != j_ptr->ds) return (0);
1171 /* Hack -- Never stack chests */
1172 if (o_ptr->tval == TV_CHEST) return (0);
1173 if (o_ptr->tval == TV_STATUE) return (0);
1174 if (o_ptr->tval == TV_CAPTURE) return (0);
1176 /* Require matching discounts */
1177 if (o_ptr->discount != j_ptr->discount) return (0);
1179 /* They match, so they must be similar */
1185 * @brief 店舗に並べた品を重ね合わせできるかどうか判定する /
1186 * Allow a store item to absorb another item
1187 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1188 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1189 * @return 重ね合わせできるならTRUEを返す
1192 * See "object_similar()" for the same function for the "player"
1195 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
1197 int max_num = (o_ptr->tval == TV_ROD) ?
1198 MIN(99, MAX_SHORT / k_info[o_ptr->k_idx].pval) : 99;
1199 int total = o_ptr->number + j_ptr->number;
1200 int diff = (total > max_num) ? total - max_num : 0;
1202 /* Combine quantity, lose excess items */
1203 o_ptr->number = (total > max_num) ? max_num : total;
1205 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) together. -LM- */
1206 if (o_ptr->tval == TV_ROD)
1208 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1211 /* Hack -- if wands are stacking, combine the charges. -LM- */
1212 if (o_ptr->tval == TV_WAND)
1214 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1220 * @brief 店舗に品を置くスペースがあるかどうかの判定を返す /
1221 * Check to see if the shop will be carrying too many objects -RAK-
1222 * @param o_ptr 店舗に置きたいオブジェクト構造体の参照ポインタ
1223 * @return 置き場がないなら0、重ね合わせできるアイテムがあるなら-1、スペースがあるなら1を返す。
1226 * Note that the shop, just like a player, will not accept things
1227 * it cannot hold. Before, one could "nuke" potions this way.
1228 * Return value is now int:
1230 * -1 : Can be combined to existing slot.
1231 * 1 : Cannot be combined but there are empty spaces.
1234 static int store_check_num(object_type *o_ptr)
1239 /* The "home" acts like the player */
1240 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
1242 bool old_stack_force_notes = stack_force_notes;
1243 bool old_stack_force_costs = stack_force_costs;
1245 if (cur_store_num != STORE_HOME)
1247 stack_force_notes = FALSE;
1248 stack_force_costs = FALSE;
1251 /* Check all the items */
1252 for (i = 0; i < st_ptr->stock_num; i++)
1254 /* Get the existing item */
1255 j_ptr = &st_ptr->stock[i];
1257 /* Can the new object be combined with the old one? */
1258 if (object_similar(j_ptr, o_ptr))
1260 if (cur_store_num != STORE_HOME)
1262 stack_force_notes = old_stack_force_notes;
1263 stack_force_costs = old_stack_force_costs;
1270 if (cur_store_num != STORE_HOME)
1272 stack_force_notes = old_stack_force_notes;
1273 stack_force_costs = old_stack_force_costs;
1277 /* Normal stores do special stuff */
1280 /* Check all the items */
1281 for (i = 0; i < st_ptr->stock_num; i++)
1283 /* Get the existing item */
1284 j_ptr = &st_ptr->stock[i];
1286 /* Can the new object be combined with the old one? */
1287 if (store_object_similar(j_ptr, o_ptr)) return -1;
1291 /* Free space is always usable */
1293 * オプション powerup_home が設定されていると
1296 if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
1297 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
1302 if (st_ptr->stock_num < st_ptr->stock_size) {
1307 /* But there was no room at the inn... */
1312 * @brief オブジェクトが祝福されているかの判定を返す /
1313 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1314 * @return アイテムが祝福されたアイテムならばTRUEを返す
1316 static bool is_blessed(object_type *o_ptr)
1318 BIT_FLAGS flgs[TR_FLAG_SIZE];
1319 object_flags(o_ptr, flgs);
1320 if (have_flag(flgs, TR_BLESSED)) return (TRUE);
1321 else return (FALSE);
1327 * @brief オブジェクトが所定の店舗で引き取れるかどうかを返す /
1328 * Determine if the current store will purchase the given item
1329 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1330 * @return アイテムが買い取れるならばTRUEを返す
1332 * Note that a shop-keeper must refuse to buy "worthless" items
1334 static bool store_will_buy(object_type *o_ptr)
1336 /* Hack -- The Home is simple */
1337 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
1339 /* Switch on the store */
1340 switch (cur_store_num)
1345 /* Analyze the type */
1346 switch (o_ptr->tval)
1349 if (o_ptr->sval != SV_POTION_WATER) return FALSE;
1361 case TV_BOTTLE: /* 'Green', recycling Angband */
1376 /* Analyze the type */
1377 switch (o_ptr->tval)
1398 /* Analyze the type */
1399 switch (o_ptr->tval)
1408 case TV_HISSATSU_BOOK:
1412 if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
1424 /* Analyze the type */
1425 switch (o_ptr->tval)
1428 case TV_CRUSADE_BOOK:
1438 monster_race *r_ptr = &r_info[o_ptr->pval];
1441 if (!(r_ptr->flags3 & RF3_EVIL))
1444 if (r_ptr->flags3 & RF3_GOOD) break;
1446 /* Accept animals */
1447 if (r_ptr->flags3 & RF3_ANIMAL) break;
1450 if (my_strchr("?!", r_ptr->d_char)) break;
1456 if (is_blessed(o_ptr)) break;
1465 case STORE_ALCHEMIST:
1467 /* Analyze the type */
1468 switch (o_ptr->tval)
1482 /* Analyze the type */
1483 switch (o_ptr->tval)
1485 case TV_SORCERY_BOOK:
1486 case TV_NATURE_BOOK:
1490 case TV_ARCANE_BOOK:
1492 case TV_DAEMON_BOOK:
1506 if(o_ptr->sval == SV_WIZSTAFF) break;
1507 else return (FALSE);
1514 /* Bookstore Shop */
1517 /* Analyze the type */
1518 switch (o_ptr->tval)
1520 case TV_SORCERY_BOOK:
1521 case TV_NATURE_BOOK:
1526 case TV_ARCANE_BOOK:
1528 case TV_DAEMON_BOOK:
1529 case TV_CRUSADE_BOOK:
1540 /* XXX XXX XXX Ignore "worthless" items */
1541 if (object_value(o_ptr) <= 0) return (FALSE);
1549 * @brief 現在の町の指定された店舗のアイテムを整理する /
1550 * Combine and reorder items in store.
1551 * @param store_num 店舗ID
1552 * @return 実際に整理が行われたならばTRUEを返す。
1554 bool combine_and_reorder_home(int store_num)
1558 object_type forge, *o_ptr, *j_ptr;
1559 bool flag = FALSE, combined;
1560 store_type *old_st_ptr = st_ptr;
1561 bool old_stack_force_notes = stack_force_notes;
1562 bool old_stack_force_costs = stack_force_costs;
1564 st_ptr = &town[1].store[store_num];
1565 if (store_num != STORE_HOME)
1567 stack_force_notes = FALSE;
1568 stack_force_costs = FALSE;
1575 /* Combine the items in the home (backwards) */
1576 for (i = st_ptr->stock_num - 1; i > 0; i--)
1579 o_ptr = &st_ptr->stock[i];
1581 /* Skip empty items */
1582 if (!o_ptr->k_idx) continue;
1584 /* Scan the items above that item */
1585 for (j = 0; j < i; j++)
1590 j_ptr = &st_ptr->stock[j];
1592 /* Skip empty items */
1593 if (!j_ptr->k_idx) continue;
1596 * Get maximum number of the stack if these
1597 * are similar, get zero otherwise.
1599 max_num = object_similar_part(j_ptr, o_ptr);
1601 /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
1602 if (max_num && j_ptr->number < max_num)
1604 if (o_ptr->number + j_ptr->number <= max_num)
1606 /* Add together the item counts */
1607 object_absorb(j_ptr, o_ptr);
1609 /* One object is gone */
1610 st_ptr->stock_num--;
1612 /* Slide everything down */
1613 for (k = i; k < st_ptr->stock_num; k++)
1615 /* Structure copy */
1616 st_ptr->stock[k] = st_ptr->stock[k + 1];
1619 /* Erase the "final" slot */
1620 object_wipe(&st_ptr->stock[k]);
1624 ITEM_NUMBER old_num = o_ptr->number;
1625 ITEM_NUMBER remain = j_ptr->number + o_ptr->number - max_num;
1627 /* Add together the item counts */
1628 object_absorb(j_ptr, o_ptr);
1630 o_ptr->number = remain;
1632 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
1633 if (o_ptr->tval == TV_ROD)
1635 o_ptr->pval = o_ptr->pval * remain / old_num;
1636 o_ptr->timeout = o_ptr->timeout * remain / old_num;
1639 /* Hack -- if wands are stacking, combine the charges. -LM- */
1640 else if (o_ptr->tval == TV_WAND)
1642 o_ptr->pval = o_ptr->pval * remain / old_num;
1658 /* Re-order the items in the home (forwards) */
1659 for (i = 0; i < st_ptr->stock_num; i++)
1662 o_ptr = &st_ptr->stock[i];
1664 /* Skip empty slots */
1665 if (!o_ptr->k_idx) continue;
1667 /* Get the "value" of the item */
1668 o_value = object_value(o_ptr);
1670 /* Scan every occupied slot */
1671 for (j = 0; j < st_ptr->stock_num; j++)
1673 if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
1676 /* Never move down */
1677 if (j >= i) continue;
1682 /* Get local object */
1685 /* Save a copy of the moving item */
1686 object_copy(j_ptr, &st_ptr->stock[i]);
1688 /* Slide the objects */
1689 for (k = i; k > j; k--)
1691 /* Slide the item */
1692 object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
1695 /* Insert the moving item */
1696 object_copy(&st_ptr->stock[j], j_ptr);
1699 st_ptr = old_st_ptr;
1700 if (store_num != STORE_HOME)
1702 stack_force_notes = old_stack_force_notes;
1703 stack_force_costs = old_stack_force_costs;
1711 * @brief 我が家にオブジェクトを加える /
1712 * Add the item "o_ptr" to the inventory of the "Home"
1713 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1717 * In all cases, return the slot (or -1) where the object was placed
1718 * Note that this is a hacked up version of "inven_carry()".
1719 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1720 * known, the player may have to pick stuff up and drop it again.
1723 static int home_carry(object_type *o_ptr)
1729 bool old_stack_force_notes = stack_force_notes;
1730 bool old_stack_force_costs = stack_force_costs;
1732 if (cur_store_num != STORE_HOME)
1734 stack_force_notes = FALSE;
1735 stack_force_costs = FALSE;
1738 /* Check each existing item (try to combine) */
1739 for (slot = 0; slot < st_ptr->stock_num; slot++)
1741 /* Get the existing item */
1742 j_ptr = &st_ptr->stock[slot];
1744 /* The home acts just like the player */
1745 if (object_similar(j_ptr, o_ptr))
1747 /* Save the new number of items */
1748 object_absorb(j_ptr, o_ptr);
1750 if (cur_store_num != STORE_HOME)
1752 stack_force_notes = old_stack_force_notes;
1753 stack_force_costs = old_stack_force_costs;
1761 if (cur_store_num != STORE_HOME)
1763 stack_force_notes = old_stack_force_notes;
1764 stack_force_costs = old_stack_force_costs;
1769 * 隠し機能: オプション powerup_home が設定されていると
1773 if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
1774 if (st_ptr->stock_num >= st_ptr->stock_size) {
1779 if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
1785 /* Determine the "value" of the item */
1786 value = object_value(o_ptr);
1788 /* Check existing slots to see if we must "slide" */
1789 for (slot = 0; slot < st_ptr->stock_num; slot++)
1791 if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
1794 /* Slide the others up */
1795 for (i = st_ptr->stock_num; i > slot; i--)
1797 st_ptr->stock[i] = st_ptr->stock[i-1];
1800 /* More stuff now */
1801 st_ptr->stock_num++;
1803 /* Insert the new item */
1804 st_ptr->stock[slot] = *o_ptr;
1806 chg_virtue(V_SACRIFICE, -1);
1808 (void)combine_and_reorder_home(cur_store_num);
1810 /* Return the location */
1816 * @brief 店舗にオブジェクトを加える /
1817 * Add the item "o_ptr" to a real stores inventory.
1818 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1822 * In all cases, return the slot (or -1) where the object was placed
1823 * Note that this is a hacked up version of "inven_carry()".
1824 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1825 * known, the player may have to pick stuff up and drop it again.
1828 static int store_carry(object_type *o_ptr)
1831 s32b value, j_value;
1835 /* Evaluate the object */
1836 value = object_value(o_ptr);
1838 /* Cursed/Worthless items "disappear" when sold */
1839 if (value <= 0) return (-1);
1841 /* All store items are fully *identified* */
1842 o_ptr->ident |= IDENT_MENTAL;
1844 /* Erase the inscription */
1845 o_ptr->inscription = 0;
1847 /* Erase the "feeling" */
1848 o_ptr->feeling = FEEL_NONE;
1850 /* Check each existing item (try to combine) */
1851 for (slot = 0; slot < st_ptr->stock_num; slot++)
1853 /* Get the existing item */
1854 j_ptr = &st_ptr->stock[slot];
1856 /* Can the existing items be incremented? */
1857 if (store_object_similar(j_ptr, o_ptr))
1859 /* Hack -- extra items disappear */
1860 store_object_absorb(j_ptr, o_ptr);
1868 if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
1871 /* Check existing slots to see if we must "slide" */
1872 for (slot = 0; slot < st_ptr->stock_num; slot++)
1875 j_ptr = &st_ptr->stock[slot];
1877 /* Objects sort by decreasing type */
1878 if (o_ptr->tval > j_ptr->tval) break;
1879 if (o_ptr->tval < j_ptr->tval) continue;
1881 /* Objects sort by increasing sval */
1882 if (o_ptr->sval < j_ptr->sval) break;
1883 if (o_ptr->sval > j_ptr->sval) continue;
1886 * Hack: otherwise identical rods sort by
1887 * increasing recharge time --dsb
1889 if (o_ptr->tval == TV_ROD)
1891 if (o_ptr->pval < j_ptr->pval) break;
1892 if (o_ptr->pval > j_ptr->pval) continue;
1895 /* Evaluate that slot */
1896 j_value = object_value(j_ptr);
1898 /* Objects sort by decreasing value */
1899 if (value > j_value) break;
1900 if (value < j_value) continue;
1903 /* Slide the others up */
1904 for (i = st_ptr->stock_num; i > slot; i--)
1906 st_ptr->stock[i] = st_ptr->stock[i-1];
1909 /* More stuff now */
1910 st_ptr->stock_num++;
1912 /* Insert the new item */
1913 st_ptr->stock[slot] = *o_ptr;
1915 /* Return the location */
1921 * @brief 店舗のオブジェクト数を増やす /
1922 * Add the item "o_ptr" to a real stores inventory.
1923 * @param item 増やしたいアイテムのID
1928 * Increase, by a given amount, the number of a certain item
1929 * in a certain store. This can result in zero items.
1931 * @todo numは本来ITEM_NUMBER型にしたい。
1933 static void store_item_increase(INVENTORY_IDX item, int num)
1939 o_ptr = &st_ptr->stock[item];
1941 /* Verify the number */
1942 cnt = o_ptr->number + num;
1943 if (cnt > 255) cnt = 255;
1944 else if (cnt < 0) cnt = 0;
1945 num = cnt - o_ptr->number;
1947 /* Save the new number */
1948 o_ptr->number += (ITEM_NUMBER)num;
1953 * @brief 店舗のオブジェクト数を削除する /
1954 * Remove a slot if it is empty
1955 * @param item 削除したいアイテムのID
1958 static void store_item_optimize(INVENTORY_IDX item)
1964 o_ptr = &st_ptr->stock[item];
1967 if (!o_ptr->k_idx) return;
1969 /* Must have no items */
1970 if (o_ptr->number) return;
1973 st_ptr->stock_num--;
1975 /* Slide everyone */
1976 for (j = item; j < st_ptr->stock_num; j++)
1978 st_ptr->stock[j] = st_ptr->stock[j + 1];
1981 /* Nuke the final slot */
1982 object_wipe(&st_ptr->stock[j]);
1986 * @brief ブラックマーケット用の無価値品の排除判定 /
1987 * This function will keep 'crap' out of the black market.
1988 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1989 * @return ブラックマーケットにとって無価値な品ならばTRUEを返す
1992 * Crap is defined as any item that is "available" elsewhere
1993 * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
1996 static bool black_market_crap(object_type *o_ptr)
2000 /* Ego items are never crap */
2001 if (object_is_ego(o_ptr)) return (FALSE);
2003 /* Good items are never crap */
2004 if (o_ptr->to_a > 0) return (FALSE);
2005 if (o_ptr->to_h > 0) return (FALSE);
2006 if (o_ptr->to_d > 0) return (FALSE);
2008 /* Check all stores */
2009 for (i = 0; i < MAX_STORES; i++)
2011 if (i == STORE_HOME) continue;
2012 if (i == STORE_MUSEUM) continue;
2014 /* Check every item in the store */
2015 for (j = 0; j < town[p_ptr->town_num].store[i].stock_num; j++)
2017 object_type *j_ptr = &town[p_ptr->town_num].store[i].stock[j];
2019 /* Duplicate item "type", assume crappy */
2020 if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
2030 * @brief 店舗の品揃え変化のためにアイテムを削除する /
2031 * Attempt to delete (some of) a random item from the store
2035 * Hack -- we attempt to "maintain" piles of items when possible.
2038 static void store_delete(void)
2043 /* Pick a random slot */
2044 what = (INVENTORY_IDX)randint0(st_ptr->stock_num);
2046 /* Determine how many items are here */
2047 num = st_ptr->stock[what].number;
2049 /* Hack -- sometimes, only destroy half the items */
2050 if (randint0(100) < 50) num = (num + 1) / 2;
2052 /* Hack -- sometimes, only destroy a single item */
2053 if (randint0(100) < 50) num = 1;
2055 /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
2056 if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
2058 st_ptr->stock[what].pval -= num * st_ptr->stock[what].pval / st_ptr->stock[what].number;
2061 /* Actually destroy (part of) the item */
2062 store_item_increase(what, -num);
2063 store_item_optimize(what);
2068 * @brief 店舗の品揃え変化のためにアイテムを追加する /
2069 * Creates a random item and gives it to a store
2073 * This algorithm needs to be rethought. A lot.
2074 * Currently, "normal" stores use a pre-built array.
2075 * Note -- the "level" given to "obj_get_num()" is a "favored"
2076 * level, that is, there is a much higher chance of getting
2077 * items with a level approaching that of the given level...
2078 * Should we check for "permission" to have the given item?
2081 static void store_create(void)
2091 /* Paranoia -- no room left */
2092 if (st_ptr->stock_num >= st_ptr->stock_size) return;
2095 /* Hack -- consider up to four items */
2096 for (tries = 0; tries < 4; tries++)
2099 if (cur_store_num == STORE_BLACK)
2101 /* Pick a level for object/magic */
2102 level = 25 + randint0(25);
2104 /* Random item (usually of given level) */
2105 i = get_obj_num(level);
2107 /* Handle failure */
2114 /* Hack -- Pick an item to sell */
2115 i = st_ptr->table[randint0(st_ptr->table_num)];
2117 /* Hack -- fake level for apply_magic() */
2118 level = rand_range(1, STORE_OBJ_LEVEL);
2122 /* Get local object */
2125 /* Create a new object of the chosen kind */
2126 object_prep(q_ptr, i);
2128 /* Apply some "low-level" magic (no artifacts) */
2129 apply_magic(q_ptr, level, AM_NO_FIXED_ART);
2131 /* Require valid object */
2132 if (!store_will_buy(q_ptr)) continue;
2134 /* Hack -- Charge lite's */
2135 if (q_ptr->tval == TV_LITE)
2137 if (q_ptr->sval == SV_LITE_TORCH) q_ptr->xtra4 = FUEL_TORCH / 2;
2138 if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->xtra4 = FUEL_LAMP / 2;
2142 /* The item is "known" */
2143 object_known(q_ptr);
2145 /* Mark it storebought */
2146 q_ptr->ident |= IDENT_STORE;
2148 /* Mega-Hack -- no chests in stores */
2149 if (q_ptr->tval == TV_CHEST) continue;
2151 /* Prune the black market */
2152 if (cur_store_num == STORE_BLACK)
2154 /* Hack -- No "crappy" items */
2155 if (black_market_crap(q_ptr)) continue;
2157 /* Hack -- No "cheap" items */
2158 if (object_value(q_ptr) < 10) continue;
2160 /* No "worthless" items */
2161 /* if (object_value(q_ptr) <= 0) continue; */
2164 /* Prune normal stores */
2167 /* No "worthless" items */
2168 if (object_value(q_ptr) <= 0) continue;
2172 /* Mass produce and/or Apply discount */
2173 mass_produce(q_ptr);
2175 /* Attempt to carry the (known) item */
2176 (void)store_carry(q_ptr);
2178 /* Definitely done */
2185 * @brief 店舗の割引対象外にするかどうかを判定 /
2186 * Eliminate need to bargain if player has haggled well in the past
2187 * @param minprice アイテムの最低販売価格
2188 * @return 割引を禁止するならTRUEを返す。
2190 static bool noneedtobargain(PRICE minprice)
2192 s32b good = st_ptr->good_buy;
2193 s32b bad = st_ptr->bad_buy;
2195 /* Cheap items are "boring" */
2196 if (minprice < 10L) return (TRUE);
2198 /* Perfect haggling */
2199 if (good == MAX_SHORT) return (TRUE);
2201 /* Reward good haggles, punish bad haggles, notice price */
2202 if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
2204 /* Return the flag */
2210 * @brief 店主の持つプレイヤーに対する売買の良し悪し経験を記憶する /
2211 * Update the bargain info
2212 * @param price 実際の取引価格
2213 * @param minprice 店主の提示した価格
2217 static void updatebargain(PRICE price, PRICE minprice, int num)
2219 /* Hack -- auto-haggle */
2220 if (!manual_haggle) return;
2222 /* Cheap items are "boring" */
2223 if ((minprice/num) < 10L) return;
2225 /* Count the successful haggles */
2226 if (price == minprice)
2228 /* Just count the good haggles */
2229 if (st_ptr->good_buy < MAX_SHORT)
2235 /* Count the failed haggles */
2238 /* Just count the bad haggles */
2239 if (st_ptr->bad_buy < MAX_SHORT)
2248 * @brief 店の商品リストを再表示する /
2249 * Re-displays a single store entry
2253 static void display_entry(int pos)
2259 char o_name[MAX_NLEN];
2266 o_ptr = &st_ptr->stock[pos];
2268 /* Get the "offset" */
2269 i = (pos % store_bottom);
2271 /* Label it, clear the line --(-- */
2272 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
2273 prt(out_val, i+6, 0);
2276 if (show_item_graph)
2278 byte a = object_attr(o_ptr);
2279 char c = object_char(o_ptr);
2281 Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
2282 if (use_bigtile) cur_col++;
2287 /* Describe an item in the home */
2288 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
2292 /* Leave room for weights, if necessary -DRS- */
2293 if (show_weights) maxwid -= 10;
2295 /* Describe the object */
2296 object_desc(o_name, o_ptr, 0);
2297 o_name[maxwid] = '\0';
2298 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2303 /* Only show the weight of an individual item */
2304 int wgt = o_ptr->weight;
2306 sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2307 put_str(out_val, i+6, 67);
2309 (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10);
2310 put_str(out_val, i+6, 68);
2316 /* Describe an item (fully) in a store */
2319 /* Must leave room for the "price" */
2322 /* Leave room for weights, if necessary -DRS- */
2323 if (show_weights) maxwid -= 7;
2325 /* Describe the object (fully) */
2326 object_desc(o_name, o_ptr, 0);
2327 o_name[maxwid] = '\0';
2328 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2333 /* Only show the weight of an individual item */
2334 int wgt = o_ptr->weight;
2336 sprintf(out_val, "%3d.%1d", lbtokg1(wgt) , lbtokg2(wgt) );
2337 put_str(out_val, i+6, 60);
2339 (void)sprintf(out_val, "%3d.%d", wgt / 10, wgt % 10);
2340 put_str(out_val, i+6, 61);
2345 /* Display a "fixed" cost */
2346 if (o_ptr->ident & (IDENT_FIXED))
2348 /* Extract the "minimum" price */
2349 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2351 /* Actually draw the price (not fixed) */
2353 (void)sprintf(out_val, "%9ld固", (long)x);
2355 (void)sprintf(out_val, "%9ld F", (long)x);
2358 put_str(out_val, i+6, 68);
2361 /* Display a "taxed" cost */
2362 else if (!manual_haggle)
2364 /* Extract the "minimum" price */
2365 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2367 /* Hack -- Apply Sales Tax if needed */
2368 if (!noneedtobargain(x)) x += x / 10;
2370 /* Actually draw the price (with tax) */
2371 (void)sprintf(out_val, "%9ld ", (long)x);
2372 put_str(out_val, i+6, 68);
2375 /* Display a "haggle" cost */
2378 /* Extrect the "maximum" price */
2379 x = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
2381 /* Actually draw the price (not fixed) */
2382 (void)sprintf(out_val, "%9ld ", (long)x);
2383 put_str(out_val, i+6, 68);
2390 * @brief 店の商品リストを表示する /
2391 * Displays a store's inventory -RAK-
2394 * All prices are listed as "per individual object". -BEN-
2396 static void display_inventory(void)
2400 /* Display the next 12 items */
2401 for (k = 0; k < store_bottom; k++)
2403 /* Do not display "dead" items */
2404 if (store_top + k >= st_ptr->stock_num) break;
2406 /* Display that line */
2407 display_entry(store_top + k);
2410 /* Erase the extra lines and the "more" prompt */
2411 for (i = k; i < store_bottom + 1; i++) prt("", i + 6, 0);
2413 /* Assume "no current page" */
2415 put_str(" ", 5, 20);
2417 put_str(" ", 5, 20);
2421 /* Visual reminder of "more items" */
2422 if (st_ptr->stock_num > store_bottom)
2424 /* Show "more" reminder (after the last item) */
2426 prt("-続く-", k + 6, 3);
2428 prt("-more-", k + 6, 3);
2432 /* Indicate the "current page" */
2433 /* Trailing spaces are to display (Page xx) and (Page x) */
2435 put_str(format("(%dページ) ", store_top/store_bottom + 1), 5, 20);
2437 put_str(format("(Page %d) ", store_top/store_bottom + 1), 5, 20);
2442 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
2444 k = st_ptr->stock_size;
2446 if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
2448 put_str(format("アイテム数: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
2450 put_str(format("Objects: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
2457 * @brief プレイヤーの所持金を表示する /
2458 * Displays players gold -RAK-
2462 static void store_prt_gold(void)
2467 prt("手持ちのお金: ", 19 + xtra_stock, 53);
2469 prt("Gold Remaining: ", 19 + xtra_stock, 53);
2473 sprintf(out_val, "%9ld", (long)p_ptr->au);
2474 prt(out_val, 19 + xtra_stock, 68);
2478 * @brief 店舗情報全体を表示するメインルーチン /
2479 * Displays store (after clearing screen) -RAK-
2483 static void display_store(void)
2491 /* The "Home" is special */
2492 if (cur_store_num == STORE_HOME)
2494 /* Put the owner name */
2496 put_str("我が家", 3, 31);
2498 put_str("Your Home", 3, 30);
2502 /* Label the item descriptions */
2504 put_str("アイテムの一覧", 5, 4);
2506 put_str("Item Description", 5, 3);
2510 /* If showing weights, show label */
2514 put_str("重さ", 5, 72);
2516 put_str("Weight", 5, 70);
2522 /* The "Home" is special */
2523 else if (cur_store_num == STORE_MUSEUM)
2525 /* Put the owner name */
2527 put_str("博物館", 3, 31);
2529 put_str("Museum", 3, 30);
2533 /* Label the item descriptions */
2535 put_str("アイテムの一覧", 5, 4);
2537 put_str("Item Description", 5, 3);
2541 /* If showing weights, show label */
2545 put_str("重さ", 5, 72);
2547 put_str("Weight", 5, 70);
2556 cptr store_name = (f_name + f_info[cur_store_feat].name);
2557 cptr owner_name = (ot_ptr->owner_name);
2558 cptr race_name = race_info[ot_ptr->owner_race].title;
2560 /* Put the owner name and race */
2561 sprintf(buf, "%s (%s)", owner_name, race_name);
2562 put_str(buf, 3, 10);
2564 /* Show the max price in the store (above prices) */
2565 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
2568 /* Label the item descriptions */
2570 put_str("商品の一覧", 5, 7);
2572 put_str("Item Description", 5, 3);
2576 /* If showing weights, show label */
2580 put_str("重さ", 5, 62);
2582 put_str("Weight", 5, 60);
2587 /* Label the asking price (in stores) */
2589 put_str("価格", 5, 73);
2591 put_str("Price", 5, 72);
2596 /* Display the current gold */
2599 /* Draw in the inventory */
2600 display_inventory();
2606 * @brief 店舗からアイテムを選択する /
2607 * Get the ID of a store item and return its value -RAK-
2608 * @param com_val 選択IDを返す参照ポインタ
2609 * @param pmt メッセージキャプション
2612 * @return 実際に選択したらTRUE、キャンセルしたらFALSE
2614 static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
2620 #ifdef ALLOW_REPEAT /* TNB */
2622 /* Get the item index */
2623 if (repeat_pull(com_val))
2625 /* Verify the item */
2626 if ((*com_val >= i) && (*com_val <= j))
2633 #endif /* ALLOW_REPEAT -- TNB */
2635 /* Paranoia XXX XXX XXX */
2639 /* Assume failure */
2642 /* Build the prompt */
2644 hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
2646 (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s",
2647 (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"),
2650 (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s",
2655 /* Ask until done */
2661 if (!get_com(out_val, &command, FALSE)) break;
2664 if (islower(command))
2666 else if (isupper(command))
2667 k = A2I(tolower(command)) + 26;
2671 /* Legal responses */
2672 if ((k >= i) && (k <= j))
2682 /* Clear the prompt */
2686 if (command == ESCAPE) return (FALSE);
2688 #ifdef ALLOW_REPEAT /* TNB */
2690 repeat_push(*com_val);
2692 #endif /* ALLOW_REPEAT -- TNB */
2700 * @brief 店主の不満度を増やし、プレイヤーを締め出す判定と処理を行う /
2701 * Increase the insult counter and get angry if too many -RAK-
2702 * @return プレイヤーを締め出す場合TRUEを返す
2704 static int increase_insults(void)
2706 /* Increase insults */
2707 st_ptr->insult_cur++;
2709 /* Become insulted */
2710 if (st_ptr->insult_cur > ot_ptr->insult_max)
2716 st_ptr->insult_cur = 0;
2717 st_ptr->good_buy = 0;
2718 st_ptr->bad_buy = 0;
2721 st_ptr->store_open = turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
2733 * @brief 店主の不満度を減らす /
2734 * Decrease insults -RAK-
2735 * @return プレイヤーを締め出す場合TRUEを返す
2737 static void decrease_insults(void)
2739 /* Decrease insults */
2740 if (st_ptr->insult_cur) st_ptr->insult_cur--;
2745 * @brief 店主の不満度が増えた場合のみのメッセージを表示する /
2746 * Have insulted while haggling -RAK-
2747 * @return プレイヤーを締め出す場合TRUEを返す
2749 static int haggle_insults(void)
2751 /* Increase insults */
2752 if (increase_insults()) return (TRUE);
2754 /* Display and flush insult */
2763 * Mega-Hack -- Enable "increments"
2765 static bool allow_inc = FALSE;
2768 * Mega-Hack -- Last "increment" during haggling
2770 static s32b last_inc = 0L;
2774 * @brief 交渉価格を確認と認証の是非を行う /
2777 * @param poffer 別途価格提示をした場合の値を返す参照ポインタ
2778 * @param price 現在の交渉価格
2779 * @param final 最終確定価格ならばTRUE
2780 * @return プレイヤーを締め出す場合TRUEを返す
2782 static int get_haggle(cptr pmt, s32b *poffer, PRICE price, int final)
2792 /* Clear old increment if necessary */
2793 if (!allow_inc) last_inc = 0L;
2800 sprintf(buf, "%s [承諾] ", pmt);
2802 sprintf(buf, "%s [accept] ", pmt);
2807 /* Old (negative) increment, and not final */
2808 else if (last_inc < 0)
2811 sprintf(buf, "%s [-$%ld] ", pmt, (long)(ABS(last_inc)));
2813 sprintf(buf, "%s [-%ld] ", pmt, (long)(ABS(last_inc)));
2818 /* Old (positive) increment, and not final */
2819 else if (last_inc > 0)
2822 sprintf(buf, "%s [+$%ld] ", pmt, (long)(ABS(last_inc)));
2824 sprintf(buf, "%s [+%ld] ", pmt, (long)(ABS(last_inc)));
2832 sprintf(buf, "%s ", pmt);
2836 /* Paranoia XXX XXX XXX */
2840 /* Ask until done */
2845 /* Display prompt */
2849 strcpy(out_val, "");
2852 * Ask the user for a response.
2853 * Don't allow to use numpad as cursor key.
2855 res = askfor_aux(out_val, 32, FALSE);
2861 if (!res) return FALSE;
2863 /* Skip leading spaces */
2864 for (p = out_val; *p == ' '; p++) /* loop */;
2866 /* Empty response */
2869 /* Accept current price */
2877 /* Use previous increment */
2878 if (allow_inc && last_inc)
2880 *poffer += last_inc;
2885 /* Normal response */
2888 /* Extract a number */
2891 /* Handle "incremental" number */
2892 if ((*p == '+' || *p == '-'))
2894 /* Allow increments */
2897 /* Use the given "increment" */
2904 /* Handle normal number */
2907 /* Use the given "number" */
2916 msg_print("値がおかしいです。");
2918 msg_print("Invalid response.");
2930 * @brief 店主がプレイヤーからの交渉価格を判断する /
2931 * Receive an offer (from the player)
2933 * @param poffer 店主からの交渉価格を返す参照ポインタ
2934 * @param last_offer 現在の交渉価格
2935 * @param factor 店主の価格基準倍率
2936 * @param price アイテムの実価値
2937 * @param final 最終価格確定ならばTRUE
2938 * @return プレイヤーの価格に対して不服ならばTRUEを返す /
2939 * Return TRUE if offer is NOT okay
2941 static bool receive_offer(cptr pmt, s32b *poffer,
2942 s32b last_offer, int factor,
2943 PRICE price, int final)
2945 /* Haggle till done */
2948 /* Get a haggle (or cancel) */
2949 if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
2951 /* Acceptable offer */
2952 if (((*poffer) * factor) >= (last_offer * factor)) break;
2954 /* Insult, and check for kicked out */
2955 if (haggle_insults()) return (TRUE);
2957 /* Reject offer (correctly) */
2958 (*poffer) = last_offer;
2967 * @brief プレイヤーが購入する時の値切り処理メインルーチン /
2968 * Haggling routine -RAK-
2969 * @param o_ptr オブジェクトの構造体参照ポインタ
2970 * @param price 最終価格を返す参照ポインタ
2971 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
2972 * Return TRUE if purchase is NOT successful
2974 static bool purchase_haggle(object_type *o_ptr, s32b *price)
2976 s32b cur_ask, final_ask;
2977 s32b last_offer, offer;
2979 s32b min_per, max_per;
2980 int flag, loop_flag, noneed;
2981 int annoyed = 0, final = FALSE;
2983 bool cancel = FALSE;
2988 cptr pmt = "Asking";
2998 /* Extract the starting offer and the final offer */
2999 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
3000 final_ask = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3002 /* Determine if haggling is necessary */
3003 noneed = noneedtobargain(final_ask);
3005 /* No need to haggle */
3006 if (noneed || !manual_haggle)
3008 /* No need to haggle */
3011 /* Message summary */
3013 msg_print("結局この金額にまとまった。");
3015 msg_print("You eventually agree upon the price.");
3021 /* No haggle option */
3024 /* Message summary */
3026 msg_print("すんなりとこの金額にまとまった。");
3028 msg_print("You quickly agree upon the price.");
3033 /* Apply Sales Tax */
3034 final_ask += final_ask / 10;
3038 cur_ask = final_ask;
3040 /* Go to final offer */
3044 pmt = "Final Offer";
3051 /* Haggle for the whole pile */
3052 cur_ask *= o_ptr->number;
3053 final_ask *= o_ptr->number;
3056 /* Haggle parameters */
3057 min_per = ot_ptr->haggle_per;
3058 max_per = min_per * 3;
3060 /* Mega-Hack -- artificial "last offer" value */
3061 last_offer = object_value(o_ptr) * o_ptr->number;
3062 last_offer = last_offer * (200 - (int)(ot_ptr->max_inflate)) / 100L;
3063 if (last_offer <= 0) last_offer = 1;
3068 /* No incremental haggling yet */
3071 /* Haggle until done */
3072 for (flag = FALSE; !flag; )
3076 while (!flag && loop_flag)
3078 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3079 put_str(out_val, 1, 0);
3081 cancel = receive_offer("提示する金額? ",
3083 cancel = receive_offer("What do you offer? ",
3086 &offer, last_offer, 1, cur_ask, final);
3092 else if (offer > cur_ask)
3097 else if (offer == cur_ask)
3110 x1 = 100 * (offer - last_offer) / (cur_ask - last_offer);
3113 if (haggle_insults())
3119 else if (x1 > max_per)
3122 if (x1 < max_per) x1 = max_per;
3124 x2 = rand_range(x1-2, x1+2);
3125 x3 = ((cur_ask - offer) * x2 / 100L) + 1;
3126 /* don't let the price go up */
3131 if (cur_ask < final_ask)
3134 cur_ask = final_ask;
3138 pmt = "Final Offer";
3144 (void)(increase_insults());
3149 else if (offer >= cur_ask)
3161 (void)sprintf(out_val, "前回の提示金額: $%ld",
3163 (void)sprintf(out_val, "Your last offer: %ld",
3167 put_str(out_val, 1, 39);
3168 say_comment_2(cur_ask, annoyed);
3174 if (cancel) return (TRUE);
3176 /* Update bargaining info */
3177 updatebargain(*price, final_ask, o_ptr->number);
3185 * @brief プレイヤーが売却する時の値切り処理メインルーチン /
3186 * Haggling routine -RAK-
3187 * @param o_ptr オブジェクトの構造体参照ポインタ
3188 * @param price 最終価格を返す参照ポインタ
3189 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
3190 * Return TRUE if purchase is NOT successful
3192 static bool sell_haggle(object_type *o_ptr, s32b *price)
3194 s32b purse, cur_ask, final_ask;
3195 s32b last_offer = 0, offer = 0;
3197 s32b min_per, max_per;
3198 int flag, loop_flag, noneed;
3199 int annoyed = 0, final = FALSE;
3200 bool cancel = FALSE;
3213 /* Obtain the starting offer and the final offer */
3214 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
3215 final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
3217 /* Determine if haggling is necessary */
3218 noneed = noneedtobargain(final_ask);
3220 /* Get the owner's payout limit */
3221 purse = (s32b)(ot_ptr->max_cost);
3223 /* No need to haggle */
3224 if (noneed || !manual_haggle || (final_ask >= purse))
3226 /* Apply Sales Tax (if needed) */
3227 if (!manual_haggle && !noneed)
3229 final_ask -= final_ask / 10;
3232 /* No reason to haggle */
3233 if (final_ask >= purse)
3236 msg_print("即座にこの金額にまとまった。");
3238 msg_print("You instantly agree upon the price.");
3243 /* Offer full purse */
3247 /* No need to haggle */
3251 msg_print("結局この金額にまとまった。");
3253 msg_print("You eventually agree upon the price.");
3259 /* No haggle option */
3262 /* Message summary */
3264 msg_print("すんなりとこの金額にまとまった。");
3266 msg_print("You quickly agree upon the price.");
3273 cur_ask = final_ask;
3280 pmt = "Final Offer";
3285 /* Haggle for the whole pile */
3286 cur_ask *= o_ptr->number;
3287 final_ask *= o_ptr->number;
3290 /* XXX XXX XXX Display commands */
3292 /* Haggling parameters */
3293 min_per = ot_ptr->haggle_per;
3294 max_per = min_per * 3;
3296 /* Mega-Hack -- artificial "last offer" value */
3297 last_offer = object_value(o_ptr) * o_ptr->number;
3298 last_offer = last_offer * ot_ptr->max_inflate / 100L;
3303 /* No incremental haggling yet */
3307 for (flag = FALSE; !flag; )
3313 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3314 put_str(out_val, 1, 0);
3316 cancel = receive_offer("提示する価格? ",
3318 cancel = receive_offer("What price do you ask? ",
3321 &offer, last_offer, -1, cur_ask, final);
3327 else if (offer < cur_ask)
3330 /* rejected, reset offer for incremental haggling */
3333 else if (offer == cur_ask)
3344 if (flag || !loop_flag) break;
3349 x1 = 100 * (last_offer - offer) / (last_offer - cur_ask);
3352 if (haggle_insults())
3358 else if (x1 > max_per)
3361 if (x1 < max_per) x1 = max_per;
3363 x2 = rand_range(x1-2, x1+2);
3364 x3 = ((offer - cur_ask) * x2 / 100L) + 1;
3365 /* don't let the price go down */
3369 if (cur_ask > final_ask)
3371 cur_ask = final_ask;
3376 pmt = "Final Offer";
3384 /* 追加 $0 で買い取られてしまうのを防止 By FIRST*/
3387 (void)(increase_insults());
3390 else if (offer <= cur_ask)
3401 (void)sprintf(out_val,
3403 "前回の提示価格 $%ld", (long)last_offer);
3405 "Your last bid %ld", (long)last_offer);
3408 put_str(out_val, 1, 39);
3409 say_comment_3(cur_ask, annoyed);
3415 if (cancel) return (TRUE);
3417 /* Update bargaining info */
3418 updatebargain(*price, final_ask, o_ptr->number);
3426 * @brief 店からの購入処理のメインルーチン /
3427 * Buy an item from a store -RAK-
3430 static void store_purchase(void)
3433 COMMAND_CODE item, item_new;
3444 char o_name[MAX_NLEN];
3448 if (cur_store_num == STORE_MUSEUM)
3451 msg_print("博物館から取り出すことはできません。");
3453 msg_print("Museum.");
3459 if (st_ptr->stock_num <= 0)
3461 if (cur_store_num == STORE_HOME)
3463 msg_print("我が家には何も置いてありません。");
3465 msg_print("Your home is empty.");
3470 msg_print("現在商品の在庫を切らしています。");
3472 msg_print("I am currently out of stock.");
3479 /* Find the number of objects on this and following pages */
3480 i = (st_ptr->stock_num - store_top);
3482 /* And then restrict it to the current page */
3483 if (i > store_bottom) i = store_bottom;
3487 /* ブラックマーケットの時は別のメッセージ */
3488 switch( cur_store_num ) {
3490 sprintf(out_val, "どのアイテムを取りますか? ");
3493 sprintf(out_val, "どれ? ");
3496 sprintf(out_val, "どの品物が欲しいんだい? ");
3500 if (cur_store_num == STORE_HOME)
3502 sprintf(out_val, "Which item do you want to take? ");
3506 sprintf(out_val, "Which item are you interested in? ");
3511 /* Get the item number to be bought */
3512 if (!get_stock(&item, out_val, 0, i - 1)) return;
3514 /* Get the actual index */
3515 item = item + store_top;
3517 /* Get the actual item */
3518 o_ptr = &st_ptr->stock[item];
3520 /* Assume the player wants just one of them */
3523 /* Get local object */
3526 /* Get a copy of the object */
3527 object_copy(j_ptr, o_ptr);
3530 * If a rod or wand, allocate total maximum timeouts or charges
3531 * between those purchased and left on the shelf.
3533 reduce_charges(j_ptr, o_ptr->number - amt);
3535 /* Modify quantity */
3536 j_ptr->number = amt;
3538 /* Hack -- require room in pack */
3539 if (!inven_carry_okay(j_ptr))
3542 msg_print("そんなにアイテムを持てない。");
3544 msg_print("You cannot carry that many different items.");
3550 /* Determine the "best" price (per item) */
3551 best = price_item(j_ptr, ot_ptr->min_inflate, FALSE);
3553 /* Find out how many the player wants */
3554 if (o_ptr->number > 1)
3556 /* Hack -- note cost of "fixed" items */
3557 if ((cur_store_num != STORE_HOME) &&
3558 (o_ptr->ident & IDENT_FIXED))
3561 msg_format("一つにつき $%ldです。", (long)(best));
3563 msg_format("That costs %ld gold per item.", (long)(best));
3568 /* Get a quantity */
3569 amt = get_quantity(NULL, o_ptr->number);
3571 /* Allow user abort */
3572 if (amt <= 0) return;
3575 /* Get local object */
3578 /* Get desired object */
3579 object_copy(j_ptr, o_ptr);
3582 * If a rod or wand, allocate total maximum timeouts or charges
3583 * between those purchased and left on the shelf.
3585 reduce_charges(j_ptr, o_ptr->number - amt);
3587 /* Modify quantity */
3588 j_ptr->number = amt;
3590 /* Hack -- require room in pack */
3591 if (!inven_carry_okay(j_ptr))
3594 msg_print("ザックにそのアイテムを入れる隙間がない。");
3596 msg_print("You cannot carry that many items.");
3602 /* Attempt to buy it */
3603 if (cur_store_num != STORE_HOME)
3605 /* Fixed price, quick buy */
3606 if (o_ptr->ident & (IDENT_FIXED))
3611 /* Go directly to the "best" deal */
3612 price = (best * j_ptr->number);
3618 /* Describe the object (fully) */
3619 object_desc(o_name, j_ptr, 0);
3622 msg_format("%s(%c)を購入する。", o_name, I2A(item));
3624 msg_format("Buying %s (%c).", o_name, I2A(item));
3629 /* Haggle for a final price */
3630 choice = purchase_haggle(j_ptr, &price);
3632 /* Hack -- Got kicked out */
3633 if (st_ptr->store_open >= turn) return;
3636 /* Player wants it */
3639 /* Fix the item price (if "correctly" haggled) */
3640 if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
3642 /* Player can afford it */
3643 if (p_ptr->au >= price)
3648 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
3649 chg_virtue(V_JUSTICE, -1);
3650 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
3651 chg_virtue(V_NATURE, -1);
3659 /* Spend the money */
3662 /* Update the display */
3665 /* Hack -- buying an item makes you aware of it */
3666 object_aware(j_ptr);
3668 /* Hack -- clear the "fixed" flag from the item */
3669 j_ptr->ident &= ~(IDENT_FIXED);
3671 /* Describe the transaction */
3672 object_desc(o_name, j_ptr, 0);
3675 msg_format("%sを $%ldで購入しました。", o_name, (long)price);
3677 msg_format("You bought %s for %ld gold.", o_name, (long)price);
3680 strcpy(record_o_name, o_name);
3683 if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
3684 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3685 if(record_rand_art && o_ptr->art_name)
3686 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
3688 /* Erase the inscription */
3689 j_ptr->inscription = 0;
3691 /* Erase the "feeling" */
3692 j_ptr->feeling = FEEL_NONE;
3693 j_ptr->ident &= ~(IDENT_STORE);
3694 /* Give it to the player */
3695 item_new = inven_carry(j_ptr);
3697 /* Describe the final result */
3698 object_desc(o_name, &inventory[item_new], 0);
3701 msg_format("%s(%c)を手に入れた。", o_name, index_to_label(item_new));
3703 msg_format("You have %s (%c).",
3704 o_name, index_to_label(item_new));
3707 /* Auto-inscription */
3708 autopick_alter_item(item_new, FALSE);
3710 /* Now, reduce the original stack's pval. */
3711 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3713 o_ptr->pval -= j_ptr->pval;
3719 /* Note how many slots the store used to have */
3720 i = st_ptr->stock_num;
3722 /* Remove the bought items from the store */
3723 store_item_increase(item, -amt);
3724 store_item_optimize(item);
3726 /* Store is empty */
3727 if (st_ptr->stock_num == 0)
3730 if (one_in_(STORE_SHUFFLE))
3734 msg_print("店主は引退した。");
3736 msg_print("The shopkeeper retires.");
3740 /* Shuffle the store */
3741 store_shuffle(cur_store_num);
3744 sprintf(buf, "%s (%s)",
3745 ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
3746 put_str(buf, 3, 10);
3747 sprintf(buf, "%s (%ld)",
3748 (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
3756 msg_print("店主は新たな在庫を取り出した。");
3758 msg_print("The shopkeeper brings out some new stock.");
3764 for (i = 0; i < 10; i++)
3766 /* Maintain the store */
3767 store_maint(p_ptr->town_num, cur_store_num);
3773 /* Redraw everything */
3774 display_inventory();
3777 /* The item is gone */
3778 else if (st_ptr->stock_num != i)
3780 /* Pick the correct screen */
3781 if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3783 /* Redraw everything */
3784 display_inventory();
3787 /* Item is still here */
3790 /* Redraw the item */
3791 display_entry(item);
3795 /* Player cannot afford it */
3798 /* Simple message (no insult) */
3800 msg_print("お金が足りません。");
3802 msg_print("You do not have enough gold.");
3809 /* Home is much easier */
3812 bool combined_or_reordered;
3814 /* Distribute charges of wands/rods */
3815 distribute_charges(o_ptr, j_ptr, amt);
3817 /* Give it to the player */
3818 item_new = inven_carry(j_ptr);
3820 /* Describe just the result */
3821 object_desc(o_name, &inventory[item_new], 0);
3824 msg_format("%s(%c)を取った。",
3826 msg_format("You have %s (%c).",
3828 o_name, index_to_label(item_new));
3833 /* Take note if we take the last one */
3834 i = st_ptr->stock_num;
3836 /* Remove the items from the home */
3837 store_item_increase(item, -amt);
3838 store_item_optimize(item);
3840 combined_or_reordered = combine_and_reorder_home(STORE_HOME);
3842 /* Hack -- Item is still here */
3843 if (i == st_ptr->stock_num)
3845 /* Redraw everything */
3846 if (combined_or_reordered) display_inventory();
3848 /* Redraw the item */
3849 else display_entry(item);
3852 /* The item is gone */
3856 if (st_ptr->stock_num == 0) store_top = 0;
3858 /* Nothing left on that screen */
3859 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3861 /* Redraw everything */
3862 display_inventory();
3864 chg_virtue(V_SACRIFICE, 1);
3868 /* Not kicked out */
3874 * @brief 店からの売却処理のメインルーチン /
3875 * Sell an item to the store (or home)
3878 static void store_sell(void)
3885 PRICE price, value, dummy;
3894 char o_name[MAX_NLEN];
3897 /* Prepare a prompt */
3898 if (cur_store_num == STORE_HOME)
3900 q = "どのアイテムを置きますか? ";
3902 q = "Drop which item? ";
3905 else if (cur_store_num == STORE_MUSEUM)
3907 q = "どのアイテムを寄贈しますか? ";
3909 q = "Give which item? ";
3914 q = "どのアイテムを売りますか? ";
3916 q = "Sell which item? ";
3920 item_tester_no_ryoute = TRUE;
3921 /* Only allow items the store will buy */
3922 item_tester_hook = store_will_buy;
3925 /* 我が家でおかしなメッセージが出るオリジナルのバグを修正 */
3926 if (cur_store_num == STORE_HOME)
3929 s = "置けるアイテムを持っていません。";
3931 s = "You don't have any item to drop.";
3934 else if (cur_store_num == STORE_MUSEUM)
3937 s = "寄贈できるアイテムを持っていません。";
3939 s = "You don't have any item to give.";
3947 s = "You have nothing that I want.";
3951 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
3953 /* Get the item (in the pack) */
3956 o_ptr = &inventory[item];
3959 /* Get the item (on the floor) */
3962 o_ptr = &o_list[0 - item];
3966 /* Hack -- Cannot remove cursed items */
3967 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
3971 msg_print("ふーむ、どうやらそれは呪われているようだね。");
3973 msg_print("Hmmm, it seems to be cursed.");
3982 /* Assume one item */
3985 /* Find out how many the player wants (letter means "all") */
3986 if (o_ptr->number > 1)
3988 /* Get a quantity */
3989 amt = get_quantity(NULL, o_ptr->number);
3991 /* Allow user abort */
3992 if (amt <= 0) return;
3995 /* Get local object */
3998 /* Get a copy of the object */
3999 object_copy(q_ptr, o_ptr);
4001 /* Modify quantity */
4002 q_ptr->number = amt;
4005 * Hack -- If a rod or wand, allocate total maximum
4006 * timeouts or charges to those being sold. -LM-
4008 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4010 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4013 /* Get a full description */
4014 object_desc(o_name, q_ptr, 0);
4016 /* Remove any inscription, feeling for stores */
4017 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4019 q_ptr->inscription = 0;
4020 q_ptr->feeling = FEEL_NONE;
4023 /* Is there room in the store (or the home?) */
4024 if (!store_check_num(q_ptr))
4026 if (cur_store_num == STORE_HOME)
4028 msg_print("我が家にはもう置く場所がない。");
4030 msg_print("Your home is full.");
4033 else if (cur_store_num == STORE_MUSEUM)
4035 msg_print("博物館はもう満杯だ。");
4037 msg_print("Museum is full.");
4042 msg_print("すいませんが、店にはもう置く場所がありません。");
4044 msg_print("I have not the room in my store to keep it.");
4052 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4054 /* Describe the transaction */
4056 msg_format("%s(%c)を売却する。", o_name, index_to_label(item));
4058 msg_format("Selling %s (%c).", o_name, index_to_label(item));
4064 choice = sell_haggle(q_ptr, &price);
4067 if (st_ptr->store_open >= turn) return;
4079 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
4080 chg_virtue(V_JUSTICE, -1);
4082 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
4083 chg_virtue(V_NATURE, 1);
4086 /* Get some money */
4089 /* Update the display */
4092 /* Get the "apparent" value */
4093 dummy = object_value(q_ptr) * q_ptr->number;
4096 identify_item(o_ptr);
4098 /* Get local object */
4101 /* Get a copy of the object */
4102 object_copy(q_ptr, o_ptr);
4104 /* Modify quantity */
4105 q_ptr->number = amt;
4107 /* Make it look like to be known */
4108 q_ptr->ident |= IDENT_STORE;
4111 * Hack -- If a rod or wand, let the shopkeeper know just
4112 * how many charges he really paid for. -LM-
4114 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4116 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4119 /* Get the "actual" value */
4120 value = object_value(q_ptr) * q_ptr->number;
4122 /* Get the description all over again */
4123 object_desc(o_name, q_ptr, 0);
4125 /* Describe the result (in message buffer) */
4127 msg_format("%sを $%ldで売却しました。", o_name, (long)price);
4129 msg_format("You sold %s for %ld gold.", o_name, (long)price);
4132 if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
4134 if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
4136 /* Analyze the prices (and comment verbally) unless a figurine*/
4137 purchase_analyze(price, value, dummy);
4141 * Hack -- Allocate charges between those wands or rods sold
4142 * and retained, unless all are being sold. -LM-
4144 distribute_charges(o_ptr, q_ptr, amt);
4146 /* Reset timeouts of the sold items */
4149 /* Take the item from the player, describe the result */
4150 inven_item_increase(item, -amt);
4151 inven_item_describe(item);
4153 /* If items remain, auto-inscribe before optimizing */
4154 if (o_ptr->number > 0)
4155 autopick_alter_item(item, FALSE);
4157 inven_item_optimize(item);
4162 /* The store gets that (known) item */
4163 item_pos = store_carry(q_ptr);
4165 /* Re-display if item is now in store */
4168 store_top = (item_pos / store_bottom) * store_bottom;
4169 display_inventory();
4174 /* Player is at museum */
4175 else if (cur_store_num == STORE_MUSEUM)
4177 char o2_name[MAX_NLEN];
4178 object_desc(o2_name, q_ptr, OD_NAME_ONLY);
4180 if (-1 == store_check_num(q_ptr))
4183 msg_print("それと同じ品物は既に博物館にあるようです。");
4185 msg_print("The same object as it is already in the Museum.");
4191 msg_print("博物館に寄贈したものは取り出すことができません!!");
4193 msg_print("You cannot take items which is given to the Museum back!!");
4197 if (!get_check(format("本当に%sを寄贈しますか?", o2_name))) return;
4199 if (!get_check(format("Really give %s to the Museum? ", o2_name))) return;
4203 identify_item(q_ptr);
4204 q_ptr->ident |= IDENT_MENTAL;
4206 /* Distribute charges of wands/rods */
4207 distribute_charges(o_ptr, q_ptr, amt);
4211 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4213 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4218 /* Take it from the players inventory */
4219 inven_item_increase(item, -amt);
4220 inven_item_describe(item);
4221 inven_item_optimize(item);
4226 /* Let the home carry it */
4227 item_pos = home_carry(q_ptr);
4229 /* Update store display */
4232 store_top = (item_pos / store_bottom) * store_bottom;
4233 display_inventory();
4236 /* Player is at home */
4239 /* Distribute charges of wands/rods */
4240 distribute_charges(o_ptr, q_ptr, amt);
4244 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4246 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4251 /* Take it from the players inventory */
4252 inven_item_increase(item, -amt);
4253 inven_item_describe(item);
4254 inven_item_optimize(item);
4259 /* Let the home carry it */
4260 item_pos = home_carry(q_ptr);
4262 /* Update store display */
4265 store_top = (item_pos / store_bottom) * store_bottom;
4266 display_inventory();
4270 if ((choice == 0) && (item >= INVEN_RARM))
4279 * @brief 店のアイテムを調べるコマンドのメインルーチン /
4280 * Examine an item in a store -JDL-
4283 static void store_examine(void)
4288 char o_name[MAX_NLEN];
4293 if (st_ptr->stock_num <= 0)
4295 if (cur_store_num == STORE_HOME)
4297 msg_print("我が家には何も置いてありません。");
4299 msg_print("Your home is empty.");
4302 else if (cur_store_num == STORE_MUSEUM)
4304 msg_print("博物館には何も置いてありません。");
4306 msg_print("Museum is empty.");
4311 msg_print("現在商品の在庫を切らしています。");
4313 msg_print("I am currently out of stock.");
4320 /* Find the number of objects on this and following pages */
4321 i = (st_ptr->stock_num - store_top);
4323 /* And then restrict it to the current page */
4324 if (i > store_bottom) i = store_bottom;
4328 sprintf(out_val, "どれを調べますか?");
4330 sprintf(out_val, "Which item do you want to examine? ");
4334 /* Get the item number to be examined */
4335 if (!get_stock(&item, out_val, 0, i - 1)) return;
4337 /* Get the actual index */
4338 item = item + store_top;
4340 /* Get the actual item */
4341 o_ptr = &st_ptr->stock[item];
4343 /* Require full knowledge */
4344 if (!(o_ptr->ident & IDENT_MENTAL))
4346 /* This can only happen in the home */
4348 msg_print("このアイテムについて特に知っていることはない。");
4350 msg_print("You have no special knowledge about that item.");
4357 object_desc(o_name, o_ptr, 0);
4361 msg_format("%sを調べている...", o_name);
4363 msg_format("Examining %s...", o_name);
4367 /* Describe it fully */
4368 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
4370 msg_print("特に変わったところはないようだ。");
4372 msg_print("You see nothing special.");
4381 * @brief 博物館のアイテムを除去するコマンドのメインルーチン /
4382 * Remove an item from museum (Originally from TOband)
4385 static void museum_remove_object(void)
4390 char o_name[MAX_NLEN];
4394 if (st_ptr->stock_num <= 0)
4397 msg_print("博物館には何も置いてありません。");
4399 msg_print("Museum is empty.");
4405 /* Find the number of objects on this and following pages */
4406 i = st_ptr->stock_num - store_top;
4408 /* And then restrict it to the current page */
4409 if (i > store_bottom) i = store_bottom;
4413 sprintf(out_val, "どのアイテムの展示をやめさせますか?");
4415 sprintf(out_val, "Which item do you want to order to remove? ");
4418 /* Get the item number to be removed */
4419 if (!get_stock(&item, out_val, 0, i - 1)) return;
4421 /* Get the actual index */
4422 item = item + store_top;
4424 /* Get the actual item */
4425 o_ptr = &st_ptr->stock[item];
4428 object_desc(o_name, o_ptr, 0);
4431 msg_print("展示をやめさせたアイテムは二度と見ることはできません!");
4432 if (!get_check(format("本当に%sの展示をやめさせますか?", o_name))) return;
4434 msg_print("You cannot see items which is removed from the Museum!");
4435 if (!get_check(format("Really order to remove %s from the Museum? ", o_name))) return;
4439 msg_format("%sの展示をやめさせた。", o_name);
4441 msg_format("You ordered to remove %s.", o_name);
4444 /* Remove the items from the home */
4445 store_item_increase(item, -o_ptr->number);
4446 store_item_optimize(item);
4448 (void)combine_and_reorder_home(STORE_MUSEUM);
4450 /* The item is gone */
4453 if (st_ptr->stock_num == 0) store_top = 0;
4455 /* Nothing left on that screen */
4456 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4458 /* Redraw everything */
4459 display_inventory();
4466 * Hack -- set this to leave the store
4468 static bool leave_store = FALSE;
4472 * @brief 店舗処理コマンド選択のメインルーチン /
4473 * Process a command in a store
4477 * Note that we must allow the use of a few "special" commands
4478 * in the stores which are not allowed in the dungeon, and we
4479 * must disable some commands which are allowed in the dungeon
4480 * but not in the stores, to prevent chaos.
4483 static void store_process_command(void)
4485 #ifdef ALLOW_REPEAT /* TNB */
4487 /* Handle repeating the last command */
4490 #endif /* ALLOW_REPEAT -- TNB */
4492 if (rogue_like_commands && command_cmd == 'l')
4494 command_cmd = 'x'; /* hack! */
4497 /* Parse the command */
4498 switch (command_cmd)
4508 /* 1 ページ戻るコマンド: 我が家のページ数が多いので重宝するはず By BUG */
4511 if (st_ptr->stock_num <= store_bottom) {
4513 msg_print("これで全部です。");
4515 msg_print("Entire inventory is shown.");
4519 store_top -= store_bottom;
4520 if ( store_top < 0 )
4521 store_top = ((st_ptr->stock_num - 1 )/store_bottom) * store_bottom;
4522 if ( (cur_store_num == STORE_HOME) && (powerup_home == FALSE) )
4523 if ( store_top >= store_bottom ) store_top = store_bottom;
4524 display_inventory();
4532 if (st_ptr->stock_num <= store_bottom)
4535 msg_print("これで全部です。");
4537 msg_print("Entire inventory is shown.");
4543 store_top += store_bottom;
4545 * 隠しオプション(powerup_home)がセットされていないときは
4546 * 我が家では 2 ページまでしか表示しない
4548 if ((cur_store_num == STORE_HOME) &&
4549 (powerup_home == FALSE) &&
4550 (st_ptr->stock_num >= STORE_INVEN_MAX))
4552 if (store_top >= (STORE_INVEN_MAX - 1))
4559 if (store_top >= st_ptr->stock_num) store_top = 0;
4562 display_inventory();
4575 /* Get (purchase) */
4602 /*** Inventory Commands ***/
4604 /* Wear/wield equipment */
4611 /* Take off equipment */
4618 /* Destroy an item */
4625 /* Equipment list */
4632 /* Inventory list */
4640 /*** Various commands ***/
4642 /* Identify an object */
4649 /* Hack -- toggle windows */
4652 toggle_inven_equip();
4658 /*** Use various objects ***/
4663 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4664 (p_ptr->pclass == CLASS_BERSERKER) ||
4665 (p_ptr->pclass == CLASS_NINJA) ||
4666 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4667 ) do_cmd_mind_browse();
4668 else if (p_ptr->pclass == CLASS_SMITH)
4670 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4671 do_cmd_magic_eater(TRUE, FALSE);
4672 else if (p_ptr->pclass == CLASS_SNIPER)
4673 do_cmd_snipe_browse();
4674 else do_cmd_browse();
4678 /* Inscribe an object */
4685 /* Uninscribe an object */
4688 do_cmd_uninscribe();
4694 /*** Help and Such ***/
4703 /* Identify symbol */
4706 do_cmd_query_symbol();
4710 /* Character description */
4713 p_ptr->town_num = old_town_num;
4714 do_cmd_change_name();
4715 p_ptr->town_num = inner_town_num;
4721 /*** System Commands ***/
4723 /* Hack -- User interface */
4730 /* Single line from a pref file */
4733 p_ptr->town_num = old_town_num;
4735 p_ptr->town_num = inner_town_num;
4739 /* Interact with macros */
4742 p_ptr->town_num = old_town_num;
4744 p_ptr->town_num = inner_town_num;
4748 /* Interact with visuals */
4751 p_ptr->town_num = old_town_num;
4753 p_ptr->town_num = inner_town_num;
4757 /* Interact with colors */
4760 p_ptr->town_num = old_town_num;
4762 p_ptr->town_num = inner_town_num;
4766 /* Interact with options */
4770 (void)combine_and_reorder_home(STORE_HOME);
4776 /*** Misc Commands ***/
4792 /* Repeat level feeling */
4799 /* Show previous message */
4802 do_cmd_message_one();
4806 /* Show previous messages */
4819 /* Check artifacts, uniques etc. */
4826 /* Load "screen dump" */
4829 do_cmd_load_screen();
4833 /* Save "screen dump" */
4836 do_cmd_save_screen();
4840 /* Hack -- Unknown command */
4843 if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
4845 museum_remove_object();
4850 msg_print("そのコマンドは店の中では使えません。");
4852 msg_print("That command does not work in stores.");
4863 * @brief 店舗処理全体のメインルーチン /
4864 * Enter a store, and interact with it. *
4868 * Note that we use the standard "request_command()" function
4869 * to get a command, allowing us to use "command_arg" and all
4870 * command macros and other nifty stuff, but we use the special
4871 * "shopping" argument, to force certain commands to be converted
4872 * into other commands, normally, we convert "p" (pray) and "m"
4873 * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
4876 void do_cmd_store(void)
4882 bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
4886 Term_get_size(&w, &h);
4888 /* Calculate stocks per 1 page */
4889 xtra_stock = MIN(14+26, ((h > 24) ? (h - 24) : 0));
4890 store_bottom = MIN_STOCK + xtra_stock;
4892 /* Access the player grid */
4893 c_ptr = &cave[p_ptr->y][p_ptr->x];
4895 /* Verify a store */
4896 if (!cave_have_flag_grid(c_ptr, FF_STORE))
4899 msg_print("ここには店がありません。");
4901 msg_print("You see no store here.");
4907 /* Extract the store code */
4908 which = f_info[c_ptr->feat].subtype;
4910 old_town_num = p_ptr->town_num;
4911 if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
4912 if (dun_level) p_ptr->town_num = NO_TOWN;
4913 inner_town_num = p_ptr->town_num;
4915 /* Hack -- Check the "locked doors" */
4916 if ((town[p_ptr->town_num].store[which].store_open >= turn) ||
4920 msg_print("ドアに鍵がかかっている。");
4922 msg_print("The doors are locked.");
4925 p_ptr->town_num = old_town_num;
4929 /* Calculate the number of store maintainances since the last visit */
4930 maintain_num = (turn - town[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
4932 /* Maintain the store max. 10 times */
4933 if (maintain_num > 10) maintain_num = 10;
4937 /* Maintain the store */
4938 for (i = 0; i < maintain_num; i++)
4939 store_maint(p_ptr->town_num, which);
4941 /* Save the visit */
4942 town[p_ptr->town_num].store[which].last_visit = turn;
4945 /* Forget the lite */
4948 /* Forget the view */
4952 /* Hack -- Character is in "icky" mode */
4953 character_icky = TRUE;
4956 /* No command argument */
4959 /* No repeated command */
4962 /* No automatic command */
4965 /* Do not expand macros */
4966 get_com_no_macros = TRUE;
4968 /* Save the store number */
4969 cur_store_num = which;
4971 /* Hack -- save the store feature */
4972 cur_store_feat = c_ptr->feat;
4974 /* Save the store and owner pointers */
4975 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
4976 ot_ptr = &owners[cur_store_num][st_ptr->owner];
4979 /* Start at the beginning */
4982 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4984 /* Display the store */
4988 leave_store = FALSE;
4990 /* Interact with player */
4991 while (!leave_store)
4993 /* Hack -- Clear line 1 */
4997 clear_from(20 + xtra_stock);
5000 /* Basic commands */
5002 prt(" ESC) 建物から出る", 21 + xtra_stock, 0);
5004 prt(" ESC) Exit from Building.", 21 + xtra_stock, 0);
5008 /* Browse if necessary */
5009 if (st_ptr->stock_num > store_bottom)
5012 prt(" -)前ページ", 22 + xtra_stock, 0);
5013 prt(" スペース) 次ページ", 23 + xtra_stock, 0);
5015 prt(" -) Previous page", 22 + xtra_stock, 0);
5016 prt(" SPACE) Next page", 23 + xtra_stock, 0);
5022 if (cur_store_num == STORE_HOME)
5025 prt("g) アイテムを取る", 21 + xtra_stock, 27);
5026 prt("d) アイテムを置く", 22 + xtra_stock, 27);
5027 prt("x) 家のアイテムを調べる", 23 + xtra_stock, 27);
5029 prt("g) Get an item.", 21 + xtra_stock, 27);
5030 prt("d) Drop an item.", 22 + xtra_stock, 27);
5031 prt("x) eXamine an item in the home.", 23 + xtra_stock, 27);
5035 /* Museum commands */
5036 else if (cur_store_num == STORE_MUSEUM)
5039 prt("d) アイテムを置く", 21 + xtra_stock, 27);
5040 prt("r) アイテムの展示をやめる", 22 + xtra_stock, 27);
5041 prt("x) 博物館のアイテムを調べる", 23 + xtra_stock, 27);
5043 prt("d) Drop an item.", 21 + xtra_stock, 27);
5044 prt("r) order to Remove an item.", 22 + xtra_stock, 27);
5045 prt("x) eXamine an item in the museum.", 23 + xtra_stock, 27);
5049 /* Shop commands XXX XXX XXX */
5053 prt("p) 商品を買う", 21 + xtra_stock, 30);
5054 prt("s) アイテムを売る", 22 + xtra_stock, 30);
5055 prt("x) 商品を調べる", 23 + xtra_stock,30);
5057 prt("p) Purchase an item.", 21 + xtra_stock, 30);
5058 prt("s) Sell an item.", 22 + xtra_stock, 30);
5059 prt("x) eXamine an item in the shop", 23 + xtra_stock,30);
5066 prt("i/e) 持ち物/装備の一覧", 21 + xtra_stock, 56);
5068 if (rogue_like_commands)
5070 prt("w/T) 装備する/はずす", 22 + xtra_stock, 56);
5074 prt("w/t) 装備する/はずす", 22 + xtra_stock, 56);
5077 prt("i/e) Inventry/Equipment list", 21 + xtra_stock, 56);
5079 if (rogue_like_commands)
5081 prt("w/T) Wear/Take off equipment", 22 + xtra_stock, 56);
5085 prt("w/t) Wear/Take off equipment", 22 + xtra_stock, 56);
5090 prt("コマンド:", 20 + xtra_stock, 0);
5092 prt("You may: ", 20 + xtra_stock, 0);
5097 request_command(TRUE);
5099 /* Process the command */
5100 store_process_command();
5103 * Hack -- To redraw missiles damage and prices in store
5104 * If player's charisma changes, or if player changes a bow, PU_BONUS is set
5106 need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
5108 /* Hack -- Character is still in "icky" mode */
5109 character_icky = TRUE;
5117 /* XXX XXX XXX Pack Overflow */
5118 if (inventory[INVEN_PACK].k_idx)
5120 INVENTORY_IDX item = INVEN_PACK;
5122 object_type *o_ptr = &inventory[item];
5124 /* Hack -- Flee from the store */
5125 if (cur_store_num != STORE_HOME)
5128 if (cur_store_num == STORE_MUSEUM)
5129 msg_print("ザックからアイテムがあふれそうなので、あわてて博物館から出た...");
5131 msg_print("ザックからアイテムがあふれそうなので、あわてて店から出た...");
5133 if (cur_store_num == STORE_MUSEUM)
5134 msg_print("Your pack is so full that you flee the Museum...");
5136 msg_print("Your pack is so full that you flee the store...");
5144 /* Hack -- Flee from the home */
5145 else if (!store_check_num(o_ptr))
5148 msg_print("ザックからアイテムがあふれそうなので、あわてて家から出た...");
5150 msg_print("Your pack is so full that you flee your home...");
5158 /* Hack -- Drop items into the home */
5166 char o_name[MAX_NLEN];
5169 /* Give a message */
5171 msg_print("ザックからアイテムがあふれてしまった!");
5173 msg_print("Your pack overflows!");
5177 /* Get local object */
5180 /* Grab a copy of the item */
5181 object_copy(q_ptr, o_ptr);
5184 object_desc(o_name, q_ptr, 0);
5187 msg_format("%sが落ちた。(%c)", o_name, index_to_label(item));
5189 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5193 /* Remove it from the players inventory */
5194 inven_item_increase(item, -255);
5195 inven_item_describe(item);
5196 inven_item_optimize(item);
5201 /* Let the home carry it */
5202 item_pos = home_carry(q_ptr);
5204 /* Redraw the home */
5207 store_top = (item_pos / store_bottom) * store_bottom;
5208 display_inventory();
5213 /* Hack -- Redisplay store prices if charisma changes */
5214 /* Hack -- Redraw missiles damage if player changes bow */
5215 if (need_redraw_store_inv) display_inventory();
5217 /* Hack -- get kicked out of the store */
5218 if (st_ptr->store_open >= turn) leave_store = TRUE;
5221 select_floor_music();
5223 p_ptr->town_num = old_town_num;
5225 /* Free turn XXX XXX XXX */
5226 p_ptr->energy_use = 100;
5229 /* Hack -- Character is no longer in "icky" mode */
5230 character_icky = FALSE;
5233 /* Hack -- Cancel automatic command */
5236 /* Hack -- Cancel "see" mode */
5237 command_see = FALSE;
5239 /* Allow expanding macros */
5240 get_com_no_macros = FALSE;
5242 /* Flush messages XXX XXX XXX */
5246 /* Clear the screen */
5250 /* Update everything */
5251 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
5252 p_ptr->update |= (PU_MONSTERS);
5254 /* Redraw entire screen */
5255 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5258 p_ptr->redraw |= (PR_MAP);
5261 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5267 * @brief 現在の町の店主を交代させる /
5268 * Shuffle one of the stores.
5269 * @param which 店舗種類のID
5272 void store_shuffle(int which)
5278 if (which == STORE_HOME) return;
5279 if (which == STORE_MUSEUM) return;
5282 /* Save the store index */
5283 cur_store_num = which;
5285 /* Activate that store */
5286 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
5289 /* Pick a new owner */
5292 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5293 if (j == st_ptr->owner) continue;
5294 for (i = 1;i < max_towns; i++)
5296 if (i == p_ptr->town_num) continue;
5297 if (st_ptr->owner == town[i].store[cur_store_num].owner) break;
5299 if (i == max_towns) break;
5302 /* Activate the new owner */
5303 ot_ptr = &owners[cur_store_num][st_ptr->owner];
5306 /* Reset the owner data */
5307 st_ptr->insult_cur = 0;
5308 st_ptr->store_open = 0;
5309 st_ptr->good_buy = 0;
5310 st_ptr->bad_buy = 0;
5313 /* Hack -- discount all the items */
5314 for (i = 0; i < st_ptr->stock_num; i++)
5319 o_ptr = &st_ptr->stock[i];
5321 if (!object_is_artifact(o_ptr))
5323 /* Hack -- Sell all non-artifact old items for "half price" */
5324 o_ptr->discount = 50;
5326 /* Hack -- Items are no longer "fixed price" */
5327 o_ptr->ident &= ~(IDENT_FIXED);
5329 /* Mega-Hack -- Note that the item is "on sale" */
5331 o_ptr->inscription = quark_add("売出中");
5333 o_ptr->inscription = quark_add("on sale");
5341 * @brief 店の品揃えを変化させる /
5342 * Maintain the inventory at the stores.
5343 * @param town_num 町のID
5344 * @param store_num 店舗種類のID
5347 void store_maint(int town_num, int store_num)
5351 cur_store_num = store_num;
5354 if (store_num == STORE_HOME) return;
5355 if (store_num == STORE_MUSEUM) return;
5357 /* Activate that store */
5358 st_ptr = &town[town_num].store[store_num];
5360 /* Activate the owner */
5361 ot_ptr = &owners[store_num][st_ptr->owner];
5363 /* Store keeper forgives the player */
5364 st_ptr->insult_cur = 0;
5366 /* Mega-Hack -- prune the black market */
5367 if (store_num == STORE_BLACK)
5369 /* Destroy crappy black market items */
5370 for (j = st_ptr->stock_num - 1; j >= 0; j--)
5372 object_type *o_ptr = &st_ptr->stock[j];
5374 /* Destroy crappy items */
5375 if (black_market_crap(o_ptr))
5377 /* Destroy the item */
5378 store_item_increase(j, 0 - o_ptr->number);
5379 store_item_optimize(j);
5385 /* Choose the number of slots to keep */
5386 j = st_ptr->stock_num;
5388 /* Sell a few items */
5389 j = j - randint1(STORE_TURNOVER);
5391 /* Never keep more than "STORE_MAX_KEEP" slots */
5392 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5394 /* Always "keep" at least "STORE_MIN_KEEP" items */
5395 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5397 /* Hack -- prevent "underflow" */
5400 /* Destroy objects until only "j" slots are left */
5401 while (st_ptr->stock_num > j) store_delete();
5404 /* Choose the number of slots to fill */
5405 j = st_ptr->stock_num;
5407 /* Buy some more items */
5408 j = j + randint1(STORE_TURNOVER);
5410 /* Never keep more than "STORE_MAX_KEEP" slots */
5411 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5413 /* Always "keep" at least "STORE_MIN_KEEP" items */
5414 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5416 /* Hack -- prevent "overflow" */
5417 if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1;
5419 /* Acquire some new items */
5420 while (st_ptr->stock_num < j) store_create();
5425 * @brief 店舗情報を初期化する /
5426 * Initialize the stores
5427 * @param town_num 町のID
5428 * @param store_num 店舗種類のID
5431 void store_init(int town_num, int store_num)
5435 cur_store_num = store_num;
5437 /* Activate that store */
5438 st_ptr = &town[town_num].store[store_num];
5446 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5447 for (i = 1;i < max_towns; i++)
5449 if (i == town_num) continue;
5450 if (st_ptr->owner == town[i].store[store_num].owner) break;
5452 if (i == max_towns) break;
5455 /* Activate the new owner */
5456 ot_ptr = &owners[store_num][st_ptr->owner];
5459 /* Initialize the store */
5460 st_ptr->store_open = 0;
5461 st_ptr->insult_cur = 0;
5462 st_ptr->good_buy = 0;
5463 st_ptr->bad_buy = 0;
5465 /* Nothing in stock */
5466 st_ptr->stock_num = 0;
5469 * MEGA-HACK - Last visit to store is
5470 * BEFORE player birth to enable store restocking
5472 st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5474 /* Clear any old items */
5475 for (k = 0; k < st_ptr->stock_size; k++)
5477 object_wipe(&st_ptr->stock[k]);
5483 * @brief アイテムを町のブラックマーケットに移動させる /
5484 * @param o_ptr 移動させたいオブジェクトの構造体参照ポインタ
5487 void move_to_black_market(object_type *o_ptr)
5490 if (!p_ptr->town_num) return;
5492 st_ptr = &town[p_ptr->town_num].store[STORE_BLACK];
5494 o_ptr->ident |= IDENT_STORE;
5496 (void)store_carry(o_ptr);
5498 object_wipe(o_ptr); /* Don't leave a bogus object behind... */