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 "grid/feature.h"
7 #include "locale/japanese.h"
8 #include "object-enchant/special-object-flags.h"
9 #include "object/object-info.h"
10 #include "object/object-kind.h"
11 #include "player/race-info-table.h"
12 #include "store/pricing.h"
13 #include "store/store-owners.h"
14 #include "store/store-util.h"
15 #include "store/store.h" //!< @todo 相互依存している、こっちは残す?.
16 #include "system/object-type-definition.h"
17 #include "system/player-type-definition.h"
18 #include "term/gameterm.h"
19 #include "term/screen-processor.h"
20 #include "util/enum-converter.h"
21 #include "util/int-char-converter.h"
24 * @brief プレイヤーの所持金を表示する /
25 * Displays players gold -RAK-
26 * @param player_ptr プレイヤーへの参照ポインタ
29 void store_prt_gold(PlayerType *player_ptr)
31 prt(_("手持ちのお金: ", "Gold Remaining: "), 19 + xtra_stock, 53);
33 sprintf(out_val, "%9ld", (long)player_ptr->au);
34 prt(out_val, 19 + xtra_stock, 68);
38 * @brief 店の商品リストを再表示する /
39 * Re-displays a single store entry
40 * @param player_ptr プレイヤーへの参照ポインタ
43 void display_entry(PlayerType *player_ptr, int pos)
46 o_ptr = &st_ptr->stock[pos];
47 int i = (pos % store_bottom);
49 /* Label it, clear the line --(-- */
51 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
52 prt(out_val, i + 6, 0);
55 if (show_item_graph) {
56 TERM_COLOR a = object_attr(o_ptr);
57 SYMBOL_CODE c = object_char(o_ptr);
59 term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
66 /* Describe an item in the home */
68 if ((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM)) {
73 GAME_TEXT o_name[MAX_NLEN];
74 describe_flavor(player_ptr, o_name, o_ptr, 0);
75 o_name[maxwid] = '\0';
76 c_put_str(tval_to_attr[enum2i(o_ptr->tval)], o_name, i + 6, cur_col);
78 WEIGHT wgt = o_ptr->weight;
79 sprintf(out_val, _("%3d.%1d kg", "%3d.%d lb"), _(lb_to_kg_integer(wgt), wgt / 10), _(lb_to_kg_fraction(wgt), wgt % 10));
80 put_str(out_val, i + 6, _(67, 68));
90 GAME_TEXT o_name[MAX_NLEN];
91 describe_flavor(player_ptr, o_name, o_ptr, 0);
92 o_name[maxwid] = '\0';
93 c_put_str(tval_to_attr[enum2i(o_ptr->tval)], o_name, i + 6, cur_col);
96 int wgt = o_ptr->weight;
97 sprintf(out_val, "%3d.%1d", _(lb_to_kg_integer(wgt), wgt / 10), _(lb_to_kg_fraction(wgt), wgt % 10));
98 put_str(out_val, i + 6, _(60, 61));
101 const auto price = price_item(player_ptr, o_ptr, ot_ptr->inflate, false);
103 (void)sprintf(out_val, "%9ld ", (long)price);
104 put_str(out_val, i + 6, 68);
108 * @brief 店の商品リストを表示する /
109 * Displays a store's inventory -RAK-
110 * @param player_ptr プレイヤーへの参照ポインタ
112 * All prices are listed as "per individual object". -BEN-
114 void display_store_inventory(PlayerType *player_ptr)
117 for (k = 0; k < store_bottom; k++) {
118 if (store_top + k >= st_ptr->stock_num)
121 display_entry(player_ptr, store_top + k);
124 for (int i = k; i < store_bottom + 1; i++)
127 put_str(_(" ", " "), 5, _(20, 22));
128 if (st_ptr->stock_num > store_bottom) {
129 prt(_("-続く-", "-more-"), k + 6, 3);
130 put_str(format(_("(%dページ) ", "(Page %d) "), store_top / store_bottom + 1), 5, _(20, 22));
133 if (cur_store_num == StoreSaleType::HOME || cur_store_num == StoreSaleType::MUSEUM) {
134 k = st_ptr->stock_size;
135 if (cur_store_num == StoreSaleType::HOME && !powerup_home)
138 put_str(format(_("アイテム数: %4d/%4d", "Objects: %4d/%4d"), st_ptr->stock_num, k), 19 + xtra_stock, _(27, 30));
143 * @brief 店舗情報全体を表示するメインルーチン /
144 * Displays store (after clearing screen) -RAK-
145 * @param player_ptr プレイヤーへの参照ポインタ
148 void display_store(PlayerType *player_ptr)
151 if (cur_store_num == StoreSaleType::HOME) {
152 put_str(_("我が家", "Your Home"), 3, 31);
153 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
155 put_str(_(" 重さ", "Weight"), 5, 70);
158 store_prt_gold(player_ptr);
159 display_store_inventory(player_ptr);
163 if (cur_store_num == StoreSaleType::MUSEUM) {
164 put_str(_("博物館", "Museum"), 3, 31);
165 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
167 put_str(_(" 重さ", "Weight"), 5, 70);
170 store_prt_gold(player_ptr);
171 display_store_inventory(player_ptr);
175 concptr store_name = f_info[cur_store_feat].name.c_str();
176 concptr owner_name = (ot_ptr->owner_name);
177 concptr race_name = race_info[enum2i(ot_ptr->owner_race)].title;
179 sprintf(buf, "%s (%s)", owner_name, race_name);
182 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
185 put_str(_("商品の一覧", "Item Description"), 5, 5);
187 put_str(_(" 重さ", "Weight"), 5, 60);
189 put_str(_(" 価格", "Price"), 5, 72);
190 store_prt_gold(player_ptr);
191 display_store_inventory(player_ptr);