static void _spoil_spell_book2(doc_ptr doc, int class1_idx, int class2_idx, int realm_idx, int book_idx) { int spell_idx; int k_idx = lookup_kind(realm2tval(realm_idx), book_idx); player_magic *magic1_ptr = &m_info[class1_idx]; player_magic *magic2_ptr = &m_info[class2_idx]; doc_printf(doc, "%-25.25s <color:G>%-12.12s</color> <color:R>%-12.12s</color>\n", "", get_class_aux(class1_idx, 0)->name, get_class_aux(class2_idx, 0)->name); doc_printf(doc, "<color:o>%-25.25s</color><color:G> Lvl Cst Fail</color> <color:R>Lvl Cst Fail</color>\n", k_name + k_info[k_idx].name); for (spell_idx = book_idx*8; spell_idx < (book_idx+1)*8; spell_idx++) { magic_type *spell1_ptr = &magic1_ptr->info[realm_idx - 1][spell_idx]; magic_type *spell2_ptr = &magic2_ptr->info[realm_idx - 1][spell_idx]; doc_printf(doc, "%-25.25s ", do_spell(realm_idx, spell_idx, SPELL_NAME)); if (1 <= spell1_ptr->slevel && spell1_ptr->slevel <= PY_MAX_LEVEL) doc_printf(doc, "%3d %3d %3d%% ", spell1_ptr->slevel, spell1_ptr->smana, spell1_ptr->sfail); else doc_insert(doc, "<color:D>Illegible</color> "); if (1 <= spell2_ptr->slevel && spell2_ptr->slevel <= PY_MAX_LEVEL) doc_printf(doc, "%3d %3d %3d%% ", spell2_ptr->slevel, spell2_ptr->smana, spell2_ptr->sfail); else doc_insert(doc, "<color:D>Illegible</color> "); doc_newline(doc); } doc_newline(doc); }
static void _spoil_spell_book(doc_ptr doc, int class_idx, int realm_idx, int book_idx) { int spell_idx; int k_idx = lookup_kind(realm2tval(realm_idx), book_idx); player_magic *magic_ptr = &m_info[class_idx]; doc_printf(doc, "<color:o>%-25.25s</color><color:G> Lvl Cst Fail </color>\n", k_name + k_info[k_idx].name); for (spell_idx = book_idx*8; spell_idx < (book_idx+1)*8; spell_idx++) { magic_type *spell_ptr = NULL; if (is_magic(realm_idx)) spell_ptr = &magic_ptr->info[realm_idx - 1][spell_idx]; else spell_ptr = &technic_info[realm_idx - MIN_TECHNIC][spell_idx]; if (0 < spell_ptr->slevel && spell_ptr->slevel <= PY_MAX_LEVEL) { doc_printf(doc, "%-25.25s %3d %3d %3d%%\n", do_spell(realm_idx, spell_idx, SPELL_NAME), spell_ptr->slevel, spell_ptr->smana, spell_ptr->sfail ); } else { doc_printf(doc, "<color:D>%-26.26s</color>\n", "Illegible"); } } doc_newline(doc); }
static bool _has_book(int realm, int book) { int tval = realm2tval(realm); int sval = book; int i; for (i = 0; i < INVEN_PACK; i++) { if (inventory[i].tval == tval && inventory[i].sval == sval) return TRUE; } return FALSE; }
static void _dump_book(doc_ptr doc, int realm, int book) { int k_idx = lookup_kind(realm2tval(realm), book); int i, increment = 64; caster_info *caster_ptr = get_caster_info(); if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0; else if (realm == p_ptr->realm1) increment = 0; else if (realm == p_ptr->realm2) increment = 32; if (realm == REALM_HISSATSU) { doc_printf(doc, "<color:G> %-25.25s Lvl SP %-15.15s Cast</color>\n", k_name + k_info[k_idx].name, "Desc"); } else { if (caster_ptr && (caster_ptr->options & CASTER_USE_HP)) doc_printf(doc, "<color:G> %-23.23s Profic Lvl HP Fail %-15.15s Cast Fail</color>\n", k_name + k_info[k_idx].name, "Desc"); else doc_printf(doc, "<color:G> %-23.23s Profic Lvl SP Fail %-15.15s Cast Fail</color>\n", k_name + k_info[k_idx].name, "Desc"); } for (i = 0; i < 8; i++) { int s_idx = book * 8 + i; magic_type *s_ptr; int cost; bool max = FALSE; char proficiency[10]; char info[80]; cptr comment; char line[160]; char color = 'w'; if (is_magic(realm)) s_ptr = &mp_ptr->info[realm - 1][s_idx]; else s_ptr = &technic_info[realm - MIN_TECHNIC][s_idx]; if (s_ptr->slevel >= 99) continue; if (realm == REALM_HISSATSU) cost = s_ptr->smana; else { s16b exp = experience_of_spell(s_idx, realm); int exp_level = spell_exp_level(exp); cost = mod_need_mana(s_ptr->smana, s_idx, realm); max = FALSE; if (!increment && (exp_level == EXP_LEVEL_MASTER)) max = TRUE; else if ((increment == 32) && (exp_level >= EXP_LEVEL_EXPERT)) max = TRUE; else if ((p_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE; strncpy(proficiency, exp_level_str[exp_level], 4); proficiency[3] = ']'; proficiency[4] = '\0'; } strcpy(info, do_spell(realm, s_idx, SPELL_INFO)); comment = info; if (p_ptr->pclass == CLASS_SORCERER || p_ptr->pclass == CLASS_RED_MAGE) { if (s_ptr->slevel > p_ptr->max_plv) { comment = "unknown"; color = 'D'; } else if (s_ptr->slevel > p_ptr->lev) { comment = "forgotten"; color = 'y'; } } else if ((realm == p_ptr->realm1) ? ((p_ptr->spell_forgotten1 & (1L << s_idx))) : ((p_ptr->spell_forgotten2 & (1L << s_idx)))) { comment = "forgotten"; color = 'y'; } else if (!((realm == p_ptr->realm1) ? (p_ptr->spell_learned1 & (1L << s_idx)) : (p_ptr->spell_learned2 & (1L << s_idx)))) { comment = "unknown"; if (s_ptr->slevel > p_ptr->lev) color = 'D'; else color = 'B'; } else if (!((realm == p_ptr->realm1) ? (p_ptr->spell_worked1 & (1L << s_idx)) : (p_ptr->spell_worked2 & (1L << s_idx)))) { comment = "untried"; } sprintf(line, " %c) ", I2A(i)); if (realm == REALM_HISSATSU) { spell_stats_ptr stats = spell_stats_old(realm, s_idx); strcat( line, format( "<color:%c>%-25s %3d %3d %-15.15s %5d</color>", color, do_spell(realm, s_idx, SPELL_NAME), s_ptr->slevel, cost, comment, stats->ct_cast ) ); } else { spell_stats_ptr stats = spell_stats_old(realm, s_idx); strcat( line, format( "<color:%c>%-25s%c%-4s %3d %3d %3d%% %-15.15s %5d %4d %3d%%</color>", color, do_spell(realm, s_idx, SPELL_NAME), (max ? '!' : ' '), proficiency, s_ptr->slevel, cost, spell_chance(s_idx, realm), comment, stats->ct_cast, stats->ct_fail, spell_stats_fail(stats) ) ); } doc_printf(doc, "%s\n", line); } doc_newline(doc); }