1 #include "view/display-store.h"
2 #include "flavor/flavor-describer.h"
3 #include "game-option/birth-options.h"
4 #include "game-option/special-options.h"
5 #include "game-option/text-display-options.h"
6 #include "locale/japanese.h"
7 #include "object-enchant/special-object-flags.h"
8 #include "object/object-info.h"
9 #include "player/race-info-table.h"
10 #include "store/pricing.h"
11 #include "store/store-owners.h"
12 #include "store/store-util.h"
13 #include "store/store.h" //!< @todo 相互依存している、こっちは残す?.
14 #include "system/baseitem-info.h"
15 #include "system/item-entity.h"
16 #include "system/player-type-definition.h"
17 #include "system/terrain-type-definition.h"
18 #include "term/gameterm.h"
19 #include "term/screen-processor.h"
20 #include "term/z-form.h"
21 #include "util/enum-converter.h"
22 #include "util/int-char-converter.h"
25 * @brief プレイヤーの所持金を表示する /
26 * Displays players gold -RAK-
27 * @param player_ptr プレイヤーへの参照ポインタ
30 void store_prt_gold(PlayerType *player_ptr)
32 prt(_("手持ちのお金: ", "Gold Remaining: "), 19 + xtra_stock, 53);
33 prt(format("%9ld", (long)player_ptr->au), 19 + xtra_stock, 68);
37 * @brief 店の商品リストを再表示する /
38 * Re-displays a single store entry
39 * @param player_ptr プレイヤーへの参照ポインタ
42 void display_entry(PlayerType *player_ptr, int pos, StoreSaleType store_num)
45 o_ptr = &st_ptr->stock[pos];
46 int i = (pos % store_bottom);
48 /* Label it, clear the line --(-- */
49 prt(format("%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i))), i + 6, 0);
52 if (show_item_graph) {
53 const auto a = o_ptr->get_color();
54 const auto c = o_ptr->get_symbol();
56 term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
64 /* Describe an item in the home */
66 if ((store_num == StoreSaleType::HOME) || (store_num == StoreSaleType::MUSEUM)) {
71 const auto item_name = describe_flavor(player_ptr, o_ptr, 0, maxwid);
72 c_put_str(tval_to_attr[enum2i(o_ptr->bi_key.tval())], item_name, i + 6, cur_col);
75 WEIGHT wgt = o_ptr->weight;
76 put_str(format(_("%3d.%1d kg", "%3d.%d lb"), _(lb_to_kg_integer(wgt), wgt / 10), _(lb_to_kg_fraction(wgt), wgt % 10)), i + 6, _(67, 68));
87 const auto item_name = describe_flavor(player_ptr, o_ptr, 0, maxwid);
88 c_put_str(tval_to_attr[enum2i(o_ptr->bi_key.tval())], item_name, i + 6, cur_col);
91 int wgt = o_ptr->weight;
92 put_str(format("%3d.%1d", _(lb_to_kg_integer(wgt), wgt / 10), _(lb_to_kg_fraction(wgt), wgt % 10)), i + 6, _(60, 61));
95 const auto price = price_item(player_ptr, o_ptr, ot_ptr->inflate, false, store_num);
96 put_str(format("%9ld ", (long)price), i + 6, 68);
100 * @brief 店の商品リストを表示する /
101 * Displays a store's inventory -RAK-
102 * @param player_ptr プレイヤーへの参照ポインタ
104 * All prices are listed as "per individual object". -BEN-
106 void display_store_inventory(PlayerType *player_ptr, StoreSaleType store_num)
109 for (k = 0; k < store_bottom; k++) {
110 if (store_top + k >= st_ptr->stock_num) {
114 display_entry(player_ptr, store_top + k, store_num);
117 for (int i = k; i < store_bottom + 1; i++) {
121 put_str(_(" ", " "), 5, _(20, 22));
122 if (st_ptr->stock_num > store_bottom) {
123 prt(_("-続く-", "-more-"), k + 6, 3);
124 put_str(format(_("(%dページ) ", "(Page %d) "), store_top / store_bottom + 1), 5, _(20, 22));
127 if (store_num == StoreSaleType::HOME || store_num == StoreSaleType::MUSEUM) {
128 k = st_ptr->stock_size;
129 if (store_num == StoreSaleType::HOME && !powerup_home) {
133 put_str(format(_("アイテム数: %4d/%4d", "Objects: %4d/%4d"), st_ptr->stock_num, k), 19 + xtra_stock, _(27, 30));
138 * @brief 店舗情報全体を表示するメインルーチン /
139 * Displays store (after clearing screen) -RAK-
140 * @param player_ptr プレイヤーへの参照ポインタ
143 void display_store(PlayerType *player_ptr, StoreSaleType store_num)
146 if (store_num == StoreSaleType::HOME) {
147 put_str(_("我が家", "Your Home"), 3, 31);
148 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
150 put_str(_(" 重さ", "Weight"), 5, 70);
153 store_prt_gold(player_ptr);
154 display_store_inventory(player_ptr, store_num);
158 if (store_num == StoreSaleType::MUSEUM) {
159 put_str(_("博物館", "Museum"), 3, 31);
160 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
162 put_str(_(" 重さ", "Weight"), 5, 70);
165 store_prt_gold(player_ptr);
166 display_store_inventory(player_ptr, store_num);
170 concptr store_name = terrains_info[cur_store_feat].name.data();
171 concptr owner_name = (ot_ptr->owner_name);
172 concptr race_name = race_info[enum2i(ot_ptr->owner_race)].title;
173 put_str(format("%s (%s)", owner_name, race_name), 3, 10);
175 prt(format("%s (%ld)", store_name, (long)(ot_ptr->max_cost)), 3, 50);
177 put_str(_("商品の一覧", "Item Description"), 5, 5);
179 put_str(_(" 重さ", "Weight"), 5, 60);
182 put_str(_(" 価格", "Price"), 5, 72);
183 store_prt_gold(player_ptr);
184 display_store_inventory(player_ptr, store_num);