int cmd_recover(string name) {
   object* obs;
   object* fail;
   object* ok_me;
   object* ok_here;
   object cont;
   object ob;
   class obj_match omatch;

#ifdef PT
   if (!PLAYTESTER_HAND->query_playtester(this_player()->query_name()) &&
       !this_player()->query_creator()) {
      add_failed_mess("This command is in play testing at the moment.\n");
      return 0;
   }
#endif

   if (this_player()->query_property("dead")) {
      add_failed_mess("You're a disembodied spirit, how do you expect to "
                      "recover anything at all?\n");
      return 0;
   }

   cont = BURY_EFFECT->query_buried_container(environment(this_player()));
   if (!cont) {
      add_failed_mess("There is nothing buried here.\n");
      return 0;
   }
   omatch = (class obj_match)match_objects_in_environments(name, cont);
   if (omatch->result != OBJ_PARSER_SUCCESS) {
      add_failed_mess(match_objects_failed_mess(omatch));
      return 0;
   }
   obs = omatch->objects;
   
   if ( sizeof( obs ) > MAX_RECOVER ) {
      add_failed_mess( "You can only recover " + 
        query_num( MAX_RECOVER ) + " items at a time.\n" );
      return 0;
   }

   fail = ({ });
예제 #2
0
string query_colored_name(object me, object he, string his_name, int how_many)
{
  int al_me, al_him;
  string aux, ret;
  object race;
  
  string hud;
  string color;

  hud = me->query_hud();
  color = "";

  if (!me)
    return he->query_cap_name();

  if (me == he)
    return he->query_cap_name();

  // al_me = 0;
  // al_him = 0;

  ret = "";

  al_me = (int)me->query_real_align();
  al_him = (int)he->query_ext_align();

  // Con los npcs (o players sin raza) no sacamos el sobrenombre con la raza!!
  if (!he->query_race_ob() || he->query_npc())
  {
    // Obtenemos el nombre
    if (he->query_npc()) 
    {
      if (how_many > 1) 
      {
        aux = capitalize(query_num(how_many, 0)) + " " +
          he->pretty_plural();
      } 
      else 
      {
        aux = capitalize(his_name);
      }
    } 
    else 
    {
      aux = capitalize(his_name);
    }
    
    // Tras el nombre obtenemos el color segun el tipo de apuntador
    if (hud == HUD_ALIGNMENT && ALIGN_TABLE->query_enemies(al_me, al_him))
    {
      color = "%^BOLD%^RED%^";
    }
    else if (hud == HUD_DIFFICULTY)
    {
      int dif;

      dif = he->query_level() - me->query_level();

      if (dif > 10)
        color = "%^BOLD%^RED%^";
      else if (dif > 5)
        color = "%^BOLD%^ORANGE%^";
      else if (dif > -2)
        color = "%^GREEN%^";
    }
    
    // Unimos color y nombre
    if (color != "")
      ret += color + aux + "%^RESET%^";
    else
      ret += aux;
    
  }
  else // Es player con raza
  {
    string new_str;

    new_str = "";
    race = load_object(he->query_race_ob());

    // No damos las subrazas/culturas, porque los nombres
    //  suelen ser mas largos y menos representativos
    // Algo simple como humano, elfo, etc da informacion mas
    //  rapido.
    // if (race->query_subrace())
    //  race = race->query_base_race();

    // ret += "%^BOLD%^RED%^" + capitalize(inv[0][i]) + " " + 
    //    race->query_race_gender_string(inv[1][i][0]) +
    //    "%^RESET%^";

    // Nueva forma de hacerlo para que funcionen bien las monturas
    // Folken 07/04
    ret += capitalize(his_name);

    // Tras el nombre obtenemos el color segun el tipo de apuntador
    if (hud == HUD_ALIGNMENT && ALIGN_TABLE->query_enemies(al_me, al_him))
    {
      color = "%^BOLD%^RED%^";
    }
    else if (hud == HUD_DIFFICULTY)
    {
      int dif;
      
      dif = he->query_level() - me->query_level();

      if (dif > 10)
        color = "%^BOLD%^RED%^";
      else if (dif > 5)
        color = "%^BOLD%^ORANGE%^";
      else if (dif >= -2)
        color = "%^GREEN%^";
    }

    if (color != "")
      new_str = color + he->query_cap_name() + " " + race->query_race_gender_string(he) + "%^RESET%^";
    else
      new_str = he->query_cap_name() + " " + race->query_race_gender_string(he);

    ret = replace_string(ret, he->query_cap_name(), new_str);
  }

  return ret;

}