/
mudd/docs/html/
mudd/world/
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mud.h"

bool 
locate_person (CHAR_DATA * ch, int level, char *argy)
{
  char buf[STD_LENGTH];
  char arg[SML_LENGTH];
  bool found;
  CHAR_DATA *victim;
  one_argy (argy, arg);
  found = FALSE;
  for (victim = char_list[PLAYER_LIST]; victim != NULL; victim = victim->next)
    {
      if (victim->in_room != NULL &&
	  (IS_HURT(victim, BEACON) ||
	   (!IS_AFF(victim, HIDE)
	    && !IS_PROT(victim, BEACON)
	    && !IS_SET (victim->in_room->room_flags, ROOM_UNTRACKABLE)
	    && can_see (ch, victim)
	    && is_name (arg, NAME (victim)))))
	{
	  found = TRUE;
	  sprintf (buf, "%-28s %s\n\r",
		   PERS (victim, ch), show_room_name (victim, victim->in_room->name));
	  send_to_char (buf, ch);
	  
	  if (number_range (1, 3) == 1)
	    {
	      sprintf (buf, "\x1b[1;31mYou feel as if %s might have pin-pointed your location!\n\r", NAME (ch));
	      send_to_char (buf, victim);
	      send_to_char (buf, victim);
	      send_to_char (buf, victim);
	      
	    }
	  else
	    if (number_range(1,2) ==1 )
	      {
		sprintf (buf, "\x1b[1;31mYou feel as if someone is pin-pointing your location...\n\r");
		send_to_char (buf, victim);
                  send_to_char (buf, victim);
                  send_to_char (buf, victim);

	      }
	    else
	      {
		sprintf(buf, "\x1b[1;31m%s is coming to kill you!\n\r",
			NAME(ch));
		send_to_char(buf, victim);
		send_to_char (buf, victim);
		send_to_char (buf, victim);
		
	      }
	  {
	    CHAR_DATA *rch;
	    for (rch = victim->in_room->people; rch != NULL; rch = rch->next_in_room)
	      {
		if(rch == victim || IS_MOB(victim)) continue;
		send_to_char("\x1b[1;31mAll of a sudden, you feel a ripple in the \x1b[1;30mVoid\x1b[1;31m, and then nothing.\n\r", rch);
	      }
	  }
	  break;
	}
    }
  return found;
}

  bool 
scry (CHAR_DATA * ch, int level, char *argy)
{
  char arg[SML_LENGTH];
  char buf[STD_LENGTH];
  bool found;
  CHAR_DATA *victim;
  one_argy (argy, arg);
  if (LEVEL (ch) > 100)
    return FALSE;
  found = FALSE;
  for (victim = char_list[PLAYER_LIST]; victim != NULL; victim = victim->next)
    {
      if (victim->in_room != NULL &&
	  (IS_HURT(victim, BEACON) ||
	   (!IS_AFF(victim, HIDE)
	    && !IS_PROT(victim, BEACON)
	    && !IS_SET (victim->in_room->room_flags, ROOM_UNTRACKABLE)
	    && can_see (ch, victim)
	    && is_name (arg, NAME (victim)))))
	{
	  found = TRUE;
	  sprintf (buf, "%s look", NAME (victim));
	  do_at (ch, buf);
	  if (number_range (1, 3) == 1)
	    {
	      sprintf (buf, "\x1b[1;31mYou feel as if %s is watching you!\n\r", NAME (ch));
	      send_to_char (buf, victim);
	      send_to_char (buf, victim);
	      send_to_char (buf, victim);
	      
	    }
	  else
	    if (number_range(1,2) ==1 )
	      {
		sprintf (buf, "\x1b[1;31mYou feel as if someone is watching you..\n\r");
		send_to_char (buf, victim);
		send_to_char (buf, victim);
		send_to_char (buf, victim);
		
	      }
	    else
	      {
		sprintf(buf, "\x1b[1;31m%s is coming to kill you!\n\r",
			NAME(ch));
		send_to_char(buf, victim);
		send_to_char (buf, victim);
		send_to_char (buf, victim);
		
	      }
	  {
	    CHAR_DATA *rch;
	    for (rch = victim->in_room->people; rch != NULL; rch = rch->next_in_room)
	      {
		if(rch == victim || IS_MOB(victim)) continue;
		send_to_char("\x1b[1;31mAll of a sudden, you feel a ripple in the \x1b[1;30mVoid\x1b[1;31m, and then nothing.\n\r", rch);
	      }
	  }
	  
	  break;
	}
    }
  
  return found;
}

