3 * @brief 店の処理 / Store commands
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 * This software may be copied and distributed for educational, research, and\n
8 * not for profit purposes provided that this copyright and statement are\n
9 * included in all such copies.\n
10 * 2014 Deskull rearranged comment for Doxygen.
17 static int cur_store_num = 0;
18 static int store_top = 0;
19 static int store_bottom = 0;
20 static int xtra_stock = 0;
21 static store_type *st_ptr = NULL;
22 static const owner_type *ot_ptr = NULL;
23 static s16b old_town_num = 0;
24 static s16b inner_town_num = 0;
25 #define RUMOR_CHANCE 8
27 #define MAX_COMMENT_1 6
29 static cptr comment_1[MAX_COMMENT_1] =
50 /*! ブラックマーケット追加メッセージ(承諾) */
51 static cptr comment_1_B[MAX_COMMENT_1] = {
60 #define MAX_COMMENT_2A 2
62 static cptr comment_2a[MAX_COMMENT_2A] =
65 "私の忍耐力を試しているのかい? $%s が最後だ。",
66 "我慢にも限度があるぞ。 $%s が最後だ。"
68 "You try my patience. %s is final.",
69 "My patience grows thin. %s is final."
74 #define MAX_COMMENT_2B 12
76 static cptr comment_2b[MAX_COMMENT_2B] =
79 " $%s ぐらいは出さなきゃダメだよ。",
82 "何て奴だ! $%s 以下はあり得ないぞ。",
83 "それじゃ少なすぎる! $%s は欲しいところだ。",
84 "バカにしている! $%s はもらわないと。",
86 "おいおい! $%s を考えてくれないか?",
87 "1000匹のオークのノミに苦しめられるがいい! $%s だ。",
88 "お前の大切なものに災いあれ! $%s でどうだ。",
89 "モルゴスに賞味されるがいい!本当は $%s なんだろう?",
90 "お前の母親はオーガか! $%s は出すつもりなんだろ?"
92 "I can take no less than %s gold pieces.",
93 "I will accept no less than %s gold pieces.",
94 "Ha! No less than %s gold pieces.",
95 "You knave! No less than %s gold pieces.",
96 "That's a pittance! I want %s gold pieces.",
97 "That's an insult! I want %s gold pieces.",
98 "As if! How about %s gold pieces?",
99 "My arse! How about %s gold pieces?",
100 "May the fleas of 1000 orcs molest you! Try %s gold pieces.",
101 "May your most favourite parts go moldy! Try %s gold pieces.",
102 "May Morgoth find you tasty! Perhaps %s gold pieces?",
103 "Your mother was an Ogre! Perhaps %s gold pieces?"
109 /*! ブラックマーケット用追加メッセージ(売るとき) */
110 static cptr comment_2b_B[MAX_COMMENT_2B] = {
111 "いくら俺様がお人好しとはいえ $%s が限界だね。嫌なら帰りな。",
112 "金がないのかい、あんた?まずは家に帰って $%s 揃えてきな。",
113 "物の価値が分からん奴だな。これは $%s が普通なんだよ。",
114 "俺の付けた値段に文句があるのか? $%s が限界だ。",
115 "ひょっとして新手の冗談かい? $%s 持ってないなら帰りな。",
116 "うちは他の店とは違うんだよ。$%s ぐらいは出しな。",
117 "買う気がないなら帰りな。 $%s だと言っているんだ。",
118 "話にならないね。 $%s くらい持っているんだろ?",
119 "は?なんだそりゃ? $%s の間違いか、ひょっとして?",
120 "出口はあっちだよ。それとも $%s 出せるのかい、あんたに。",
121 "命知らずな奴だな。 $%s 出せば今日の所は勘弁してやるよ。",
122 "うちの店は貧乏人お断りだ。 $%s ぐらい出せないのかい?"
125 #define MAX_COMMENT_3A 2
127 static cptr comment_3a[MAX_COMMENT_3A] =
130 "私の忍耐力を試しているのかい? $%s が最後だ。",
131 "我慢にも限度があるぞ。 $%s が最後だ。"
133 "You try my patience. %s is final.",
134 "My patience grows thin. %s is final."
140 #define MAX_COMMENT_3B 12
142 static cptr comment_3b[MAX_COMMENT_3B] =
145 "本音を言うと $%s でいいんだろ?",
147 " $%s ぐらいなら出してもいいが。",
148 " $%s 以上払うなんて考えられないね。",
149 "まあ落ちついて。 $%s でどうだい?",
150 "そのガラクタなら $%s で引き取るよ。",
151 "それじゃ高すぎる! $%s がいいとこだろ。",
152 "どうせいらないんだろ! $%s でいいだろ?",
153 "だめだめ! $%s がずっとお似合いだよ。",
154 "バカにしている! $%s がせいぜいだ。",
155 " $%s なら嬉しいところだがなあ。",
156 " $%s 、それ以上はビタ一文出さないよ!"
158 "Perhaps %s gold pieces?",
159 "How about %s gold pieces?",
160 "I will pay no more than %s gold pieces.",
161 "I can afford no more than %s gold pieces.",
162 "Be reasonable. How about %s gold pieces?",
163 "I'll buy it as scrap for %s gold pieces.",
164 "That is too much! How about %s gold pieces?",
165 "That looks war surplus! Say %s gold pieces?",
166 "Never! %s is more like it.",
167 "That's an insult! %s is more like it.",
168 "%s gold pieces and be thankful for it!",
169 "%s gold pieces and not a copper more!"
175 /*! ブラックマーケット用追加メッセージ(買い取り) */
176 static cptr comment_3b_B[MAX_COMMENT_3B] = {
177 " $%s ってところだね。そのどうしようもないガラクタは。",
178 "この俺が $%s って言っているんだから、その通りにした方が身のためだぞ。",
179 "俺の優しさに甘えるのもいい加減にしておけ。 $%s だ。",
180 "その品なら $%s で売ってくれているがね、常識ある紳士はみんな。",
181 "こりゃまた、がめつい奴だな。いくら俺が温厚とはいえ $%s が限界だ。",
182 " $%s だ。別に俺はそんなガラクタ欲しくはないんだから。",
183 "俺の鑑定額が気に入らないのか? $%s 、嫌なら帰りな。",
184 " $%s で引き取ってやるよ。喜んで受け取りな、貧乏人。",
185 "物の価値が分からん奴は始末におえんな。それは $%s なんだよ。",
186 "そんなに金が欲しいのか、あんた? $%s で満足できんのか?",
187 "入る店間違えてんじゃないのか? $%s で嫌なら他をあたってくれ。",
188 "俺の言い値にケチをつける奴がいるとは! その度胸に免じて $%s だ。"
191 #define MAX_COMMENT_4A 4
193 static cptr comment_4a[MAX_COMMENT_4A] =
196 "もうたくさんだ!何度も私をわずらわせないでくれ!",
197 "うがー!一日の我慢の限度を超えている!",
198 "もういい!時間の無駄以外のなにものでもない!",
199 "もうやってられないよ!顔も見たくない!"
201 "Enough! You have abused me once too often!",
202 "Arghhh! I have had enough abuse for one day!",
203 "That does it! You shall waste my time no more!",
204 "This is getting nowhere! I'm going to Londis!"
210 /*! ブラックマーケット用追加メッセージ(怒りの頂点) */
211 static cptr comment_4a_B[MAX_COMMENT_4A] = {
212 "なめやがって!温厚な俺様でも限界があるってことを知れ!",
213 "俺をここまで怒らせて...命があるだけでもありがたいと思え!",
214 "ふざけてるのか!冷やかしなら相手を見てからにしろ!",
215 "いいかげんにしろ!今度こんなまねしたらただじゃおかねえぞ!"
218 #define MAX_COMMENT_4B 4
220 static cptr comment_4b[MAX_COMMENT_4B] =
229 "Get out of my sight!",
230 "Begone, you scoundrel!",
237 /*! ブラックマーケット用追加メッセージ(追い出し) */
238 static cptr comment_4b_B[MAX_COMMENT_4B] = {
245 #define MAX_COMMENT_5 8
247 static cptr comment_5[MAX_COMMENT_5] =
261 "You will have to do better than that!",
262 "Do you wish to do business or not?",
263 "You've got to be kidding!",
264 "You'd better be kidding!",
265 "You try my patience.",
266 "Hmmm, nice weather we're having."
272 /*! ブラックマーケット用追加メッセージ(怒り) */
273 static cptr comment_5_B[MAX_COMMENT_5] = {
284 #define MAX_COMMENT_6 4
286 static cptr comment_6[MAX_COMMENT_6] =
294 "I must have heard you wrong.",
295 "I'm sorry, I missed that.",
296 "I'm sorry, what was that?",
297 "Sorry, what was that again?"
305 * @brief 取引成功時の店主のメッセージ処理 /
309 static void say_comment_1(void)
312 /* ブラックマーケットのときは別のメッセージを出す */
313 if ( cur_store_num == STORE_BLACK ) {
314 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
317 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
320 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
324 if (one_in_(RUMOR_CHANCE))
327 msg_print("店主は耳うちした:");
329 msg_print("The shopkeeper whispers something into your ear:");
337 * @brief プレイヤーがアイテムを買う時の価格代案メッセージ処理 /
338 * Continue haggling (player is buying)
339 * @param value 店主の提示価格
340 * @param annoyed 店主のいらつき度
343 static void say_comment_2(s32b value, int annoyed)
347 /* Prepare a string to insert */
348 sprintf(tmp_val, "%ld", (long)value);
353 /* Formatted message */
354 msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
360 /* Formatted message */
362 /* ブラックマーケットの時は別のメッセージを出す */
363 if ( cur_store_num == STORE_BLACK ){
364 msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
367 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
370 msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
378 * @brief プレイヤーがアイテムを売る時の価格代案メッセージ処理 /
379 * Continue haggling (player is selling)
380 * @param value 店主の提示価格
381 * @param annoyed 店主のいらつき度
384 static void say_comment_3(s32b value, int annoyed)
388 /* Prepare a string to insert */
389 sprintf(tmp_val, "%ld", (long)value);
394 /* Formatted message */
395 msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
401 /* Formatted message */
403 /* ブラックマーケットの時は別のメッセージを出す */
404 if ( cur_store_num == STORE_BLACK ){
405 msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
408 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
411 msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
419 * @brief 店主がプレイヤーを追い出す時のメッセージ処理 /
420 * Kick 'da bum out. -RAK-
423 static void say_comment_4(void)
426 /* ブラックマーケットの時は別のメッセージを出す */
427 if ( cur_store_num == STORE_BLACK ){
428 msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
429 msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
432 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
433 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
436 msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
437 msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
444 * @brief 店主がプレイヤーに取り合わない時のメッセージ処理 /
445 * You are insulting me
448 static void say_comment_5(void)
451 /* ブラックマーケットの時は別のメッセージを出す */
452 if ( cur_store_num == STORE_BLACK ){
453 msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
456 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
459 msg_print(comment_5[randint0(MAX_COMMENT_5)]);
466 * @brief 店主がプレイヤーの提示を理解できなかった時のメッセージ処理 /
467 * That makes no sense.
470 static void say_comment_6(void)
472 msg_print(comment_6[randint0(MAX_COMMENT_6)]);
476 #define MAX_COMMENT_7A 4
478 static cptr comment_7a[MAX_COMMENT_7A] =
483 "誰かがむせび泣く声が聞こえる...。",
488 "You hear someone sobbing...",
489 "The shopkeeper howls in agony!"
494 #define MAX_COMMENT_7B 4
496 static cptr comment_7b[MAX_COMMENT_7B] =
506 "The shopkeeper curses at you.",
507 "The shopkeeper glares at you."
512 #define MAX_COMMENT_7C 4
514 static cptr comment_7c[MAX_COMMENT_7C] =
523 "You've made my day!",
524 "The shopkeeper giggles.",
525 "The shopkeeper laughs loudly."
530 #define MAX_COMMENT_7D 4
532 static cptr comment_7d[MAX_COMMENT_7D] =
536 "こんなおいしい思いをしたら、真面目に働けなくなるなぁ。",
541 "I think I'll retire!",
542 "The shopkeeper jumps for joy.",
543 "The shopkeeper smiles gleefully."
550 * @brief 店主が交渉を終えた際の反応を返す処理 /
551 * Let a shop-keeper React to a purchase
552 * @param price アイテムの取引額
553 * @param value アイテムの実際価値
554 * @param guess 店主が当初予想していた価値
557 * We paid "price", it was worth "value", and we thought it was worth "guess"
559 static void purchase_analyze(s32b price, s32b value, s32b guess)
561 /* Item was worthless, but we bought it */
562 if ((value <= 0) && (price > value))
565 msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
567 chg_virtue(V_HONOUR, -1);
568 chg_virtue(V_JUSTICE, -1);
574 /* Item was cheaper than we thought, and we paid more than necessary */
575 else if ((value < guess) && (price > value))
578 msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
580 chg_virtue(V_JUSTICE, -1);
582 chg_virtue(V_HONOUR, -1);
588 /* Item was a good bargain, and we got away with it */
589 else if ((value > guess) && (value < (4 * guess)) && (price < value))
592 msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
595 chg_virtue(V_HONOUR, -1);
597 chg_virtue(V_HONOUR, 1);
603 /* Item was a great bargain, and we got away with it */
604 else if ((value > guess) && (price < value))
607 msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
610 chg_virtue(V_HONOUR, -1);
612 chg_virtue(V_HONOUR, 1);
614 if (10 * price < value)
615 chg_virtue(V_SACRIFICE, 1);
625 * We store the current "store feat" here so everyone can access it
627 static int cur_store_feat;
631 * Buying and selling adjustments for race combinations.
632 * Entry[owner][player] gives the basic "cost inflation".
634 static byte rgold_adj[MAX_RACES][MAX_RACES] =
636 /*Hum, HfE, Elf, Hal, Gno, Dwa, HfO, HfT, Dun, HiE, Barbarian,
637 HfOg, HGn, HTn, Cyc, Yek, Klc, Kbd, Nbl, DkE, Drc, Mind Flayer,
638 Imp, Glm, Skl, Zombie, Vampire, Spectre, Fairy, Beastman, Ent,
639 Angel, Demon, Kutar */
642 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
643 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
644 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
645 100, 120, 110, 105 },
648 { 110, 100, 100, 105, 110, 120, 125, 130, 110, 100, 110,
649 120, 115, 108, 115, 110, 110, 120, 120, 115, 115, 110,
650 120, 110, 110, 110, 120, 110, 100, 125, 100, 95, 140,
651 110, 115, 110, 110 },
654 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
655 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
656 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
657 110, 110, 105, 110 },
660 { 115, 110, 105, 95, 105, 110, 115, 130, 115, 105, 115,
661 125, 120, 120, 125, 115, 110, 120, 120, 120, 115, 115,
662 120, 110, 120, 120, 130, 110, 110, 130, 110, 95, 140,
663 115, 120, 105, 115 },
666 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
667 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
668 120, 101, 110, 110, 120, 120, 115, 130, 115, 95, 140,
669 115, 110, 110, 115 },
672 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
673 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
674 120, 105, 115, 115, 115, 115, 120, 130, 120, 95, 140,
675 115, 110, 115, 115 },
678 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
679 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
680 115, 125, 120, 120, 115, 120, 125, 115, 125, 95, 140,
681 115, 110, 115, 115 },
684 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
685 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
686 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
687 110, 110, 115, 110 },
690 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
691 120, 120, 105, 120, 115, 105, 115, 120, 110, 105, 105,
692 120, 105, 120, 120, 125, 120, 105, 135, 105, 95, 140,
693 100, 110, 110, 100 },
696 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
697 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
698 125, 115, 120, 120, 125, 120, 100, 125, 100, 95, 140,
699 110, 110, 105, 110 },
701 /* Human / Barbarian (copied from human) */
702 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
703 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
704 115, 105, 125, 125, 130, 125, 115, 120, 115, 95, 140,
705 100, 120, 110, 100 },
707 /* Half-Ogre: theoretical, copied from half-troll */
708 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
709 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
710 110, 115, 112, 112, 115, 112, 120, 110, 120, 95, 140,
711 110, 110, 115, 110 },
713 /* Half-Giant: theoretical, copied from half-troll */
714 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
715 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
716 110, 115, 112, 112, 115, 112, 130, 120, 130, 95, 140,
717 110, 110, 115, 110 },
719 /* Half-Titan: theoretical, copied from High_Elf */
720 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
721 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
722 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
723 110, 110, 115, 110 },
725 /* Cyclops: theoretical, copied from half-troll */
726 { 110, 115, 115, 110, 110, 130, 110, 110, 110, 115, 110,
727 110, 115, 120, 110, 120, 120, 110, 110, 110, 115, 110,
728 110, 115, 112, 112, 115, 112, 130, 130, 130, 95, 140,
729 110, 110, 115, 110 },
731 /* Yeek: theoretical, copied from Half-Orc */
732 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
733 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
734 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
735 115, 110, 115, 115 },
737 /* Klackon: theoretical, copied from Gnome */
738 { 115, 115, 110, 105, 95, 110, 115, 130, 115, 110, 115,
739 120, 125, 110, 120, 110, 105, 120, 110, 110, 105, 110,
740 120, 101, 110, 110, 120, 120, 130, 130, 130, 95, 140,
741 115, 110, 115, 115 },
743 /* Kobold: theoretical, copied from Half-Orc */
744 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
745 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
746 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
747 115, 110, 115, 115 },
749 /* Nibelung: theoretical, copied from Dwarf */
750 { 115, 120, 120, 110, 110, 95, 125, 135, 115, 120, 115,
751 125, 140, 130, 130, 120, 115, 115, 115, 135, 125, 120,
752 120, 105, 115, 115, 120, 120, 130, 130, 130, 95, 140,
753 115, 135, 115, 115 },
756 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
757 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
758 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
759 110, 101, 115, 110 },
761 /* Draconian: theoretical, copied from High_Elf */
762 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
763 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
764 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
765 110, 110, 115, 110 },
767 /* Mind Flayer: theoretical, copied from High_Elf */
768 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
769 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
770 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
771 110, 110, 115, 110 },
773 /* Imp: theoretical, copied from High_Elf */
774 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
775 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
776 125, 115, 120, 120, 120, 120, 130, 130, 130, 120, 120,
777 110, 110, 115, 110 },
779 /* Golem: theoretical, copied from High_Elf */
780 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
781 125, 125, 101, 120, 115, 110, 115, 125, 110, 110, 110,
782 125, 115, 120, 120, 120, 120, 130, 130, 130, 95, 140,
783 110, 110, 115, 110 },
785 /* Skeleton: theoretical, copied from half-orc */
786 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
787 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
788 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
789 115, 110, 125, 115 },
791 /* Zombie: Theoretical, copied from half-orc */
792 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
793 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
794 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
795 115, 110, 125, 115 },
797 /* Vampire: Theoretical, copied from half-orc */
798 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
799 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
800 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
801 115, 110, 125, 115 },
803 /* Spectre: Theoretical, copied from half-orc */
804 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
805 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
806 115, 125, 120, 120, 120, 120, 130, 130, 130, 120, 120,
807 115, 110, 125, 115 },
809 /* Sprite: Theoretical, copied from half-orc */
810 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
811 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
812 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
813 115, 110, 105, 115 },
815 /* Beastman: Theoretical, copied from half-orc */
816 { 115, 120, 125, 115, 115, 130, 110, 115, 115, 125, 115,
817 110, 110, 120, 110, 120, 125, 115, 115, 110, 120, 110,
818 115, 125, 120, 120, 120, 120, 130, 130, 130, 95, 140,
819 115, 110, 115, 115 },
822 { 110, 105, 100, 105, 110, 120, 125, 130, 110, 100, 110,
823 120, 120, 105, 120, 110, 105, 125, 125, 110, 115, 108,
824 120, 115, 110, 110, 120, 110, 100, 125, 100, 95, 140,
825 110, 110, 105, 110 },
828 { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
829 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
830 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 160,
834 { 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
835 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
836 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 120,
837 140, 140, 140, 140 },
840 { 100, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
841 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
842 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
843 100, 120, 110, 100 },
846 { 110, 110, 110, 115, 120, 130, 115, 115, 120, 110, 115,
847 115, 115, 116, 115, 120, 120, 115, 115, 101, 110, 110,
848 110, 110, 112, 122, 110, 110, 110, 115, 110, 120, 120,
849 110, 101, 115, 110 },
852 { 110, 110, 105, 105, 110, 115, 115, 115, 110, 105, 110,
853 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
854 115, 115, 125, 125, 125, 125, 105, 115, 105, 95, 140,
855 110, 115, 100, 110 },
858 { 105, 105, 105, 110, 113, 115, 120, 125, 100, 105, 100,
859 124, 120, 110, 125, 115, 120, 120, 120, 120, 115, 120,
860 115, 105, 125, 125, 125, 125, 105, 120, 105, 95, 140,
861 100, 120, 110, 100 },
868 * Determine the price of an item (qty one) in a store.
869 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
870 * @param greed 店主の強欲度
871 * @param flip TRUEならば店主にとっての買取価格、FALSEなら売出価格を計算
875 * This function takes into account the player's charisma, and the
876 * shop-keepers friendliness, and the shop-keeper's base greed, but
877 * never lets a shop-keeper lose money in a transaction.
878 * The "greed" value should exceed 100 when the player is "buying" the
879 * item, and should be less than 100 when the player is "selling" it.
880 * Hack -- the black market always charges twice as much as it should.
881 * Charisma adjustment runs from 80 to 130
882 * Racial adjustment runs from 95 to 130
883 * Since greed/charisma/racial adjustments are centered at 100, we need
884 * to adjust (by 200) to extract a usable multiplier. Note that the
885 * "greed" value is always something (?).
888 static s32b price_item(object_type *o_ptr, int greed, bool flip)
895 /* Get the value of one of the items */
896 price = object_value(o_ptr);
898 /* Worthless items */
899 if (price <= 0) return (0L);
902 /* Compute the racial factor */
903 factor = rgold_adj[ot_ptr->owner_race][p_ptr->prace];
905 /* Add in the charisma factor */
906 factor += adj_chr_gold[p_ptr->stat_ind[A_CHR]];
912 /* Adjust for greed */
913 adjust = 100 + (300 - (greed + factor));
915 /* Never get "silly" */
916 if (adjust > 100) adjust = 100;
918 /* Mega-Hack -- Black market sucks */
919 if (cur_store_num == STORE_BLACK)
922 /* Compute the final price (with rounding) */
923 /* Hack -- prevent underflow */
924 price = (price * adjust + 50L) / 100L;
927 /* Shop is selling */
930 /* Adjust for greed */
931 adjust = 100 + ((greed + factor) - 300);
933 /* Never get "silly" */
934 if (adjust < 100) adjust = 100;
936 /* Mega-Hack -- Black market sucks */
937 if (cur_store_num == STORE_BLACK)
940 /* Compute the final price (with rounding) */
941 /* Hack -- prevent overflow */
942 price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
945 /* Note -- Never become "free" */
946 if (price <= 0L) return (1L);
948 /* Return the price */
954 * @brief 安価な消耗品の販売数を増やし、低確率で割引にする /
955 * Certain "cheap" objects should be created in "piles"
956 * @param o_ptr 店舗に並べるオブジェクト構造体の参照ポインタ
960 * Some objects can be sold at a "discount" (in small piles)
963 static void mass_produce(object_type *o_ptr)
966 DISCOUNT_RATE discount = 0;
968 s32b cost = object_value(o_ptr);
971 /* Analyze the type */
974 /* Food, Flasks, and Lites */
979 if (cost <= 5L) size += damroll(3, 5);
980 if (cost <= 20L) size += damroll(3, 5);
981 if (cost <= 50L) size += damroll(2, 2);
988 if (cost <= 60L) size += damroll(3, 5);
989 if (cost <= 240L) size += damroll(1, 5);
990 if (o_ptr->sval == SV_SCROLL_STAR_IDENTIFY) size += damroll(3, 5);
991 if (o_ptr->sval == SV_SCROLL_STAR_REMOVE_CURSE) size += damroll(1, 4);
996 case TV_SORCERY_BOOK:
1001 case TV_ARCANE_BOOK:
1003 case TV_DAEMON_BOOK:
1004 case TV_CRUSADE_BOOK:
1006 case TV_HISSATSU_BOOK:
1009 if (cost <= 50L) size += damroll(2, 3);
1010 if (cost <= 500L) size += damroll(1, 3);
1028 if (object_is_artifact(o_ptr)) break;
1029 if (object_is_ego(o_ptr)) break;
1030 if (cost <= 10L) size += damroll(3, 5);
1031 if (cost <= 100L) size += damroll(3, 5);
1040 if (cost <= 5L) size += damroll(5, 5);
1041 if (cost <= 50L) size += damroll(5, 5);
1042 if (cost <= 500L) size += damroll(5, 5);
1048 if (cost <= 100L) size += damroll(2, 2);
1049 if (cost <= 1000L) size += damroll(2, 2);
1062 * Because many rods (and a few wands and staffs) are useful mainly
1063 * in quantity, the Black Market will occasionally have a bunch of
1070 if ((cur_store_num == STORE_BLACK) && one_in_(3))
1072 if (cost < 1601L) size += damroll(1, 5);
1073 else if (cost < 3201L) size += damroll(1, 3);
1080 /* Pick a discount */
1085 else if (one_in_(25))
1089 else if (one_in_(150))
1093 else if (one_in_(300))
1097 else if (one_in_(500))
1102 if (o_ptr->art_name)
1107 /* Save the discount */
1108 o_ptr->discount = discount;
1110 /* Save the total pile size */
1111 o_ptr->number = size - (size * discount / 100);
1113 /* Ensure that mass-produced rods and wands get the correct pvals. */
1114 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1116 o_ptr->pval *= (PARAMETER_VALUE)o_ptr->number;
1123 * @brief 店舗に並べた品を同一品であるかどうか判定する /
1124 * Determine if a store item can "absorb" another item
1125 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1126 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1127 * @return 同一扱いできるならTRUEを返す
1130 * See "object_similar()" for the same function for the "player"
1133 static bool store_object_similar(object_type *o_ptr, object_type *j_ptr)
1137 /* Hack -- Identical items cannot be stacked */
1138 if (o_ptr == j_ptr) return (0);
1140 /* Different objects cannot be stacked */
1141 if (o_ptr->k_idx != j_ptr->k_idx) return (0);
1143 /* Different charges (etc) cannot be stacked, unless wands or rods. */
1144 if ((o_ptr->pval != j_ptr->pval) && (o_ptr->tval != TV_WAND) && (o_ptr->tval != TV_ROD)) return (0);
1146 /* Require many identical values */
1147 if (o_ptr->to_h != j_ptr->to_h) return (0);
1148 if (o_ptr->to_d != j_ptr->to_d) return (0);
1149 if (o_ptr->to_a != j_ptr->to_a) return (0);
1151 /* Require identical "ego-item" names */
1152 if (o_ptr->name2 != j_ptr->name2) return (0);
1154 /* Artifacts don't stack! */
1155 if (object_is_artifact(o_ptr) || object_is_artifact(j_ptr)) return (0);
1157 /* Hack -- Identical art_flags! */
1158 for (i = 0; i < TR_FLAG_SIZE; i++)
1159 if (o_ptr->art_flags[i] != j_ptr->art_flags[i]) return (0);
1161 /* Hack -- Never stack "powerful" items */
1162 if (o_ptr->xtra1 || j_ptr->xtra1) return (0);
1164 /* Hack -- Never stack recharging items */
1165 if (o_ptr->timeout || j_ptr->timeout) return (0);
1167 /* Require many identical values */
1168 if (o_ptr->ac != j_ptr->ac) return (0);
1169 if (o_ptr->dd != j_ptr->dd) return (0);
1170 if (o_ptr->ds != j_ptr->ds) return (0);
1172 /* Hack -- Never stack chests */
1173 if (o_ptr->tval == TV_CHEST) return (0);
1174 if (o_ptr->tval == TV_STATUE) return (0);
1175 if (o_ptr->tval == TV_CAPTURE) return (0);
1177 /* Require matching discounts */
1178 if (o_ptr->discount != j_ptr->discount) return (0);
1180 /* They match, so they must be similar */
1186 * @brief 店舗に並べた品を重ね合わせできるかどうか判定する /
1187 * Allow a store item to absorb another item
1188 * @param o_ptr 判定するオブジェクト構造体の参照ポインタ1
1189 * @param j_ptr 判定するオブジェクト構造体の参照ポインタ2
1190 * @return 重ね合わせできるならTRUEを返す
1193 * See "object_similar()" for the same function for the "player"
1196 static void store_object_absorb(object_type *o_ptr, object_type *j_ptr)
1198 int max_num = (o_ptr->tval == TV_ROD) ?
1199 MIN(99, MAX_SHORT / k_info[o_ptr->k_idx].pval) : 99;
1200 int total = o_ptr->number + j_ptr->number;
1201 int diff = (total > max_num) ? total - max_num : 0;
1203 /* Combine quantity, lose excess items */
1204 o_ptr->number = (total > max_num) ? max_num : total;
1206 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) together. -LM- */
1207 if (o_ptr->tval == TV_ROD)
1209 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1212 /* Hack -- if wands are stacking, combine the charges. -LM- */
1213 if (o_ptr->tval == TV_WAND)
1215 o_ptr->pval += j_ptr->pval * (j_ptr->number - diff) / j_ptr->number;
1221 * @brief 店舗に品を置くスペースがあるかどうかの判定を返す /
1222 * Check to see if the shop will be carrying too many objects -RAK-
1223 * @param o_ptr 店舗に置きたいオブジェクト構造体の参照ポインタ
1224 * @return 置き場がないなら0、重ね合わせできるアイテムがあるなら-1、スペースがあるなら1を返す。
1227 * Note that the shop, just like a player, will not accept things
1228 * it cannot hold. Before, one could "nuke" potions this way.
1229 * Return value is now int:
1231 * -1 : Can be combined to existing slot.
1232 * 1 : Cannot be combined but there are empty spaces.
1235 static int store_check_num(object_type *o_ptr)
1240 /* The "home" acts like the player */
1241 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
1243 bool old_stack_force_notes = stack_force_notes;
1244 bool old_stack_force_costs = stack_force_costs;
1246 if (cur_store_num != STORE_HOME)
1248 stack_force_notes = FALSE;
1249 stack_force_costs = FALSE;
1252 /* Check all the items */
1253 for (i = 0; i < st_ptr->stock_num; i++)
1255 /* Get the existing item */
1256 j_ptr = &st_ptr->stock[i];
1258 /* Can the new object be combined with the old one? */
1259 if (object_similar(j_ptr, o_ptr))
1261 if (cur_store_num != STORE_HOME)
1263 stack_force_notes = old_stack_force_notes;
1264 stack_force_costs = old_stack_force_costs;
1271 if (cur_store_num != STORE_HOME)
1273 stack_force_notes = old_stack_force_notes;
1274 stack_force_costs = old_stack_force_costs;
1278 /* Normal stores do special stuff */
1281 /* Check all the items */
1282 for (i = 0; i < st_ptr->stock_num; i++)
1284 /* Get the existing item */
1285 j_ptr = &st_ptr->stock[i];
1287 /* Can the new object be combined with the old one? */
1288 if (store_object_similar(j_ptr, o_ptr)) return -1;
1292 /* Free space is always usable */
1294 * オプション powerup_home が設定されていると
1297 if ((cur_store_num == STORE_HOME) && ( powerup_home == FALSE )) {
1298 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10)) {
1303 if (st_ptr->stock_num < st_ptr->stock_size) {
1308 /* But there was no room at the inn... */
1313 * @brief オブジェクトが祝福されているかの判定を返す /
1314 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1315 * @return アイテムが祝福されたアイテムならばTRUEを返す
1317 static bool is_blessed(object_type *o_ptr)
1319 u32b flgs[TR_FLAG_SIZE];
1320 object_flags(o_ptr, flgs);
1321 if (have_flag(flgs, TR_BLESSED)) return (TRUE);
1322 else return (FALSE);
1328 * @brief オブジェクトが所定の店舗で引き取れるかどうかを返す /
1329 * Determine if the current store will purchase the given item
1330 * @param o_ptr 判定したいオブジェクト構造体の参照ポインタ
1331 * @return アイテムが買い取れるならばTRUEを返す
1333 * Note that a shop-keeper must refuse to buy "worthless" items
1335 static bool store_will_buy(object_type *o_ptr)
1337 /* Hack -- The Home is simple */
1338 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) return (TRUE);
1340 /* Switch on the store */
1341 switch (cur_store_num)
1346 /* Analyze the type */
1347 switch (o_ptr->tval)
1350 if (o_ptr->sval != SV_POTION_WATER) return FALSE;
1362 case TV_BOTTLE: /* 'Green', recycling Angband */
1377 /* Analyze the type */
1378 switch (o_ptr->tval)
1399 /* Analyze the type */
1400 switch (o_ptr->tval)
1409 case TV_HISSATSU_BOOK:
1413 if(o_ptr->sval == SV_WIZSTAFF) return (FALSE);
1425 /* Analyze the type */
1426 switch (o_ptr->tval)
1429 case TV_CRUSADE_BOOK:
1439 monster_race *r_ptr = &r_info[o_ptr->pval];
1442 if (!(r_ptr->flags3 & RF3_EVIL))
1445 if (r_ptr->flags3 & RF3_GOOD) break;
1447 /* Accept animals */
1448 if (r_ptr->flags3 & RF3_ANIMAL) break;
1451 if (my_strchr("?!", r_ptr->d_char)) break;
1457 if (is_blessed(o_ptr)) break;
1466 case STORE_ALCHEMIST:
1468 /* Analyze the type */
1469 switch (o_ptr->tval)
1483 /* Analyze the type */
1484 switch (o_ptr->tval)
1486 case TV_SORCERY_BOOK:
1487 case TV_NATURE_BOOK:
1491 case TV_ARCANE_BOOK:
1493 case TV_DAEMON_BOOK:
1507 if(o_ptr->sval == SV_WIZSTAFF) break;
1508 else return (FALSE);
1515 /* Bookstore Shop */
1518 /* Analyze the type */
1519 switch (o_ptr->tval)
1521 case TV_SORCERY_BOOK:
1522 case TV_NATURE_BOOK:
1527 case TV_ARCANE_BOOK:
1529 case TV_DAEMON_BOOK:
1530 case TV_CRUSADE_BOOK:
1541 /* XXX XXX XXX Ignore "worthless" items */
1542 if (object_value(o_ptr) <= 0) return (FALSE);
1550 * @brief 現在の町の指定された店舗のアイテムを整理する /
1551 * Combine and reorder items in store.
1552 * @param store_num 店舗ID
1553 * @return 実際に整理が行われたならばTRUEを返す。
1555 bool combine_and_reorder_home(int store_num)
1559 object_type forge, *o_ptr, *j_ptr;
1560 bool flag = FALSE, combined;
1561 store_type *old_st_ptr = st_ptr;
1562 bool old_stack_force_notes = stack_force_notes;
1563 bool old_stack_force_costs = stack_force_costs;
1565 st_ptr = &town[1].store[store_num];
1566 if (store_num != STORE_HOME)
1568 stack_force_notes = FALSE;
1569 stack_force_costs = FALSE;
1576 /* Combine the items in the home (backwards) */
1577 for (i = st_ptr->stock_num - 1; i > 0; i--)
1580 o_ptr = &st_ptr->stock[i];
1582 /* Skip empty items */
1583 if (!o_ptr->k_idx) continue;
1585 /* Scan the items above that item */
1586 for (j = 0; j < i; j++)
1591 j_ptr = &st_ptr->stock[j];
1593 /* Skip empty items */
1594 if (!j_ptr->k_idx) continue;
1597 * Get maximum number of the stack if these
1598 * are similar, get zero otherwise.
1600 max_num = object_similar_part(j_ptr, o_ptr);
1602 /* Can we (partialy) drop "o_ptr" onto "j_ptr"? */
1603 if (max_num && j_ptr->number < max_num)
1605 if (o_ptr->number + j_ptr->number <= max_num)
1607 /* Add together the item counts */
1608 object_absorb(j_ptr, o_ptr);
1610 /* One object is gone */
1611 st_ptr->stock_num--;
1613 /* Slide everything down */
1614 for (k = i; k < st_ptr->stock_num; k++)
1616 /* Structure copy */
1617 st_ptr->stock[k] = st_ptr->stock[k + 1];
1620 /* Erase the "final" slot */
1621 object_wipe(&st_ptr->stock[k]);
1625 ITEM_NUMBER old_num = o_ptr->number;
1626 ITEM_NUMBER remain = j_ptr->number + o_ptr->number - max_num;
1628 /* Add together the item counts */
1629 object_absorb(j_ptr, o_ptr);
1631 o_ptr->number = remain;
1633 /* Hack -- if rods are stacking, add the pvals (maximum timeouts) and current timeouts together. -LM- */
1634 if (o_ptr->tval == TV_ROD)
1636 o_ptr->pval = o_ptr->pval * remain / old_num;
1637 o_ptr->timeout = o_ptr->timeout * remain / old_num;
1640 /* Hack -- if wands are stacking, combine the charges. -LM- */
1641 else if (o_ptr->tval == TV_WAND)
1643 o_ptr->pval = o_ptr->pval * remain / old_num;
1660 /* Re-order the items in the home (forwards) */
1661 for (i = 0; i < st_ptr->stock_num; i++)
1664 o_ptr = &st_ptr->stock[i];
1666 /* Skip empty slots */
1667 if (!o_ptr->k_idx) continue;
1669 /* Get the "value" of the item */
1670 o_value = object_value(o_ptr);
1672 /* Scan every occupied slot */
1673 for (j = 0; j < st_ptr->stock_num; j++)
1675 if (object_sort_comp(o_ptr, o_value, &st_ptr->stock[j])) break;
1678 /* Never move down */
1679 if (j >= i) continue;
1684 /* Get local object */
1687 /* Save a copy of the moving item */
1688 object_copy(j_ptr, &st_ptr->stock[i]);
1690 /* Slide the objects */
1691 for (k = i; k > j; k--)
1693 /* Slide the item */
1694 object_copy(&st_ptr->stock[k], &st_ptr->stock[k - 1]);
1697 /* Insert the moving item */
1698 object_copy(&st_ptr->stock[j], j_ptr);
1701 st_ptr = old_st_ptr;
1702 if (store_num != STORE_HOME)
1704 stack_force_notes = old_stack_force_notes;
1705 stack_force_costs = old_stack_force_costs;
1713 * @brief 我が家にオブジェクトを加える /
1714 * Add the item "o_ptr" to the inventory of the "Home"
1715 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1719 * In all cases, return the slot (or -1) where the object was placed
1720 * Note that this is a hacked up version of "inven_carry()".
1721 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1722 * known, the player may have to pick stuff up and drop it again.
1725 static int home_carry(object_type *o_ptr)
1731 bool old_stack_force_notes = stack_force_notes;
1732 bool old_stack_force_costs = stack_force_costs;
1734 if (cur_store_num != STORE_HOME)
1736 stack_force_notes = FALSE;
1737 stack_force_costs = FALSE;
1740 /* Check each existing item (try to combine) */
1741 for (slot = 0; slot < st_ptr->stock_num; slot++)
1743 /* Get the existing item */
1744 j_ptr = &st_ptr->stock[slot];
1746 /* The home acts just like the player */
1747 if (object_similar(j_ptr, o_ptr))
1749 /* Save the new number of items */
1750 object_absorb(j_ptr, o_ptr);
1752 if (cur_store_num != STORE_HOME)
1754 stack_force_notes = old_stack_force_notes;
1755 stack_force_costs = old_stack_force_costs;
1763 if (cur_store_num != STORE_HOME)
1765 stack_force_notes = old_stack_force_notes;
1766 stack_force_costs = old_stack_force_costs;
1771 * 隠し機能: オプション powerup_home が設定されていると
1775 if ((cur_store_num != STORE_HOME) || (powerup_home == TRUE)) {
1776 if (st_ptr->stock_num >= st_ptr->stock_size) {
1781 if (st_ptr->stock_num >= ((st_ptr->stock_size) / 10)) {
1787 /* Determine the "value" of the item */
1788 value = object_value(o_ptr);
1790 /* Check existing slots to see if we must "slide" */
1791 for (slot = 0; slot < st_ptr->stock_num; slot++)
1793 if (object_sort_comp(o_ptr, value, &st_ptr->stock[slot])) break;
1796 /* Slide the others up */
1797 for (i = st_ptr->stock_num; i > slot; i--)
1799 st_ptr->stock[i] = st_ptr->stock[i-1];
1802 /* More stuff now */
1803 st_ptr->stock_num++;
1805 /* Insert the new item */
1806 st_ptr->stock[slot] = *o_ptr;
1808 chg_virtue(V_SACRIFICE, -1);
1810 (void)combine_and_reorder_home(cur_store_num);
1812 /* Return the location */
1818 * @brief 店舗にオブジェクトを加える /
1819 * Add the item "o_ptr" to a real stores inventory.
1820 * @param o_ptr 加えたいオブジェクトの構造体参照ポインタ
1824 * In all cases, return the slot (or -1) where the object was placed
1825 * Note that this is a hacked up version of "inven_carry()".
1826 * Also note that it may not correctly "adapt" to "knowledge" bacoming
1827 * known, the player may have to pick stuff up and drop it again.
1830 static int store_carry(object_type *o_ptr)
1833 s32b value, j_value;
1837 /* Evaluate the object */
1838 value = object_value(o_ptr);
1840 /* Cursed/Worthless items "disappear" when sold */
1841 if (value <= 0) return (-1);
1843 /* All store items are fully *identified* */
1844 o_ptr->ident |= IDENT_MENTAL;
1846 /* Erase the inscription */
1847 o_ptr->inscription = 0;
1849 /* Erase the "feeling" */
1850 o_ptr->feeling = FEEL_NONE;
1852 /* Check each existing item (try to combine) */
1853 for (slot = 0; slot < st_ptr->stock_num; slot++)
1855 /* Get the existing item */
1856 j_ptr = &st_ptr->stock[slot];
1858 /* Can the existing items be incremented? */
1859 if (store_object_similar(j_ptr, o_ptr))
1861 /* Hack -- extra items disappear */
1862 store_object_absorb(j_ptr, o_ptr);
1870 if (st_ptr->stock_num >= st_ptr->stock_size) return (-1);
1873 /* Check existing slots to see if we must "slide" */
1874 for (slot = 0; slot < st_ptr->stock_num; slot++)
1877 j_ptr = &st_ptr->stock[slot];
1879 /* Objects sort by decreasing type */
1880 if (o_ptr->tval > j_ptr->tval) break;
1881 if (o_ptr->tval < j_ptr->tval) continue;
1883 /* Objects sort by increasing sval */
1884 if (o_ptr->sval < j_ptr->sval) break;
1885 if (o_ptr->sval > j_ptr->sval) continue;
1888 * Hack: otherwise identical rods sort by
1889 * increasing recharge time --dsb
1891 if (o_ptr->tval == TV_ROD)
1893 if (o_ptr->pval < j_ptr->pval) break;
1894 if (o_ptr->pval > j_ptr->pval) continue;
1897 /* Evaluate that slot */
1898 j_value = object_value(j_ptr);
1900 /* Objects sort by decreasing value */
1901 if (value > j_value) break;
1902 if (value < j_value) continue;
1905 /* Slide the others up */
1906 for (i = st_ptr->stock_num; i > slot; i--)
1908 st_ptr->stock[i] = st_ptr->stock[i-1];
1911 /* More stuff now */
1912 st_ptr->stock_num++;
1914 /* Insert the new item */
1915 st_ptr->stock[slot] = *o_ptr;
1917 /* Return the location */
1923 * @brief 店舗のオブジェクト数を増やす /
1924 * Add the item "o_ptr" to a real stores inventory.
1925 * @param item 増やしたいアイテムのID
1930 * Increase, by a given amount, the number of a certain item
1931 * in a certain store. This can result in zero items.
1933 * @todo numは本来ITEM_NUMBER型にしたい。
1935 static void store_item_increase(int item, int num)
1941 o_ptr = &st_ptr->stock[item];
1943 /* Verify the number */
1944 cnt = o_ptr->number + num;
1945 if (cnt > 255) cnt = 255;
1946 else if (cnt < 0) cnt = 0;
1947 num = cnt - o_ptr->number;
1949 /* Save the new number */
1950 o_ptr->number += (ITEM_NUMBER)num;
1955 * @brief 店舗のオブジェクト数を削除する /
1956 * Remove a slot if it is empty
1957 * @param item 削除したいアイテムのID
1960 static void store_item_optimize(int item)
1966 o_ptr = &st_ptr->stock[item];
1969 if (!o_ptr->k_idx) return;
1971 /* Must have no items */
1972 if (o_ptr->number) return;
1975 st_ptr->stock_num--;
1977 /* Slide everyone */
1978 for (j = item; j < st_ptr->stock_num; j++)
1980 st_ptr->stock[j] = st_ptr->stock[j + 1];
1983 /* Nuke the final slot */
1984 object_wipe(&st_ptr->stock[j]);
1988 * @brief ブラックマーケット用の無価値品の排除判定 /
1989 * This function will keep 'crap' out of the black market.
1990 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1991 * @return ブラックマーケットにとって無価値な品ならばTRUEを返す
1994 * Crap is defined as any item that is "available" elsewhere
1995 * Based on a suggestion by "Lee Vogt" <lvogt@cig.mcel.mot.com>
1998 static bool black_market_crap(object_type *o_ptr)
2002 /* Ego items are never crap */
2003 if (object_is_ego(o_ptr)) return (FALSE);
2005 /* Good items are never crap */
2006 if (o_ptr->to_a > 0) return (FALSE);
2007 if (o_ptr->to_h > 0) return (FALSE);
2008 if (o_ptr->to_d > 0) return (FALSE);
2010 /* Check all stores */
2011 for (i = 0; i < MAX_STORES; i++)
2013 if (i == STORE_HOME) continue;
2014 if (i == STORE_MUSEUM) continue;
2016 /* Check every item in the store */
2017 for (j = 0; j < town[p_ptr->town_num].store[i].stock_num; j++)
2019 object_type *j_ptr = &town[p_ptr->town_num].store[i].stock[j];
2021 /* Duplicate item "type", assume crappy */
2022 if (o_ptr->k_idx == j_ptr->k_idx) return (TRUE);
2032 * @brief 店舗の品揃え変化のためにアイテムを削除する /
2033 * Attempt to delete (some of) a random item from the store
2037 * Hack -- we attempt to "maintain" piles of items when possible.
2040 static void store_delete(void)
2044 /* Pick a random slot */
2045 what = randint0(st_ptr->stock_num);
2047 /* Determine how many items are here */
2048 num = st_ptr->stock[what].number;
2050 /* Hack -- sometimes, only destroy half the items */
2051 if (randint0(100) < 50) num = (num + 1) / 2;
2053 /* Hack -- sometimes, only destroy a single item */
2054 if (randint0(100) < 50) num = 1;
2056 /* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
2057 if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
2059 st_ptr->stock[what].pval -= num * st_ptr->stock[what].pval / st_ptr->stock[what].number;
2062 /* Actually destroy (part of) the item */
2063 store_item_increase(what, -num);
2064 store_item_optimize(what);
2069 * @brief 店舗の品揃え変化のためにアイテムを追加する /
2070 * Creates a random item and gives it to a store
2074 * This algorithm needs to be rethought. A lot.
2075 * Currently, "normal" stores use a pre-built array.
2076 * Note -- the "level" given to "obj_get_num()" is a "favored"
2077 * level, that is, there is a much higher chance of getting
2078 * items with a level approaching that of the given level...
2079 * Should we check for "permission" to have the given item?
2082 static void store_create(void)
2084 int i, tries, level;
2090 /* Paranoia -- no room left */
2091 if (st_ptr->stock_num >= st_ptr->stock_size) return;
2094 /* Hack -- consider up to four items */
2095 for (tries = 0; tries < 4; tries++)
2098 if (cur_store_num == STORE_BLACK)
2100 /* Pick a level for object/magic */
2101 level = 25 + randint0(25);
2103 /* Random item (usually of given level) */
2104 i = get_obj_num(level);
2106 /* Handle failure */
2113 /* Hack -- Pick an item to sell */
2114 i = st_ptr->table[randint0(st_ptr->table_num)];
2116 /* Hack -- fake level for apply_magic() */
2117 level = rand_range(1, STORE_OBJ_LEVEL);
2121 /* Get local object */
2124 /* Create a new object of the chosen kind */
2125 object_prep(q_ptr, i);
2127 /* Apply some "low-level" magic (no artifacts) */
2128 apply_magic(q_ptr, level, AM_NO_FIXED_ART);
2130 /* Require valid object */
2131 if (!store_will_buy(q_ptr)) continue;
2133 /* Hack -- Charge lite's */
2134 if (q_ptr->tval == TV_LITE)
2136 if (q_ptr->sval == SV_LITE_TORCH) q_ptr->xtra4 = FUEL_TORCH / 2;
2137 if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->xtra4 = FUEL_LAMP / 2;
2141 /* The item is "known" */
2142 object_known(q_ptr);
2144 /* Mark it storebought */
2145 q_ptr->ident |= IDENT_STORE;
2147 /* Mega-Hack -- no chests in stores */
2148 if (q_ptr->tval == TV_CHEST) continue;
2150 /* Prune the black market */
2151 if (cur_store_num == STORE_BLACK)
2153 /* Hack -- No "crappy" items */
2154 if (black_market_crap(q_ptr)) continue;
2156 /* Hack -- No "cheap" items */
2157 if (object_value(q_ptr) < 10) continue;
2159 /* No "worthless" items */
2160 /* if (object_value(q_ptr) <= 0) continue; */
2163 /* Prune normal stores */
2166 /* No "worthless" items */
2167 if (object_value(q_ptr) <= 0) continue;
2171 /* Mass produce and/or Apply discount */
2172 mass_produce(q_ptr);
2174 /* Attempt to carry the (known) item */
2175 (void)store_carry(q_ptr);
2177 /* Definitely done */
2184 * @brief 店舗の割引対象外にするかどうかを判定 /
2185 * Eliminate need to bargain if player has haggled well in the past
2186 * @param minprice アイテムの最低販売価格
2187 * @return 割引を禁止するならTRUEを返す。
2189 static bool noneedtobargain(s32b minprice)
2191 s32b good = st_ptr->good_buy;
2192 s32b bad = st_ptr->bad_buy;
2194 /* Cheap items are "boring" */
2195 if (minprice < 10L) return (TRUE);
2197 /* Perfect haggling */
2198 if (good == MAX_SHORT) return (TRUE);
2200 /* Reward good haggles, punish bad haggles, notice price */
2201 if (good > ((3 * bad) + (5 + (minprice/50)))) return (TRUE);
2203 /* Return the flag */
2209 * @brief 店主の持つプレイヤーに対する売買の良し悪し経験を記憶する /
2210 * Update the bargain info
2211 * @param price 実際の取引価格
2212 * @param minprice 店主の提示した価格
2216 static void updatebargain(s32b price, s32b minprice, int num)
2218 /* Hack -- auto-haggle */
2219 if (!manual_haggle) return;
2221 /* Cheap items are "boring" */
2222 if ((minprice/num) < 10L) return;
2224 /* Count the successful haggles */
2225 if (price == minprice)
2227 /* Just count the good haggles */
2228 if (st_ptr->good_buy < MAX_SHORT)
2234 /* Count the failed haggles */
2237 /* Just count the bad haggles */
2238 if (st_ptr->bad_buy < MAX_SHORT)
2247 * @brief 店の商品リストを再表示する /
2248 * Re-displays a single store entry
2252 static void display_entry(int pos)
2258 char o_name[MAX_NLEN];
2265 o_ptr = &st_ptr->stock[pos];
2267 /* Get the "offset" */
2268 i = (pos % store_bottom);
2270 /* Label it, clear the line --(-- */
2271 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
2272 prt(out_val, i+6, 0);
2275 if (show_item_graph)
2277 byte a = object_attr(o_ptr);
2278 char c = object_char(o_ptr);
2280 Term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
2281 if (use_bigtile) cur_col++;
2286 /* Describe an item in the home */
2287 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
2291 /* Leave room for weights, if necessary -DRS- */
2292 if (show_weights) maxwid -= 10;
2294 /* Describe the object */
2295 object_desc(o_name, o_ptr, 0);
2296 o_name[maxwid] = '\0';
2297 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2302 /* Only show the weight of an individual item */
2303 int wgt = o_ptr->weight;
2305 sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2306 put_str(out_val, i+6, 67);
2308 (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10);
2309 put_str(out_val, i+6, 68);
2315 /* Describe an item (fully) in a store */
2318 /* Must leave room for the "price" */
2321 /* Leave room for weights, if necessary -DRS- */
2322 if (show_weights) maxwid -= 7;
2324 /* Describe the object (fully) */
2325 object_desc(o_name, o_ptr, 0);
2326 o_name[maxwid] = '\0';
2327 c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, cur_col);
2332 /* Only show the weight of an individual item */
2333 int wgt = o_ptr->weight;
2335 sprintf(out_val, "%3d.%1d", lbtokg1(wgt) , lbtokg2(wgt) );
2336 put_str(out_val, i+6, 60);
2338 (void)sprintf(out_val, "%3d.%d", wgt / 10, wgt % 10);
2339 put_str(out_val, i+6, 61);
2344 /* Display a "fixed" cost */
2345 if (o_ptr->ident & (IDENT_FIXED))
2347 /* Extract the "minimum" price */
2348 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2350 /* Actually draw the price (not fixed) */
2352 (void)sprintf(out_val, "%9ld固", (long)x);
2354 (void)sprintf(out_val, "%9ld F", (long)x);
2357 put_str(out_val, i+6, 68);
2360 /* Display a "taxed" cost */
2361 else if (!manual_haggle)
2363 /* Extract the "minimum" price */
2364 x = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
2366 /* Hack -- Apply Sales Tax if needed */
2367 if (!noneedtobargain(x)) x += x / 10;
2369 /* Actually draw the price (with tax) */
2370 (void)sprintf(out_val, "%9ld ", (long)x);
2371 put_str(out_val, i+6, 68);
2374 /* Display a "haggle" cost */
2377 /* Extrect the "maximum" price */
2378 x = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
2380 /* Actually draw the price (not fixed) */
2381 (void)sprintf(out_val, "%9ld ", (long)x);
2382 put_str(out_val, i+6, 68);
2389 * @brief 店の商品リストを表示する /
2390 * Displays a store's inventory -RAK-
2393 * All prices are listed as "per individual object". -BEN-
2395 static void display_inventory(void)
2399 /* Display the next 12 items */
2400 for (k = 0; k < store_bottom; k++)
2402 /* Do not display "dead" items */
2403 if (store_top + k >= st_ptr->stock_num) break;
2405 /* Display that line */
2406 display_entry(store_top + k);
2409 /* Erase the extra lines and the "more" prompt */
2410 for (i = k; i < store_bottom + 1; i++) prt("", i + 6, 0);
2412 /* Assume "no current page" */
2414 put_str(" ", 5, 20);
2416 put_str(" ", 5, 20);
2420 /* Visual reminder of "more items" */
2421 if (st_ptr->stock_num > store_bottom)
2423 /* Show "more" reminder (after the last item) */
2425 prt("-続く-", k + 6, 3);
2427 prt("-more-", k + 6, 3);
2431 /* Indicate the "current page" */
2432 /* Trailing spaces are to display (Page xx) and (Page x) */
2434 put_str(format("(%dページ) ", store_top/store_bottom + 1), 5, 20);
2436 put_str(format("(Page %d) ", store_top/store_bottom + 1), 5, 20);
2441 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM)
2443 k = st_ptr->stock_size;
2445 if (cur_store_num == STORE_HOME && !powerup_home) k /= 10;
2447 put_str(format("アイテム数: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 27);
2449 put_str(format("Objects: %4d/%4d", st_ptr->stock_num, k), 19 + xtra_stock, 30);
2456 * @brief プレイヤーの所持金を表示する /
2457 * Displays players gold -RAK-
2461 static void store_prt_gold(void)
2466 prt("手持ちのお金: ", 19 + xtra_stock, 53);
2468 prt("Gold Remaining: ", 19 + xtra_stock, 53);
2472 sprintf(out_val, "%9ld", (long)p_ptr->au);
2473 prt(out_val, 19 + xtra_stock, 68);
2477 * @brief 店舗情報全体を表示するメインルーチン /
2478 * Displays store (after clearing screen) -RAK-
2482 static void display_store(void)
2490 /* The "Home" is special */
2491 if (cur_store_num == STORE_HOME)
2493 /* Put the owner name */
2495 put_str("我が家", 3, 31);
2497 put_str("Your Home", 3, 30);
2501 /* Label the item descriptions */
2503 put_str("アイテムの一覧", 5, 4);
2505 put_str("Item Description", 5, 3);
2509 /* If showing weights, show label */
2513 put_str("重さ", 5, 72);
2515 put_str("Weight", 5, 70);
2521 /* The "Home" is special */
2522 else if (cur_store_num == STORE_MUSEUM)
2524 /* Put the owner name */
2526 put_str("博物館", 3, 31);
2528 put_str("Museum", 3, 30);
2532 /* Label the item descriptions */
2534 put_str("アイテムの一覧", 5, 4);
2536 put_str("Item Description", 5, 3);
2540 /* If showing weights, show label */
2544 put_str("重さ", 5, 72);
2546 put_str("Weight", 5, 70);
2555 cptr store_name = (f_name + f_info[cur_store_feat].name);
2556 cptr owner_name = (ot_ptr->owner_name);
2557 cptr race_name = race_info[ot_ptr->owner_race].title;
2559 /* Put the owner name and race */
2560 sprintf(buf, "%s (%s)", owner_name, race_name);
2561 put_str(buf, 3, 10);
2563 /* Show the max price in the store (above prices) */
2564 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
2567 /* Label the item descriptions */
2569 put_str("商品の一覧", 5, 7);
2571 put_str("Item Description", 5, 3);
2575 /* If showing weights, show label */
2579 put_str("重さ", 5, 62);
2581 put_str("Weight", 5, 60);
2586 /* Label the asking price (in stores) */
2588 put_str("価格", 5, 73);
2590 put_str("Price", 5, 72);
2595 /* Display the current gold */
2598 /* Draw in the inventory */
2599 display_inventory();
2605 * @brief 店舗からアイテムを選択する /
2606 * Get the ID of a store item and return its value -RAK-
2607 * @param com_val 選択IDを返す参照ポインタ
2608 * @param pmt メッセージキャプション
2611 * @return 実際に選択したらTRUE、キャンセルしたらFALSE
2613 static int get_stock(COMMAND_CODE *com_val, cptr pmt, int i, int j)
2619 #ifdef ALLOW_REPEAT /* TNB */
2621 /* Get the item index */
2622 if (repeat_pull(com_val))
2624 /* Verify the item */
2625 if ((*com_val >= i) && (*com_val <= j))
2632 #endif /* ALLOW_REPEAT -- TNB */
2634 /* Paranoia XXX XXX XXX */
2638 /* Assume failure */
2641 /* Build the prompt */
2643 hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
2645 (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s",
2646 (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"),
2649 (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s",
2654 /* Ask until done */
2660 if (!get_com(out_val, &command, FALSE)) break;
2663 if (islower(command))
2665 else if (isupper(command))
2666 k = A2I(tolower(command)) + 26;
2670 /* Legal responses */
2671 if ((k >= i) && (k <= j))
2681 /* Clear the prompt */
2685 if (command == ESCAPE) return (FALSE);
2687 #ifdef ALLOW_REPEAT /* TNB */
2689 repeat_push(*com_val);
2691 #endif /* ALLOW_REPEAT -- TNB */
2699 * @brief 店主の不満度を増やし、プレイヤーを締め出す判定と処理を行う /
2700 * Increase the insult counter and get angry if too many -RAK-
2701 * @return プレイヤーを締め出す場合TRUEを返す
2703 static int increase_insults(void)
2705 /* Increase insults */
2706 st_ptr->insult_cur++;
2708 /* Become insulted */
2709 if (st_ptr->insult_cur > ot_ptr->insult_max)
2715 st_ptr->insult_cur = 0;
2716 st_ptr->good_buy = 0;
2717 st_ptr->bad_buy = 0;
2720 st_ptr->store_open = turn + TURNS_PER_TICK*TOWN_DAWN/8 + randint1(TURNS_PER_TICK*TOWN_DAWN/8);
2732 * @brief 店主の不満度を減らす /
2733 * Decrease insults -RAK-
2734 * @return プレイヤーを締め出す場合TRUEを返す
2736 static void decrease_insults(void)
2738 /* Decrease insults */
2739 if (st_ptr->insult_cur) st_ptr->insult_cur--;
2744 * @brief 店主の不満度が増えた場合のみのメッセージを表示する /
2745 * Have insulted while haggling -RAK-
2746 * @return プレイヤーを締め出す場合TRUEを返す
2748 static int haggle_insults(void)
2750 /* Increase insults */
2751 if (increase_insults()) return (TRUE);
2753 /* Display and flush insult */
2762 * Mega-Hack -- Enable "increments"
2764 static bool allow_inc = FALSE;
2767 * Mega-Hack -- Last "increment" during haggling
2769 static s32b last_inc = 0L;
2773 * @brief 交渉価格を確認と認証の是非を行う /
2776 * @param poffer 別途価格提示をした場合の値を返す参照ポインタ
2777 * @param price 現在の交渉価格
2778 * @param final 最終確定価格ならばTRUE
2779 * @return プレイヤーを締め出す場合TRUEを返す
2781 static int get_haggle(cptr pmt, s32b *poffer, s32b price, int final)
2791 /* Clear old increment if necessary */
2792 if (!allow_inc) last_inc = 0L;
2799 sprintf(buf, "%s [承諾] ", pmt);
2801 sprintf(buf, "%s [accept] ", pmt);
2806 /* Old (negative) increment, and not final */
2807 else if (last_inc < 0)
2810 sprintf(buf, "%s [-$%ld] ", pmt, (long)(ABS(last_inc)));
2812 sprintf(buf, "%s [-%ld] ", pmt, (long)(ABS(last_inc)));
2817 /* Old (positive) increment, and not final */
2818 else if (last_inc > 0)
2821 sprintf(buf, "%s [+$%ld] ", pmt, (long)(ABS(last_inc)));
2823 sprintf(buf, "%s [+%ld] ", pmt, (long)(ABS(last_inc)));
2831 sprintf(buf, "%s ", pmt);
2835 /* Paranoia XXX XXX XXX */
2839 /* Ask until done */
2844 /* Display prompt */
2848 strcpy(out_val, "");
2851 * Ask the user for a response.
2852 * Don't allow to use numpad as cursor key.
2854 res = askfor_aux(out_val, 32, FALSE);
2860 if (!res) return FALSE;
2862 /* Skip leading spaces */
2863 for (p = out_val; *p == ' '; p++) /* loop */;
2865 /* Empty response */
2868 /* Accept current price */
2876 /* Use previous increment */
2877 if (allow_inc && last_inc)
2879 *poffer += last_inc;
2884 /* Normal response */
2887 /* Extract a number */
2890 /* Handle "incremental" number */
2891 if ((*p == '+' || *p == '-'))
2893 /* Allow increments */
2896 /* Use the given "increment" */
2903 /* Handle normal number */
2906 /* Use the given "number" */
2915 msg_print("値がおかしいです。");
2917 msg_print("Invalid response.");
2929 * @brief 店主がプレイヤーからの交渉価格を判断する /
2930 * Receive an offer (from the player)
2932 * @param poffer 店主からの交渉価格を返す参照ポインタ
2933 * @param last_offer 現在の交渉価格
2934 * @param factor 店主の価格基準倍率
2935 * @param price アイテムの実価値
2936 * @param final 最終価格確定ならばTRUE
2937 * @return プレイヤーの価格に対して不服ならばTRUEを返す /
2938 * Return TRUE if offer is NOT okay
2940 static bool receive_offer(cptr pmt, s32b *poffer,
2941 s32b last_offer, int factor,
2942 s32b price, int final)
2944 /* Haggle till done */
2947 /* Get a haggle (or cancel) */
2948 if (!get_haggle(pmt, poffer, price, final)) return (TRUE);
2950 /* Acceptable offer */
2951 if (((*poffer) * factor) >= (last_offer * factor)) break;
2953 /* Insult, and check for kicked out */
2954 if (haggle_insults()) return (TRUE);
2956 /* Reject offer (correctly) */
2957 (*poffer) = last_offer;
2966 * @brief プレイヤーが購入する時の値切り処理メインルーチン /
2967 * Haggling routine -RAK-
2968 * @param o_ptr オブジェクトの構造体参照ポインタ
2969 * @param price 最終価格を返す参照ポインタ
2970 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
2971 * Return TRUE if purchase is NOT successful
2973 static bool purchase_haggle(object_type *o_ptr, s32b *price)
2975 s32b cur_ask, final_ask;
2976 s32b last_offer, offer;
2978 s32b min_per, max_per;
2979 int flag, loop_flag, noneed;
2980 int annoyed = 0, final = FALSE;
2982 bool cancel = FALSE;
2987 cptr pmt = "Asking";
2997 /* Extract the starting offer and the final offer */
2998 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, FALSE);
2999 final_ask = price_item(o_ptr, ot_ptr->min_inflate, FALSE);
3001 /* Determine if haggling is necessary */
3002 noneed = noneedtobargain(final_ask);
3004 /* No need to haggle */
3005 if (noneed || !manual_haggle)
3007 /* No need to haggle */
3010 /* Message summary */
3012 msg_print("結局この金額にまとまった。");
3014 msg_print("You eventually agree upon the price.");
3020 /* No haggle option */
3023 /* Message summary */
3025 msg_print("すんなりとこの金額にまとまった。");
3027 msg_print("You quickly agree upon the price.");
3032 /* Apply Sales Tax */
3033 final_ask += final_ask / 10;
3037 cur_ask = final_ask;
3039 /* Go to final offer */
3043 pmt = "Final Offer";
3050 /* Haggle for the whole pile */
3051 cur_ask *= o_ptr->number;
3052 final_ask *= o_ptr->number;
3055 /* Haggle parameters */
3056 min_per = ot_ptr->haggle_per;
3057 max_per = min_per * 3;
3059 /* Mega-Hack -- artificial "last offer" value */
3060 last_offer = object_value(o_ptr) * o_ptr->number;
3061 last_offer = last_offer * (200 - (int)(ot_ptr->max_inflate)) / 100L;
3062 if (last_offer <= 0) last_offer = 1;
3067 /* No incremental haggling yet */
3070 /* Haggle until done */
3071 for (flag = FALSE; !flag; )
3075 while (!flag && loop_flag)
3077 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3078 put_str(out_val, 1, 0);
3080 cancel = receive_offer("提示する金額? ",
3082 cancel = receive_offer("What do you offer? ",
3085 &offer, last_offer, 1, cur_ask, final);
3091 else if (offer > cur_ask)
3096 else if (offer == cur_ask)
3109 x1 = 100 * (offer - last_offer) / (cur_ask - last_offer);
3112 if (haggle_insults())
3118 else if (x1 > max_per)
3121 if (x1 < max_per) x1 = max_per;
3123 x2 = rand_range(x1-2, x1+2);
3124 x3 = ((cur_ask - offer) * x2 / 100L) + 1;
3125 /* don't let the price go up */
3130 if (cur_ask < final_ask)
3133 cur_ask = final_ask;
3137 pmt = "Final Offer";
3143 (void)(increase_insults());
3148 else if (offer >= cur_ask)
3160 (void)sprintf(out_val, "前回の提示金額: $%ld",
3162 (void)sprintf(out_val, "Your last offer: %ld",
3166 put_str(out_val, 1, 39);
3167 say_comment_2(cur_ask, annoyed);
3173 if (cancel) return (TRUE);
3175 /* Update bargaining info */
3176 updatebargain(*price, final_ask, o_ptr->number);
3184 * @brief プレイヤーが売却する時の値切り処理メインルーチン /
3185 * Haggling routine -RAK-
3186 * @param o_ptr オブジェクトの構造体参照ポインタ
3187 * @param price 最終価格を返す参照ポインタ
3188 * @return プレイヤーの価格に対して店主が不服ならばTRUEを返す /
3189 * Return TRUE if purchase is NOT successful
3191 static bool sell_haggle(object_type *o_ptr, s32b *price)
3193 s32b purse, cur_ask, final_ask;
3194 s32b last_offer = 0, offer = 0;
3196 s32b min_per, max_per;
3197 int flag, loop_flag, noneed;
3198 int annoyed = 0, final = FALSE;
3199 bool cancel = FALSE;
3212 /* Obtain the starting offer and the final offer */
3213 cur_ask = price_item(o_ptr, ot_ptr->max_inflate, TRUE);
3214 final_ask = price_item(o_ptr, ot_ptr->min_inflate, TRUE);
3216 /* Determine if haggling is necessary */
3217 noneed = noneedtobargain(final_ask);
3219 /* Get the owner's payout limit */
3220 purse = (s32b)(ot_ptr->max_cost);
3222 /* No need to haggle */
3223 if (noneed || !manual_haggle || (final_ask >= purse))
3225 /* Apply Sales Tax (if needed) */
3226 if (!manual_haggle && !noneed)
3228 final_ask -= final_ask / 10;
3231 /* No reason to haggle */
3232 if (final_ask >= purse)
3236 msg_print("即座にこの金額にまとまった。");
3238 msg_print("You instantly agree upon the price.");
3243 /* Offer full purse */
3247 /* No need to haggle */
3252 msg_print("結局この金額にまとまった。");
3254 msg_print("You eventually agree upon the price.");
3260 /* No haggle option */
3263 /* Message summary */
3265 msg_print("すんなりとこの金額にまとまった。");
3267 msg_print("You quickly agree upon the price.");
3274 cur_ask = final_ask;
3281 pmt = "Final Offer";
3286 /* Haggle for the whole pile */
3287 cur_ask *= o_ptr->number;
3288 final_ask *= o_ptr->number;
3291 /* XXX XXX XXX Display commands */
3293 /* Haggling parameters */
3294 min_per = ot_ptr->haggle_per;
3295 max_per = min_per * 3;
3297 /* Mega-Hack -- artificial "last offer" value */
3298 last_offer = object_value(o_ptr) * o_ptr->number;
3299 last_offer = last_offer * ot_ptr->max_inflate / 100L;
3304 /* No incremental haggling yet */
3308 for (flag = FALSE; !flag; )
3314 (void)sprintf(out_val, "%s : %ld", pmt, (long)cur_ask);
3315 put_str(out_val, 1, 0);
3317 cancel = receive_offer("提示する価格? ",
3319 cancel = receive_offer("What price do you ask? ",
3322 &offer, last_offer, -1, cur_ask, final);
3328 else if (offer < cur_ask)
3331 /* rejected, reset offer for incremental haggling */
3334 else if (offer == cur_ask)
3345 if (flag || !loop_flag) break;
3350 x1 = 100 * (last_offer - offer) / (last_offer - cur_ask);
3353 if (haggle_insults())
3359 else if (x1 > max_per)
3362 if (x1 < max_per) x1 = max_per;
3364 x2 = rand_range(x1-2, x1+2);
3365 x3 = ((offer - cur_ask) * x2 / 100L) + 1;
3366 /* don't let the price go down */
3370 if (cur_ask > final_ask)
3372 cur_ask = final_ask;
3377 pmt = "Final Offer";
3385 /* 追加 $0 で買い取られてしまうのを防止 By FIRST*/
3388 (void)(increase_insults());
3391 else if (offer <= cur_ask)
3402 (void)sprintf(out_val,
3404 "前回の提示価格 $%ld", (long)last_offer);
3406 "Your last bid %ld", (long)last_offer);
3409 put_str(out_val, 1, 39);
3410 say_comment_3(cur_ask, annoyed);
3416 if (cancel) return (TRUE);
3418 /* Update bargaining info */
3419 updatebargain(*price, final_ask, o_ptr->number);
3427 * @brief 店からの購入処理のメインルーチン /
3428 * Buy an item from a store -RAK-
3431 static void store_purchase(void)
3445 char o_name[MAX_NLEN];
3449 if (cur_store_num == STORE_MUSEUM)
3452 msg_print("博物館から取り出すことはできません。");
3454 msg_print("Museum.");
3460 if (st_ptr->stock_num <= 0)
3462 if (cur_store_num == STORE_HOME)
3464 msg_print("我が家には何も置いてありません。");
3466 msg_print("Your home is empty.");
3471 msg_print("現在商品の在庫を切らしています。");
3473 msg_print("I am currently out of stock.");
3480 /* Find the number of objects on this and following pages */
3481 i = (st_ptr->stock_num - store_top);
3483 /* And then restrict it to the current page */
3484 if (i > store_bottom) i = store_bottom;
3488 /* ブラックマーケットの時は別のメッセージ */
3489 switch( cur_store_num ) {
3491 sprintf(out_val, "どのアイテムを取りますか? ");
3494 sprintf(out_val, "どれ? ");
3497 sprintf(out_val, "どの品物が欲しいんだい? ");
3501 if (cur_store_num == STORE_HOME)
3503 sprintf(out_val, "Which item do you want to take? ");
3507 sprintf(out_val, "Which item are you interested in? ");
3512 /* Get the item number to be bought */
3513 if (!get_stock(&item, out_val, 0, i - 1)) return;
3515 /* Get the actual index */
3516 item = item + store_top;
3518 /* Get the actual item */
3519 o_ptr = &st_ptr->stock[item];
3521 /* Assume the player wants just one of them */
3524 /* Get local object */
3527 /* Get a copy of the object */
3528 object_copy(j_ptr, o_ptr);
3531 * If a rod or wand, allocate total maximum timeouts or charges
3532 * between those purchased and left on the shelf.
3534 reduce_charges(j_ptr, o_ptr->number - amt);
3536 /* Modify quantity */
3537 j_ptr->number = amt;
3539 /* Hack -- require room in pack */
3540 if (!inven_carry_okay(j_ptr))
3543 msg_print("そんなにアイテムを持てない。");
3545 msg_print("You cannot carry that many different items.");
3551 /* Determine the "best" price (per item) */
3552 best = price_item(j_ptr, ot_ptr->min_inflate, FALSE);
3554 /* Find out how many the player wants */
3555 if (o_ptr->number > 1)
3557 /* Hack -- note cost of "fixed" items */
3558 if ((cur_store_num != STORE_HOME) &&
3559 (o_ptr->ident & IDENT_FIXED))
3562 msg_format("一つにつき $%ldです。", (long)(best));
3564 msg_format("That costs %ld gold per item.", (long)(best));
3569 /* Get a quantity */
3570 amt = get_quantity(NULL, o_ptr->number);
3572 /* Allow user abort */
3573 if (amt <= 0) return;
3576 /* Get local object */
3579 /* Get desired object */
3580 object_copy(j_ptr, o_ptr);
3583 * If a rod or wand, allocate total maximum timeouts or charges
3584 * between those purchased and left on the shelf.
3586 reduce_charges(j_ptr, o_ptr->number - amt);
3588 /* Modify quantity */
3589 j_ptr->number = amt;
3591 /* Hack -- require room in pack */
3592 if (!inven_carry_okay(j_ptr))
3595 msg_print("ザックにそのアイテムを入れる隙間がない。");
3597 msg_print("You cannot carry that many items.");
3603 /* Attempt to buy it */
3604 if (cur_store_num != STORE_HOME)
3606 /* Fixed price, quick buy */
3607 if (o_ptr->ident & (IDENT_FIXED))
3612 /* Go directly to the "best" deal */
3613 price = (best * j_ptr->number);
3619 /* Describe the object (fully) */
3620 object_desc(o_name, j_ptr, 0);
3624 msg_format("%s(%c)を購入する。", o_name, I2A(item));
3626 msg_format("Buying %s (%c).", o_name, I2A(item));
3631 /* Haggle for a final price */
3632 choice = purchase_haggle(j_ptr, &price);
3634 /* Hack -- Got kicked out */
3635 if (st_ptr->store_open >= turn) return;
3638 /* Player wants it */
3641 /* Fix the item price (if "correctly" haggled) */
3642 if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED);
3644 /* Player can afford it */
3645 if (p_ptr->au >= price)
3650 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
3651 chg_virtue(V_JUSTICE, -1);
3652 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
3653 chg_virtue(V_NATURE, -1);
3661 /* Spend the money */
3664 /* Update the display */
3667 /* Hack -- buying an item makes you aware of it */
3668 object_aware(j_ptr);
3670 /* Hack -- clear the "fixed" flag from the item */
3671 j_ptr->ident &= ~(IDENT_FIXED);
3673 /* Describe the transaction */
3674 object_desc(o_name, j_ptr, 0);
3678 msg_format("%sを $%ldで購入しました。", o_name, (long)price);
3680 msg_format("You bought %s for %ld gold.", o_name, (long)price);
3683 strcpy(record_o_name, o_name);
3686 if (record_buy) do_cmd_write_nikki(NIKKI_BUY, 0, o_name);
3687 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3688 if(record_rand_art && o_ptr->art_name)
3689 do_cmd_write_nikki(NIKKI_ART, 0, o_name);
3691 /* Erase the inscription */
3692 j_ptr->inscription = 0;
3694 /* Erase the "feeling" */
3695 j_ptr->feeling = FEEL_NONE;
3696 j_ptr->ident &= ~(IDENT_STORE);
3697 /* Give it to the player */
3698 item_new = inven_carry(j_ptr);
3700 /* Describe the final result */
3701 object_desc(o_name, &inventory[item_new], 0);
3705 msg_format("%s(%c)を手に入れた。", o_name, index_to_label(item_new));
3707 msg_format("You have %s (%c).",
3708 o_name, index_to_label(item_new));
3711 /* Auto-inscription */
3712 autopick_alter_item(item_new, FALSE);
3714 /* Now, reduce the original stack's pval. */
3715 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3717 o_ptr->pval -= j_ptr->pval;
3723 /* Note how many slots the store used to have */
3724 i = st_ptr->stock_num;
3726 /* Remove the bought items from the store */
3727 store_item_increase(item, -amt);
3728 store_item_optimize(item);
3730 /* Store is empty */
3731 if (st_ptr->stock_num == 0)
3734 if (one_in_(STORE_SHUFFLE))
3739 msg_print("店主は引退した。");
3741 msg_print("The shopkeeper retires.");
3745 /* Shuffle the store */
3746 store_shuffle(cur_store_num);
3749 sprintf(buf, "%s (%s)",
3750 ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
3751 put_str(buf, 3, 10);
3752 sprintf(buf, "%s (%ld)",
3753 (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
3762 msg_print("店主は新たな在庫を取り出した。");
3764 msg_print("The shopkeeper brings out some new stock.");
3770 for (i = 0; i < 10; i++)
3772 /* Maintain the store */
3773 store_maint(p_ptr->town_num, cur_store_num);
3779 /* Redraw everything */
3780 display_inventory();
3783 /* The item is gone */
3784 else if (st_ptr->stock_num != i)
3786 /* Pick the correct screen */
3787 if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3789 /* Redraw everything */
3790 display_inventory();
3793 /* Item is still here */
3796 /* Redraw the item */
3797 display_entry(item);
3801 /* Player cannot afford it */
3804 /* Simple message (no insult) */
3806 msg_print("お金が足りません。");
3808 msg_print("You do not have enough gold.");
3815 /* Home is much easier */
3818 bool combined_or_reordered;
3820 /* Distribute charges of wands/rods */
3821 distribute_charges(o_ptr, j_ptr, amt);
3823 /* Give it to the player */
3824 item_new = inven_carry(j_ptr);
3826 /* Describe just the result */
3827 object_desc(o_name, &inventory[item_new], 0);
3831 msg_format("%s(%c)を取った。",
3833 msg_format("You have %s (%c).",
3835 o_name, index_to_label(item_new));
3840 /* Take note if we take the last one */
3841 i = st_ptr->stock_num;
3843 /* Remove the items from the home */
3844 store_item_increase(item, -amt);
3845 store_item_optimize(item);
3847 combined_or_reordered = combine_and_reorder_home(STORE_HOME);
3849 /* Hack -- Item is still here */
3850 if (i == st_ptr->stock_num)
3852 /* Redraw everything */
3853 if (combined_or_reordered) display_inventory();
3855 /* Redraw the item */
3856 else display_entry(item);
3859 /* The item is gone */
3863 if (st_ptr->stock_num == 0) store_top = 0;
3865 /* Nothing left on that screen */
3866 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
3868 /* Redraw everything */
3869 display_inventory();
3871 chg_virtue(V_SACRIFICE, 1);
3875 /* Not kicked out */
3881 * @brief 店からの売却処理のメインルーチン /
3882 * Sell an item to the store (or home)
3885 static void store_sell(void)
3891 s32b price, value, dummy;
3900 char o_name[MAX_NLEN];
3903 /* Prepare a prompt */
3904 if (cur_store_num == STORE_HOME)
3906 q = "どのアイテムを置きますか? ";
3908 q = "Drop which item? ";
3911 else if (cur_store_num == STORE_MUSEUM)
3913 q = "どのアイテムを寄贈しますか? ";
3915 q = "Give which item? ";
3920 q = "どのアイテムを売りますか? ";
3922 q = "Sell which item? ";
3926 item_tester_no_ryoute = TRUE;
3927 /* Only allow items the store will buy */
3928 item_tester_hook = store_will_buy;
3931 /* 我が家でおかしなメッセージが出るオリジナルのバグを修正 */
3932 if (cur_store_num == STORE_HOME)
3935 s = "置けるアイテムを持っていません。";
3937 s = "You don't have any item to drop.";
3940 else if (cur_store_num == STORE_MUSEUM)
3943 s = "寄贈できるアイテムを持っていません。";
3945 s = "You don't have any item to give.";
3953 s = "You have nothing that I want.";
3957 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
3959 /* Get the item (in the pack) */
3962 o_ptr = &inventory[item];
3965 /* Get the item (on the floor) */
3968 o_ptr = &o_list[0 - item];
3972 /* Hack -- Cannot remove cursed items */
3973 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
3977 msg_print("ふーむ、どうやらそれは呪われているようだね。");
3979 msg_print("Hmmm, it seems to be cursed.");
3988 /* Assume one item */
3991 /* Find out how many the player wants (letter means "all") */
3992 if (o_ptr->number > 1)
3994 /* Get a quantity */
3995 amt = get_quantity(NULL, o_ptr->number);
3997 /* Allow user abort */
3998 if (amt <= 0) return;
4001 /* Get local object */
4004 /* Get a copy of the object */
4005 object_copy(q_ptr, o_ptr);
4007 /* Modify quantity */
4008 q_ptr->number = amt;
4011 * Hack -- If a rod or wand, allocate total maximum
4012 * timeouts or charges to those being sold. -LM-
4014 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4016 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4019 /* Get a full description */
4020 object_desc(o_name, q_ptr, 0);
4022 /* Remove any inscription, feeling for stores */
4023 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4025 q_ptr->inscription = 0;
4026 q_ptr->feeling = FEEL_NONE;
4029 /* Is there room in the store (or the home?) */
4030 if (!store_check_num(q_ptr))
4032 if (cur_store_num == STORE_HOME)
4034 msg_print("我が家にはもう置く場所がない。");
4036 msg_print("Your home is full.");
4039 else if (cur_store_num == STORE_MUSEUM)
4041 msg_print("博物館はもう満杯だ。");
4043 msg_print("Museum is full.");
4048 msg_print("すいませんが、店にはもう置く場所がありません。");
4050 msg_print("I have not the room in my store to keep it.");
4058 if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM))
4060 /* Describe the transaction */
4062 msg_format("%s(%c)を売却する。", o_name, index_to_label(item));
4064 msg_format("Selling %s (%c).", o_name, index_to_label(item));
4070 choice = sell_haggle(q_ptr, &price);
4073 if (st_ptr->store_open >= turn) return;
4085 if (cur_store_num == STORE_BLACK) /* The black market is illegal! */
4086 chg_virtue(V_JUSTICE, -1);
4088 if((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
4089 chg_virtue(V_NATURE, 1);
4092 /* Get some money */
4095 /* Update the display */
4098 /* Get the "apparent" value */
4099 dummy = object_value(q_ptr) * q_ptr->number;
4102 identify_item(o_ptr);
4104 /* Get local object */
4107 /* Get a copy of the object */
4108 object_copy(q_ptr, o_ptr);
4110 /* Modify quantity */
4111 q_ptr->number = amt;
4113 /* Make it look like to be known */
4114 q_ptr->ident |= IDENT_STORE;
4117 * Hack -- If a rod or wand, let the shopkeeper know just
4118 * how many charges he really paid for. -LM-
4120 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
4122 q_ptr->pval = o_ptr->pval * amt / o_ptr->number;
4125 /* Get the "actual" value */
4126 value = object_value(q_ptr) * q_ptr->number;
4128 /* Get the description all over again */
4129 object_desc(o_name, q_ptr, 0);
4131 /* Describe the result (in message buffer) */
4133 msg_format("%sを $%ldで売却しました。", o_name, (long)price);
4135 msg_format("You sold %s for %ld gold.", o_name, (long)price);
4138 if (record_sell) do_cmd_write_nikki(NIKKI_SELL, 0, o_name);
4140 if (!((o_ptr->tval == TV_FIGURINE) && (value > 0)))
4142 /* Analyze the prices (and comment verbally) unless a figurine*/
4143 purchase_analyze(price, value, dummy);
4147 * Hack -- Allocate charges between those wands or rods sold
4148 * and retained, unless all are being sold. -LM-
4150 distribute_charges(o_ptr, q_ptr, amt);
4152 /* Reset timeouts of the sold items */
4155 /* Take the item from the player, describe the result */
4156 inven_item_increase(item, -amt);
4157 inven_item_describe(item);
4159 /* If items remain, auto-inscribe before optimizing */
4160 if (o_ptr->number > 0)
4161 autopick_alter_item(item, FALSE);
4163 inven_item_optimize(item);
4168 /* The store gets that (known) item */
4169 item_pos = store_carry(q_ptr);
4171 /* Re-display if item is now in store */
4174 store_top = (item_pos / store_bottom) * store_bottom;
4175 display_inventory();
4180 /* Player is at museum */
4181 else if (cur_store_num == STORE_MUSEUM)
4183 char o2_name[MAX_NLEN];
4184 object_desc(o2_name, q_ptr, OD_NAME_ONLY);
4186 if (-1 == store_check_num(q_ptr))
4189 msg_print("それと同じ品物は既に博物館にあるようです。");
4191 msg_print("The same object as it is already in the Museum.");
4197 msg_print("博物館に寄贈したものは取り出すことができません!!");
4199 msg_print("You cannot take items which is given to the Museum back!!");
4203 if (!get_check(format("本当に%sを寄贈しますか?", o2_name))) return;
4205 if (!get_check(format("Really give %s to the Museum? ", o2_name))) return;
4209 identify_item(q_ptr);
4210 q_ptr->ident |= IDENT_MENTAL;
4212 /* Distribute charges of wands/rods */
4213 distribute_charges(o_ptr, q_ptr, amt);
4217 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4219 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4224 /* Take it from the players inventory */
4225 inven_item_increase(item, -amt);
4226 inven_item_describe(item);
4227 inven_item_optimize(item);
4232 /* Let the home carry it */
4233 item_pos = home_carry(q_ptr);
4235 /* Update store display */
4238 store_top = (item_pos / store_bottom) * store_bottom;
4239 display_inventory();
4242 /* Player is at home */
4245 /* Distribute charges of wands/rods */
4246 distribute_charges(o_ptr, q_ptr, amt);
4250 msg_format("%sを置いた。(%c)", o_name, index_to_label(item));
4252 msg_format("You drop %s (%c).", o_name, index_to_label(item));
4257 /* Take it from the players inventory */
4258 inven_item_increase(item, -amt);
4259 inven_item_describe(item);
4260 inven_item_optimize(item);
4265 /* Let the home carry it */
4266 item_pos = home_carry(q_ptr);
4268 /* Update store display */
4271 store_top = (item_pos / store_bottom) * store_bottom;
4272 display_inventory();
4276 if ((choice == 0) && (item >= INVEN_RARM))
4285 * @brief 店のアイテムを調べるコマンドのメインルーチン /
4286 * Examine an item in a store -JDL-
4289 static void store_examine(void)
4294 char o_name[MAX_NLEN];
4299 if (st_ptr->stock_num <= 0)
4301 if (cur_store_num == STORE_HOME)
4303 msg_print("我が家には何も置いてありません。");
4305 msg_print("Your home is empty.");
4308 else if (cur_store_num == STORE_MUSEUM)
4310 msg_print("博物館には何も置いてありません。");
4312 msg_print("Museum is empty.");
4317 msg_print("現在商品の在庫を切らしています。");
4319 msg_print("I am currently out of stock.");
4326 /* Find the number of objects on this and following pages */
4327 i = (st_ptr->stock_num - store_top);
4329 /* And then restrict it to the current page */
4330 if (i > store_bottom) i = store_bottom;
4334 sprintf(out_val, "どれを調べますか?");
4336 sprintf(out_val, "Which item do you want to examine? ");
4340 /* Get the item number to be examined */
4341 if (!get_stock(&item, out_val, 0, i - 1)) return;
4343 /* Get the actual index */
4344 item = item + store_top;
4346 /* Get the actual item */
4347 o_ptr = &st_ptr->stock[item];
4349 /* Require full knowledge */
4350 if (!(o_ptr->ident & IDENT_MENTAL))
4352 /* This can only happen in the home */
4354 msg_print("このアイテムについて特に知っていることはない。");
4356 msg_print("You have no special knowledge about that item.");
4363 object_desc(o_name, o_ptr, 0);
4367 msg_format("%sを調べている...", o_name);
4369 msg_format("Examining %s...", o_name);
4373 /* Describe it fully */
4374 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL))
4376 msg_print("特に変わったところはないようだ。");
4378 msg_print("You see nothing special.");
4387 * @brief 博物館のアイテムを除去するコマンドのメインルーチン /
4388 * Remove an item from museum (Originally from TOband)
4391 static void museum_remove_object(void)
4396 char o_name[MAX_NLEN];
4400 if (st_ptr->stock_num <= 0)
4403 msg_print("博物館には何も置いてありません。");
4405 msg_print("Museum is empty.");
4411 /* Find the number of objects on this and following pages */
4412 i = st_ptr->stock_num - store_top;
4414 /* And then restrict it to the current page */
4415 if (i > store_bottom) i = store_bottom;
4419 sprintf(out_val, "どのアイテムの展示をやめさせますか?");
4421 sprintf(out_val, "Which item do you want to order to remove? ");
4424 /* Get the item number to be removed */
4425 if (!get_stock(&item, out_val, 0, i - 1)) return;
4427 /* Get the actual index */
4428 item = item + store_top;
4430 /* Get the actual item */
4431 o_ptr = &st_ptr->stock[item];
4434 object_desc(o_name, o_ptr, 0);
4437 msg_print("展示をやめさせたアイテムは二度と見ることはできません!");
4438 if (!get_check(format("本当に%sの展示をやめさせますか?", o_name))) return;
4440 msg_print("You cannot see items which is removed from the Museum!");
4441 if (!get_check(format("Really order to remove %s from the Museum? ", o_name))) return;
4446 msg_format("%sの展示をやめさせた。", o_name);
4448 msg_format("You ordered to remove %s.", o_name);
4451 /* Remove the items from the home */
4452 store_item_increase(item, -o_ptr->number);
4453 store_item_optimize(item);
4455 (void)combine_and_reorder_home(STORE_MUSEUM);
4457 /* The item is gone */
4460 if (st_ptr->stock_num == 0) store_top = 0;
4462 /* Nothing left on that screen */
4463 else if (store_top >= st_ptr->stock_num) store_top -= store_bottom;
4465 /* Redraw everything */
4466 display_inventory();
4473 * Hack -- set this to leave the store
4475 static bool leave_store = FALSE;
4479 * @brief 店舗処理コマンド選択のメインルーチン /
4480 * Process a command in a store
4484 * Note that we must allow the use of a few "special" commands
4485 * in the stores which are not allowed in the dungeon, and we
4486 * must disable some commands which are allowed in the dungeon
4487 * but not in the stores, to prevent chaos.
4490 static void store_process_command(void)
4492 #ifdef ALLOW_REPEAT /* TNB */
4494 /* Handle repeating the last command */
4497 #endif /* ALLOW_REPEAT -- TNB */
4499 if (rogue_like_commands && command_cmd == 'l')
4501 command_cmd = 'x'; /* hack! */
4504 /* Parse the command */
4505 switch (command_cmd)
4515 /* 1 ページ戻るコマンド: 我が家のページ数が多いので重宝するはず By BUG */
4518 if (st_ptr->stock_num <= store_bottom) {
4520 msg_print("これで全部です。");
4522 msg_print("Entire inventory is shown.");
4526 store_top -= store_bottom;
4527 if ( store_top < 0 )
4528 store_top = ((st_ptr->stock_num - 1 )/store_bottom) * store_bottom;
4529 if ( (cur_store_num == STORE_HOME) && (powerup_home == FALSE) )
4530 if ( store_top >= store_bottom ) store_top = store_bottom;
4531 display_inventory();
4539 if (st_ptr->stock_num <= store_bottom)
4542 msg_print("これで全部です。");
4544 msg_print("Entire inventory is shown.");
4550 store_top += store_bottom;
4552 * 隠しオプション(powerup_home)がセットされていないときは
4553 * 我が家では 2 ページまでしか表示しない
4555 if ((cur_store_num == STORE_HOME) &&
4556 (powerup_home == FALSE) &&
4557 (st_ptr->stock_num >= STORE_INVEN_MAX))
4559 if (store_top >= (STORE_INVEN_MAX - 1))
4566 if (store_top >= st_ptr->stock_num) store_top = 0;
4569 display_inventory();
4582 /* Get (purchase) */
4609 /*** Inventory Commands ***/
4611 /* Wear/wield equipment */
4618 /* Take off equipment */
4625 /* Destroy an item */
4632 /* Equipment list */
4639 /* Inventory list */
4647 /*** Various commands ***/
4649 /* Identify an object */
4656 /* Hack -- toggle windows */
4659 toggle_inven_equip();
4665 /*** Use various objects ***/
4670 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4671 (p_ptr->pclass == CLASS_BERSERKER) ||
4672 (p_ptr->pclass == CLASS_NINJA) ||
4673 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4674 ) do_cmd_mind_browse();
4675 else if (p_ptr->pclass == CLASS_SMITH)
4677 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4678 do_cmd_magic_eater(TRUE, FALSE);
4679 else if (p_ptr->pclass == CLASS_SNIPER)
4680 do_cmd_snipe_browse();
4681 else do_cmd_browse();
4685 /* Inscribe an object */
4692 /* Uninscribe an object */
4695 do_cmd_uninscribe();
4701 /*** Help and Such ***/
4710 /* Identify symbol */
4713 do_cmd_query_symbol();
4717 /* Character description */
4720 p_ptr->town_num = old_town_num;
4721 do_cmd_change_name();
4722 p_ptr->town_num = inner_town_num;
4728 /*** System Commands ***/
4730 /* Hack -- User interface */
4737 /* Single line from a pref file */
4740 p_ptr->town_num = old_town_num;
4742 p_ptr->town_num = inner_town_num;
4746 /* Interact with macros */
4749 p_ptr->town_num = old_town_num;
4751 p_ptr->town_num = inner_town_num;
4755 /* Interact with visuals */
4758 p_ptr->town_num = old_town_num;
4760 p_ptr->town_num = inner_town_num;
4764 /* Interact with colors */
4767 p_ptr->town_num = old_town_num;
4769 p_ptr->town_num = inner_town_num;
4773 /* Interact with options */
4777 (void)combine_and_reorder_home(STORE_HOME);
4783 /*** Misc Commands ***/
4799 /* Repeat level feeling */
4806 /* Show previous message */
4809 do_cmd_message_one();
4813 /* Show previous messages */
4826 /* Check artifacts, uniques etc. */
4833 /* Load "screen dump" */
4836 do_cmd_load_screen();
4840 /* Save "screen dump" */
4843 do_cmd_save_screen();
4847 /* Hack -- Unknown command */
4850 if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r'))
4852 museum_remove_object();
4857 msg_print("そのコマンドは店の中では使えません。");
4859 msg_print("That command does not work in stores.");
4870 * @brief 店舗処理全体のメインルーチン /
4871 * Enter a store, and interact with it. *
4875 * Note that we use the standard "request_command()" function
4876 * to get a command, allowing us to use "command_arg" and all
4877 * command macros and other nifty stuff, but we use the special
4878 * "shopping" argument, to force certain commands to be converted
4879 * into other commands, normally, we convert "p" (pray) and "m"
4880 * (cast magic) into "g" (get), and "s" (search) into "d" (drop).
4883 void do_cmd_store(void)
4889 bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */
4893 Term_get_size(&w, &h);
4895 /* Calculate stocks per 1 page */
4896 xtra_stock = MIN(14+26, ((h > 24) ? (h - 24) : 0));
4897 store_bottom = MIN_STOCK + xtra_stock;
4899 /* Access the player grid */
4900 c_ptr = &cave[p_ptr->y][p_ptr->x];
4902 /* Verify a store */
4903 if (!cave_have_flag_grid(c_ptr, FF_STORE))
4906 msg_print("ここには店がありません。");
4908 msg_print("You see no store here.");
4914 /* Extract the store code */
4915 which = f_info[c_ptr->feat].subtype;
4917 old_town_num = p_ptr->town_num;
4918 if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
4919 if (dun_level) p_ptr->town_num = NO_TOWN;
4920 inner_town_num = p_ptr->town_num;
4922 /* Hack -- Check the "locked doors" */
4923 if ((town[p_ptr->town_num].store[which].store_open >= turn) ||
4927 msg_print("ドアに鍵がかかっている。");
4929 msg_print("The doors are locked.");
4932 p_ptr->town_num = old_town_num;
4936 /* Calculate the number of store maintainances since the last visit */
4937 maintain_num = (turn - town[p_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
4939 /* Maintain the store max. 10 times */
4940 if (maintain_num > 10) maintain_num = 10;
4944 /* Maintain the store */
4945 for (i = 0; i < maintain_num; i++)
4946 store_maint(p_ptr->town_num, which);
4948 /* Save the visit */
4949 town[p_ptr->town_num].store[which].last_visit = turn;
4952 /* Forget the lite */
4955 /* Forget the view */
4959 /* Hack -- Character is in "icky" mode */
4960 character_icky = TRUE;
4963 /* No command argument */
4966 /* No repeated command */
4969 /* No automatic command */
4972 /* Do not expand macros */
4973 get_com_no_macros = TRUE;
4975 /* Save the store number */
4976 cur_store_num = which;
4978 /* Hack -- save the store feature */
4979 cur_store_feat = c_ptr->feat;
4981 /* Save the store and owner pointers */
4982 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
4983 ot_ptr = &owners[cur_store_num][st_ptr->owner];
4986 /* Start at the beginning */
4989 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4991 /* Display the store */
4995 leave_store = FALSE;
4997 /* Interact with player */
4998 while (!leave_store)
5000 /* Hack -- Clear line 1 */
5004 clear_from(20 + xtra_stock);
5007 /* Basic commands */
5009 prt(" ESC) 建物から出る", 21 + xtra_stock, 0);
5011 prt(" ESC) Exit from Building.", 21 + xtra_stock, 0);
5015 /* Browse if necessary */
5016 if (st_ptr->stock_num > store_bottom)
5019 prt(" -)前ページ", 22 + xtra_stock, 0);
5020 prt(" スペース) 次ページ", 23 + xtra_stock, 0);
5022 prt(" -) Previous page", 22 + xtra_stock, 0);
5023 prt(" SPACE) Next page", 23 + xtra_stock, 0);
5029 if (cur_store_num == STORE_HOME)
5032 prt("g) アイテムを取る", 21 + xtra_stock, 27);
5033 prt("d) アイテムを置く", 22 + xtra_stock, 27);
5034 prt("x) 家のアイテムを調べる", 23 + xtra_stock, 27);
5036 prt("g) Get an item.", 21 + xtra_stock, 27);
5037 prt("d) Drop an item.", 22 + xtra_stock, 27);
5038 prt("x) eXamine an item in the home.", 23 + xtra_stock, 27);
5042 /* Museum commands */
5043 else if (cur_store_num == STORE_MUSEUM)
5046 prt("d) アイテムを置く", 21 + xtra_stock, 27);
5047 prt("r) アイテムの展示をやめる", 22 + xtra_stock, 27);
5048 prt("x) 博物館のアイテムを調べる", 23 + xtra_stock, 27);
5050 prt("d) Drop an item.", 21 + xtra_stock, 27);
5051 prt("r) order to Remove an item.", 22 + xtra_stock, 27);
5052 prt("x) eXamine an item in the museum.", 23 + xtra_stock, 27);
5056 /* Shop commands XXX XXX XXX */
5060 prt("p) 商品を買う", 21 + xtra_stock, 30);
5061 prt("s) アイテムを売る", 22 + xtra_stock, 30);
5062 prt("x) 商品を調べる", 23 + xtra_stock,30);
5064 prt("p) Purchase an item.", 21 + xtra_stock, 30);
5065 prt("s) Sell an item.", 22 + xtra_stock, 30);
5066 prt("x) eXamine an item in the shop", 23 + xtra_stock,30);
5073 prt("i/e) 持ち物/装備の一覧", 21 + xtra_stock, 56);
5075 if (rogue_like_commands)
5077 prt("w/T) 装備する/はずす", 22 + xtra_stock, 56);
5081 prt("w/t) 装備する/はずす", 22 + xtra_stock, 56);
5084 prt("i/e) Inventry/Equipment list", 21 + xtra_stock, 56);
5086 if (rogue_like_commands)
5088 prt("w/T) Wear/Take off equipment", 22 + xtra_stock, 56);
5092 prt("w/t) Wear/Take off equipment", 22 + xtra_stock, 56);
5097 prt("コマンド:", 20 + xtra_stock, 0);
5099 prt("You may: ", 20 + xtra_stock, 0);
5104 request_command(TRUE);
5106 /* Process the command */
5107 store_process_command();
5110 * Hack -- To redraw missiles damage and prices in store
5111 * If player's charisma changes, or if player changes a bow, PU_BONUS is set
5113 need_redraw_store_inv = (p_ptr->update & PU_BONUS) ? TRUE : FALSE;
5115 /* Hack -- Character is still in "icky" mode */
5116 character_icky = TRUE;
5124 /* XXX XXX XXX Pack Overflow */
5125 if (inventory[INVEN_PACK].k_idx)
5127 int item = INVEN_PACK;
5129 object_type *o_ptr = &inventory[item];
5131 /* Hack -- Flee from the store */
5132 if (cur_store_num != STORE_HOME)
5136 if (cur_store_num == STORE_MUSEUM)
5137 msg_print("ザックからアイテムがあふれそうなので、あわてて博物館から出た...");
5139 msg_print("ザックからアイテムがあふれそうなので、あわてて店から出た...");
5141 if (cur_store_num == STORE_MUSEUM)
5142 msg_print("Your pack is so full that you flee the Museum...");
5144 msg_print("Your pack is so full that you flee the store...");
5152 /* Hack -- Flee from the home */
5153 else if (!store_check_num(o_ptr))
5157 msg_print("ザックからアイテムがあふれそうなので、あわてて家から出た...");
5159 msg_print("Your pack is so full that you flee your home...");
5167 /* Hack -- Drop items into the home */
5175 char o_name[MAX_NLEN];
5178 /* Give a message */
5180 msg_print("ザックからアイテムがあふれてしまった!");
5182 msg_print("Your pack overflows!");
5186 /* Get local object */
5189 /* Grab a copy of the item */
5190 object_copy(q_ptr, o_ptr);
5193 object_desc(o_name, q_ptr, 0);
5197 msg_format("%sが落ちた。(%c)", o_name, index_to_label(item));
5199 msg_format("You drop %s (%c).", o_name, index_to_label(item));
5203 /* Remove it from the players inventory */
5204 inven_item_increase(item, -255);
5205 inven_item_describe(item);
5206 inven_item_optimize(item);
5211 /* Let the home carry it */
5212 item_pos = home_carry(q_ptr);
5214 /* Redraw the home */
5217 store_top = (item_pos / store_bottom) * store_bottom;
5218 display_inventory();
5223 /* Hack -- Redisplay store prices if charisma changes */
5224 /* Hack -- Redraw missiles damage if player changes bow */
5225 if (need_redraw_store_inv) display_inventory();
5227 /* Hack -- get kicked out of the store */
5228 if (st_ptr->store_open >= turn) leave_store = TRUE;
5231 select_floor_music();
5233 p_ptr->town_num = old_town_num;
5235 /* Free turn XXX XXX XXX */
5236 p_ptr->energy_use = 100;
5239 /* Hack -- Character is no longer in "icky" mode */
5240 character_icky = FALSE;
5243 /* Hack -- Cancel automatic command */
5246 /* Hack -- Cancel "see" mode */
5247 command_see = FALSE;
5249 /* Allow expanding macros */
5250 get_com_no_macros = FALSE;
5252 /* Flush messages XXX XXX XXX */
5256 /* Clear the screen */
5260 /* Update everything */
5261 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
5262 p_ptr->update |= (PU_MONSTERS);
5264 /* Redraw entire screen */
5265 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5268 p_ptr->redraw |= (PR_MAP);
5271 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5277 * @brief 現在の町の店主を交代させる /
5278 * Shuffle one of the stores.
5279 * @param which 店舗種類のID
5282 void store_shuffle(int which)
5288 if (which == STORE_HOME) return;
5289 if (which == STORE_MUSEUM) return;
5292 /* Save the store index */
5293 cur_store_num = which;
5295 /* Activate that store */
5296 st_ptr = &town[p_ptr->town_num].store[cur_store_num];
5299 /* Pick a new owner */
5302 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5303 if (j == st_ptr->owner) continue;
5304 for (i = 1;i < max_towns; i++)
5306 if (i == p_ptr->town_num) continue;
5307 if (st_ptr->owner == town[i].store[cur_store_num].owner) break;
5309 if (i == max_towns) break;
5312 /* Activate the new owner */
5313 ot_ptr = &owners[cur_store_num][st_ptr->owner];
5316 /* Reset the owner data */
5317 st_ptr->insult_cur = 0;
5318 st_ptr->store_open = 0;
5319 st_ptr->good_buy = 0;
5320 st_ptr->bad_buy = 0;
5323 /* Hack -- discount all the items */
5324 for (i = 0; i < st_ptr->stock_num; i++)
5329 o_ptr = &st_ptr->stock[i];
5331 if (!object_is_artifact(o_ptr))
5333 /* Hack -- Sell all non-artifact old items for "half price" */
5334 o_ptr->discount = 50;
5336 /* Hack -- Items are no longer "fixed price" */
5337 o_ptr->ident &= ~(IDENT_FIXED);
5339 /* Mega-Hack -- Note that the item is "on sale" */
5341 o_ptr->inscription = quark_add("売出中");
5343 o_ptr->inscription = quark_add("on sale");
5351 * @brief 店の品揃えを変化させる /
5352 * Maintain the inventory at the stores.
5353 * @param town_num 町のID
5354 * @param store_num 店舗種類のID
5357 void store_maint(int town_num, int store_num)
5361 cur_store_num = store_num;
5364 if (store_num == STORE_HOME) return;
5365 if (store_num == STORE_MUSEUM) return;
5367 /* Activate that store */
5368 st_ptr = &town[town_num].store[store_num];
5370 /* Activate the owner */
5371 ot_ptr = &owners[store_num][st_ptr->owner];
5373 /* Store keeper forgives the player */
5374 st_ptr->insult_cur = 0;
5376 /* Mega-Hack -- prune the black market */
5377 if (store_num == STORE_BLACK)
5379 /* Destroy crappy black market items */
5380 for (j = st_ptr->stock_num - 1; j >= 0; j--)
5382 object_type *o_ptr = &st_ptr->stock[j];
5384 /* Destroy crappy items */
5385 if (black_market_crap(o_ptr))
5387 /* Destroy the item */
5388 store_item_increase(j, 0 - o_ptr->number);
5389 store_item_optimize(j);
5395 /* Choose the number of slots to keep */
5396 j = st_ptr->stock_num;
5398 /* Sell a few items */
5399 j = j - randint1(STORE_TURNOVER);
5401 /* Never keep more than "STORE_MAX_KEEP" slots */
5402 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5404 /* Always "keep" at least "STORE_MIN_KEEP" items */
5405 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5407 /* Hack -- prevent "underflow" */
5410 /* Destroy objects until only "j" slots are left */
5411 while (st_ptr->stock_num > j) store_delete();
5414 /* Choose the number of slots to fill */
5415 j = st_ptr->stock_num;
5417 /* Buy some more items */
5418 j = j + randint1(STORE_TURNOVER);
5420 /* Never keep more than "STORE_MAX_KEEP" slots */
5421 if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
5423 /* Always "keep" at least "STORE_MIN_KEEP" items */
5424 if (j < STORE_MIN_KEEP) j = STORE_MIN_KEEP;
5426 /* Hack -- prevent "overflow" */
5427 if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1;
5429 /* Acquire some new items */
5430 while (st_ptr->stock_num < j) store_create();
5435 * @brief 店舗情報を初期化する /
5436 * Initialize the stores
5437 * @param town_num 町のID
5438 * @param store_num 店舗種類のID
5441 void store_init(int town_num, int store_num)
5445 cur_store_num = store_num;
5447 /* Activate that store */
5448 st_ptr = &town[town_num].store[store_num];
5456 st_ptr->owner = (byte)randint0(MAX_OWNERS);
5457 for (i = 1;i < max_towns; i++)
5459 if (i == town_num) continue;
5460 if (st_ptr->owner == town[i].store[store_num].owner) break;
5462 if (i == max_towns) break;
5465 /* Activate the new owner */
5466 ot_ptr = &owners[store_num][st_ptr->owner];
5469 /* Initialize the store */
5470 st_ptr->store_open = 0;
5471 st_ptr->insult_cur = 0;
5472 st_ptr->good_buy = 0;
5473 st_ptr->bad_buy = 0;
5475 /* Nothing in stock */
5476 st_ptr->stock_num = 0;
5479 * MEGA-HACK - Last visit to store is
5480 * BEFORE player birth to enable store restocking
5482 st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5484 /* Clear any old items */
5485 for (k = 0; k < st_ptr->stock_size; k++)
5487 object_wipe(&st_ptr->stock[k]);
5493 * @brief アイテムを町のブラックマーケットに移動させる /
5494 * @param o_ptr 移動させたいオブジェクトの構造体参照ポインタ
5497 void move_to_black_market(object_type *o_ptr)
5500 if (!p_ptr->town_num) return;
5502 st_ptr = &town[p_ptr->town_num].store[STORE_BLACK];
5504 o_ptr->ident |= IDENT_STORE;
5506 (void)store_carry(o_ptr);
5508 object_wipe(o_ptr); /* Don't leave a bogus object behind... */