9 #include "knowledge-self.h"
10 #include "birth/birth-explanations-table.h"
11 #include "core/show-file.h"
12 #include "flavor/flavor-describer.h"
13 #include "floor/floor-town.h"
14 #include "info-reader/fixed-map-parser.h"
15 #include "io-dump/dump-util.h"
16 #include "player-info/avatar.h"
17 #include "player-info/alignment.h"
18 #include "player/player-class.h"
19 #include "player/player-status-table.h"
20 #include "player/race-info-table.h"
21 #include "store/store-util.h"
22 #include "system/object-type-definition.h"
23 #include "system/player-type-definition.h"
24 #include "util/angband-files.h"
25 #include "util/buffer-shaper.h"
26 #include "util/int-char-converter.h"
27 #include "util/string-processor.h"
28 #include "world/world.h"
32 * List virtues & status
34 void do_cmd_knowledge_virtues(player_type *creature_ptr)
37 GAME_TEXT file_name[FILE_NAME_SIZE];
38 if (!open_temporary_file(&fff, file_name))
41 std::unique_ptr<PlayerAlignment> alignment(new PlayerAlignment(creature_ptr));
42 std::string alg = alignment->your_alignment();
43 fprintf(fff, _("現在の属性 : %s\n\n", "Your alignment : %s\n\n"), alg.c_str());
44 dump_virtues(creature_ptr, fff);
46 (void)show_file(creature_ptr, TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
51 * @brief 自分に関する情報を画面に表示する
52 * @param creature_ptr プレーヤーへの参照ポインタ
56 static void dump_yourself(player_type *creature_ptr, FILE *fff)
62 shape_buffer(race_explanations[creature_ptr->prace], 78, temp, sizeof(temp));
64 fprintf(fff, _("種族: %s\n", "Race: %s\n"), race_info[creature_ptr->prace].title);
67 for (int i = 0; i < 10; i++) {
70 fprintf(fff, "%s\n", t);
74 shape_buffer(class_explanations[creature_ptr->pclass], 78, temp, sizeof(temp));
76 fprintf(fff, _("職業: %s\n", "Class: %s\n"), class_info[creature_ptr->pclass].title);
79 for (int i = 0; i < 10; i++) {
82 fprintf(fff, "%s\n", t);
86 shape_buffer(personality_explanations[creature_ptr->pseikaku], 78, temp, sizeof(temp));
88 fprintf(fff, _("性格: %s\n", "Pesonality: %s\n"), personality_info[creature_ptr->pseikaku].title);
91 for (int i = 0; i < A_MAX; i++) {
94 fprintf(fff, "%s\n", t);
99 if (creature_ptr->realm1) {
100 shape_buffer(realm_explanations[technic2magic(creature_ptr->realm1) - 1], 78, temp, sizeof(temp));
101 fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[creature_ptr->realm1]);
104 for (int i = 0; i < A_MAX; i++) {
108 fprintf(fff, "%s\n", t);
114 if (creature_ptr->realm2) {
115 shape_buffer(realm_explanations[technic2magic(creature_ptr->realm2) - 1], 78, temp, sizeof(temp));
116 fprintf(fff, _("魔法: %s\n", "Realm: %s\n"), realm_names[creature_ptr->realm2]);
119 for (int i = 0; i < A_MAX; i++) {
123 fprintf(fff, "%s\n", t);
130 * @brief 勝利済みの職業をダンプする
131 * @param fff ファイルストリームのポインタ
134 static void dump_winner_classes(FILE *fff)
136 int n = current_world_ptr->sf_winner.count();
137 concptr ss = n > 1 ? _("", "s") : "";
138 fprintf(fff, _("*勝利*済みの職業%s : %d\n", "Class of *Winner%s* : %d\n"), ss, n);
145 for (int c = 0; c < MAX_CLASS; c++) {
146 if (current_world_ptr->sf_winner.has_not(static_cast<player_class_type>(c)))
149 auto &cl = class_info[c];
150 auto t = std::string(cl.title);
152 if (current_world_ptr->sf_retired.has_not(static_cast<player_class_type>(c)))
155 if (l.size() + t.size() + 2 > max_len) {
156 fprintf(fff, " %s\n", str_rtrim(l).c_str());
165 fprintf(fff, " %s\n", str_rtrim(l).c_str());
169 * List virtues & status
172 void do_cmd_knowledge_stat(player_type *creature_ptr)
175 GAME_TEXT file_name[FILE_NAME_SIZE];
176 if (!open_temporary_file(&fff, file_name))
180 u32b play_time = current_world_ptr->play_time;
181 u32b all_time = current_world_ptr->sf_play_time + play_time;
182 fprintf(fff, _("現在のプレイ時間 : %d:%02d:%02d\n", "Current Play Time is %d:%02d:%02d\n"), play_time / (60 * 60), (play_time / 60) % 60, play_time % 60);
183 fprintf(fff, _("合計のプレイ時間 : %d:%02d:%02d\n", " Total play Time is %d:%02d:%02d\n"), all_time / (60 * 60), (all_time / 60) % 60, all_time % 60);
187 = (int)(((long)creature_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) / (2 * creature_ptr->hitdie + ((PY_MAX_LEVEL - 1 + 3) * (creature_ptr->hitdie + 1))));
189 if (creature_ptr->knowledge & KNOW_HPRATE)
190 fprintf(fff, _("現在の体力ランク : %d/100\n\n", "Your current Life Rating is %d/100.\n\n"), percent);
192 fprintf(fff, _("現在の体力ランク : ???\n\n", "Your current Life Rating is ???.\n\n"));
194 fprintf(fff, _("能力の最大値\n\n", "Limits of maximum stats\n\n"));
195 for (int v_nr = 0; v_nr < A_MAX; v_nr++) {
196 if ((creature_ptr->knowledge & KNOW_STAT) || creature_ptr->stat_max[v_nr] == creature_ptr->stat_max_max[v_nr])
197 fprintf(fff, "%s 18/%d\n", stat_names[v_nr], creature_ptr->stat_max_max[v_nr] - 18);
199 fprintf(fff, "%s ???\n", stat_names[v_nr]);
202 dump_yourself(creature_ptr, fff);
203 dump_winner_classes(fff);
206 (void)show_file(creature_ptr, TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
212 * @param player_ptr プレーヤーへの参照ポインタ
215 void do_cmd_knowledge_home(player_type *player_ptr)
217 parse_fixed_map(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
220 GAME_TEXT file_name[FILE_NAME_SIZE];
221 if (!open_temporary_file(&fff, file_name))
224 store_type *store_ptr;
225 store_ptr = &town_info[1].store[STORE_HOME];
227 if (store_ptr->stock_num) {
231 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
233 GAME_TEXT o_name[MAX_NLEN];
234 for (int i = 0; i < store_ptr->stock_num; i++) {
237 fprintf(fff, "\n ( %d ページ )\n", x++);
238 describe_flavor(player_ptr, o_name, &store_ptr->stock[i], 0);
239 if (strlen(o_name) <= 80 - 3) {
240 fprintf(fff, "%c%s %s\n", I2A(i % 12), paren, o_name);
244 for (n = 0, t = o_name; n < 80 - 3; n++, t++)
250 n = 79 - 3; /* 最後が漢字半分 */
252 fprintf(fff, "%c%s %.*s\n", I2A(i % 12), paren, n, o_name);
253 fprintf(fff, " %.77s\n", o_name + n);
256 describe_flavor(player_ptr, o_name, &store_ptr->stock[i], 0);
257 fprintf(fff, "%c%s %s\n", I2A(i % 12), paren, o_name);
261 fprintf(fff, "\n\n");
265 (void)show_file(player_ptr, TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);