/* * Describe an item's random attributes for "character dumps" */ void identify_random_gen(const object_type *o_ptr) { /* Set hooks for character dump */ object_info_out_flags = object_flags_known; /* Set the indent/wrap */ text_out_indent = 3; text_out_wrap = 65; /* Dump the info */ if (object_info_out(o_ptr, FALSE)) text_out("\n"); /* Dump object history if necessary */ if (history_interesting(o_ptr)) { char buf[200]; /* Get the history and dump it */ if (format_object_history(buf, sizeof(buf), o_ptr)) { text_out(buf); text_out("\n"); } } /* Reset indent/wrap */ text_out_indent = 0; text_out_wrap = 0; }
/** * Provide information on an ego-item type */ textblock *object_info_ego(struct ego_item * ego) { object_kind *kind = NULL; object_type obj = { 0 }; int i; for (i = 0; i < z_info->k_max; i++) { kind = &k_info[i]; if (!kind->name) continue; if (kind->tval == ego->tval[0]) break; } obj.kind = kind; obj.tval = kind->tval; obj.sval = kind->sval; obj.name2 = ego->eidx; of_union(obj.flags_obj, ego->flags_obj); cf_union(obj.flags_curse, ego->flags_curse); for (i = 0; i < MAX_P_RES; i++) obj.percent_res[i] = ego->percent_res[i]; for (i = 0; i < A_MAX; i++) obj.bonus_stat[i] = ego->bonus_stat[i]; for (i = 0; i < MAX_P_BONUS; i++) obj.bonus_other[i] = ego->bonus_other[i]; for (i = 0; i < MAX_P_SLAY; i++) obj.multiple_slay[i] = ego->multiple_slay[i]; for (i = 0; i < MAX_P_BRAND; i++) obj.multiple_brand[i] = ego->multiple_brand[i]; return object_info_out(&obj, OINFO_FULL | OINFO_EGO | OINFO_DUMMY); }
/** * Provide information on an item suitable for writing to the character dump * - keep it brief. */ void object_info_chardump(ang_file *f, const struct object *obj, int indent, int wrap) { textblock *tb = object_info_out(obj, OINFO_TERSE | OINFO_SUBJ); textblock_to_file(tb, f, indent, wrap); textblock_free(tb); }
/** * Provide information on an ego-item type */ textblock *object_info_ego(struct ego_item *ego) { struct object_kind *kind = NULL; struct object obj = OBJECT_NULL, known_obj = OBJECT_NULL; size_t i; for (i = 0; i < z_info->k_max; i++) { kind = &k_info[i]; if (!kind->name) continue; if (i == ego->poss_items->kidx) break; } obj.kind = kind; obj.tval = kind->tval; obj.sval = kind->sval; obj.ego = ego; ego_apply_magic(&obj, 0); object_copy(&known_obj, &obj); obj.known = &known_obj; return object_info_out(&obj, OINFO_NONE | OINFO_EGO); }
/** * Provide information on an item suitable for writing to the character dump - keep it brief. */ void object_info_chardump(const object_type *o_ptr, char_attr_line **line, int *current_line, int indent, int wrap) { textblock *tb = object_info_out(o_ptr, OINFO_TERSE | OINFO_SUBJ); textblock_dump(tb, line, current_line, indent, wrap); textblock_free(tb); }
/* * Describe fake ego item "lore" */ QString desc_ego_fake(int ego_num, QString object_string, bool display) { /* Hack: dereference the join */ QString xtra[10] = { "sustains", "higher resistances", "abilities", "immunities", "stat increases", "slays", "*slays*", "elemental brands", "elemental resists", "native abilities"}; ego_item_type *e_ptr = &e_info[ego_num]; object_type dummy; object_type *o_ptr = &dummy; /* List ego flags */ int k_idx = find_first_ego_match(ego_num); if (!k_idx) return ("No match"); make_object_fake(o_ptr, k_idx, ego_num, TRUE); o_ptr->xtra2 = 0; o_ptr->update_object_flags(); QString output = color_string(QString("<big><b>%1 %2</b></big><br>") .arg(object_string) .arg(e_ptr->e_name), TERM_BLUE); if (e_ptr->e_text.length()) { output.append(QString("<br>%1<br>") .arg(e_ptr->e_text)); } output.append(object_info_out(o_ptr, FALSE, FALSE)); if (e_ptr->xtra) { output.append(QString("<br>It provides one or more random %1.<br>") .arg(xtra[e_ptr->xtra - 1])); } if (e_ptr->e_flags3 & (TR3_PERMA_CURSE)) output.append("It is permanently cursed."); else if (e_ptr->e_flags3 & (TR3_HEAVY_CURSE)) output.append("It is heavily cursed."); if (e_ptr->e_flags3 & (TR3_LIGHT_CURSE)) output.append("It is cursed."); /* Finally, display it */ if (display) display_info_window(DISPLAY_INFO_OBJECT, o_ptr->k_idx, output); return(output); }
textblock *object_info_theme(struct theme *theme) { object_kind *kind = NULL; object_type obj = {0}; int i; for (i = 0; i < z_info->k_max; i++) { kind = &k_info[i]; if (!kind->name) continue; if (kind->tval == theme->tval[0]) break; } obj.kind = kind; obj.tval = kind->tval; obj.sval = kind->sval; obj_apply_theme(&obj, 0, theme->index); return object_info_out(&obj, OINFO_FULL | OINFO_EGO | OINFO_DUMMY); }
/** * Provide information on an ego-item type */ textblock *object_info_ego(struct ego_item *ego) { object_kind *kind = NULL; object_type obj = { 0 }; int i; for (i = 0; i < z_info->k_max; i++) { kind = &k_info[i]; if (!kind->name) continue; if (kind->tval == ego->tval[0]) break; } obj.kind = kind; obj.tval = kind->tval; obj.sval = kind->sval; obj.ego = ego; of_union(obj.flags, ego->flags); return object_info_out(&obj, OINFO_FULL | OINFO_EGO | OINFO_DUMMY); }
/** * Provide information on an ego-item type */ textblock *object_info_ego(struct ego_item *ego) { object_kind *kind = NULL; object_type obj = { 0 }; int i; for (i = 0; i < z_info->k_max; i++) { kind = &k_info[i]; if (!kind->name) continue; if (kind->tval == ego->tval[0]) break; } obj.kind = kind; obj.tval = kind->tval; obj.sval = kind->sval; obj.affix[0] = ego; ego_apply_magic(&obj, 0, ego->eidx); return object_info_out(&obj, OINFO_FULL | OINFO_EGO | OINFO_DUMMY); }
/* * Place an item description on the screen. */ void object_info_screen(const object_type *o_ptr) { bool has_description, has_info; /* Redirect output to the screen */ text_out_hook = text_out_to_screen; /* Save the screen */ screen_save(); has_description = screen_out_head(o_ptr); object_info_out_flags = object_flags_known; /* Dump the info */ new_paragraph = TRUE; has_info = object_info_out(o_ptr); new_paragraph = FALSE; if (!object_known_p(o_ptr)) { p_text_out("\n\n This item has not been identified."); } else if ((!has_description) && (!has_info)) { p_text_out("\n\n This item does not seem to possess any special abilities."); } text_out_c(TERM_L_BLUE, "\n\n(press any key)\n"); /* Wait for input */ (void)inkey(); /* Load the screen */ screen_load(); return; }
/** * Provide spoiler information on an item. * * Practically, this means that we should not print anything which relies upon * the player's current state, since that is not suitable for spoiler material. */ void object_info_spoil(ang_file *f, const object_type *o_ptr, int wrap) { textblock *tb = object_info_out(o_ptr, OINFO_FULL); textblock_to_file(tb, f, 0, wrap); textblock_free(tb); }
/** * Provide information on an item, including how it would affect the current * player's state. * * mode OINFO_FULL should be set if actual player knowledge should be ignored * in favour of full knowledge. * * returns TRUE if anything is printed. */ textblock *object_info(const object_type *o_ptr, oinfo_detail_t mode) { mode |= OINFO_SUBJ; return object_info_out(o_ptr, mode); }
/** * Provide spoiler information on an item. * * Practically, this means that we should not print anything which relies upon * the player's current state, since that is not suitable for spoiler material. */ void object_info_spoil(ang_file *f, const struct object *obj, int wrap) { textblock *tb = object_info_out(obj, OINFO_NONE); textblock_to_file(tb, f, 0, wrap); textblock_free(tb); }
/** * Provide information on an item, including how it would affect the current * player's state. * * returns true if anything is printed. */ textblock *object_info(const struct object *obj, oinfo_detail_t mode) { mode |= OINFO_SUBJ; return object_info_out(obj, mode); }