7 #include "knowledge/knowledge-experiences.h"
8 #include "core/show-file.h"
9 #include "flavor/object-flavor.h"
10 #include "game-option/cheat-options.h"
11 #include "game-option/text-display-options.h"
12 #include "io-dump/dump-util.h"
13 #include "player-info/class-info.h"
14 #include "player/player-skill.h"
15 #include "player/player-status.h"
16 #include "realm/realm-names-table.h"
17 #include "spell/spells-execution.h"
18 #include "spell/technic-info-table.h"
19 #include "sv-definition/sv-bow-types.h"
20 #include "system/baseitem-info.h"
21 #include "system/player-type-definition.h"
22 #include "util/angband-files.h"
27 void do_cmd_knowledge_weapon_exp(PlayerType *player_ptr)
30 GAME_TEXT file_name[FILE_NAME_SIZE];
31 if (!open_temporary_file(&fff, file_name)) {
35 for (auto tval : { ItemKindType::SWORD, ItemKindType::POLEARM, ItemKindType::HAFTED, ItemKindType::DIGGING, ItemKindType::BOW }) {
36 for (int num = 0; num < 64; num++) {
37 BaseitemKey bi_key(tval, num);
38 for (const auto &baseitem : baseitems_info) {
39 if (baseitem.bi_key != bi_key) {
43 const auto sval = baseitem.bi_key.sval();
44 if ((baseitem.bi_key.tval() == ItemKindType::BOW) && (sval == SV_CRIMSON || sval == SV_HARP)) {
48 SUB_EXP weapon_exp = player_ptr->weapon_exp[tval][num];
49 SUB_EXP weapon_max = player_ptr->weapon_exp_max[tval][num];
50 const auto tmp = strip_name(baseitem.idx);
51 fprintf(fff, "%-25s ", tmp.data());
52 if (show_actual_value) {
53 fprintf(fff, "%4d/%4d ", weapon_exp, weapon_max);
55 if (weapon_exp >= weapon_max) {
60 auto skill_rank = PlayerSkill::weapon_skill_rank(weapon_exp);
61 fprintf(fff, "%s", PlayerSkill::skill_rank_str(skill_rank));
63 fprintf(fff, " %d", weapon_exp);
72 (void)show_file(player_ptr, true, file_name, 0, 0, _("武器の経験値", "Weapon Proficiency"));
77 * @brief 魔法の経験値を表示するコマンドのメインルーチン
80 void do_cmd_knowledge_spell_exp(PlayerType *player_ptr)
83 GAME_TEXT file_name[FILE_NAME_SIZE];
84 if (!open_temporary_file(&fff, file_name)) {
88 if (player_ptr->realm1 != REALM_NONE) {
89 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[player_ptr->realm1]);
90 for (SPELL_IDX i = 0; i < 32; i++) {
91 const magic_type *s_ptr;
92 if (!is_magic(player_ptr->realm1)) {
93 s_ptr = &technic_info[player_ptr->realm1 - MIN_TECHNIC][i];
95 s_ptr = &mp_ptr->info[player_ptr->realm1 - 1][i];
98 if (s_ptr->slevel >= 99) {
101 SUB_EXP spell_exp = player_ptr->spell_exp[i];
102 auto skill_rank = PlayerSkill::spell_skill_rank(spell_exp);
103 const auto spell_name = exe_spell(player_ptr, player_ptr->realm1, i, SpellProcessType::NAME);
104 fprintf(fff, "%-25s ", spell_name->data());
105 if (player_ptr->realm1 == REALM_HISSATSU) {
106 if (show_actual_value) {
107 fprintf(fff, "----/---- ");
109 fprintf(fff, "[--]");
111 if (show_actual_value) {
112 fprintf(fff, "%4d/%4d ", spell_exp, PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER));
114 if (skill_rank >= PlayerSkillRank::MASTER) {
119 fprintf(fff, "%s", PlayerSkill::skill_rank_str(skill_rank));
123 fprintf(fff, " %d", spell_exp);
129 if (player_ptr->realm2 != REALM_NONE) {
130 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[player_ptr->realm2]);
131 for (SPELL_IDX i = 0; i < 32; i++) {
132 const magic_type *s_ptr;
133 if (!is_magic(player_ptr->realm1)) {
134 s_ptr = &technic_info[player_ptr->realm2 - MIN_TECHNIC][i];
136 s_ptr = &mp_ptr->info[player_ptr->realm2 - 1][i];
139 if (s_ptr->slevel >= 99) {
143 SUB_EXP spell_exp = player_ptr->spell_exp[i + 32];
144 auto skill_rank = PlayerSkill::spell_skill_rank(spell_exp);
145 const auto spell_name = exe_spell(player_ptr, player_ptr->realm2, i, SpellProcessType::NAME);
146 fprintf(fff, "%-25s ", spell_name->data());
147 if (show_actual_value) {
148 fprintf(fff, "%4d/%4d ", spell_exp, PlayerSkill::spell_exp_at(PlayerSkillRank::MASTER));
150 if (skill_rank >= PlayerSkillRank::EXPERT) {
155 fprintf(fff, "%s", PlayerSkill::skill_rank_str(skill_rank));
157 fprintf(fff, " %d", spell_exp);
164 (void)show_file(player_ptr, true, file_name, 0, 0, _("魔法の経験値", "Spell Proficiency"));
169 * @brief スキル情報を表示するコマンドのメインルーチン /
172 void do_cmd_knowledge_skill_exp(PlayerType *player_ptr)
175 char file_name[FILE_NAME_SIZE];
176 if (!open_temporary_file(&fff, file_name)) {
180 for (auto i : PLAYER_SKILL_KIND_TYPE_RANGE) {
181 SUB_EXP skill_exp = player_ptr->skill_exp[i];
182 SUB_EXP skill_max = class_skills_info[enum2i(player_ptr->pclass)].s_max[i];
183 fprintf(fff, "%-20s ", PlayerSkill::skill_name(i));
184 if (show_actual_value) {
185 fprintf(fff, "%4d/%4d ", std::min(skill_exp, skill_max), skill_max);
187 if (skill_exp >= skill_max) {
192 auto skill_rank = (i == PlayerSkillKindType::RIDING) ? PlayerSkill::riding_skill_rank(skill_exp) : PlayerSkill::weapon_skill_rank(skill_exp);
193 fprintf(fff, "%s", PlayerSkill::skill_rank_str(skill_rank));
195 fprintf(fff, " %d", skill_exp);
201 (void)show_file(player_ptr, true, file_name, 0, 0, _("技能の経験値", "Miscellaneous Proficiency"));