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.
14 #include "cmd-zapwand.h"
15 #include "cmd-magiceat.h"
19 static int cur_store_num = 0;
20 static int store_top = 0;
21 static int store_bottom = 0;
22 static int xtra_stock = 0;
23 static store_type *st_ptr = NULL;
24 static const owner_type *ot_ptr = NULL;
25 static s16b old_town_num = 0;
26 static s16b inner_town_num = 0;
27 #define RUMOR_CHANCE 8
29 #define MAX_COMMENT_1 6
31 static cptr comment_1[MAX_COMMENT_1] =
52 /*! ブラックマーケット追加メッセージ(承諾) */
53 static cptr comment_1_B[MAX_COMMENT_1] = {
62 #define MAX_COMMENT_2A 2
64 static cptr comment_2a[MAX_COMMENT_2A] =
67 "私の忍耐力を試しているのかい? $%s が最後だ。",
68 "我慢にも限度があるぞ。 $%s が最後だ。"
70 "You try my patience. %s is final.",
71 "My patience grows thin. %s is final."
76 #define MAX_COMMENT_2B 12
78 static cptr comment_2b[MAX_COMMENT_2B] =
81 " $%s ぐらいは出さなきゃダメだよ。",
84 "何て奴だ! $%s 以下はあり得ないぞ。",
85 "それじゃ少なすぎる! $%s は欲しいところだ。",
86 "バカにしている! $%s はもらわないと。",
88 "おいおい! $%s を考えてくれないか?",
89 "1000匹のオークのノミに苦しめられるがいい! $%s だ。",
90 "お前の大切なものに災いあれ! $%s でどうだ。",
91 "モルゴスに賞味されるがいい!本当は $%s なんだろう?",
92 "お前の母親はオーガか! $%s は出すつもりなんだろ?"
94 "I can take no less than %s gold pieces.",
95 "I will accept no less than %s gold pieces.",
96 "Ha! No less than %s gold pieces.",
97 "You knave! No less than %s gold pieces.",
98 "That's a pittance! I want %s gold pieces.",
99 "That's an insult! I want %s gold pieces.",
100 "As if! How about %s gold pieces?",
101 "My arse! How about %s gold pieces?",
102 "May the fleas of 1000 orcs molest you! Try %s gold pieces.",
103 "May your most favourite parts go moldy! Try %s gold pieces.",
104 "May Morgoth find you tasty! Perhaps %s gold pieces?",
105 "Your mother was an Ogre! Perhaps %s gold pieces?"
111 /*! ブラックマーケット用追加メッセージ(売るとき) */
112 static cptr comment_2b_B[MAX_COMMENT_2B] = {
113 "いくら俺様がお人好しとはいえ $%s が限界だね。嫌なら帰りな。",
114 "金がないのかい、あんた?まずは家に帰って $%s 揃えてきな。",
115 "物の価値が分からん奴だな。これは $%s が普通なんだよ。",
116 "俺の付けた値段に文句があるのか? $%s が限界だ。",
117 "ひょっとして新手の冗談かい? $%s 持ってないなら帰りな。",
118 "うちは他の店とは違うんだよ。$%s ぐらいは出しな。",
119 "買う気がないなら帰りな。 $%s だと言っているんだ。",
120 "話にならないね。 $%s くらい持っているんだろ?",
121 "は?なんだそりゃ? $%s の間違いか、ひょっとして?",
122 "出口はあっちだよ。それとも $%s 出せるのかい、あんたに。",
123 "命知らずな奴だな。 $%s 出せば今日の所は勘弁してやるよ。",
124 "うちの店は貧乏人お断りだ。 $%s ぐらい出せないのかい?"
127 #define MAX_COMMENT_3A 2
129 static cptr comment_3a[MAX_COMMENT_3A] =
132 "私の忍耐力を試しているのかい? $%s が最後だ。",
133 "我慢にも限度があるぞ。 $%s が最後だ。"
135 "You try my patience. %s is final.",
136 "My patience grows thin. %s is final."
142 #define MAX_COMMENT_3B 12
144 static cptr comment_3b[MAX_COMMENT_3B] =
147 "本音を言うと $%s でいいんだろ?",
149 " $%s ぐらいなら出してもいいが。",
150 " $%s 以上払うなんて考えられないね。",
151 "まあ落ちついて。 $%s でどうだい?",
152 "そのガラクタなら $%s で引き取るよ。",
153 "それじゃ高すぎる! $%s がいいとこだろ。",
154 "どうせいらないんだろ! $%s でいいだろ?",
155 "だめだめ! $%s がずっとお似合いだよ。",
156 "バカにしている! $%s がせいぜいだ。",
157 " $%s なら嬉しいところだがなあ。",
158 " $%s 、それ以上はビタ一文出さないよ!"
160 "Perhaps %s gold pieces?",
161 "How about %s gold pieces?",
162 "I will pay no more than %s gold pieces.",
163 "I can afford no more than %s gold pieces.",
164 "Be reasonable. How about %s gold pieces?",
165 "I'll buy it as scrap for %s gold pieces.",
166 "That is too much! How about %s gold pieces?",
167 "That looks war surplus! Say %s gold pieces?",
168 "Never! %s is more like it.",
169 "That's an insult! %s is more like it.",
170 "%s gold pieces and be thankful for it!",
171 "%s gold pieces and not a copper more!"
177 /*! ブラックマーケット用追加メッセージ(買い取り) */
178 static cptr comment_3b_B[MAX_COMMENT_3B] = {
179 " $%s ってところだね。そのどうしようもないガラクタは。",
180 "この俺が $%s って言っているんだから、その通りにした方が身のためだぞ。",
181 "俺の優しさに甘えるのもいい加減にしておけ。 $%s だ。",
182 "その品なら $%s で売ってくれているがね、常識ある紳士はみんな。",
183 "こりゃまた、がめつい奴だな。いくら俺が温厚とはいえ $%s が限界だ。",
184 " $%s だ。別に俺はそんなガラクタ欲しくはないんだから。",
185 "俺の鑑定額が気に入らないのか? $%s 、嫌なら帰りな。",
186 " $%s で引き取ってやるよ。喜んで受け取りな、貧乏人。",
187 "物の価値が分からん奴は始末におえんな。それは $%s なんだよ。",
188 "そんなに金が欲しいのか、あんた? $%s で満足できんのか?",
189 "入る店間違えてんじゃないのか? $%s で嫌なら他をあたってくれ。",
190 "俺の言い値にケチをつける奴がいるとは! その度胸に免じて $%s だ。"
193 #define MAX_COMMENT_4A 4
195 static cptr comment_4a[MAX_COMMENT_4A] =
198 "もうたくさんだ!何度も私をわずらわせないでくれ!",
199 "うがー!一日の我慢の限度を超えている!",
200 "もういい!時間の無駄以外のなにものでもない!",
201 "もうやってられないよ!顔も見たくない!"
203 "Enough! You have abused me once too often!",
204 "Arghhh! I have had enough abuse for one day!",
205 "That does it! You shall waste my time no more!",
206 "This is getting nowhere! I'm going to Londis!"
212 /*! ブラックマーケット用追加メッセージ(怒りの頂点) */
213 static cptr comment_4a_B[MAX_COMMENT_4A] = {
214 "なめやがって!温厚な俺様でも限界があるってことを知れ!",
215 "俺をここまで怒らせて...命があるだけでもありがたいと思え!",
216 "ふざけてるのか!冷やかしなら相手を見てからにしろ!",
217 "いいかげんにしろ!今度こんなまねしたらただじゃおかねえぞ!"
220 #define MAX_COMMENT_4B 4
222 static cptr comment_4b[MAX_COMMENT_4B] =
231 "Get out of my sight!",
232 "Begone, you scoundrel!",
239 /*! ブラックマーケット用追加メッセージ(追い出し) */
240 static cptr comment_4b_B[MAX_COMMENT_4B] = {
247 #define MAX_COMMENT_5 8
249 static cptr comment_5[MAX_COMMENT_5] =
263 "You will have to do better than that!",
264 "Do you wish to do business or not?",
265 "You've got to be kidding!",
266 "You'd better be kidding!",
267 "You try my patience.",
268 "Hmmm, nice weather we're having."
274 /*! ブラックマーケット用追加メッセージ(怒り) */
275 static cptr comment_5_B[MAX_COMMENT_5] = {
286 #define MAX_COMMENT_6 4
288 static cptr comment_6[MAX_COMMENT_6] =
296 "I must have heard you wrong.",
297 "I'm sorry, I missed that.",
298 "I'm sorry, what was that?",
299 "Sorry, what was that again?"
307 * @brief 取引成功時の店主のメッセージ処理 /
311 static void say_comment_1(void)
314 /* ブラックマーケットのときは別のメッセージを出す */
315 if ( cur_store_num == STORE_BLACK ) {
316 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
319 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
322 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
326 if (one_in_(RUMOR_CHANCE))
329 msg_print("店主は耳うちした:");
331 msg_print("The shopkeeper whispers something into your ear:");
339 * @brief プレイヤーがアイテムを買う時の価格代案メッセージ処理 /
340 * Continue haggling (player is buying)
341 * @param value 店主の提示価格
342 * @param annoyed 店主のいらつき度
345 static void say_comment_2(s32b value, int annoyed)
349 /* Prepare a string to insert */
350 sprintf(tmp_val, "%ld", (long)value);
355 /* Formatted message */
356 msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
362 /* Formatted message */
364 /* ブラックマーケットの時は別のメッセージを出す */
365 if ( cur_store_num == STORE_BLACK ){
366 msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
369 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
372 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
380 * @brief プレイヤーがアイテムを売る時の価格代案メッセージ処理 /
381 * Continue haggling (player is selling)
382 * @param value 店主の提示価格
383 * @param annoyed 店主のいらつき度
386 static void say_comment_3(s32b value, int annoyed)
390 /* Prepare a string to insert */
391 sprintf(tmp_val, "%ld", (long)value);
396 /* Formatted message */
397 msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
403 /* Formatted message */
405 /* ブラックマーケットの時は別のメッセージを出す */
406 if ( cur_store_num == STORE_BLACK ){
407 msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
410 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
413 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
421 * @brief 店主がプレイヤーを追い出す時のメッセージ処理 /
422 * Kick 'da bum out. -RAK-
425 static void say_comment_4(void)
428 /* ブラックマーケットの時は別のメッセージを出す */
429 if ( cur_store_num == STORE_BLACK ){
430 msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
431 msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
434 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
435 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
438 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
439 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
446 * @brief 店主がプレイヤーに取り合わない時のメッセージ処理 /
447 * You are insulting me
450 static void say_comment_5(void)
453 /* ブラックマーケットの時は別のメッセージを出す */
454 if ( cur_store_num == STORE_BLACK ){
455 msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
458 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
461 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
468 * @brief 店主がプレイヤーの提示を理解できなかった時のメッセージ処理 /
469 * That makes no sense.
472 static void say_comment_6(void)
474 msg_print(comment_6[randint0(MAX_COMMENT_6)]);
478 #define MAX_COMMENT_7A 4
480 static cptr comment_7a[MAX_COMMENT_7A] =
485 "誰かがむせび泣く声が聞こえる...。",
490 "You hear someone sobbing...",
491 "The shopkeeper howls in agony!"
496 #define MAX_COMMENT_7B 4
498 static cptr comment_7b[MAX_COMMENT_7B] =
508 "The shopkeeper curses at you.",
509 "The shopkeeper glares at you."
514 #define MAX_COMMENT_7C 4
516 static cptr comment_7c[MAX_COMMENT_7C] =
525 "You've made my day!",
526 "The shopkeeper giggles.",
527 "The shopkeeper laughs loudly."
532 #define MAX_COMMENT_7D 4
534 static cptr comment_7d[MAX_COMMENT_7D] =
538 "こんなおいしい思いをしたら、真面目に働けなくなるなぁ。",
543 "I think I'll retire!",
544 "The shopkeeper jumps for joy.",
545 "The shopkeeper smiles gleefully."
552 * @brief 店主が交渉を終えた際の反応を返す処理 /
553 * Let a shop-keeper React to a purchase
554 * @param price アイテムの取引額
555 * @param value アイテムの実際価値
556 * @param guess 店主が当初予想していた価値
559 * We paid "price", it was worth "value", and we thought it was worth "guess"
561 static void purchase_analyze(s32b price, s32b value, s32b guess)
563 /* Item was worthless, but we bought it */
564 if ((value <= 0) && (price > value))
567 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
569 chg_virtue(V_HONOUR, -1);
570 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);
590 /* Item was a good bargain, and we got away with it */
591 else if ((value > guess) && (value < (4 * guess)) && (price < value))
594 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
597 chg_virtue(V_HONOUR, -1);
599 chg_virtue(V_HONOUR, 1);
605 /* Item was a great bargain, and we got away with it */
606 else if ((value > guess) && (price < value))
609 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
612 chg_virtue(V_HONOUR, -1);
614 chg_virtue(V_HONOUR, 1);
616 if (10 * price < value)
617 chg_virtue(V_SACRIFICE, 1);
627 * We store the current "store feat" here so everyone can access it
629 static int cur_store_feat;
633 * Buying and selling adjustments for race combinations.
634 * Entry[owner][player] gives the basic "cost inflation".
636 static byte rgold_adj[MAX_RACES][MAX_RACES] =
638 /*Hum, HfE, Elf, Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
639 HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
640 Imp, Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
641 Angel, Demon, Kutar */
644 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
645 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
646 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
647 100, 120, 110, 105 },
650 { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
651 120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
652 120, 110, 110, 110, 120, 110, 100, 125, 100, 95, 140,
653 110, 115, 110, 110 },
656 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
657 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
658 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
659 110, 110, 105, 110 },
662 { 115, 110, 105, 95, 105, 110, 115, 130, 115, 105, 115,
663 125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
664 120, 110, 120, 120, 130, 110, 110, 130, 110, 95, 140,
665 115, 120, 105, 115 },
668 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
669 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
670 120, 101, 110, 110, 120, 120, 115, 130, 115, 95, 140,
671 115, 110, 110, 115 },
674 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
675 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
676 120, 105, 115, 115, 115, 115, 120, 130, 120, 95, 140,
677 115, 110, 115, 115 },
680 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
681 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
682 115, 125, 120, 120, 115, 120, 125, 115, 125, 95, 140,
683 115, 110, 115, 115 },
686 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
687 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
688 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
689 110, 110, 115, 110 },
692 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
693 120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
694 120, 105, 120, 120, 125, 120, 105, 135, 105, 95, 140,
695 100, 110, 110, 100 },
698 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
699 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
700 125, 115, 120, 120, 125, 120, 100, 125, 100, 95, 140,
701 110, 110, 105, 110 },
703 /* Human / Barbarian (copied from human) */
704 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
705 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
706 115, 105, 125, 125, 130, 125, 115, 120, 115, 95, 140,
707 100, 120, 110, 100 },
709 /* Half-Ogre: theoretical, copied from half-troll */
710 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
711 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
712 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
713 110, 110, 115, 110 },
715 /* Half-Giant: theoretical, copied from half-troll */
716 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
717 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
718 110, 115, 112, 112, 115, 112, 130, 120, 130, 95, 140,
719 110, 110, 115, 110 },
721 /* Half-Titan: theoretical, copied from High_Elf */
722 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
723 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
724 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
725 110, 110, 115, 110 },
727 /* Cyclops: theoretical, copied from half-troll */
728 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
729 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
730 110, 115, 112, 112, 115, 112, 130, 130, 130, 95, 140,
731 110, 110, 115, 110 },
733 /* Yeek: theoretical, copied from Half-Orc */
734 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
735 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
736 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
737 115, 110, 115, 115 },
739 /* Klackon: theoretical, copied from Gnome */
740 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
741 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
742 120, 101, 110, 110, 120, 120, 130, 130, 130, 95, 140,
743 115, 110, 115, 115 },
745 /* Kobold: theoretical, copied from Half-Orc */
746 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
747 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
748 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
749 115, 110, 115, 115 },
751 /* Nibelung: theoretical, copied from Dwarf */
752 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
753 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
754 120, 105, 115, 115, 120, 120, 130, 130, 130, 95, 140,
755 115, 135, 115, 115 },
758 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
759 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
760 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
761 110, 101, 115, 110 },
763 /* Draconian: theoretical, copied from High_Elf */
764 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
765 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
766 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
767 110, 110, 115, 110 },
769 /* Mind Flayer: theoretical, copied from High_Elf */
770 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
771 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
772 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
773 110, 110, 115, 110 },
775 /* Imp: theoretical, copied from High_Elf */
776 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
777 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
778 125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
779 110, 110, 115, 110 },
781 /* Golem: theoretical, copied from High_Elf */
782 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
783 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
784 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
785 110, 110, 115, 110 },
787 /* Skeleton: theoretical, copied from half-orc */
788 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
789 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
790 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
791 115, 110, 125, 115 },
793 /* Zombie: Theoretical, copied from half-orc */
794 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
795 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
796 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
797 115, 110, 125, 115 },
799 /* Vampire: Theoretical, copied from half-orc */
800 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
801 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
802 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
803 115, 110, 125, 115 },
805 /* Spectre: Theoretical, copied from half-orc */
806 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
807 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
808 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
809 115, 110, 125, 115 },
811 /* Sprite: Theoretical, copied from half-orc */
812 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
813 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
814 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
815 115, 110, 105, 115 },
817 /* Beastman: Theoretical, copied from half-orc */
818 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
819 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
820 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
821 115, 110, 115, 115 },
824 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
825 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
826 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
827 110, 110, 105, 110 },
830 { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
831 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
832 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 160,
836 { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
837 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
838 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
839 140, 140, 140, 140 },
842 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
843 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
844 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
845 100, 120, 110, 100 },
848 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
849 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
850 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
851 110, 101, 115, 110 },
854 { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
855 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
856 115, 115, 125, 125, 125, 125, 105, 115, 105, 95, 140,
857 110, 115, 100, 110 },
860 { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
861 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
862 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
863 100, 120, 110, 100 },
870 * Determine the price of an item (qty one) in a store.
871 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
872 * @param greed 店主の強欲度
873 * @param flip TRUEならば店主にとっての買取価格、FALSEなら売出価格を計算
877 * This function takes into account the player's charisma, and the
878 * shop-keepers friendliness, and the shop-keeper's base greed, but
879 * never lets a shop-keeper lose money in a transaction.
880 * The "greed" value should exceed 100 when the player is "buying" the
881 * item, and should be less than 100 when the player is "selling" it.
882 * Hack -- the black market always charges twice as much as it should.
883 * Charisma adjustment runs from 80 to 130
884 * Racial adjustment runs from 95 to 130
885 * Since greed/charisma/racial adjustments are centered at 100, we need
886 * to adjust (by 200) to extract a usable multiplier. Note that the
887 * "greed" value is always something (?).
890 static s32b price_item(object_type *o_ptr, int greed, bool flip)
897 /* Get the value of one of the items */
898 price = object_value(o_ptr);
900 /* Worthless items */
901 if (price <= 0) return (0L);
904 /* Compute the racial factor */
905 factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
907 /* Add in the charisma factor */
908 factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]];
914 /* Adjust for greed */
915 adjust = 100 + (300 - (greed + factor));
917 /* Never get "silly" */
918 if (adjust > 100) adjust = 100;
920 /* Mega-Hack -- Black market sucks */
921 if (cur_store_num == STORE_BLACK)
924 /* Compute the final price (with rounding) */
925 /* Hack -- prevent underflow */
926 price = (price * adjust + 50L) / 100L;
929 /* Shop is selling */
932 /* Adjust for greed */
933 adjust = 100 + ((greed + factor) - 300);
935 /* Never get "silly" */
936 if (adjust < 100) adjust = 100;
938 /* Mega-Hack -- Black market sucks */
939 if (cur_store_num == STORE_BLACK)
942 /* Compute the final price (with rounding) */
943 /* Hack -- prevent overflow */
944 price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
947 /* Note -- Never become "free" */
948 if (price <= 0L) return (1L);
950 /* Return the price */
956 * @brief 安価な消耗品の販売数を増やし、低確率で割引にする /
957 * Certain "cheap" objects should be created in "piles"
958 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
962 * Some objects can be sold at a "discount" (in small piles)
965 static void mass_produce(object_type *o_ptr)
968 DISCOUNT_RATE discount = 0;
970 s32b cost = object_value(o_ptr);
973 /* Analyze the type */
976 /* Food, Flasks, and Lites */
981 if (cost <= 5L) size += damroll(3, 5);
982 if (cost <= 20L) size += damroll(3, 5);
983 if (cost <= 50L) size += damroll(2, 2);
990 if (cost <= 60L) size += damroll(3, 5);
991 if (cost <= 240L) size += damroll(1, 5);
992 if (o_ptr->sval == SV_SCROLL_STAR_IDENTIFY) size += damroll(3, 5);
993 if (o_ptr->sval == SV_SCROLL_STAR_REMOVE_CURSE) size += damroll(1, 4);
998 case TV_SORCERY_BOOK:
1003 case TV_ARCANE_BOOK:
1005 case TV_DAEMON_BOOK:
1006 case TV_CRUSADE_BOOK:
1008 case TV_HISSATSU_BOOK:
1011 if (cost <= 50L) size += damroll(2, 3);
1012 if (cost <= 500L) size += damroll(1, 3);
1030 if (object_is_artifact(o_ptr)) break;
1031 if (object_is_ego(o_ptr)) break;
1032 if (cost <= 10L) size += damroll(3, 5);
1033 if (cost <= 100L) size += damroll(3, 5);
1042 if (cost <= 5L) size += damroll(5, 5);
1043 if (cost <= 50L) size += damroll(5, 5);
1044 if (cost <= 500L) size += damroll(5, 5);
1050 if (cost <= 100L) size += damroll(2, 2);
1051 if (cost <= 1000L) size += damroll(2, 2);
1064 * Because many rods (and a few wands and staffs) are useful mainly
1065 * in quantity, the Black Market will occasionally have a bunch of
1072 if ((cur_store_num == STORE_BLACK) && one_in_(3))
1074 if (cost < 1601L) size += damroll(1, 5);
1075 else if (cost < 3201L) size += damroll(1, 3);
1082 /* Pick a discount */
1087 else if (one_in_(25))
1091 else if (one_in_(150))
1095 else if (one_in_(300))
1099 else if (one_in_(500))
1104 if (o_ptr->art_name)
1109 /* Save the discount */
1110 o_ptr->discount = discount;
1112 /* Save the total pile size */
1113 o_ptr->number = size - (size * discount / 100);
1115 /* Ensure that mass-produced rods and wands get the correct pvals. */
1116 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1118 o_ptr->pval *= (PARAMETER_VALUE)o_ptr->number;
1125 * @brief 店舗に並べた品を同一品であるかどうか判定する /
1126 * Determine if a store item can "absorb" another item
1127 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1128 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1129 * @return 同一扱いできるならTRUEを返す
1132 * See "object_similar()" for the same function for the "player"
1135 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
1139 /* Hack -- Identical items cannot be stacked */
1140 if (o_ptr == j_ptr) return (0);
1142 /* Different objects cannot be stacked */
1143 if (o_ptr->k_idx != j_ptr->k_idx) return (0);
1145 /* Different charges (etc) cannot be stacked, unless wands or rods. */
1146 if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
1148 /* Require many identical values */
1149 if (o_ptr->to_h != j_ptr->to_h) return (0);
1150 if (o_ptr->to_d != j_ptr->to_d) return (0);
1151 if (o_ptr->to_a != j_ptr->to_a) return (0);
1153 /* Require identical "ego-item" names */
1154 if (o_ptr->name2 != j_ptr->name2) return (0);
1156 /* Artifacts don't stack! */
1157 if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
1159 /* Hack -- Identical art_flags! */
1160 for (i = 0; i < TR_FLAG_SIZE; i++)
1161 if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
1163 /* Hack -- Never stack "powerful" items */
1164 if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
1166 /* Hack -- Never stack recharging items */
1167 if (o_ptr->timeout || j_ptr->timeout) return (0);
1169 /* Require many identical values */
1170 if (o_ptr->ac != j_ptr->ac) return (0);
1171 if (o_ptr->dd != j_ptr->dd) return (0);
1172 if (o_ptr->ds != j_ptr->ds) return (0);
1174 /* Hack -- Never stack chests */
1175 if (o_ptr->tval == TV_CHEST) return (0);
1176 if (o_ptr->tval == TV_STATUE) return (0);
1177 if (o_ptr->tval == TV_CAPTURE) return (0);
1179 /* Require matching discounts */
1180 if (o_ptr->discount != j_ptr->discount) return (0);
1182 /* They match, so they must be similar */
1188 * @brief 店舗に並べた品を重ね合わせできるかどうか判定する /
1189 * Allow a store item to absorb another item
1190 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1191 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1192 * @return 重ね合わせできるならTRUEを返す
1195 * See "object_similar()" for the same function for the "player"
1198 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
1200 int max_num = (o_ptr->tval == TV_ROD) ?
1201 MIN(99, MAX_SHORT / k_info[o_ptr->k_idx].pval) : 99;
1202 int total = o_ptr->number + j_ptr->number;
1203 int diff = (total > max_num) ? total - max_num : 0;
1205 /* Combine quantity, lose excess items */
1206 o_ptr->number = (total > max_num) ? max_num : total;
1208 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) together. -LM- */
1209 if (o_ptr->tval == TV_ROD)
1211 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1214 /* Hack -- if wands are stacking, combine the charges. -LM- */
1215 if (o_ptr->tval == TV_WAND)
1217 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1223 * @brief 店舗に品を置くスペースがあるかどうかの判定を返す /
1224 * Check to see if the shop will be carrying too many objects -RAK-
1225 * @param o_ptr 店舗に置きたいオブジェクト構造体の参照ポインタ
1226 * @return 置き場がないなら0、重ね合わせできるアイテムがあるなら-1、スペースがあるなら1を返す。
1229 * Note that the shop, just like a player, will not accept things
1230 * it cannot hold. Before, one could "nuke" potions this way.
1231 * Return value is now int:
1233 * -1 : Can be combined to existing slot.
1234 * 1 : Cannot be combined but there are empty spaces.
1237 static int store_check_num(object_type *o_ptr)
1242 /* The "home" acts like the player */
1243 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
1245 bool old_stack_force_notes = stack_force_notes;
1246 bool old_stack_force_costs = stack_force_costs;
1248 if (cur_store_num != STORE_HOME)
1250 stack_force_notes = FALSE;
1251 stack_force_costs = FALSE;
1254 /* Check all the items */
1255 for (i = 0; i < st_ptr->stock_num; i++)
1257 /* Get the existing item */
1258 j_ptr = &st_ptr->stock[i];
1260 /* Can the new object be combined with the old one? */
1261 if (object_similar(j_ptr, o_ptr))
1263 if (cur_store_num != STORE_HOME)
1265 stack_force_notes = old_stack_force_notes;
1266 stack_force_costs = old_stack_force_costs;
1273 if (cur_store_num != STORE_HOME)
1275 stack_force_notes = old_stack_force_notes;
1276 stack_force_costs = old_stack_force_costs;
1280 /* Normal stores do special stuff */
1283 /* Check all the items */
1284 for (i = 0; i < st_ptr->stock_num; i++)
1286 /* Get the existing item */
1287 j_ptr = &st_ptr->stock[i];
1289 /* Can the new object be combined with the old one? */
1290 if (store_object_similar(j_ptr, o_ptr)) return -1;
1294 /* Free space is always usable */
1296 * オプション powerup_home が設定されていると
1299 if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
1300 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
1305 if (st_ptr->stock_num < st_ptr->stock_size) {
1310 /* But there was no room at the inn... */
1315 * @brief オブジェクトが祝福されているかの判定を返す /
1316 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1317 * @return アイテムが祝福されたアイテムならばTRUEを返す
1319 static bool is_blessed(object_type *o_ptr)
1321 u32b flgs[TR_FLAG_SIZE];
1322 object_flags(o_ptr, flgs);
1323 if (have_flag(flgs, TR_BLESSED)) return (TRUE);
1324 else return (FALSE);
1330 * @brief オブジェクトが所定の店舗で引き取れるかどうかを返す /
1331 * Determine if the current store will purchase the given item
1332 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1333 * @return アイテムが買い取れるならばTRUEを返す
1335 * Note that a shop-keeper must refuse to buy "worthless" items
1337 static bool store_will_buy(object_type *o_ptr)
1339 /* Hack -- The Home is simple */
1340 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
1342 /* Switch on the store */
1343 switch (cur_store_num)
1348 /* Analyze the type */
1349 switch (o_ptr->tval)
1352 if (o_ptr->sval != SV_POTION_WATER) return FALSE;
1364 case TV_BOTTLE: /* 'Green', recycling Angband */
1379 /* Analyze the type */
1380 switch (o_ptr->tval)
1401 /* Analyze the type */
1402 switch (o_ptr->tval)
1411 case TV_HISSATSU_BOOK:
1415 if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
1427 /* Analyze the type */
1428 switch (o_ptr->tval)
1431 case TV_CRUSADE_BOOK:
1441 monster_race *r_ptr = &r_info[o_ptr->pval];
1444 if (!(r_ptr->flags3 & RF3_EVIL))
1447 if (r_ptr->flags3 & RF3_GOOD) break;
1449 /* Accept animals */
1450 if (r_ptr->flags3 & RF3_ANIMAL) break;
1453 if (my_strchr("?!", r_ptr->d_char)) break;
1459 if (is_blessed(o_ptr)) break;
1468 case STORE_ALCHEMIST:
1470 /* Analyze the type */
1471 switch (o_ptr->tval)
1485 /* Analyze the type */
1486 switch (o_ptr->tval)
1488 case TV_SORCERY_BOOK:
1489 case TV_NATURE_BOOK:
1493 case TV_ARCANE_BOOK:
1495 case TV_DAEMON_BOOK:
1509 if(o_ptr->sval == SV_WIZSTAFF) break;
1510 else return (FALSE);
1517 /* Bookstore Shop */
1520 /* Analyze the type */
1521 switch (o_ptr->tval)
1523 case TV_SORCERY_BOOK:
1524 case TV_NATURE_BOOK:
1529 case TV_ARCANE_BOOK:
1531 case TV_DAEMON_BOOK:
1532 case TV_CRUSADE_BOOK:
1543 /* XXX XXX XXX Ignore "worthless" items */
1544 if (object_value(o_ptr) <= 0) return (FALSE);
1552 * @brief 現在の町の指定された店舗のアイテムを整理する /
1553 * Combine and reorder items in store.
1554 * @param store_num 店舗ID
1555 * @return 実際に整理が行われたならばTRUEを返す。
1557 bool combine_and_reorder_home(int store_num)
1561 object_type forge, *o_ptr, *j_ptr;
1562 bool flag = FALSE, combined;
1563 store_type *old_st_ptr = st_ptr;
1564 bool old_stack_force_notes = stack_force_notes;
1565 bool old_stack_force_costs = stack_force_costs;
1567 st_ptr = &town[1].store[store_num];
1568 if (store_num != STORE_HOME)
1570 stack_force_notes = FALSE;
1571 stack_force_costs = FALSE;
1578 /* Combine the items in the home (backwards) */
1579 for (i = st_ptr->stock_num - 1; i > 0; i--)
1582 o_ptr = &st_ptr->stock[i];
1584 /* Skip empty items */
1585 if (!o_ptr->k_idx) continue;
1587 /* Scan the items above that item */
1588 for (j = 0; j < i; j++)
1593 j_ptr = &st_ptr->stock[j];
1595 /* Skip empty items */
1596 if (!j_ptr->k_idx) continue;
1599 * Get maximum number of the stack if these
1600 * are similar, get zero otherwise.
1602 max_num = object_similar_part(j_ptr, o_ptr);
1604 /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
1605 if (max_num && j_ptr->number < max_num)
1607 if (o_ptr->number + j_ptr->number <= max_num)
1609 /* Add together the item counts */
1610 object_absorb(j_ptr, o_ptr);
1612 /* One object is gone */
1613 st_ptr->stock_num--;
1615 /* Slide everything down */
1616 for (k = i; k < st_ptr->stock_num; k++)
1618 /* Structure copy */
1619 st_ptr->stock[k] = st_ptr->stock[k + 1];
1622 /* Erase the "final" slot */
1623 object_wipe(&st_ptr->stock[k]);
1627 ITEM_NUMBER old_num = o_ptr->number;
1628 ITEM_NUMBER remain = j_ptr->number + o_ptr->number - max_num;
1630 /* Add together the item counts */
1631 object_absorb(j_ptr, o_ptr);
1633 o_ptr->number = remain;
1635 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
1636 if (o_ptr->tval == TV_ROD)
1638 o_ptr->pval = o_ptr->pval * remain / old_num;
1639 o_ptr->timeout = o_ptr->timeout * remain / old_num;
1642 /* Hack -- if wands are stacking, combine the charges. -LM- */
1643 else if (o_ptr->tval == TV_WAND)
1645 o_ptr->pval = o_ptr->pval * remain / old_num;
1662 /* Re-order the items in the home (forwards) */
1663 for (i = 0; i < st_ptr->stock_num; i++)
1666 o_ptr = &st_ptr->stock[i];
1668 /* Skip empty slots */
1669 if (!o_ptr->k_idx) continue;
1671 /* Get the "value" of the item */
1672 o_value = object_value(o_ptr);
1674 /* Scan every occupied slot */
1675 for (j = 0; j < st_ptr->stock_num; j++)
1677 if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
1680 /* Never move down */
1681 if (j >= i) continue;
1686 /* Get local object */
1689 /* Save a copy of the moving item */
1690 object_copy(j_ptr, &st_ptr->stock[i]);
1692 /* Slide the objects */
1693 for (k = i; k > j; k--)
1695 /* Slide the item */
1696 object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
1699 /* Insert the moving item */
1700 object_copy(&st_ptr->stock[j], j_ptr);
1703 st_ptr = old_st_ptr;
1704 if (store_num != STORE_HOME)
1706 stack_force_notes = old_stack_force_notes;
1707 stack_force_costs = old_stack_force_costs;
1715 * @brief 我が家にオブジェクトを加える /
1716 * Add the item "o_ptr" to the inventory of the "Home"
1717 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1721 * In all cases, return the slot (or -1) where the object was placed
1722 * Note that this is a hacked up version of "inven_carry()".
1723 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1724 * known, the player may have to pick stuff up and drop it again.
1727 static int home_carry(object_type *o_ptr)
1733 bool old_stack_force_notes = stack_force_notes;
1734 bool old_stack_force_costs = stack_force_costs;
1736 if (cur_store_num != STORE_HOME)
1738 stack_force_notes = FALSE;
1739 stack_force_costs = FALSE;
1742 /* Check each existing item (try to combine) */
1743 for (slot = 0; slot < st_ptr->stock_num; slot++)
1745 /* Get the existing item */
1746 j_ptr = &st_ptr->stock[slot];
1748 /* The home acts just like the player */
1749 if (object_similar(j_ptr, o_ptr))
1751 /* Save the new number of items */
1752 object_absorb(j_ptr, o_ptr);
1754 if (cur_store_num != STORE_HOME)
1756 stack_force_notes = old_stack_force_notes;
1757 stack_force_costs = old_stack_force_costs;
1765 if (cur_store_num != STORE_HOME)
1767 stack_force_notes = old_stack_force_notes;
1768 stack_force_costs = old_stack_force_costs;
1773 * 隠し機能: オプション powerup_home が設定されていると
1777 if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
1778 if (st_ptr->stock_num >= st_ptr->stock_size) {
1783 if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
1789 /* Determine the "value" of the item */
1790 value = object_value(o_ptr);
1792 /* Check existing slots to see if we must "slide" */
1793 for (slot = 0; slot < st_ptr->stock_num; slot++)
1795 if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
1798 /* Slide the others up */
1799 for (i = st_ptr->stock_num; i > slot; i--)
1801 st_ptr->stock[i] = st_ptr->stock[i-1];
1804 /* More stuff now */
1805 st_ptr->stock_num++;
1807 /* Insert the new item */
1808 st_ptr->stock[slot] = *o_ptr;
1810 chg_virtue(V_SACRIFICE, -1);
1812 (void)combine_and_reorder_home(cur_store_num);
1814 /* Return the location */
1820 * @brief 店舗にオブジェクトを加える /
1821 * Add the item "o_ptr" to a real stores inventory.
1822 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1826 * In all cases, return the slot (or -1) where the object was placed
1827 * Note that this is a hacked up version of "inven_carry()".
1828 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1829 * known, the player may have to pick stuff up and drop it again.
1832 static int store_carry(object_type *o_ptr)
1835 s32b value, j_value;
1839 /* Evaluate the object */
1840 value = object_value(o_ptr);
1842 /* Cursed/Worthless items "disappear" when sold */
1843 if (value <= 0) return (-1);
1845 /* All store items are fully *identified* */
1846 o_ptr->ident |= IDENT_MENTAL;
1848 /* Erase the inscription */
1849 o_ptr->inscription = 0;
1851 /* Erase the "feeling" */
1852 o_ptr->feeling = FEEL_NONE;
1854 /* Check each existing item (try to combine) */
1855 for (slot = 0; slot < st_ptr->stock_num; slot++)
1857 /* Get the existing item */
1858 j_ptr = &st_ptr->stock[slot];
1860 /* Can the existing items be incremented? */
1861 if (store_object_similar(j_ptr, o_ptr))
1863 /* Hack -- extra items disappear */
1864 store_object_absorb(j_ptr, o_ptr);
1872 if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
1875 /* Check existing slots to see if we must "slide" */
1876 for (slot = 0; slot < st_ptr->stock_num; slot++)
1879 j_ptr = &st_ptr->stock[slot];
1881 /* Objects sort by decreasing type */
1882 if (o_ptr->tval > j_ptr->tval) break;
1883 if (o_ptr->tval < j_ptr->tval) continue;
1885 /* Objects sort by increasing sval */
1886 if (o_ptr->sval < j_ptr->sval) break;
1887 if (o_ptr->sval > j_ptr->sval) continue;
1890 * Hack: otherwise identical rods sort by
1891 * increasing recharge time --dsb
1893 if (o_ptr->tval == TV_ROD)
1895 if (o_ptr->pval < j_ptr->pval) break;
1896 if (o_ptr->pval > j_ptr->pval) continue;
1899 /* Evaluate that slot */
1900 j_value = object_value(j_ptr);
1902 /* Objects sort by decreasing value */
1903 if (value > j_value) break;
1904 if (value < j_value) continue;
1907 /* Slide the others up */
1908 for (i = st_ptr->stock_num; i > slot; i--)
1910 st_ptr->stock[i] = st_ptr->stock[i-1];
1913 /* More stuff now */
1914 st_ptr->stock_num++;
1916 /* Insert the new item */
1917 st_ptr->stock[slot] = *o_ptr;
1919 /* Return the location */
1925 * @brief 店舗のオブジェクト数を増やす /
1926 * Add the item "o_ptr" to a real stores inventory.
1927 * @param item 増やしたいアイテムのID
1932 * Increase, by a given amount, the number of a certain item
1933 * in a certain store. This can result in zero items.
1935 * @todo numは本来ITEM_NUMBER型にしたい。
1937 static void store_item_increase(int item, int num)
1943 o_ptr = &st_ptr->stock[item];
1945 /* Verify the number */
1946 cnt = o_ptr->number + num;
1947 if (cnt > 255) cnt = 255;
1948 else if (cnt < 0) cnt = 0;
1949 num = cnt - o_ptr->number;
1951 /* Save the new number */
1952 o_ptr->number += (ITEM_NUMBER)num;
1957 * @brief 店舗のオブジェクト数を削除する /
1958 * Remove a slot if it is empty
1959 * @param item 削除したいアイテムのID
1962 static void store_item_optimize(int item)
1968 o_ptr = &st_ptr->stock[item];
1971 if (!o_ptr->k_idx) return;
1973 /* Must have no items */
1974 if (o_ptr->number) return;
1977 st_ptr->stock_num--;
1979 /* Slide everyone */
1980 for (j = item; j < st_ptr->stock_num; j++)
1982 st_ptr->stock[j] = st_ptr->stock[j + 1];
1985 /* Nuke the final slot */
1986 object_wipe(&st_ptr->stock[j]);
1990 * @brief ブラックマーケット用の無価値品の排除判定 /
1991 * This function will keep 'crap' out of the black market.
1992 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1993 * @return ブラックマーケットにとって無価値な品ならばTRUEを返す
1996 * Crap is defined as any item that is "available" elsewhere
1997 * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
2000 static bool black_market_crap(object_type *o_ptr)
2004 /* Ego items are never crap */
2005 if (object_is_ego(o_ptr)) return (FALSE);
2007 /* Good items are never crap */
2008 if (o_ptr->to_a > 0) return (FALSE);
2009 if (o_ptr->to_h > 0) return (FALSE);
2010 if (o_ptr->to_d > 0) return (FALSE);
2012 /* Check all stores */
2013 for (i = 0; i < MAX_STORES; i++)
2015 if (i == STORE_HOME) continue;
2016 if (i == STORE_MUSEUM) continue;
2018 /* Check every item in the store */
2019 for (j = 0; j < town[p_ptr->town_num].store[i].stock_num; j++)
2021 object_type *j_ptr = &town[p_ptr->town_num].store[i].stock[j];
2023 /* Duplicate item "type", assume crappy */
2024 if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
2034 * @brief 店舗の品揃え変化のためにアイテムを削除する /
2035 * Attempt to delete (some of) a random item from the store
2039 * Hack -- we attempt to "maintain" piles of items when possible.
2042 static void store_delete(void)
2046 /* Pick a random slot */
2047 what = randint0(st_ptr->stock_num);
2049 /* Determine how many items are here */
2050 num = st_ptr->stock[what].number;
2052 /* Hack -- sometimes, only destroy half the items */
2053 if (randint0(100) < 50) num = (num + 1) / 2;
2055 /* Hack -- sometimes, only destroy a single item */
2056 if (randint0(100) < 50) num = 1;
2058 /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
2059 if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
2061 st_ptr->stock[what].pval -= num * st_ptr->stock[what].pval / st_ptr->stock[what].number;
2064 /* Actually destroy (part of) the item */
2065 store_item_increase(what, -num);
2066 store_item_optimize(what);
2071 * @brief 店舗の品揃え変化のためにアイテムを追加する /
2072 * Creates a random item and gives it to a store
2076 * This algorithm needs to be rethought. A lot.
2077 * Currently, "normal" stores use a pre-built array.
2078 * Note -- the "level" given to "obj_get_num()" is a "favored"
2079 * level, that is, there is a much higher chance of getting
2080 * items with a level approaching that of the given level...
2081 * Should we check for "permission" to have the given item?
2084 static void store_create(void)
2094 /* Paranoia -- no room left */
2095 if (st_ptr->stock_num >= st_ptr->stock_size) return;
2098 /* Hack -- consider up to four items */
2099 for (tries = 0; tries < 4; tries++)
2102 if (cur_store_num == STORE_BLACK)
2104 /* Pick a level for object/magic */
2105 level = 25 + randint0(25);
2107 /* Random item (usually of given level) */
2108 i = get_obj_num(level);
2110 /* Handle failure */
2117 /* Hack -- Pick an item to sell */
2118 i = st_ptr->table[randint0(st_ptr->table_num)];
2120 /* Hack -- fake level for apply_magic() */
2121 level = rand_range(1, STORE_OBJ_LEVEL);
2125 /* Get local object */
2128 /* Create a new object of the chosen kind */
2129 object_prep(q_ptr, i);
2131 /* Apply some "low-level" magic (no artifacts) */
2132 apply_magic(q_ptr, level, AM_NO_FIXED_ART);
2134 /* Require valid object */
2135 if (!store_will_buy(q_ptr)) continue;
2137 /* Hack -- Charge lite's */
2138 if (q_ptr->tval == TV_LITE)
2140 if (q_ptr->sval == SV_LITE_TORCH) q_ptr->xtra4 = FUEL_TORCH / 2;
2141 if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->xtra4 = FUEL_LAMP / 2;
2145 /* The item is "known" */
2146 object_known(q_ptr);
2148 /* Mark it storebought */
2149 q_ptr->ident |= IDENT_STORE;
2151 /* Mega-Hack -- no chests in stores */
2152 if (q_ptr->tval == TV_CHEST) continue;
2154 /* Prune the black market */
2155 if (cur_store_num == STORE_BLACK)
2157 /* Hack -- No "crappy" items */
2158 if (black_market_crap(q_ptr)) continue;
2160 /* Hack -- No "cheap" items */
2161 if (object_value(q_ptr) < 10) continue;
2163 /* No "worthless" items */
2164 /* if (object_value(q_ptr) <= 0) continue; */
2167 /* Prune normal stores */
2170 /* No "worthless" items */
2171 if (object_value(q_ptr) <= 0) continue;
2175 /* Mass produce and/or Apply discount */
2176 mass_produce(q_ptr);
2178 /* Attempt to carry the (known) item */
2179 (void)store_carry(q_ptr);
2181 /* Definitely done */
2188 * @brief 店舗の割引対象外にするかどうかを判定 /
2189 * Eliminate need to bargain if player has haggled well in the past
2190 * @param minprice アイテムの最低販売価格
2191 * @return 割引を禁止するならTRUEを返す。
2193 static bool noneedtobargain(s32b minprice)
2195 s32b good = st_ptr->good_buy;
2196 s32b bad = st_ptr->bad_buy;
2198 /* Cheap items are "boring" */
2199 if (minprice < 10L) return (TRUE);
2201 /* Perfect haggling */
2202 if (good == MAX_SHORT) return (TRUE);
2204 /* Reward good haggles, punish bad haggles, notice price */
2205 if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
2207 /* Return the flag */
2213 * @brief 店主の持つプレイヤーに対する売買の良し悪し経験を記憶する /
2214 * Update the bargain info
2215 * @param price 実際の取引価格
2216 * @param minprice 店主の提示した価格
2220 static void updatebargain(s32b price, s32b minprice, int num)
2222 /* Hack -- auto-haggle */
2223 if (!manual_haggle) return;
2225 /* Cheap items are "boring" */
2226 if ((minprice/num) < 10L) return;
2228 /* Count the successful haggles */
2229 if (price == minprice)
2231 /* Just count the good haggles */
2232 if (st_ptr->good_buy < MAX_SHORT)
2238 /* Count the failed haggles */
2241 /* Just count the bad haggles */
2242 if (st_ptr->bad_buy < MAX_SHORT)
2251 * @brief 店の商品リストを再表示する /
2252 * Re-displays a single store entry
2256 static void display_entry(int pos)
2262 char o_name[MAX_NLEN];
2269 o_ptr = &st_ptr->stock[pos];
2271 /* Get the "offset" */
2272 i = (pos % store_bottom);
2274 /* Label it, clear the line --(-- */
2275 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
2276 prt(out_val, i+6, 0);
2279 if (show_item_graph)
2281 byte a = object_attr(o_ptr);
2282 char c = object_char(o_ptr);
2284 Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
2285 if (use_bigtile) cur_col++;
2290 /* Describe an item in the home */
2291 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
2295 /* Leave room for weights, if necessary -DRS- */
2296 if (show_weights) maxwid -= 10;
2298 /* Describe the object */
2299 object_desc(o_name, o_ptr, 0);
2300 o_name[maxwid] = '\0';
2301 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2306 /* Only show the weight of an individual item */
2307 int wgt = o_ptr->weight;
2309 sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2310 put_str(out_val, i+6, 67);
2312 (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10);
2313 put_str(out_val, i+6, 68);
2319 /* Describe an item (fully) in a store */
2322 /* Must leave room for the "price" */
2325 /* Leave room for weights, if necessary -DRS- */
2326 if (show_weights) maxwid -= 7;
2328 /* Describe the object (fully) */
2329 object_desc(o_name, o_ptr, 0);
2330 o_name[maxwid] = '\0';
2331 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2336 /* Only show the weight of an individual item */
2337 int wgt = o_ptr->weight;
2339 sprintf(out_val, "%3d.%1d", lbtokg1(wgt) , lbtokg2(wgt) );
2340 put_str(out_val, i+6, 60);
2342 (void)sprintf(out_val, "%3d.%d", wgt / 10, wgt % 10);
2343 put_str(out_val, i+6, 61);
2348 /* Display a "fixed" cost */
2349 if (o_ptr->ident & (IDENT_FIXED))
2351 /* Extract the "minimum" price */
2352 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2354 /* Actually draw the price (not fixed) */
2356 (void)sprintf(out_val, "%9ld固", (long)x);
2358 (void)sprintf(out_val, "%9ld F", (long)x);
2361 put_str(out_val, i+6, 68);
2364 /* Display a "taxed" cost */
2365 else if (!manual_haggle)
2367 /* Extract the "minimum" price */
2368 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2370 /* Hack -- Apply Sales Tax if needed */
2371 if (!noneedtobargain(x)) x += x / 10;
2373 /* Actually draw the price (with tax) */
2374 (void)sprintf(out_val, "%9ld ", (long)x);
2375 put_str(out_val, i+6, 68);
2378 /* Display a "haggle" cost */
2381 /* Extrect the "maximum" price */
2382 x = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
2384 /* Actually draw the price (not fixed) */
2385 (void)sprintf(out_val, "%9ld ", (long)x);
2386 put_str(out_val, i+6, 68);
2393 * @brief 店の商品リストを表示する /
2394 * Displays a store's inventory -RAK-
2397 * All prices are listed as "per individual object". -BEN-
2399 static void display_inventory(void)
2403 /* Display the next 12 items */
2404 for (k = 0; k < store_bottom; k++)
2406 /* Do not display "dead" items */
2407 if (store_top + k >= st_ptr->stock_num) break;
2409 /* Display that line */
2410 display_entry(store_top + k);
2413 /* Erase the extra lines and the "more" prompt */
2414 for (i = k; i < store_bottom + 1; i++) prt("", i + 6, 0);
2416 /* Assume "no current page" */
2418 put_str(" ", 5, 20);
2420 put_str(" ", 5, 20);
2424 /* Visual reminder of "more items" */
2425 if (st_ptr->stock_num > store_bottom)
2427 /* Show "more" reminder (after the last item) */
2429 prt("-続く-", k + 6, 3);
2431 prt("-more-", k + 6, 3);
2435 /* Indicate the "current page" */
2436 /* Trailing spaces are to display (Page xx) and (Page x) */
2438 put_str(format("(%dページ) ", store_top/store_bottom + 1), 5, 20);
2440 put_str(format("(Page %d) ", store_top/store_bottom + 1), 5, 20);
2445 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
2447 k = st_ptr->stock_size;
2449 if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
2451 put_str(format("アイテム数: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
2453 put_str(format("Objects: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
2460 * @brief プレイヤーの所持金を表示する /
2461 * Displays players gold -RAK-
2465 static void store_prt_gold(void)
2470 prt("手持ちのお金: ", 19 + xtra_stock, 53);
2472 prt("Gold Remaining: ", 19 + xtra_stock, 53);
2476 sprintf(out_val, "%9ld", (long)p_ptr->au);
2477 prt(out_val, 19 + xtra_stock, 68);
2481 * @brief 店舗情報全体を表示するメインルーチン /
2482 * Displays store (after clearing screen) -RAK-
2486 static void display_store(void)
2494 /* The "Home" is special */
2495 if (cur_store_num == STORE_HOME)
2497 /* Put the owner name */
2499 put_str("我が家", 3, 31);
2501 put_str("Your Home", 3, 30);
2505 /* Label the item descriptions */
2507 put_str("アイテムの一覧", 5, 4);
2509 put_str("Item Description", 5, 3);
2513 /* If showing weights, show label */
2517 put_str("重さ", 5, 72);
2519 put_str("Weight", 5, 70);
2525 /* The "Home" is special */
2526 else if (cur_store_num == STORE_MUSEUM)
2528 /* Put the owner name */
2530 put_str("博物館", 3, 31);
2532 put_str("Museum", 3, 30);
2536 /* Label the item descriptions */
2538 put_str("アイテムの一覧", 5, 4);
2540 put_str("Item Description", 5, 3);
2544 /* If showing weights, show label */
2548 put_str("重さ", 5, 72);
2550 put_str("Weight", 5, 70);
2559 cptr store_name = (f_name + f_info[cur_store_feat].name);
2560 cptr owner_name = (ot_ptr->owner_name);
2561 cptr race_name = race_info[ot_ptr->owner_race].title;
2563 /* Put the owner name and race */
2564 sprintf(buf, "%s (%s)", owner_name, race_name);
2565 put_str(buf, 3, 10);
2567 /* Show the max price in the store (above prices) */
2568 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
2571 /* Label the item descriptions */
2573 put_str("商品の一覧", 5, 7);
2575 put_str("Item Description", 5, 3);
2579 /* If showing weights, show label */
2583 put_str("重さ", 5, 62);
2585 put_str("Weight", 5, 60);
2590 /* Label the asking price (in stores) */
2592 put_str("価格", 5, 73);
2594 put_str("Price", 5, 72);
2599 /* Display the current gold */
2602 /* Draw in the inventory */
2603 display_inventory();
2609 * @brief 店舗からアイテムを選択する /
2610 * Get the ID of a store item and return its value -RAK-
2611 * @param com_val 選択IDを返す参照ポインタ
2612 * @param pmt メッセージキャプション
2615 * @return 実際に選択したらTRUE、キャンセルしたらFALSE
2617 static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
2623 #ifdef ALLOW_REPEAT /* TNB */
2625 /* Get the item index */
2626 if (repeat_pull(com_val))
2628 /* Verify the item */
2629 if ((*com_val >= i) && (*com_val <= j))
2636 #endif /* ALLOW_REPEAT -- TNB */
2638 /* Paranoia XXX XXX XXX */
2642 /* Assume failure */
2645 /* Build the prompt */
2647 hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
2649 (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s",
2650 (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"),
2653 (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s",
2658 /* Ask until done */
2664 if (!get_com(out_val, &command, FALSE)) break;
2667 if (islower(command))
2669 else if (isupper(command))
2670 k = A2I(tolower(command)) + 26;
2674 /* Legal responses */
2675 if ((k >= i) && (k <= j))
2685 /* Clear the prompt */
2689 if (command == ESCAPE) return (FALSE);
2691 #ifdef ALLOW_REPEAT /* TNB */
2693 repeat_push(*com_val);
2695 #endif /* ALLOW_REPEAT -- TNB */
2703 * @brief 店主の不満度を増やし、プレイヤーを締め出す判定と処理を行う /
2704 * Increase the insult counter and get angry if too many -RAK-
2705 * @return プレイヤーを締め出す場合TRUEを返す
2707 static int increase_insults(void)
2709 /* Increase insults */
2710 st_ptr->insult_cur++;
2712 /* Become insulted */
2713 if (st_ptr->insult_cur > ot_ptr->insult_max)
2719 st_ptr->insult_cur = 0;
2720 st_ptr->good_buy = 0;
2721 st_ptr->bad_buy = 0;
2724 st_ptr->store_open = turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
2736 * @brief 店主の不満度を減らす /
2737 * Decrease insults -RAK-
2738 * @return プレイヤーを締め出す場合TRUEを返す
2740 static void decrease_insults(void)
2742 /* Decrease insults */
2743 if (st_ptr->insult_cur) st_ptr->insult_cur--;
2748 * @brief 店主の不満度が増えた場合のみのメッセージを表示する /
2749 * Have insulted while haggling -RAK-
2750 * @return プレイヤーを締め出す場合TRUEを返す
2752 static int haggle_insults(void)
2754 /* Increase insults */
2755 if (increase_insults()) return (TRUE);
2757 /* Display and flush insult */
2766 * Mega-Hack -- Enable "increments"
2768 static bool allow_inc = FALSE;
2771 * Mega-Hack -- Last "increment" during haggling
2773 static s32b last_inc = 0L;
2777 * @brief 交渉価格を確認と認証の是非を行う /
2780 * @param poffer 別途価格提示をした場合の値を返す参照ポインタ
2781 * @param price 現在の交渉価格
2782 * @param final 最終確定価格ならばTRUE
2783 * @return プレイヤーを締め出す場合TRUEを返す
2785 static int get_haggle(cptr pmt, s32b *poffer, s32b price, int final)
2795 /* Clear old increment if necessary */
2796 if (!allow_inc) last_inc = 0L;
2803 sprintf(buf, "%s [承諾] ", pmt);
2805 sprintf(buf, "%s [accept] ", pmt);
2810 /* Old (negative) increment, and not final */
2811 else if (last_inc < 0)
2814 sprintf(buf, "%s [-$%ld] ", pmt, (long)(ABS(last_inc)));
2816 sprintf(buf, "%s [-%ld] ", pmt, (long)(ABS(last_inc)));
2821 /* Old (positive) increment, and not final */
2822 else if (last_inc > 0)
2825 sprintf(buf, "%s [+$%ld] ", pmt, (long)(ABS(last_inc)));
2827 sprintf(buf, "%s [+%ld] ", pmt, (long)(ABS(last_inc)));
2835 sprintf(buf, "%s ", pmt);
2839 /* Paranoia XXX XXX XXX */
2843 /* Ask until done */
2848 /* Display prompt */
2852 strcpy(out_val, "");
2855 * Ask the user for a response.
2856 * Don't allow to use numpad as cursor key.
2858 res = askfor_aux(out_val, 32, FALSE);
2864 if (!res) return FALSE;
2866 /* Skip leading spaces */
2867 for (p = out_val; *p == ' '; p++) /* loop */;
2869 /* Empty response */
2872 /* Accept current price */
2880 /* Use previous increment */
2881 if (allow_inc && last_inc)
2883 *poffer += last_inc;
2888 /* Normal response */
2891 /* Extract a number */
2894 /* Handle "incremental" number */
2895 if ((*p == '+' || *p == '-'))
2897 /* Allow increments */
2900 /* Use the given "increment" */
2907 /* Handle normal number */
2910 /* Use the given "number" */
2919 msg_print("値がおかしいです。");
2921 msg_print("Invalid response.");
2933 * @brief 店主がプレイヤーからの交渉価格を判断する /
2934 * Receive an offer (from the player)
2936 * @param poffer 店主からの交渉価格を返す参照ポインタ
2937 * @param last_offer 現在の交渉価格
2938 * @param factor 店主の価格基準倍率
2939 * @param price アイテムの実価値
2940 * @param final 最終価格確定ならばTRUE
2941 * @return プレイヤーの価格に対して不服ならばTRUEを返す /
2942 * Return TRUE if offer is NOT okay
2944 static bool receive_offer(cptr pmt, s32b *poffer,
2945 s32b last_offer, int factor,
2946 s32b price, int final)
2948 /* Haggle till done */
2951 /* Get a haggle (or cancel) */
2952 if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
2954 /* Acceptable offer */
2955 if (((*poffer) * factor) >= (last_offer * factor)) break;
2957 /* Insult, and check for kicked out */
2958 if (haggle_insults()) return (TRUE);
2960 /* Reject offer (correctly) */
2961 (*poffer) = last_offer;
2970 * @brief プレイヤーが購入する時の値切り処理メインルーチン /
2971 * Haggling routine -RAK-
2972 * @param o_ptr オブジェクトの構造体参照ポインタ
2973 * @param price 最終価格を返す参照ポインタ
2974 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
2975 * Return TRUE if purchase is NOT successful
2977 static bool purchase_haggle(object_type *o_ptr, s32b *price)
2979 s32b cur_ask, final_ask;
2980 s32b last_offer, offer;
2982 s32b min_per, max_per;
2983 int flag, loop_flag, noneed;
2984 int annoyed = 0, final = FALSE;
2986 bool cancel = FALSE;
2991 cptr pmt = "Asking";
3001 /* Extract the starting offer and the final offer */
3002 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
3003 final_ask = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3005 /* Determine if haggling is necessary */
3006 noneed = noneedtobargain(final_ask);
3008 /* No need to haggle */
3009 if (noneed || !manual_haggle)
3011 /* No need to haggle */
3014 /* Message summary */
3016 msg_print("結局この金額にまとまった。");
3018 msg_print("You eventually agree upon the price.");
3024 /* No haggle option */
3027 /* Message summary */
3029 msg_print("すんなりとこの金額にまとまった。");
3031 msg_print("You quickly agree upon the price.");
3036 /* Apply Sales Tax */
3037 final_ask += final_ask / 10;
3041 cur_ask = final_ask;
3043 /* Go to final offer */
3047 pmt = "Final Offer";
3054 /* Haggle for the whole pile */
3055 cur_ask *= o_ptr->number;
3056 final_ask *= o_ptr->number;
3059 /* Haggle parameters */
3060 min_per = ot_ptr->haggle_per;
3061 max_per = min_per * 3;
3063 /* Mega-Hack -- artificial "last offer" value */
3064 last_offer = object_value(o_ptr) * o_ptr->number;
3065 last_offer = last_offer * (200 - (int)(ot_ptr->max_inflate)) / 100L;
3066 if (last_offer <= 0) last_offer = 1;
3071 /* No incremental haggling yet */
3074 /* Haggle until done */
3075 for (flag = FALSE; !flag; )
3079 while (!flag && loop_flag)
3081 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3082 put_str(out_val, 1, 0);
3084 cancel = receive_offer("提示する金額? ",
3086 cancel = receive_offer("What do you offer? ",
3089 &offer, last_offer, 1, cur_ask, final);
3095 else if (offer > cur_ask)
3100 else if (offer == cur_ask)
3113 x1 = 100 * (offer - last_offer) / (cur_ask - last_offer);
3116 if (haggle_insults())
3122 else if (x1 > max_per)
3125 if (x1 < max_per) x1 = max_per;
3127 x2 = rand_range(x1-2, x1+2);
3128 x3 = ((cur_ask - offer) * x2 / 100L) + 1;
3129 /* don't let the price go up */
3134 if (cur_ask < final_ask)
3137 cur_ask = final_ask;
3141 pmt = "Final Offer";
3147 (void)(increase_insults());
3152 else if (offer >= cur_ask)
3164 (void)sprintf(out_val, "前回の提示金額: $%ld",
3166 (void)sprintf(out_val, "Your last offer: %ld",
3170 put_str(out_val, 1, 39);
3171 say_comment_2(cur_ask, annoyed);
3177 if (cancel) return (TRUE);
3179 /* Update bargaining info */
3180 updatebargain(*price, final_ask, o_ptr->number);
3188 * @brief プレイヤーが売却する時の値切り処理メインルーチン /
3189 * Haggling routine -RAK-
3190 * @param o_ptr オブジェクトの構造体参照ポインタ
3191 * @param price 最終価格を返す参照ポインタ
3192 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
3193 * Return TRUE if purchase is NOT successful
3195 static bool sell_haggle(object_type *o_ptr, s32b *price)
3197 s32b purse, cur_ask, final_ask;
3198 s32b last_offer = 0, offer = 0;
3200 s32b min_per, max_per;
3201 int flag, loop_flag, noneed;
3202 int annoyed = 0, final = FALSE;
3203 bool cancel = FALSE;
3216 /* Obtain the starting offer and the final offer */
3217 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
3218 final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
3220 /* Determine if haggling is necessary */
3221 noneed = noneedtobargain(final_ask);
3223 /* Get the owner's payout limit */
3224 purse = (s32b)(ot_ptr->max_cost);
3226 /* No need to haggle */
3227 if (noneed || !manual_haggle || (final_ask >= purse))
3229 /* Apply Sales Tax (if needed) */
3230 if (!manual_haggle && !noneed)
3232 final_ask -= final_ask / 10;
3235 /* No reason to haggle */
3236 if (final_ask >= purse)
3240 msg_print("即座にこの金額にまとまった。");
3242 msg_print("You instantly agree upon the price.");
3247 /* Offer full purse */
3251 /* No need to haggle */
3256 msg_print("結局この金額にまとまった。");
3258 msg_print("You eventually agree upon the price.");
3264 /* No haggle option */
3267 /* Message summary */
3269 msg_print("すんなりとこの金額にまとまった。");
3271 msg_print("You quickly agree upon the price.");
3278 cur_ask = final_ask;
3285 pmt = "Final Offer";
3290 /* Haggle for the whole pile */
3291 cur_ask *= o_ptr->number;
3292 final_ask *= o_ptr->number;
3295 /* XXX XXX XXX Display commands */
3297 /* Haggling parameters */
3298 min_per = ot_ptr->haggle_per;
3299 max_per = min_per * 3;
3301 /* Mega-Hack -- artificial "last offer" value */
3302 last_offer = object_value(o_ptr) * o_ptr->number;
3303 last_offer = last_offer * ot_ptr->max_inflate / 100L;
3308 /* No incremental haggling yet */
3312 for (flag = FALSE; !flag; )
3318 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3319 put_str(out_val, 1, 0);
3321 cancel = receive_offer("提示する価格? ",
3323 cancel = receive_offer("What price do you ask? ",
3326 &offer, last_offer, -1, cur_ask, final);
3332 else if (offer < cur_ask)
3335 /* rejected, reset offer for incremental haggling */
3338 else if (offer == cur_ask)
3349 if (flag || !loop_flag) break;
3354 x1 = 100 * (last_offer - offer) / (last_offer - cur_ask);
3357 if (haggle_insults())
3363 else if (x1 > max_per)
3366 if (x1 < max_per) x1 = max_per;
3368 x2 = rand_range(x1-2, x1+2);
3369 x3 = ((offer - cur_ask) * x2 / 100L) + 1;
3370 /* don't let the price go down */
3374 if (cur_ask > final_ask)
3376 cur_ask = final_ask;
3381 pmt = "Final Offer";
3389 /* 追加 $0 で買い取られてしまうのを防止 By FIRST*/
3392 (void)(increase_insults());
3395 else if (offer <= cur_ask)
3406 (void)sprintf(out_val,
3408 "前回の提示価格 $%ld", (long)last_offer);
3410 "Your last bid %ld", (long)last_offer);
3413 put_str(out_val, 1, 39);
3414 say_comment_3(cur_ask, annoyed);
3420 if (cancel) return (TRUE);
3422 /* Update bargaining info */
3423 updatebargain(*price, final_ask, o_ptr->number);
3431 * @brief 店からの購入処理のメインルーチン /
3432 * Buy an item from a store -RAK-
3435 static void store_purchase(void)
3438 COMMAND_CODE item, item_new;
3449 char o_name[MAX_NLEN];
3453 if (cur_store_num == STORE_MUSEUM)
3456 msg_print("博物館から取り出すことはできません。");
3458 msg_print("Museum.");
3464 if (st_ptr->stock_num <= 0)
3466 if (cur_store_num == STORE_HOME)
3468 msg_print("我が家には何も置いてありません。");
3470 msg_print("Your home is empty.");
3475 msg_print("現在商品の在庫を切らしています。");
3477 msg_print("I am currently out of stock.");
3484 /* Find the number of objects on this and following pages */
3485 i = (st_ptr->stock_num - store_top);
3487 /* And then restrict it to the current page */
3488 if (i > store_bottom) i = store_bottom;
3492 /* ブラックマーケットの時は別のメッセージ */
3493 switch( cur_store_num ) {
3495 sprintf(out_val, "どのアイテムを取りますか? ");
3498 sprintf(out_val, "どれ? ");
3501 sprintf(out_val, "どの品物が欲しいんだい? ");
3505 if (cur_store_num == STORE_HOME)
3507 sprintf(out_val, "Which item do you want to take? ");
3511 sprintf(out_val, "Which item are you interested in? ");
3516 /* Get the item number to be bought */
3517 if (!get_stock(&item, out_val, 0, i - 1)) return;
3519 /* Get the actual index */
3520 item = item + store_top;
3522 /* Get the actual item */
3523 o_ptr = &st_ptr->stock[item];
3525 /* Assume the player wants just one of them */
3528 /* Get local object */
3531 /* Get a copy of the object */
3532 object_copy(j_ptr, o_ptr);
3535 * If a rod or wand, allocate total maximum timeouts or charges
3536 * between those purchased and left on the shelf.
3538 reduce_charges(j_ptr, o_ptr->number - amt);
3540 /* Modify quantity */
3541 j_ptr->number = amt;
3543 /* Hack -- require room in pack */
3544 if (!inven_carry_okay(j_ptr))
3547 msg_print("そんなにアイテムを持てない。");
3549 msg_print("You cannot carry that many different items.");
3555 /* Determine the "best" price (per item) */
3556 best = price_item(j_ptr, ot_ptr->min_inflate, FALSE);
3558 /* Find out how many the player wants */
3559 if (o_ptr->number > 1)
3561 /* Hack -- note cost of "fixed" items */
3562 if ((cur_store_num != STORE_HOME) &&
3563 (o_ptr->ident & IDENT_FIXED))
3566 msg_format("一つにつき $%ldです。", (long)(best));
3568 msg_format("That costs %ld gold per item.", (long)(best));
3573 /* Get a quantity */
3574 amt = get_quantity(NULL, o_ptr->number);
3576 /* Allow user abort */
3577 if (amt <= 0) return;
3580 /* Get local object */
3583 /* Get desired object */
3584 object_copy(j_ptr, o_ptr);
3587 * If a rod or wand, allocate total maximum timeouts or charges
3588 * between those purchased and left on the shelf.
3590 reduce_charges(j_ptr, o_ptr->number - amt);
3592 /* Modify quantity */
3593 j_ptr->number = amt;
3595 /* Hack -- require room in pack */
3596 if (!inven_carry_okay(j_ptr))
3599 msg_print("ザックにそのアイテムを入れる隙間がない。");
3601 msg_print("You cannot carry that many items.");
3607 /* Attempt to buy it */
3608 if (cur_store_num != STORE_HOME)
3610 /* Fixed price, quick buy */
3611 if (o_ptr->ident & (IDENT_FIXED))
3616 /* Go directly to the "best" deal */
3617 price = (best * j_ptr->number);
3623 /* Describe the object (fully) */
3624 object_desc(o_name, j_ptr, 0);
3628 msg_format("%s(%c)を購入する。", o_name, I2A(item));
3630 msg_format("Buying %s (%c).", o_name, I2A(item));
3635 /* Haggle for a final price */
3636 choice = purchase_haggle(j_ptr, &price);
3638 /* Hack -- Got kicked out */
3639 if (st_ptr->store_open >= turn) return;
3642 /* Player wants it */
3645 /* Fix the item price (if "correctly" haggled) */
3646 if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
3648 /* Player can afford it */
3649 if (p_ptr->au >= price)
3654 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
3655 chg_virtue(V_JUSTICE, -1);
3656 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
3657 chg_virtue(V_NATURE, -1);
3665 /* Spend the money */
3668 /* Update the display */
3671 /* Hack -- buying an item makes you aware of it */
3672 object_aware(j_ptr);
3674 /* Hack -- clear the "fixed" flag from the item */
3675 j_ptr->ident &= ~(IDENT_FIXED);
3677 /* Describe the transaction */
3678 object_desc(o_name, j_ptr, 0);
3682 msg_format("%sを $%ldで購入しました。", o_name, (long)price);
3684 msg_format("You bought %s for %ld gold.", o_name, (long)price);
3687 strcpy(record_o_name, o_name);
3690 if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
3691 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3692 if(record_rand_art && o_ptr->art_name)
3693 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
3695 /* Erase the inscription */
3696 j_ptr->inscription = 0;
3698 /* Erase the "feeling" */
3699 j_ptr->feeling = FEEL_NONE;
3700 j_ptr->ident &= ~(IDENT_STORE);
3701 /* Give it to the player */
3702 item_new = inven_carry(j_ptr);
3704 /* Describe the final result */
3705 object_desc(o_name, &inventory[item_new], 0);
3709 msg_format("%s(%c)を手に入れた。", o_name, index_to_label(item_new));
3711 msg_format("You have %s (%c).",
3712 o_name, index_to_label(item_new));
3715 /* Auto-inscription */
3716 autopick_alter_item(item_new, FALSE);
3718 /* Now, reduce the original stack's pval. */
3719 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3721 o_ptr->pval -= j_ptr->pval;
3727 /* Note how many slots the store used to have */
3728 i = st_ptr->stock_num;
3730 /* Remove the bought items from the store */
3731 store_item_increase(item, -amt);
3732 store_item_optimize(item);
3734 /* Store is empty */
3735 if (st_ptr->stock_num == 0)
3738 if (one_in_(STORE_SHUFFLE))
3743 msg_print("店主は引退した。");
3745 msg_print("The shopkeeper retires.");
3749 /* Shuffle the store */
3750 store_shuffle(cur_store_num);
3753 sprintf(buf, "%s (%s)",
3754 ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
3755 put_str(buf, 3, 10);
3756 sprintf(buf, "%s (%ld)",
3757 (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
3766 msg_print("店主は新たな在庫を取り出した。");
3768 msg_print("The shopkeeper brings out some new stock.");
3774 for (i = 0; i < 10; i++)
3776 /* Maintain the store */
3777 store_maint(p_ptr->town_num, cur_store_num);
3783 /* Redraw everything */
3784 display_inventory();
3787 /* The item is gone */
3788 else if (st_ptr->stock_num != i)
3790 /* Pick the correct screen */
3791 if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3793 /* Redraw everything */
3794 display_inventory();
3797 /* Item is still here */
3800 /* Redraw the item */
3801 display_entry(item);
3805 /* Player cannot afford it */
3808 /* Simple message (no insult) */
3810 msg_print("お金が足りません。");
3812 msg_print("You do not have enough gold.");
3819 /* Home is much easier */
3822 bool combined_or_reordered;
3824 /* Distribute charges of wands/rods */
3825 distribute_charges(o_ptr, j_ptr, amt);
3827 /* Give it to the player */
3828 item_new = inven_carry(j_ptr);
3830 /* Describe just the result */
3831 object_desc(o_name, &inventory[item_new], 0);
3835 msg_format("%s(%c)を取った。",
3837 msg_format("You have %s (%c).",
3839 o_name, index_to_label(item_new));
3844 /* Take note if we take the last one */
3845 i = st_ptr->stock_num;
3847 /* Remove the items from the home */
3848 store_item_increase(item, -amt);
3849 store_item_optimize(item);
3851 combined_or_reordered = combine_and_reorder_home(STORE_HOME);
3853 /* Hack -- Item is still here */
3854 if (i == st_ptr->stock_num)
3856 /* Redraw everything */
3857 if (combined_or_reordered) display_inventory();
3859 /* Redraw the item */
3860 else display_entry(item);
3863 /* The item is gone */
3867 if (st_ptr->stock_num == 0) store_top = 0;
3869 /* Nothing left on that screen */
3870 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3872 /* Redraw everything */
3873 display_inventory();
3875 chg_virtue(V_SACRIFICE, 1);
3879 /* Not kicked out */
3885 * @brief 店からの売却処理のメインルーチン /
3886 * Sell an item to the store (or home)
3889 static void store_sell(void)
3896 s32b price, value, dummy;
3905 char o_name[MAX_NLEN];
3908 /* Prepare a prompt */
3909 if (cur_store_num == STORE_HOME)
3911 q = "どのアイテムを置きますか? ";
3913 q = "Drop which item? ";
3916 else if (cur_store_num == STORE_MUSEUM)
3918 q = "どのアイテムを寄贈しますか? ";
3920 q = "Give which item? ";
3925 q = "どのアイテムを売りますか? ";
3927 q = "Sell which item? ";
3931 item_tester_no_ryoute = TRUE;
3932 /* Only allow items the store will buy */
3933 item_tester_hook = store_will_buy;
3936 /* 我が家でおかしなメッセージが出るオリジナルのバグを修正 */
3937 if (cur_store_num == STORE_HOME)
3940 s = "置けるアイテムを持っていません。";
3942 s = "You don't have any item to drop.";
3945 else if (cur_store_num == STORE_MUSEUM)
3948 s = "寄贈できるアイテムを持っていません。";
3950 s = "You don't have any item to give.";
3958 s = "You have nothing that I want.";
3962 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
3964 /* Get the item (in the pack) */
3967 o_ptr = &inventory[item];
3970 /* Get the item (on the floor) */
3973 o_ptr = &o_list[0 - item];
3977 /* Hack -- Cannot remove cursed items */
3978 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
3982 msg_print("ふーむ、どうやらそれは呪われているようだね。");
3984 msg_print("Hmmm, it seems to be cursed.");
3993 /* Assume one item */
3996 /* Find out how many the player wants (letter means "all") */
3997 if (o_ptr->number > 1)
3999 /* Get a quantity */
4000 amt = get_quantity(NULL, o_ptr->number);
4002 /* Allow user abort */
4003 if (amt <= 0) return;
4006 /* Get local object */
4009 /* Get a copy of the object */
4010 object_copy(q_ptr, o_ptr);
4012 /* Modify quantity */
4013 q_ptr->number = amt;
4016 * Hack -- If a rod or wand, allocate total maximum
4017 * timeouts or charges to those being sold. -LM-
4019 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4021 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4024 /* Get a full description */
4025 object_desc(o_name, q_ptr, 0);
4027 /* Remove any inscription, feeling for stores */
4028 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4030 q_ptr->inscription = 0;
4031 q_ptr->feeling = FEEL_NONE;
4034 /* Is there room in the store (or the home?) */
4035 if (!store_check_num(q_ptr))
4037 if (cur_store_num == STORE_HOME)
4039 msg_print("我が家にはもう置く場所がない。");
4041 msg_print("Your home is full.");
4044 else if (cur_store_num == STORE_MUSEUM)
4046 msg_print("博物館はもう満杯だ。");
4048 msg_print("Museum is full.");
4053 msg_print("すいませんが、店にはもう置く場所がありません。");
4055 msg_print("I have not the room in my store to keep it.");
4063 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4065 /* Describe the transaction */
4067 msg_format("%s(%c)を売却する。", o_name, index_to_label(item));
4069 msg_format("Selling %s (%c).", o_name, index_to_label(item));
4075 choice = sell_haggle(q_ptr, &price);
4078 if (st_ptr->store_open >= turn) return;
4090 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
4091 chg_virtue(V_JUSTICE, -1);
4093 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
4094 chg_virtue(V_NATURE, 1);
4097 /* Get some money */
4100 /* Update the display */
4103 /* Get the "apparent" value */
4104 dummy = object_value(q_ptr) * q_ptr->number;
4107 identify_item(o_ptr);
4109 /* Get local object */
4112 /* Get a copy of the object */
4113 object_copy(q_ptr, o_ptr);
4115 /* Modify quantity */
4116 q_ptr->number = amt;
4118 /* Make it look like to be known */
4119 q_ptr->ident |= IDENT_STORE;
4122 * Hack -- If a rod or wand, let the shopkeeper know just
4123 * how many charges he really paid for. -LM-
4125 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4127 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4130 /* Get the "actual" value */
4131 value = object_value(q_ptr) * q_ptr->number;
4133 /* Get the description all over again */
4134 object_desc(o_name, q_ptr, 0);
4136 /* Describe the result (in message buffer) */
4138 msg_format("%sを $%ldで売却しました。", o_name, (long)price);
4140 msg_format("You sold %s for %ld gold.", o_name, (long)price);
4143 if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
4145 if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
4147 /* Analyze the prices (and comment verbally) unless a figurine*/
4148 purchase_analyze(price, value, dummy);
4152 * Hack -- Allocate charges between those wands or rods sold
4153 * and retained, unless all are being sold. -LM-
4155 distribute_charges(o_ptr, q_ptr, amt);
4157 /* Reset timeouts of the sold items */
4160 /* Take the item from the player, describe the result */
4161 inven_item_increase(item, -amt);
4162 inven_item_describe(item);
4164 /* If items remain, auto-inscribe before optimizing */
4165 if (o_ptr->number > 0)
4166 autopick_alter_item(item, FALSE);
4168 inven_item_optimize(item);
4173 /* The store gets that (known) item */
4174 item_pos = store_carry(q_ptr);
4176 /* Re-display if item is now in store */
4179 store_top = (item_pos / store_bottom) * store_bottom;
4180 display_inventory();
4185 /* Player is at museum */
4186 else if (cur_store_num == STORE_MUSEUM)
4188 char o2_name[MAX_NLEN];
4189 object_desc(o2_name, q_ptr, OD_NAME_ONLY);
4191 if (-1 == store_check_num(q_ptr))
4194 msg_print("それと同じ品物は既に博物館にあるようです。");
4196 msg_print("The same object as it is already in the Museum.");
4202 msg_print("博物館に寄贈したものは取り出すことができません!!");
4204 msg_print("You cannot take items which is given to the Museum back!!");
4208 if (!get_check(format("本当に%sを寄贈しますか?", o2_name))) return;
4210 if (!get_check(format("Really give %s to the Museum? ", o2_name))) return;
4214 identify_item(q_ptr);
4215 q_ptr->ident |= IDENT_MENTAL;
4217 /* Distribute charges of wands/rods */
4218 distribute_charges(o_ptr, q_ptr, amt);
4222 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4224 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4229 /* Take it from the players inventory */
4230 inven_item_increase(item, -amt);
4231 inven_item_describe(item);
4232 inven_item_optimize(item);
4237 /* Let the home carry it */
4238 item_pos = home_carry(q_ptr);
4240 /* Update store display */
4243 store_top = (item_pos / store_bottom) * store_bottom;
4244 display_inventory();
4247 /* Player is at home */
4250 /* Distribute charges of wands/rods */
4251 distribute_charges(o_ptr, q_ptr, amt);
4255 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4257 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4262 /* Take it from the players inventory */
4263 inven_item_increase(item, -amt);
4264 inven_item_describe(item);
4265 inven_item_optimize(item);
4270 /* Let the home carry it */
4271 item_pos = home_carry(q_ptr);
4273 /* Update store display */
4276 store_top = (item_pos / store_bottom) * store_bottom;
4277 display_inventory();
4281 if ((choice == 0) && (item >= INVEN_RARM))
4290 * @brief 店のアイテムを調べるコマンドのメインルーチン /
4291 * Examine an item in a store -JDL-
4294 static void store_examine(void)
4299 char o_name[MAX_NLEN];
4304 if (st_ptr->stock_num <= 0)
4306 if (cur_store_num == STORE_HOME)
4308 msg_print("我が家には何も置いてありません。");
4310 msg_print("Your home is empty.");
4313 else if (cur_store_num == STORE_MUSEUM)
4315 msg_print("博物館には何も置いてありません。");
4317 msg_print("Museum is empty.");
4322 msg_print("現在商品の在庫を切らしています。");
4324 msg_print("I am currently out of stock.");
4331 /* Find the number of objects on this and following pages */
4332 i = (st_ptr->stock_num - store_top);
4334 /* And then restrict it to the current page */
4335 if (i > store_bottom) i = store_bottom;
4339 sprintf(out_val, "どれを調べますか?");
4341 sprintf(out_val, "Which item do you want to examine? ");
4345 /* Get the item number to be examined */
4346 if (!get_stock(&item, out_val, 0, i - 1)) return;
4348 /* Get the actual index */
4349 item = item + store_top;
4351 /* Get the actual item */
4352 o_ptr = &st_ptr->stock[item];
4354 /* Require full knowledge */
4355 if (!(o_ptr->ident & IDENT_MENTAL))
4357 /* This can only happen in the home */
4359 msg_print("このアイテムについて特に知っていることはない。");
4361 msg_print("You have no special knowledge about that item.");
4368 object_desc(o_name, o_ptr, 0);
4372 msg_format("%sを調べている...", o_name);
4374 msg_format("Examining %s...", o_name);
4378 /* Describe it fully */
4379 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
4381 msg_print("特に変わったところはないようだ。");
4383 msg_print("You see nothing special.");
4392 * @brief 博物館のアイテムを除去するコマンドのメインルーチン /
4393 * Remove an item from museum (Originally from TOband)
4396 static void museum_remove_object(void)
4401 char o_name[MAX_NLEN];
4405 if (st_ptr->stock_num <= 0)
4408 msg_print("博物館には何も置いてありません。");
4410 msg_print("Museum is empty.");
4416 /* Find the number of objects on this and following pages */
4417 i = st_ptr->stock_num - store_top;
4419 /* And then restrict it to the current page */
4420 if (i > store_bottom) i = store_bottom;
4424 sprintf(out_val, "どのアイテムの展示をやめさせますか?");
4426 sprintf(out_val, "Which item do you want to order to remove? ");
4429 /* Get the item number to be removed */
4430 if (!get_stock(&item, out_val, 0, i - 1)) return;
4432 /* Get the actual index */
4433 item = item + store_top;
4435 /* Get the actual item */
4436 o_ptr = &st_ptr->stock[item];
4439 object_desc(o_name, o_ptr, 0);
4442 msg_print("展示をやめさせたアイテムは二度と見ることはできません!");
4443 if (!get_check(format("本当に%sの展示をやめさせますか?", o_name))) return;
4445 msg_print("You cannot see items which is removed from the Museum!");
4446 if (!get_check(format("Really order to remove %s from the Museum? ", o_name))) return;
4451 msg_format("%sの展示をやめさせた。", o_name);
4453 msg_format("You ordered to remove %s.", o_name);
4456 /* Remove the items from the home */
4457 store_item_increase(item, -o_ptr->number);
4458 store_item_optimize(item);
4460 (void)combine_and_reorder_home(STORE_MUSEUM);
4462 /* The item is gone */
4465 if (st_ptr->stock_num == 0) store_top = 0;
4467 /* Nothing left on that screen */
4468 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4470 /* Redraw everything */
4471 display_inventory();
4478 * Hack -- set this to leave the store
4480 static bool leave_store = FALSE;
4484 * @brief 店舗処理コマンド選択のメインルーチン /
4485 * Process a command in a store
4489 * Note that we must allow the use of a few "special" commands
4490 * in the stores which are not allowed in the dungeon, and we
4491 * must disable some commands which are allowed in the dungeon
4492 * but not in the stores, to prevent chaos.
4495 static void store_process_command(void)
4497 #ifdef ALLOW_REPEAT /* TNB */
4499 /* Handle repeating the last command */
4502 #endif /* ALLOW_REPEAT -- TNB */
4504 if (rogue_like_commands && command_cmd == 'l')
4506 command_cmd = 'x'; /* hack! */
4509 /* Parse the command */
4510 switch (command_cmd)
4520 /* 1 ページ戻るコマンド: 我が家のページ数が多いので重宝するはず By BUG */
4523 if (st_ptr->stock_num <= store_bottom) {
4525 msg_print("これで全部です。");
4527 msg_print("Entire inventory is shown.");
4531 store_top -= store_bottom;
4532 if ( store_top < 0 )
4533 store_top = ((st_ptr->stock_num - 1 )/store_bottom) * store_bottom;
4534 if ( (cur_store_num == STORE_HOME) && (powerup_home == FALSE) )
4535 if ( store_top >= store_bottom ) store_top = store_bottom;
4536 display_inventory();
4544 if (st_ptr->stock_num <= store_bottom)
4547 msg_print("これで全部です。");
4549 msg_print("Entire inventory is shown.");
4555 store_top += store_bottom;
4557 * 隠しオプション(powerup_home)がセットされていないときは
4558 * 我が家では 2 ページまでしか表示しない
4560 if ((cur_store_num == STORE_HOME) &&
4561 (powerup_home == FALSE) &&
4562 (st_ptr->stock_num >= STORE_INVEN_MAX))
4564 if (store_top >= (STORE_INVEN_MAX - 1))
4571 if (store_top >= st_ptr->stock_num) store_top = 0;
4574 display_inventory();
4587 /* Get (purchase) */
4614 /*** Inventory Commands ***/
4616 /* Wear/wield equipment */
4623 /* Take off equipment */
4630 /* Destroy an item */
4637 /* Equipment list */
4644 /* Inventory list */
4652 /*** Various commands ***/
4654 /* Identify an object */
4661 /* Hack -- toggle windows */
4664 toggle_inven_equip();
4670 /*** Use various objects ***/
4675 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4676 (p_ptr->pclass == CLASS_BERSERKER) ||
4677 (p_ptr->pclass == CLASS_NINJA) ||
4678 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4679 ) do_cmd_mind_browse();
4680 else if (p_ptr->pclass == CLASS_SMITH)
4682 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4683 do_cmd_magic_eater(TRUE, FALSE);
4684 else if (p_ptr->pclass == CLASS_SNIPER)
4685 do_cmd_snipe_browse();
4686 else do_cmd_browse();
4690 /* Inscribe an object */
4697 /* Uninscribe an object */
4700 do_cmd_uninscribe();
4706 /*** Help and Such ***/
4715 /* Identify symbol */
4718 do_cmd_query_symbol();
4722 /* Character description */
4725 p_ptr->town_num = old_town_num;
4726 do_cmd_change_name();
4727 p_ptr->town_num = inner_town_num;
4733 /*** System Commands ***/
4735 /* Hack -- User interface */
4742 /* Single line from a pref file */
4745 p_ptr->town_num = old_town_num;
4747 p_ptr->town_num = inner_town_num;
4751 /* Interact with macros */
4754 p_ptr->town_num = old_town_num;
4756 p_ptr->town_num = inner_town_num;
4760 /* Interact with visuals */
4763 p_ptr->town_num = old_town_num;
4765 p_ptr->town_num = inner_town_num;
4769 /* Interact with colors */
4772 p_ptr->town_num = old_town_num;
4774 p_ptr->town_num = inner_town_num;
4778 /* Interact with options */
4782 (void)combine_and_reorder_home(STORE_HOME);
4788 /*** Misc Commands ***/
4804 /* Repeat level feeling */
4811 /* Show previous message */
4814 do_cmd_message_one();
4818 /* Show previous messages */
4831 /* Check artifacts, uniques etc. */
4838 /* Load "screen dump" */
4841 do_cmd_load_screen();
4845 /* Save "screen dump" */
4848 do_cmd_save_screen();
4852 /* Hack -- Unknown command */
4855 if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
4857 museum_remove_object();
4862 msg_print("そのコマンドは店の中では使えません。");
4864 msg_print("That command does not work in stores.");
4875 * @brief 店舗処理全体のメインルーチン /
4876 * Enter a store, and interact with it. *
4880 * Note that we use the standard "request_command()" function
4881 * to get a command, allowing us to use "command_arg" and all
4882 * command macros and other nifty stuff, but we use the special
4883 * "shopping" argument, to force certain commands to be converted
4884 * into other commands, normally, we convert "p" (pray) and "m"
4885 * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
4888 void do_cmd_store(void)
4894 bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
4898 Term_get_size(&w, &h);
4900 /* Calculate stocks per 1 page */
4901 xtra_stock = MIN(14+26, ((h > 24) ? (h - 24) : 0));
4902 store_bottom = MIN_STOCK + xtra_stock;
4904 /* Access the player grid */
4905 c_ptr = &cave[p_ptr->y][p_ptr->x];
4907 /* Verify a store */
4908 if (!cave_have_flag_grid(c_ptr, FF_STORE))
4911 msg_print("ここには店がありません。");
4913 msg_print("You see no store here.");
4919 /* Extract the store code */
4920 which = f_info[c_ptr->feat].subtype;
4922 old_town_num = p_ptr->town_num;
4923 if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
4924 if (dun_level) p_ptr->town_num = NO_TOWN;
4925 inner_town_num = p_ptr->town_num;
4927 /* Hack -- Check the "locked doors" */
4928 if ((town[p_ptr->town_num].store[which].store_open >= turn) ||
4932 msg_print("ドアに鍵がかかっている。");
4934 msg_print("The doors are locked.");
4937 p_ptr->town_num = old_town_num;
4941 /* Calculate the number of store maintainances since the last visit */
4942 maintain_num = (turn - town[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
4944 /* Maintain the store max. 10 times */
4945 if (maintain_num > 10) maintain_num = 10;
4949 /* Maintain the store */
4950 for (i = 0; i < maintain_num; i++)
4951 store_maint(p_ptr->town_num, which);
4953 /* Save the visit */
4954 town[p_ptr->town_num].store[which].last_visit = turn;
4957 /* Forget the lite */
4960 /* Forget the view */
4964 /* Hack -- Character is in "icky" mode */
4965 character_icky = TRUE;
4968 /* No command argument */
4971 /* No repeated command */
4974 /* No automatic command */
4977 /* Do not expand macros */
4978 get_com_no_macros = TRUE;
4980 /* Save the store number */
4981 cur_store_num = which;
4983 /* Hack -- save the store feature */
4984 cur_store_feat = c_ptr->feat;
4986 /* Save the store and owner pointers */
4987 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
4988 ot_ptr = &owners[cur_store_num][st_ptr->owner];
4991 /* Start at the beginning */
4994 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4996 /* Display the store */
5000 leave_store = FALSE;
5002 /* Interact with player */
5003 while (!leave_store)
5005 /* Hack -- Clear line 1 */
5009 clear_from(20 + xtra_stock);
5012 /* Basic commands */
5014 prt(" ESC) 建物から出る", 21 + xtra_stock, 0);
5016 prt(" ESC) Exit from Building.", 21 + xtra_stock, 0);
5020 /* Browse if necessary */
5021 if (st_ptr->stock_num > store_bottom)
5024 prt(" -)前ページ", 22 + xtra_stock, 0);
5025 prt(" スペース) 次ページ", 23 + xtra_stock, 0);
5027 prt(" -) Previous page", 22 + xtra_stock, 0);
5028 prt(" SPACE) Next page", 23 + xtra_stock, 0);
5034 if (cur_store_num == STORE_HOME)
5037 prt("g) アイテムを取る", 21 + xtra_stock, 27);
5038 prt("d) アイテムを置く", 22 + xtra_stock, 27);
5039 prt("x) 家のアイテムを調べる", 23 + xtra_stock, 27);
5041 prt("g) Get an item.", 21 + xtra_stock, 27);
5042 prt("d) Drop an item.", 22 + xtra_stock, 27);
5043 prt("x) eXamine an item in the home.", 23 + xtra_stock, 27);
5047 /* Museum commands */
5048 else if (cur_store_num == STORE_MUSEUM)
5051 prt("d) アイテムを置く", 21 + xtra_stock, 27);
5052 prt("r) アイテムの展示をやめる", 22 + xtra_stock, 27);
5053 prt("x) 博物館のアイテムを調べる", 23 + xtra_stock, 27);
5055 prt("d) Drop an item.", 21 + xtra_stock, 27);
5056 prt("r) order to Remove an item.", 22 + xtra_stock, 27);
5057 prt("x) eXamine an item in the museum.", 23 + xtra_stock, 27);
5061 /* Shop commands XXX XXX XXX */
5065 prt("p) 商品を買う", 21 + xtra_stock, 30);
5066 prt("s) アイテムを売る", 22 + xtra_stock, 30);
5067 prt("x) 商品を調べる", 23 + xtra_stock,30);
5069 prt("p) Purchase an item.", 21 + xtra_stock, 30);
5070 prt("s) Sell an item.", 22 + xtra_stock, 30);
5071 prt("x) eXamine an item in the shop", 23 + xtra_stock,30);
5078 prt("i/e) 持ち物/装備の一覧", 21 + xtra_stock, 56);
5080 if (rogue_like_commands)
5082 prt("w/T) 装備する/はずす", 22 + xtra_stock, 56);
5086 prt("w/t) 装備する/はずす", 22 + xtra_stock, 56);
5089 prt("i/e) Inventry/Equipment list", 21 + xtra_stock, 56);
5091 if (rogue_like_commands)
5093 prt("w/T) Wear/Take off equipment", 22 + xtra_stock, 56);
5097 prt("w/t) Wear/Take off equipment", 22 + xtra_stock, 56);
5102 prt("コマンド:", 20 + xtra_stock, 0);
5104 prt("You may: ", 20 + xtra_stock, 0);
5109 request_command(TRUE);
5111 /* Process the command */
5112 store_process_command();
5115 * Hack -- To redraw missiles damage and prices in store
5116 * If player's charisma changes, or if player changes a bow, PU_BONUS is set
5118 need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
5120 /* Hack -- Character is still in "icky" mode */
5121 character_icky = TRUE;
5129 /* XXX XXX XXX Pack Overflow */
5130 if (inventory[INVEN_PACK].k_idx)
5132 int item = INVEN_PACK;
5134 object_type *o_ptr = &inventory[item];
5136 /* Hack -- Flee from the store */
5137 if (cur_store_num != STORE_HOME)
5141 if (cur_store_num == STORE_MUSEUM)
5142 msg_print("ザックからアイテムがあふれそうなので、あわてて博物館から出た...");
5144 msg_print("ザックからアイテムがあふれそうなので、あわてて店から出た...");
5146 if (cur_store_num == STORE_MUSEUM)
5147 msg_print("Your pack is so full that you flee the Museum...");
5149 msg_print("Your pack is so full that you flee the store...");
5157 /* Hack -- Flee from the home */
5158 else if (!store_check_num(o_ptr))
5162 msg_print("ザックからアイテムがあふれそうなので、あわてて家から出た...");
5164 msg_print("Your pack is so full that you flee your home...");
5172 /* Hack -- Drop items into the home */
5180 char o_name[MAX_NLEN];
5183 /* Give a message */
5185 msg_print("ザックからアイテムがあふれてしまった!");
5187 msg_print("Your pack overflows!");
5191 /* Get local object */
5194 /* Grab a copy of the item */
5195 object_copy(q_ptr, o_ptr);
5198 object_desc(o_name, q_ptr, 0);
5202 msg_format("%sが落ちた。(%c)", o_name, index_to_label(item));
5204 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5208 /* Remove it from the players inventory */
5209 inven_item_increase(item, -255);
5210 inven_item_describe(item);
5211 inven_item_optimize(item);
5216 /* Let the home carry it */
5217 item_pos = home_carry(q_ptr);
5219 /* Redraw the home */
5222 store_top = (item_pos / store_bottom) * store_bottom;
5223 display_inventory();
5228 /* Hack -- Redisplay store prices if charisma changes */
5229 /* Hack -- Redraw missiles damage if player changes bow */
5230 if (need_redraw_store_inv) display_inventory();
5232 /* Hack -- get kicked out of the store */
5233 if (st_ptr->store_open >= turn) leave_store = TRUE;
5236 select_floor_music();
5238 p_ptr->town_num = old_town_num;
5240 /* Free turn XXX XXX XXX */
5241 p_ptr->energy_use = 100;
5244 /* Hack -- Character is no longer in "icky" mode */
5245 character_icky = FALSE;
5248 /* Hack -- Cancel automatic command */
5251 /* Hack -- Cancel "see" mode */
5252 command_see = FALSE;
5254 /* Allow expanding macros */
5255 get_com_no_macros = FALSE;
5257 /* Flush messages XXX XXX XXX */
5261 /* Clear the screen */
5265 /* Update everything */
5266 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
5267 p_ptr->update |= (PU_MONSTERS);
5269 /* Redraw entire screen */
5270 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5273 p_ptr->redraw |= (PR_MAP);
5276 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5282 * @brief 現在の町の店主を交代させる /
5283 * Shuffle one of the stores.
5284 * @param which 店舗種類のID
5287 void store_shuffle(int which)
5293 if (which == STORE_HOME) return;
5294 if (which == STORE_MUSEUM) return;
5297 /* Save the store index */
5298 cur_store_num = which;
5300 /* Activate that store */
5301 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
5304 /* Pick a new owner */
5307 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5308 if (j == st_ptr->owner) continue;
5309 for (i = 1;i < max_towns; i++)
5311 if (i == p_ptr->town_num) continue;
5312 if (st_ptr->owner == town[i].store[cur_store_num].owner) break;
5314 if (i == max_towns) break;
5317 /* Activate the new owner */
5318 ot_ptr = &owners[cur_store_num][st_ptr->owner];
5321 /* Reset the owner data */
5322 st_ptr->insult_cur = 0;
5323 st_ptr->store_open = 0;
5324 st_ptr->good_buy = 0;
5325 st_ptr->bad_buy = 0;
5328 /* Hack -- discount all the items */
5329 for (i = 0; i < st_ptr->stock_num; i++)
5334 o_ptr = &st_ptr->stock[i];
5336 if (!object_is_artifact(o_ptr))
5338 /* Hack -- Sell all non-artifact old items for "half price" */
5339 o_ptr->discount = 50;
5341 /* Hack -- Items are no longer "fixed price" */
5342 o_ptr->ident &= ~(IDENT_FIXED);
5344 /* Mega-Hack -- Note that the item is "on sale" */
5346 o_ptr->inscription = quark_add("売出中");
5348 o_ptr->inscription = quark_add("on sale");
5356 * @brief 店の品揃えを変化させる /
5357 * Maintain the inventory at the stores.
5358 * @param town_num 町のID
5359 * @param store_num 店舗種類のID
5362 void store_maint(int town_num, int store_num)
5366 cur_store_num = store_num;
5369 if (store_num == STORE_HOME) return;
5370 if (store_num == STORE_MUSEUM) return;
5372 /* Activate that store */
5373 st_ptr = &town[town_num].store[store_num];
5375 /* Activate the owner */
5376 ot_ptr = &owners[store_num][st_ptr->owner];
5378 /* Store keeper forgives the player */
5379 st_ptr->insult_cur = 0;
5381 /* Mega-Hack -- prune the black market */
5382 if (store_num == STORE_BLACK)
5384 /* Destroy crappy black market items */
5385 for (j = st_ptr->stock_num - 1; j >= 0; j--)
5387 object_type *o_ptr = &st_ptr->stock[j];
5389 /* Destroy crappy items */
5390 if (black_market_crap(o_ptr))
5392 /* Destroy the item */
5393 store_item_increase(j, 0 - o_ptr->number);
5394 store_item_optimize(j);
5400 /* Choose the number of slots to keep */
5401 j = st_ptr->stock_num;
5403 /* Sell a few items */
5404 j = j - randint1(STORE_TURNOVER);
5406 /* Never keep more than "STORE_MAX_KEEP" slots */
5407 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5409 /* Always "keep" at least "STORE_MIN_KEEP" items */
5410 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5412 /* Hack -- prevent "underflow" */
5415 /* Destroy objects until only "j" slots are left */
5416 while (st_ptr->stock_num > j) store_delete();
5419 /* Choose the number of slots to fill */
5420 j = st_ptr->stock_num;
5422 /* Buy some more items */
5423 j = j + randint1(STORE_TURNOVER);
5425 /* Never keep more than "STORE_MAX_KEEP" slots */
5426 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5428 /* Always "keep" at least "STORE_MIN_KEEP" items */
5429 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5431 /* Hack -- prevent "overflow" */
5432 if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1;
5434 /* Acquire some new items */
5435 while (st_ptr->stock_num < j) store_create();
5440 * @brief 店舗情報を初期化する /
5441 * Initialize the stores
5442 * @param town_num 町のID
5443 * @param store_num 店舗種類のID
5446 void store_init(int town_num, int store_num)
5450 cur_store_num = store_num;
5452 /* Activate that store */
5453 st_ptr = &town[town_num].store[store_num];
5461 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5462 for (i = 1;i < max_towns; i++)
5464 if (i == town_num) continue;
5465 if (st_ptr->owner == town[i].store[store_num].owner) break;
5467 if (i == max_towns) break;
5470 /* Activate the new owner */
5471 ot_ptr = &owners[store_num][st_ptr->owner];
5474 /* Initialize the store */
5475 st_ptr->store_open = 0;
5476 st_ptr->insult_cur = 0;
5477 st_ptr->good_buy = 0;
5478 st_ptr->bad_buy = 0;
5480 /* Nothing in stock */
5481 st_ptr->stock_num = 0;
5484 * MEGA-HACK - Last visit to store is
5485 * BEFORE player birth to enable store restocking
5487 st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5489 /* Clear any old items */
5490 for (k = 0; k < st_ptr->stock_size; k++)
5492 object_wipe(&st_ptr->stock[k]);
5498 * @brief アイテムを町のブラックマーケットに移動させる /
5499 * @param o_ptr 移動させたいオブジェクトの構造体参照ポインタ
5502 void move_to_black_market(object_type *o_ptr)
5505 if (!p_ptr->town_num) return;
5507 st_ptr = &town[p_ptr->town_num].store[STORE_BLACK];
5509 o_ptr->ident |= IDENT_STORE;
5511 (void)store_carry(o_ptr);
5513 object_wipe(o_ptr); /* Don't leave a bogus object behind... */