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/pricing.h"
12 #include "store/store-util.h"
13 #include "store/store.h" // todo 相互依存している、こっちは残す?.
14 #include "system/object-type-definition.h"
15 #include "term/gameterm.h"
16 #include "term/screen-processor.h"
17 #include "util/int-char-converter.h"
20 * @brief プレイヤーの所持金を表示する /
21 * Displays players gold -RAK-
22 * @param player_ptr プレーヤーへの参照ポインタ
26 void store_prt_gold(player_type *player_ptr)
28 prt(_("手持ちのお金: ", "Gold Remaining: "), 19 + xtra_stock, 53);
30 sprintf(out_val, "%9ld", (long)player_ptr->au);
31 prt(out_val, 19 + xtra_stock, 68);
35 * @brief 店の商品リストを再表示する /
36 * Re-displays a single store entry
37 * @param player_ptr プレーヤーへの参照ポインタ
41 void display_entry(player_type *player_ptr, int pos)
44 o_ptr = &st_ptr->stock[pos];
45 int i = (pos % store_bottom);
47 /* Label it, clear the line --(-- */
49 (void)sprintf(out_val, "%c) ", ((i > 25) ? toupper(I2A(i - 26)) : I2A(i)));
50 prt(out_val, i + 6, 0);
53 if (show_item_graph) {
54 TERM_COLOR a = object_attr(o_ptr);
55 SYMBOL_CODE c = object_char(o_ptr);
57 term_queue_bigchar(cur_col, i + 6, a, c, 0, 0);
64 /* Describe an item in the home */
66 if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) {
71 GAME_TEXT o_name[MAX_NLEN];
72 describe_flavor(player_ptr, o_name, o_ptr, 0);
73 o_name[maxwid] = '\0';
74 c_put_str(tval_to_attr[o_ptr->tval], o_name, i + 6, cur_col);
76 WEIGHT wgt = o_ptr->weight;
77 sprintf(out_val, _("%3d.%1d kg", "%3d.%d lb"), _(lbtokg1(wgt), wgt / 10), _(lbtokg2(wgt), wgt % 10));
78 put_str(out_val, i + 6, _(67, 68));
88 GAME_TEXT o_name[MAX_NLEN];
89 describe_flavor(player_ptr, o_name, o_ptr, 0);
90 o_name[maxwid] = '\0';
91 c_put_str(tval_to_attr[o_ptr->tval], o_name, i + 6, cur_col);
94 int wgt = o_ptr->weight;
95 sprintf(out_val, "%3d.%1d", _(lbtokg1(wgt), wgt / 10), _(lbtokg2(wgt), wgt % 10));
96 put_str(out_val, i + 6, _(60, 61));
100 if (o_ptr->ident & IDENT_FIXED) {
101 x = price_item(player_ptr, o_ptr, ot_ptr->min_inflate, FALSE);
102 (void)sprintf(out_val, _("%9ld固", "%9ld F"), (long)x);
103 put_str(out_val, i + 6, 68);
107 if (!manual_haggle) {
108 x = price_item(player_ptr, o_ptr, ot_ptr->min_inflate, FALSE);
109 if (!noneedtobargain(x))
112 (void)sprintf(out_val, "%9ld ", (long)x);
113 put_str(out_val, i + 6, 68);
117 x = price_item(player_ptr, o_ptr, ot_ptr->max_inflate, FALSE);
118 (void)sprintf(out_val, "%9ld ", (long)x);
119 put_str(out_val, i + 6, 68);
123 * @brief 店の商品リストを表示する /
124 * Displays a store's inventory -RAK-
125 * @param player_ptr プレーヤーへの参照ポインタ
128 * All prices are listed as "per individual object". -BEN-
130 void display_store_inventory(player_type *player_ptr)
133 for (k = 0; k < store_bottom; k++) {
134 if (store_top + k >= st_ptr->stock_num)
137 display_entry(player_ptr, store_top + k);
140 for (int i = k; i < store_bottom + 1; i++)
143 put_str(_(" ", " "), 5, _(20, 22));
144 if (st_ptr->stock_num > store_bottom) {
145 prt(_("-続く-", "-more-"), k + 6, 3);
146 put_str(format(_("(%dページ) ", "(Page %d) "), store_top / store_bottom + 1), 5, _(20, 22));
149 if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM) {
150 k = st_ptr->stock_size;
151 if (cur_store_num == STORE_HOME && !powerup_home)
154 put_str(format(_("アイテム数: %4d/%4d", "Objects: %4d/%4d"), st_ptr->stock_num, k), 19 + xtra_stock, _(27, 30));
159 * @brief 店舗情報全体を表示するメインルーチン /
160 * Displays store (after clearing screen) -RAK-
161 * @param player_ptr プレーヤーへの参照ポインタ
165 void display_store(player_type *player_ptr)
168 if (cur_store_num == STORE_HOME) {
169 put_str(_("我が家", "Your Home"), 3, 31);
170 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
172 put_str(_(" 重さ", "Weight"), 5, 70);
175 store_prt_gold(player_ptr);
176 display_store_inventory(player_ptr);
180 if (cur_store_num == STORE_MUSEUM) {
181 put_str(_("博物館", "Museum"), 3, 31);
182 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
184 put_str(_(" 重さ", "Weight"), 5, 70);
187 store_prt_gold(player_ptr);
188 display_store_inventory(player_ptr);
192 concptr store_name = (f_name + f_info[cur_store_feat].name);
193 concptr owner_name = (ot_ptr->owner_name);
194 concptr race_name = race_info[ot_ptr->owner_race].title;
196 sprintf(buf, "%s (%s)", owner_name, race_name);
199 sprintf(buf, "%s (%ld)", store_name, (long)(ot_ptr->max_cost));
202 put_str(_("商品の一覧", "Item Description"), 5, 5);
204 put_str(_(" 重さ", "Weight"), 5, 60);
206 put_str(_(" 価格", "Price"), 5, 72);
207 store_prt_gold(player_ptr);
208 display_store_inventory(player_ptr);