unit_race::GENDER string_gender(const std::string& str, unit_race::GENDER def) {
	if(str == gender_string(unit_race::MALE)) {
		return unit_race::MALE;
	} else if(str == gender_string(unit_race::FEMALE)) {
		return unit_race::FEMALE;
	}
	return def;
}
Exemple #2
0
int main(string dest) {
   object ob,item;
   string buf;
   int age,x,ac,width;

   ob = this_player();

   if( dest && this_player()->query_level() >= WIZLEVEL ) {
      ob = find_player(dest);
      if( !ob ) ob = find_living( dest );
	  if( !ob ) {
         ob = single_present( dest, environment(this_player()) );
		 if( ob && !ob->query_is_living() )
            ob = 0;
	  }
      if (!ob) {
         msg(capitalize(dest)+" was not found.");
         return 1;
      }
   }

   age = ob->query_age()-ob->query_last_login();
   if( age ) age += time();
   width = this_player()->query_term_width();

   buf = "~CSC2"+tab("-",width-3)+"\n";
   buf += pad("~CSC3"+ob->query_pretitle()+"~CSC4 "+capitalize(""+ob->query_name())+" ~CSC3"+ob->query_title(),width+12,2)+"\n";
   buf += "~CSC2"+tab("-",width-3)+"\n";
   buf += "~CSC4Level: ~CSC3"+query_personal_title(ob);
   if (this_player()->query_level() >= WIZLEVEL)
     buf += " ("+(string)ob->query_level()+")";

   buf +=  "\n~CSC4Str: " + make_stat(ob, "strength");
   buf +=  "~CSC4Dex: " + make_stat(ob, "dexterity");
   buf +=  "~CSC4Con: " + make_stat(ob, "constitution");
   buf +=  "~CSC4Spd: " + make_stat(ob, "speed") + "\n";

   buf +=  "~CSC4Wil: " + make_stat(ob, "will");
   buf +=  "~CSC4Int: " + make_stat(ob, "intelligence");
   buf +=  "~CSC4Emp: " + make_stat(ob, "empathy");
   buf +=  "~CSC4Cha: " + make_stat(ob, "charm") + "\n";

   buf += "~CSC4Alignment: ~CSC3"+ob->query_alignment_string();
   if (this_player()->query_level() >= WIZLEVEL)
     buf += "~CSC2 (lawful: "+ob->query_lawful_alignment()+", good: "+ob->query_good_alignment()+")\n";
   else
     buf += "\n";

   if( age != 0 )
      buf += "~CSC4Age:    ~CSC3"+int_to_time(age)+"\n";
   buf += pad("~CSC4Sex:    ~CSC3"+gender_string(ob->query_gender()), 32, 0);
   buf += pad(" ~CSC4Race: ~CSC3"+capitalize(ob->query_race()), 31, 0);
   buf += " ~CSC4Deaths: ~CSC3"+ob->query_deaths()+"\n";
   buf += "~CSC4Weight: ~CSC3"+ob->query_us_weight()+" lbs";
   if (this_player()->query_level() >= WIZLEVEL)
     buf += "~CSC2 ("+ob->query_weight()+" grams)\n";
   else
     buf += "~CSC2 ("+(ob->query_weight()/1000)+" kg)\n";

   buf += "~CSC4Carried:  ~CSC3" + carry_string(ob) + "\n";

   buf += "/bin/hp"->hp_string(ob)+"\n";

   buf += "~CSC2Food:   " + meter( ob, "food" ) + "\n";
   buf += "~CSC2Water:  " + meter( ob, "drink" ) + "\n";

   buf += "~CSC4Defense: ~CSC3" + ac_string(ob) + "\n";
   buf += pad("~CSC4Form:    ~CSC3" + capitalize(ob->query_form()),32,0);

   if (ob->query_skill("other.endurance"))
     buf += pad(" ~CSC4Soak: ~CSC3" + (ob->query_soak()?"on":"off"),32,0);
   buf += "~CSC4Wimpy: ~CSC3" + (ob->query_wimpy()?ob->query_wimpy()+"%":"off") + "\n";

   if( find_objectref(ob->query_env_var("home")) ) {
       object home_room = find_objectref(ob->query_env_var("home"));
       object home_bldg = environment(home_room);
       object home_zone;
	   buf += "~CSC4Home:    ~CSC3"+home_room->query_short();
       if( home_bldg ) {
          home_zone = environment(home_bldg);
		  string owner;
          if( home_bldg->query_owner() )
            owner = capitalize(home_bldg->query_owner())+"'s";
          else
            owner = "An unowned";
          buf += ", "+owner+" "+home_bldg->query_name()+", "+home_zone->query_short();
       }
       buf += "\n";
   }

   // stance
   buf += "~CSC3"+pronoun_string(ob);
   switch (ob->query_stance()) {
     case ST_STANDING: buf += "standing up."; break;
     case ST_SITTING: buf += "sitting down."; break;
     case ST_LYING: buf += "lying down."; break;
     case ST_CROUCHING: buf += "crouching."; break;
     case ST_JUMPING: buf += "jumping."; break;
     case ST_FALLING: buf += "falling."; break;
	 case ST_FLYING: buf += "flying."; break;
     case ST_UNBALANCED: buf += "unbalanced."; break;
     default: buf += "tilted at some obnoxiously uncomfortable angle."; break;
   }

   // party
   if( ob->query_env_var("party") ) {
     string party = ob->query_env_var("party");
     string pupil = ob->query_env_var("mentoring");
     string leader = PARTY_DAEMON->query_party_leader(party);
     buf += "\n~CSC3" + pronoun_string(ob) +
            (leader == ob->query_name() ? "the leader" : "a member") +
            " of the party ~CSC2" + capitalize(party) + "~CSC3";
     if( pupil )
       buf += ", and are mentoring ~CSC2" + capitalize(pupil) + "~CSC3.";
     else if( pupil = PARTY_DAEMON->query_mentor(ob->query_name()) ) {
       buf += ", " + (ob==this_player()?"and":"is") +
			  " are being mentored by ~CSC2" + capitalize(pupil) + "~CSC3.";
	 } else
       buf += ".";
   }

   buf += "\n~CSC2"+tab("-",width-3);

   msg(buf+"~CDEF");
   return 1;
}