rendered paste body/* * basic/player/appearance * * This file contains all functions around short, long, name, title, pretitle * and alignment title of players. * * Coogan, 19-Dec-1998 * */#pragma strong_types // Coogan, 04-Jan-1999#include <filter.h>#include <prop/player.h>#include <message.h>#include <prop/living.h> // Coogan, 04-Jan-1999#include <termcol.h> // Coogan, 03-Sep-2001, 25-Nov-2003inherit "basic/player/scar";inherit "basic/player/extra_look";virtual inherit "basic/coloured_string"; // Alfe 01-Feb-16varargs mixed query_property(string key, string item);varargs void set_property(mixed key, mixed value, string item); mixed apply_filter(string feature,mixed arg); int query_hp(); int query_max_hp();static void check_who(string what, mixed message); status query_offering(); mixed get_offer_description();nomask string query_real_name();private string name; // our real nameprivate string vis_name; // our printed nameprivate string title; // our official title. Wiz's can change it.private string al_title; // the alignment titleprivate string pretitle; // prefix to our title - Macbeth 17-Oct-1991mixed query_away() { mixed h; if (!interactive(this_object()) || !(h=query_property(P_AWAY)) || h[0]+query_idle(this_object())<time()) return 0; return funcall(h[1]);}string query_name() { string result; status show_absence;#if 1 // Alfe 2002-Jan-11 show_absence = (query_away() && query_verb() != "who" && this_object() != this_interactive());#else show_absence = query_away() && query_verb() != "who";#endif if (stringp(result = apply_filter(F_NAME, (show_absence ? "absent " : "")+vis_name))) return result || "Someone"; return "Someone";}nomask string query_vis_name() { return vis_name;}nomask string query_real_name() { return name;}string query_al_title() { return apply_filter(F_AL_TITLE, al_title);}string query_title() { return apply_filter(F_TITLE, title);}string query_pretitle() { return apply_filter(F_PRETITLE, pretitle);}string query_short() { string tmp, desc, name; desc = ""; if ((tmp = query_pretitle()) && strlen_visible(tmp)) // Alfe 01-Feb-16 desc = tmp + " "; else if (tmp) // added this if(), Coogan, 16-Feb-2001 desc = tmp; desc += query_name(); if ((tmp = query_title()) && strlen_visible(tmp)) { if (substring(tmp,0,0) == ",") // Coogan, 20-Jun-1998 desc += tmp; else desc += " "+tmp; } else if (tmp) // added this if(), Coogan, 16-Feb-2001 desc += tmp; if (desc) // Coogan, 12-Sep-2001 // TERMCOL_DESC_PLAYER -> TERMCOL_DESC_LIVING, Coogan, 29-Aug-2003 desc = TERMCOL_DESC_LIVING + desc + TERMCOL_DESC_NORMAL; if (tmp = query_al_title()) desc += " (" + tmp + ")"; return apply_filter(F_SHORT, desc);}varargs string query_long(string str) { string cap_pronoun; string desc; mixed h; desc = query_short(); if (desc) desc = capitalize(desc) + ".\n"; else desc = ""; h = apply_filter(F_EXTENDED_LONG, query_extended_longs()); desc += implode(m_values(h), ""); desc += show_scar(); desc += capitalize(message2string(({ M_ME_PRONOUN, M_ME_VERB, "are" }))); if (query_hp() < query_max_hp() / 10) { desc += " in very bad shape.\n"; } else if (query_hp() < query_max_hp()/5) { desc += " in bad shape.\n"; } else if (query_hp() < query_max_hp()/2) { desc += " not in a good shape.\n"; } else if (query_hp() < query_max_hp() - 20) { desc += " slightly hurt.\n"; } else desc += " in good shape.\n"; if (query_offering()) desc += capitalize(message2string(({ M_ME_PRONOUN, M_ME_VERB, "offer" }) + get_offer_description() + ({ ".\n" }))); return apply_filter(F_LONG, desc);}status query_no_article() {#if 1 // Alfe 98-Apr-21 return apply_filter(F_NO_ARTICLE, 1);#else return apply_filter(F_NO_ARTICLE,interactive(this_object())); // Ugh Feb-16-1995#endif}void set_title(string t) { title = t;}void set_al_title(string t) { /* Added by Ereborn, 27-Dec-1991 */ al_title = t;}void set_pretitle(string t) { /* Macbeth 17-Oct-1991 */ check_who("pretitle", t); // Coogan, 05-Jul-1998 pretitle = t;}status set_vis_name(string str) { // changed the lfun-calls to call_others to lib/name and added the call // to keep lib/name's vis_name hash table up to date. Alfe 06-Mar-1995 if (!stringp(str) || LIB_NAME->to_real_name(str) != query_real_name()) return 0; if (!LIB_NAME->valid_name(str) || !LIB_NAME->valid_capitalization(str)) return 0; vis_name = str; LIB_NAME->change_vis_name(query_real_name(), str); return 1;}void set_name(mixed m) { } // to make it impossible to overwrite a once set // name of a player. Coogan, 04-Jan-1999