void 
do_finger (CHAR_DATA * ch, char *argy)
{
  char buf[STD_LENGTH];
  char arg[SML_LENGTH];
  CHAR_DATA *victim;
  PLAYERBASE_DATA *playerbase;
  DEFINE_COMMAND ("finger", do_finger, POSITION_DEAD, 0, LOG_NORMAL, "This command can be used to lookup information on the specified player.")

    one_argy (argy, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Finger whom?\n\r", ch);
      return;
    }
  if ((victim = get_char_world (ch, arg)) == NULL)
    {
      bool ffund;
      ffund = FALSE;
      for (playerbase = playerbase_zero; playerbase != NULL; playerbase = playerbase->next)
	{

	  if ( !str_cmp (argy, playerbase->player_name)
	       && (LEVEL (ch) > IMM_LEVEL || 
		   playerbase->player_level > IMM_LEVEL || 
		   alliance[playerbase->player_align][ALIGN(ch)])) 
	    {
	      char bufr[500];
	      ffund = TRUE;
              sprintf (bufr, "\n\r\x1B[37;0m[\x1B[1m%s\x1B[0m] Logged off last about \x1B[1m%ld\x1B[0m day%s, \x1B[1m%ld\x1B[0m hour%s and \x1B[1m%ld\x1B[0m minute%s ago.\n\r",
                             playerbase->player_name,
                             (current_time - playerbase->player_last_login)/(3600*24), ((current_time - playerbase->player_last_login)/(3600*24) != 1 ? "s" : ""),
                             (current_time - playerbase->player_last_login)/(3600) - ((current_time - playerbase->player_last_login)/(3600*24) * 24), ((current_time - playerbase->player_last_login)/(3600) - ((current_time - playerbase->player_last_login)/(3600*24) * 24) != 1 ? "s" : ""),
                             (current_time - playerbase->player_last_login)/(60) - ((current_time - playerbase->player_last_login)/(60*60) * 60 ), ((current_time - playerbase->player_last_login)/(60) - ((current_time - playerbase->player_last_login)/(60*60) * 60 ) != 1 ? "s" : ""));
	      send_to_char (bufr, ch);
	      if (LEVEL (ch) > MAX_LEVEL-3)
		{
                  sprintf (bufr, "\x1B[37;0m[\x1B[1mGod only info\x1B[0m]: Fingered character is level \x1B[1m%d\x1B[0m with \x1B[1m%d\x1B[0m remort%s.\n\r",
                                 (playerbase->player_level), playerbase->player_remort_times, playerbase->player_remort_times != 1 ? "s" : "");
		  send_to_char (bufr, ch);
                  sprintf(bufr, "\x1B[37;0m[\x1B[1m%s\x1B[0m] Was created \x1B[1m%ld\x1B[0m day%s, \x1B[1m%ld\x1B[0m hour%s and \x1B[1m%ld\x1B[0m minute%s ago.\n\r",
                                 playerbase->player_name,
                                 (current_time - playerbase->player_created)/(3600*24), ((current_time - playerbase->player_created)/(3600*24) != 1 ? "s" : ""),
                                 (current_time - playerbase->player_created)/(3600) - ((current_time - playerbase->player_created)/(3600*24) * 24), ((current_time - playerbase->player_created)/(3600) - ((current_time - playerbase->player_created)/(3600*24) * 24) != 1 ? "s" : ""),
                                 (current_time - playerbase->player_created)/(60) - ((current_time - playerbase->player_created)/(60*60) * 60 ), ((current_time - playerbase->player_created)/(60) - ((current_time - playerbase->player_created)/(60*60) * 60 ) != 1 ? "s" : ""));
		  send_to_char(bufr, ch);
		}
	      break;
	    }
	}
      if (!ffund)
	{
	  send_to_char ("Player not found or not visible.\n\r", ch);
	}
      return;
    }
  
  if ((LEVEL (ch) < 100 && DIFF_ALIGN(ch, victim)) ||  !can_see (ch, victim) || IS_MOB (victim))
    {
      send_to_char ("Player not found or not visible.\n\r", ch);
      return;
    }

  sprintf (buf, "\x1B[1;34m%s\x1B[37;0m the %s %s is currently playing.\n\r", NAME (victim),
	   (SEX (victim) == SEX_MALE ? "male" :
	    SEX (victim) == SEX_FEMALE ? "female" : "sexless"),
	   race_info[victim->pcdata->race].name);
  send_to_char (buf, ch);
  if (LEVEL (ch) > (MAX_LEVEL -3)&& victim->pcdata->email[0] != '\0')
    {
      sprintf (buf, "\x1B[37;0m[\x1B[1mGod only info\x1B[0m]: Email: %s.\n\r", victim->pcdata->email);
      send_to_char (buf, ch);
    }

  return;
}