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 "object-enchant/special-object-flags.h"
8 #include "object/object-info.h"
9 #include "object/object-kind.h"
10 #include "player/race-info-table.h"
11 #include "store/store-util.h"
12 #include "store/store.h" // todo 相互依存している、こっちは残す?.
13 #include "system/object-type-definition.h"
14 #include "term/gameterm.h"
15 #include "term/screen-processor.h"
16 #include "util/int-char-converter.h"
19 * @brief プレイヤーの所持金を表示する /
20 * Displays players gold -RAK-
21 * @param player_ptr プレーヤーへの参照ポインタ
25 void store_prt_gold(player_type *player_ptr)
27 prt(_("手持ちのお金: ", "Gold Remaining: "), 19 + xtra_stock, 53);
29 sprintf(out_val, "%9ld", (long)player_ptr->au);
30 prt(out_val, 19 + xtra_stock, 68);
34 * @brief 店の商品リストを再表示する /
35 * Re-displays a single store entry
36 * @param player_ptr プレーヤーへの参照ポインタ
40 void display_entry(player_type *player_ptr, int pos)
43 o_ptr = &st_ptr->stock[pos];
44 int i = (pos % store_bottom);
46 /* Label it, clear the line --(-- */
48 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
49 prt(out_val, i + 6, 0);
52 if (show_item_graph) {
53 TERM_COLOR a = object_attr(o_ptr);
54 SYMBOL_CODE c = object_char(o_ptr);
56 term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
63 /* Describe an item in the home */
65 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) {
70 GAME_TEXT o_name[MAX_NLEN];
71 describe_flavor(player_ptr, o_name, o_ptr, 0);
72 o_name[maxwid] = '\0';
73 c_put_str(tval_to_attr[o_ptr->tval], o_name, i + 6, cur_col);
75 WEIGHT wgt = o_ptr->weight;
76 sprintf(out_val, _("%3d.%1d kg", "%3d.%d lb"), _(lbtokg1(wgt), wgt / 10), _(lbtokg2(wgt), wgt % 10));
77 put_str(out_val, i + 6, _(67, 68));
87 GAME_TEXT o_name[MAX_NLEN];
88 describe_flavor(player_ptr, o_name, o_ptr, 0);
89 o_name[maxwid] = '\0';
90 c_put_str(tval_to_attr[o_ptr->tval], o_name, i + 6, cur_col);
93 int wgt = o_ptr->weight;
94 sprintf(out_val, "%3d.%1d", _(lbtokg1(wgt), wgt / 10), _(lbtokg2(wgt), wgt % 10));
95 put_str(out_val, i + 6, _(60, 61));
99 if (o_ptr->ident & IDENT_FIXED) {
100 x = price_item(player_ptr, o_ptr, ot_ptr->min_inflate, FALSE);
101 (void)sprintf(out_val, _("%9ld固", "%9ld F"), (long)x);
102 put_str(out_val, i + 6, 68);
106 if (!manual_haggle) {
107 x = price_item(player_ptr, o_ptr, ot_ptr->min_inflate, FALSE);
108 if (!noneedtobargain(x))
111 (void)sprintf(out_val, "%9ld ", (long)x);
112 put_str(out_val, i + 6, 68);
116 x = price_item(player_ptr, o_ptr, ot_ptr->max_inflate, FALSE);
117 (void)sprintf(out_val, "%9ld ", (long)x);
118 put_str(out_val, i + 6, 68);
122 * @brief 店の商品リストを表示する /
123 * Displays a store's inventory -RAK-
124 * @param player_ptr プレーヤーへの参照ポインタ
127 * All prices are listed as "per individual object". -BEN-
129 void display_store_inventory(player_type *player_ptr)
132 for (k = 0; k < store_bottom; k++) {
133 if (store_top + k >= st_ptr->stock_num)
136 display_entry(player_ptr, store_top + k);
139 for (int i = k; i < store_bottom + 1; i++)
142 put_str(_(" ", " "), 5, _(20, 22));
143 if (st_ptr->stock_num > store_bottom) {
144 prt(_("-続く-", "-more-"), k + 6, 3);
145 put_str(format(_("(%dページ) ", "(Page %d) "), store_top / store_bottom + 1), 5, _(20, 22));
148 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM) {
149 k = st_ptr->stock_size;
150 if (cur_store_num == STORE_HOME && !powerup_home)
153 put_str(format(_("アイテム数: %4d/%4d", "Objects: %4d/%4d"), st_ptr->stock_num, k), 19 + xtra_stock, _(27, 30));
158 * @brief 店舗情報全体を表示するメインルーチン /
159 * Displays store (after clearing screen) -RAK-
160 * @param player_ptr プレーヤーへの参照ポインタ
164 void display_store(player_type *player_ptr)
167 if (cur_store_num == STORE_HOME) {
168 put_str(_("我が家", "Your Home"), 3, 31);
169 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
171 put_str(_(" 重さ", "Weight"), 5, 70);
174 store_prt_gold(player_ptr);
175 display_store_inventory(player_ptr);
179 if (cur_store_num == STORE_MUSEUM) {
180 put_str(_("博物館", "Museum"), 3, 31);
181 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
183 put_str(_(" 重さ", "Weight"), 5, 70);
186 store_prt_gold(player_ptr);
187 display_store_inventory(player_ptr);
191 concptr store_name = (f_name + f_info[cur_store_feat].name);
192 concptr owner_name = (ot_ptr->owner_name);
193 concptr race_name = race_info[ot_ptr->owner_race].title;
195 sprintf(buf, "%s (%s)", owner_name, race_name);
198 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
201 put_str(_("商品の一覧", "Item Description"), 5, 5);
203 put_str(_(" 重さ", "Weight"), 5, 60);
205 put_str(_(" 価格", "Price"), 5, 72);
206 store_prt_gold(player_ptr);
207 display_store_inventory(player_ptr);