void
command_interpreter (CHAR_DATA * ch, char *argument)
{
	char buf[MAX_STRING_LENGTH];
	char *command_args, *p, *social_args;
	int cmd_level = 0;
	int i = 0, echo = 1;
	AFFECTED_TYPE *craft_affect = NULL;
	AFFECTED_TYPE *af;
	ALIAS_DATA *alias;
	extern int second_affect_active;

	if (!ch)
		return;

	*buf = '\0';

	p = argument;

	while (*p == ' ')
		p++;

	if (strchr (p, '%'))
	{
		send_to_char ("Input with the '%' character is not permitted.\n", ch);
		return;
	}

	if (strchr (p, '#') && IS_MORTAL (ch) && strncmp (p, "ge", 2) != 0
		&& strncmp (p, "buy", 3) != 0)
	{
		send_to_char ("Input with the '#' character is not permitted.\n", ch);
		return;
	}

	if (IS_MORTAL (ch) && strchr (p, '$'))
	{
		send_to_char ("Input with the '$' character is not permitted.\n", ch);
		return;
	}

	std::multimap<int, room_prog>::iterator it;
	if (IS_NPC(ch))
		it = mob_prog_list.find(ch->mob->nVirtual); 
	if (IS_NPC(ch) && !get_second_affect (ch, SA_DOANYWAY, 0) && it != mob_prog_list.end())
	{
		if (m_prog(ch, p))
		{
			return;
		}
	}
	std::pair<std::multimap<int, room_prog>::iterator, std::multimap<int, room_prog>::iterator> pair;

	if (ch->right_hand && !get_second_affect (ch, SA_DOANYWAY, 0))
	{
		pair = obj_prog_list.equal_range(ch->right_hand->nVirtual);
		for (it = pair.first; it != pair.second; it++)
		{
			if (it->second.type != 1 && it->second.type != 3 && it->second.type != 5)
				continue;
			if (o_prog(ch, p, it->second))
				return;
		}
	}
	if (ch->left_hand && !get_second_affect (ch, SA_DOANYWAY, 0))
	{
		pair = obj_prog_list.equal_range(ch->left_hand->nVirtual);
		for (it = pair.first; it != pair.second; it++)
		{
			if (it->second.type != 1 && it->second.type != 3 && it->second.type != 5)
				continue;
			if (o_prog(ch, p, it->second))
				return;
		}
	}
	for (OBJ_DATA *tobj = ch->equip; tobj; tobj = tobj->next_content)
	{
		if (get_second_affect (ch, SA_DOANYWAY, 0))
			break;

		pair = obj_prog_list.equal_range(tobj->nVirtual);
		for (it = pair.first; it != pair.second; it++)
		{
			if (it->second.type != 2 && it->second.type != 3 && it->second.type != 5)
				continue;
			if (o_prog(ch, p, it->second))
				return;
		}

	}

	/* this is where it crashes on the hour - Grommit */

	if (!ch->room )
	{
		std::ostringstream stream;
		stream << "Error in command_interpreter:commands.cpp. Command \"" << 
			argument << "\" called by \"" << ch->tname << "\" with null room. Previously in "
			<< (ch->last_room) << " entering null room from the " << (dirs[ch->from_dir]) << ".";

		system_log(stream.str().c_str(),true);
		return;
	}

	/* end grommit diagnostics to avoid segfaulting on the below for loop */

	for (OBJ_DATA *tobj = ch->room->contents; tobj; tobj = tobj->next_content)
	{
		if (get_second_affect (ch, SA_DOANYWAY, 0))
			break;

		pair = obj_prog_list.equal_range(tobj->nVirtual);
		for (it = pair.first; it != pair.second; it++)
		{
			if (it->second.type != 4 && it->second.type != 5)
				continue;
			if (o_prog(ch, p, it->second))
				return;
		}

	}

	for (CHAR_DATA *temp_char = ch->room->people; temp_char; temp_char = temp_char->next_in_room)
	{
		if (get_second_affect (ch, SA_DOANYWAY, 0))
			break;

		if (temp_char == ch)
			continue;

		if (!IS_NPC(temp_char))
			continue;

		pair = mob_prog_list.equal_range(temp_char->mob->nVirtual);

		for (it = pair.first; it != pair.second; ++it)
		{
			if (m_prog(ch, p, it->second))
				return;
		}
	}

	if (ch->room && ch->room->prg && !get_second_affect(ch, SA_DOANYWAY, 0) && r_program (ch, p))
	{
		if (!IS_NPC (ch)
			|| (ch->desc && (ch->pc && str_cmp (ch->pc->account_name, "Guest"))))
		{
			player_log (ch, "[RPROG]", p);
		}
		if (!IS_SET (commands[i].flags, C_NWT))
			show_to_watchers (ch, argument);
		return;
	}
	if (get_second_affect(ch, SA_DOANYWAY, 0))
		remove_second_affect(get_second_affect(ch, SA_DOANYWAY, 0));

	if (!IS_MORTAL (ch) && !str_cmp (argument, "sho wl"))
	{
		send_to_char
			("Heh heh. Glad I added in this check, aren't we? No shouting for you.\n",
			ch);
		return;
	}

	if (ch->desc)
	{
		last_descriptor = ch->desc;
		sprintf (full_last_command, "Last Command Issued, by %s [%d]: %s",
			ch->tname, ch->in_room, argument);
		sprintf (last_command, "%s", argument);
	}

	social_args = argument;

	command_args = one_argument (argument, buf);

	if (!*buf)
		return;

	while (*command_args == ' ')
		command_args++;

	if (ch->pc && !GET_FLAG (ch, FLAG_ALIASING))
	{

		if ((alias = is_alias (ch, buf)))
		{

			ch->flags |= FLAG_ALIASING;

			while (alias)
			{

				command_interpreter (ch, alias->line);

				if (ch->deleted)
					return;

				alias = alias->next_line;
			}

			ch->flags &= ~FLAG_ALIASING;

			return;
		}
	}

	for (i = 1; *commands[i].command; i++)
		if (is_abbrev (buf, commands[i].command))
			break;

	if ((craft_affect = is_craft_command (ch, argument)))
		i = 0;

	if (IS_SET (commands[i].flags, C_IMP)) {
		cmd_level = 6;
	}
	else if (IS_SET (commands[i].flags, C_LV5)) {
		cmd_level = 5;
	}
	else if (IS_SET (commands[i].flags, C_LV4)) {
		cmd_level = 4;
	}
	else if (IS_SET (commands[i].flags, C_LV3)) {
		cmd_level = 3;
	}
	else if (IS_SET (commands[i].flags, C_LV2)) {
		cmd_level = 2;
	}
	else if (IS_SET (commands[i].flags, C_LV1)) {
		cmd_level = 1;
	}

	if (IS_SET (commands[i].flags, C_GDE)
		&& (IS_NPC (ch) || (!ch->pc->is_guide && !ch->pc->level)))
	{
		send_to_char ("Eh?\n\r", ch);
		return;
	}
	/* 
	Need to pass the CHAR_DATA pointer for the person who made the command and modify
	the following line to test the commanding char's trust against the trust level for
	the command.  - Methuselah
	*/

	if ((!*commands[i].command) 
		|| (cmd_level > GET_TRUST (ch)))
	{
		if (!social (ch, argument))
		{
			echo = number (1, 9);
			if (echo == 1)
				send_to_char ("Eh?\n\r", ch);
			else if (echo == 2)
				send_to_char ("Huh?\n\r", ch);
			else if (echo == 3)
				send_to_char ("I'm afraid that just isn't possible...\n\r", ch);
			else if (echo == 4)
				send_to_char ("I don't recognize that command.\n\r", ch);
			else if (echo == 5)
				send_to_char ("What?\n\r", ch);
			else if (echo == 6)
				send_to_char
				("Perhaps you should try typing it a different way?\n\r", ch);
			else if (echo == 7)
				send_to_char
				("Try checking your typing - I don't recognize it.\n\r", ch);
			else if (echo == 8)
				send_to_char
				("That isn't a recognized command, craft, or social.\n\r", ch);
			else
				send_to_char ("Hmm?\n\r", ch);
		}
		else
		{
			if (!IS_SET (commands[i].flags, C_NWT))
				show_to_watchers (ch, argument);
		}
		return;
	}

	if (ch->stun)
	{
		send_to_char ("You're still reeling.\n", ch);
		return;
	}

	if (ch->roundtime)
	{
		sprintf (buf, "You'll need to wait another %d seconds.\n",
			ch->roundtime);
		send_to_char (buf, ch);
		return;
	}

	if (IS_SET (commands[i].flags, C_WLK) &&
		(ch->moves || GET_FLAG (ch, FLAG_LEAVING)
		|| GET_FLAG (ch, FLAG_ENTERING)))
	{
		send_to_char ("Stop traveling first.\n\r", ch);
		return;
	}

	if (IS_SET (commands[i].flags, C_MNT) && IS_RIDER (ch))
	{
		send_to_char ("Get off your mount first.\n", ch);
		return;
	}

	if (commands[i].min_position > GET_POS (ch))
	{
		switch (GET_POS (ch))
		{
		case DEAD:
			if (IS_MORTAL (ch))
			{
				send_to_char ("You are dead.  You can't do that.\n\r", ch);
				return;
			}
		case UNCON:
		case MORT:
			send_to_char ("You're seriously wounded and unconscious.\n\r", ch);
			return;

		case STUN:
			send_to_char ("You're too stunned to do that.\n\r", ch);
			return;

		case SLEEP:
			send_to_char ("You can't do that while sleeping.\n\r", ch);
			return;

		case REST:
			send_to_char ("You can't do that while lying down.\n\r", ch);
			return;

		case SIT:
			send_to_char ("You can't do that while sitting.\n\r", ch);
			return;

		case FIGHT:
			send_to_char ("No way! You are fighting for your life!\n\r", ch);
			return;
		}

		return;
	}

	if (!IS_NPC (ch) && ch->pc->create_state == STATE_DIED &&
		!IS_SET (commands[i].flags, C_DOA))
	{
		send_to_char ("You can't do that when you're dead.\n\r", ch);
		return;
	}

	if (!IS_SET (commands[i].flags, C_BLD) && is_blind (ch))
	{
		if (get_equip (ch, WEAR_BLINDFOLD))
			send_to_char ("You can't do that while blindfolded.\n\r", ch);
		else
			send_to_char ("You can't do that while blind.\n\r", ch);
		return;
	}

	if ((af = get_affect (ch, MAGIC_AFFECT_PARALYSIS)) &&
		!IS_SET (commands[i].flags, C_PAR) && IS_MORTAL (ch))
	{
		send_to_char ("You can't move.\n", ch);
		return;
	}

	if (IS_SUBDUEE (ch) && !IS_SET (commands[i].flags, C_SUB) && !cmd_level)
	{
		act ("$N won't let you.", false, ch, 0, ch->subdue, TO_CHAR);
		return;
	}

	/* Most commands break delays */

	if (ch->delay && !IS_SET (commands[i].flags, C_DEL))
		break_delay (ch);

	/* Send this command to the log */
	if (!second_affect_active && (!IS_NPC (ch) || ch->desc))
	{
		if (IS_SET (commands[i].flags, C_NLG))
			;
		else if (i > 0)
		{			/* Log craft commands separately. */
			if (!str_cmp (commands[i].command, "."))
				player_log (ch, "say", command_args);
			else if (!str_cmp (commands[i].command, ","))
				player_log (ch, "emote", command_args);
			else if (!str_cmp (commands[i].command, ":"))
				player_log (ch, "emote", command_args);
			else if (!str_cmp (commands[i].command, ";"))
				player_log (ch, "wiznet", command_args);
			else
				player_log (ch, commands[i].command, command_args);
		}
	}

	if (IS_MORTAL (ch) && get_affect (ch, MAGIC_HIDDEN) &&
		!IS_SET (commands[i].flags, C_HID) &&
		skill_level (ch, SKILL_SNEAK, 0) < number (1, MAX(100, skill_level(ch, SKILL_SNEAK, 0))) &&
		would_reveal (ch))
	{
		remove_affect_type (ch, MAGIC_HIDDEN);
		act ("$n reveals $mself.", true, ch, 0, 0, TO_ROOM | _ACT_FORMAT);
		act ("Your actions have compromised your concealment.", true, ch, 0, 0,
			TO_CHAR);
	}

	/* Execute command */

	if (!IS_SET (commands[i].flags, C_NWT))
		show_to_watchers (ch, social_args);

	if (!i)			/* craft_command */
		craft_command (ch, command_args, craft_affect);
	else

		(*commands[i].proc) (ch, command_args, 0);

	last_descriptor = NULL;
}
Exemple #2
0
void gain_exp_unchecked(CharData *ch, int gain)
{
    // PC mobs do NOT gain exps at all.
    if (IS_AFFECTED(ch, AFF_CHARM) || MOB_FLAGGED(ch, MOB_CONJURED))
        return;
 
    // stop xps clocking over.
    if ((GET_EXP(ch) > 2000000000) && gain > 0)
        return;

    if (!IS_NPC(ch) && ((GET_LEVEL(ch) < 1 || GET_LEVEL(ch) > MAX_MORTAL)))
        return;

    if (IN_ARENA(ch)) return;
    if (ZONE_FLAGGED(world[ch->in_room].zone, ZONE_ARENA)) return;
    if (ZONE_FLAGGED(world[ch->in_room].zone, ZONE_SLEEPTAG)) return;

    /* NPCs just get their exp mod and leave */
    if (IS_NPC(ch)) {
        GET_EXP(ch) += gain;
        return;
    }

    if (gain > 0) {
        if ((GET_EXP(ch) + gain ) > INT_MAX)
            return;

        GET_EXP(ch) += gain;

        /* Did the player just earn a level? */
        if( GET_LEVEL(ch) < MAX_MORTAL &&
           GET_EXP(ch) >= titles[(int) GET_CLASS(ch)][GET_LEVEL(ch) + 1].exp)
        {
            send_to_char("You rise a level!\r\n", ch);
            GET_EXP(ch) = titles[(int) GET_CLASS(ch)][GET_LEVEL(ch) + 1].exp;
            GET_LEVEL(ch) += 1;
            level_up(ch);
            set_title(ch, NULL);
        }
    } else if (gain < 0) {
        long thisLvl = (titles[(int) GET_CLASS(ch)][GET_LEVEL(ch) + 0].exp);
        long nextLvl = (titles[(int) GET_CLASS(ch)][GET_LEVEL(ch) + 1].exp);
        long neg100 = thisLvl - nextLvl + thisLvl;

        GET_EXP(ch) += gain;

        /* uh oh spaghettios! */
        if (GET_EXP(ch) < 0 && IS_MORTAL(ch)) {
            mudlog(NRM, LVL_IMMORT, TRUE, "SOUL DEATH: %s reduced to 0 xps by death, deleting!",
                    GET_NAME(ch));   
            sendChar(ch, "Your soul is too weak to return to the world...");
            sendChar(ch, "Utter darkness surrounds you as you slowly slip "
                         "into oblivion...");
            act("A look of utter despair crosses $n's face as their very soul"
                " is destroyed.", TRUE, ch, 0, 0, TO_ROOM );
            SET_BIT_AR(PLR_FLAGS(ch), PLR_DELETED);
            if (ch->desc) SET_DCPENDING(ch->desc);
        }

        /* Did the player just lose a level? */
        if (GET_LEVEL(ch) > 1 && IS_MORTAL(ch) && GET_EXP(ch) <= neg100) {
            send_to_char("You have lost a level!\r\n", ch);
            GET_LEVEL(ch) -= 1;
            retreat_level(ch);
            set_title(ch, NULL);

            /* make sure they don't drop below 0% at their new level */
            if (GET_EXP(ch) < titles[(int)GET_CLASS(ch)][GET_LEVEL(ch)].exp)
                GET_EXP(ch) = titles[(int)GET_CLASS(ch)][GET_LEVEL(ch)].exp;
        }
    }
}
int
social (CHAR_DATA * ch, char *argument)
{
	char buf[MAX_INPUT_LENGTH];
	SOCIAL_DATA *action;
	CHAR_DATA *victim;
	int i;

	argument = one_argument (argument, buf);

	if (ch->room->nVirtual == AMPITHEATRE && IS_MORTAL (ch))
	{
		if (!get_obj_in_list_num (VNUM_SPEAKER_TOKEN, ch->right_hand) &&
			!get_obj_in_list_num (VNUM_SPEAKER_TOKEN, ch->left_hand))
		{
			send_to_char
				("You decide against making a commotion. PETITION to request to speak.\n",
				ch);
			return 0;
		}
	}

	for (i = 0; i < list_top; i++)
	{
		if (is_abbrev (buf, social_messages[i].social_command))
			break;
	}

	if (i == list_top)
		return 0;

	action = &social_messages[i];

	if (action->char_found)
		one_argument (argument, buf);
	else
		*buf = '\0';

	if (!*buf)
	{
		send_to_char (action->char_no_arg, ch);
		send_to_char ("\n\r", ch);
		if (action->others_no_arg)
			act (action->others_no_arg, action->hide, ch, 0, 0, TO_ROOM);

		return 1;
	}

	if (!(victim = get_char_room_vis (ch, buf)))
	{
		send_to_char (action->not_found, ch);
		send_to_char ("\n\r", ch);
	}

	else if (victim == ch)
	{
		send_to_char (action->char_auto, ch);
		send_to_char ("\n\r", ch);
		if (action->others_auto)
			act (action->others_auto, action->hide, ch, 0, 0, TO_ROOM);
	}

	else if (GET_POS (victim) < action->min_victim_position)
		act ("$N is not in a proper position for that.",
		false, ch, 0, victim, TO_CHAR);

	else
	{
		if (action->char_found)
			act (action->char_found, 0, ch, 0, victim, TO_CHAR);

		if (action->others_found)
			act (action->others_found, action->hide, ch, 0, victim, TO_NOTVICT);

		if (action->vict_found)
			act (action->vict_found, action->hide, ch, 0, victim, TO_VICT);
	}

	return 1;
}
Exemple #4
0
void
do_assist (CHAR_DATA * ch, char *argument, int cmd)
{
  CHAR_DATA *tch = NULL;
  int pos = 0, i = 0;
  char buf[MAX_STRING_LENGTH];

  if (!IS_GUIDE (ch) && IS_MORTAL (ch)
      && !IS_SET (ch->plr_flags, NEW_PLAYER_TAG))
    {
      send_to_char
	("Only Guides, staff members, and new characters may use this command.\n",
	 ch);
      return;
    }

  if (!str_cmp (argument, "request"))
    {
      if (str_cmp (ch->room->name, PREGAME_ROOM_NAME))
	{
	  send_to_char
	    ("This command may only be invoked in a pre-game debriefing room.\n",
	     ch);
	  return;
	}
      if (!IS_SET (ch->plr_flags, NEW_PLAYER_TAG))
	{
	  send_to_char
	    ("The assist queue is only available to new characters.\n", ch);
	  return;
	}
      if ((pos = get_queue_position (ch)) != -1)
	{
	  sprintf (buf,
		   "You are already number #6%d#0 in the assist queue.\n",
		   pos);
	  send_to_char (buf, ch);
	  return;
	}
      update_assist_queue (ch, false);
      ch->assist_pos = get_queue_position (ch);
      sprintf (buf, "You are now number #6%d#0 in the assist queue.\n",
	       get_queue_position (ch));
      send_to_char (buf, ch);
      return;
    }
  else if (!str_cmp (argument, "cancel"))
    {
      if ((pos = get_queue_position (ch)) == -1)
	{
	  send_to_char ("You are not currently in the assist queue.\n", ch);
	  return;
	}
      update_assist_queue (ch, true);
      send_to_char ("You have been removed from the assist queue.\n", ch);
      return;
    }
  else if (!str_cmp (argument, "list") || !str_cmp (argument, "queue"))
    {
      if (!IS_GUIDE (ch) && IS_MORTAL (ch))
	{
	  send_to_char
	    ("Only Guides and staff members may see the assist queue.\n", ch);
	  return;
	}
      if (!assist_queue)
	{
	  send_to_char ("The assist queue is currently empty.\n", ch);
	  return;
	}
      sprintf (buf, "#6Currently waiting in the assist queue:#0\n\n");
      for (tch = assist_queue; tch; tch = tch->next_assist)
	{
	  i++;
	  sprintf (buf + strlen (buf), "  %2d. %s\n", i, tch->pc->account_name);
	}
      send_to_char (buf, ch);
      return;
    }
  else if (!str_cmp (argument, "answer"))
    {
      if (!IS_GUIDE (ch) && IS_MORTAL (ch))
	{
	  send_to_char
	    ("Only Guides and staff members may answer assist requests.\n",
	     ch);
	  return;
	}
      if (IS_GUIDE (ch) && !IS_SET (ch->flags, FLAG_GUEST))
	{
	  send_to_char
	    ("You may only answer assist requests via your Guest login.\n",
	     ch);
	  return;
	}
      if (!(tch = assist_queue))
	{
	  send_to_char
	    ("There is currently no-one waiting in the assist queue.\n", ch);
	  return;
	}
      act ("Your request for assistance has been answered!", true, tch, 0, 0,
	   TO_CHAR);

      if (tch->in_room != ch->in_room)
	{
	  tch->was_in_room = tch->in_room;
	  send_to_char ("\n", tch);
	  act ("$n vanishes in a subtle glimmer of light.", true, ch, 0, 0,
	       TO_ROOM | _ACT_FORMAT);
	  char_from_room (ch);
	  char_to_room (ch, tch->in_room);
	  act ("$n appears in a subtle glimmer of light.", true, ch, 0, 0,
	       TO_ROOM | _ACT_FORMAT);
	  send_to_char ("\n", ch);
	  act
	    ("The world around you fades away in a glimmer of light and you feel yourself whisked instantly to $N's location.",
	     false, ch, 0, tch, TO_CHAR | _ACT_FORMAT);
	  send_to_char ("\n", ch);
	}
      else
	send_to_char ("\n", ch);

      update_assist_queue (tch, true);

      send_to_char ("\n", ch);

      do_look (ch, "", 0);

      return;
    }
  else if (!str_cmp (argument, "return"))
    {
      if (!IS_GUIDE (ch) || !IS_SET (ch->flags, FLAG_GUEST))
	{
	  send_to_char ("This command is only for Guide guest logins.\n", ch);
	  return;
	}
      if (ch->in_room == OOC_LOUNGE)
	{
	  send_to_char ("You're already in Club Endore!\n", ch);
	  return;
	}
      act ("$n vanishes in a subtle glimmer of light.", true, ch, 0, 0,
	   TO_ROOM | _ACT_FORMAT);
      char_from_room (ch);
      char_to_room (ch, OOC_LOUNGE);
      act ("$n appears in a subtle glimmer of light.", true, ch, 0, 0,
	   TO_ROOM | _ACT_FORMAT);
      send_to_char ("\n", ch);
      act
	("The world around you fades away in a glimmer of light and you feel yourself whisked instantly back to Club Endore.",
	 false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
      send_to_char ("\n", ch);
      do_look (ch, "", 0);
      return;
    }
  else if (*argument)
    {
      send_to_char ("See #6HELP ASSIST#0 for command usage.\n", ch);
      return;
    }

  if ((pos = get_queue_position (ch)) != -1)
    {
      sprintf (buf, "You are currently number #6%d#0 in the assist queue.\n",
	       pos);
      send_to_char (buf, ch);
      return;
    }
  else
    send_to_char ("You are not currently in the assist queue.\n", ch);

  return;
}
Exemple #5
0
void
close_socket (DESCRIPTOR_DATA * d)
{
  DESCRIPTOR_DATA *tmp;
  char buf[100];

  if (d->connected == CON_SOFT_REBOOT)	/* Soft reboot sockets. */
    return;

  if (d->character)		/* I don't know about this one. . . */
    d->character->desc = 0;

  close (d->hSocketFD);
  flush_queues (d);

  if (d->hSocketFD == maxdesc)
    --maxdesc;

  if (d->character && d->connected != CON_PLYNG)
    {
      unload_pc (d->character);
      d->character = NULL;
    }
  else if (d->character && d->connected == CON_PLYNG)
    {

      if (d->character->pc)
	d->character->pc->last_disconnect = time (0);

      save_char (d->character, true);

      /* KLUDGE:  If the player is disconnecting is staff, he will
         get a message about himself disconnecting.  However, he will
         be gone before that message gets to him, and the message
         will sit around in memory.  By saying he isn't connected, the
         message will not be sent.  (connected = -1)
       */

      if (d->original)
	{
	  d->character = d->original;
	  d->original = NULL;
	}

      sprintf (s_buf, "%s has lost link.\n", d->character->tname);
      d->connected = CON_LINKDEAD;
      send_to_gods (s_buf);
      d->connected = CON_PLYNG;

      if (d->snoop.snooping && d->snoop.snooping->desc)
	{
	  d->snoop.snooping->desc->snoop.snoop_by = 0;
	  d->snoop.snooping = 0;
	}

      if (d->snoop.snoop_by && d->snoop.snoop_by->desc)
	{
	  d->snoop.snoop_by->desc->snoop.snooping = 0;
	  d->snoop.snoop_by = 0;
	}

      if (d->character->pc)
	d->character->pc->owner = 0;

      if (IS_MORTAL (d->character)
	  && !IS_SET (d->character->flags, FLAG_GUEST))
	{
	  act ("$n has lost link.", true, d->character, 0, 0, TO_ROOM);

	  sprintf (buf, "Closing link to: %s.", GET_NAME (d->character));
	  system_log (buf, false);

	  d->character->desc = 0;
	}
      else if (IS_SET (d->character->flags, FLAG_GUEST))
	do_quit (d->character, "", 0);
    }

  if (d->acct)
      delete d->acct;

  if (next_to_process == d)
    next_to_process = next_to_process->next;

  if (d == descriptor_list)
    {				/* this is the head of the list */
      descriptor_list = descriptor_list->next;
    }
  else
    {
      for (tmp = descriptor_list; tmp->next; tmp = tmp->next)
	if (tmp->next == d)
	  {
	    tmp->next = tmp->next->next;
	    break;
	  }
    }

  d->next = NULL;

  free_descriptor (d);

  socket_closed = true;
}
Exemple #6
0
void
do_hex (CHAR_DATA * ch, char *argument, int cmd)
{
  int sn;
  int duration, modifier;
  CHAR_DATA *tch;
  char buf[MAX_STRING_LENGTH];

  if (!real_skill (ch, SKILL_HEX))
    {
      send_to_char ("You shiver at the thought.\n\r", ch);
      return;
    }

  argument = one_argument (argument, buf);

  if (!(tch = get_char_room_vis (ch, buf)))
    {
      send_to_char ("You don't see that person here.\n\r", ch);
      return;
    }

  if (IS_MORTAL (ch) && !IS_MORTAL (tch))
    {
      send_to_char
	("Immortals are total losers.  It can't get any worse for them.\n\r",
	 ch);
      return;
    }

  if (GET_HIT (ch) + GET_MOVE (ch) <= 35)
    {
      send_to_char
	("You can't concentrate hard enough for that right now.\n\r", ch);
      return;
    }

  sprintf (buf, "Hexing %s", tch->tname);
  weaken (ch, 0, 20, buf);
  sense_activity (ch, SKILL_HEX);

  if (!skill_use (ch, SKILL_HEX, 0))
    {
      send_to_char
	("You lose your concentration, and your malignant energies dissipate.\n",
	 ch);
      return;
    }

  act
    ("You channel a stream of malignant psychic energy into $N, entwining $M in an ethereal web of ill-fortune and grief.",
     false, ch, 0, tch, TO_CHAR | _ACT_FORMAT);
  act ("A chill runs down your spine.", false, ch, 0, tch, TO_VICT);

  sn = spell_lookup ("curse");

  modifier = ch->skills[SKILL_HEX] / 5 + number (1, 10);
  duration = ch->skills[SKILL_HEX] / 5 + number (1, 48);

  magic_add_affect (tch, MAGIC_AFFECT_CURSE, duration, modifier, 0, 0, sn);

  tch->curse += ch->skills[SKILL_HEX] / 5 + number (1, 5);
}
Exemple #7
0
void
soma_stat (CHAR_DATA * ch, AFFECTED_TYPE * af)
{
  char buf[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];

  switch (af->type)
    {
    case SOMA_MUSCULAR_CRAMP:
      sprintf (buf2, "a muscle cramp");
      break;
    case SOMA_MUSCULAR_TWITCHING:
      sprintf (buf2, "twitching");
      break;
    case SOMA_MUSCULAR_TREMOR:
      sprintf (buf2, "tremors");
      break;
    case SOMA_MUSCULAR_PARALYSIS:
      sprintf (buf2, "paralysis");
      break;
    case SOMA_DIGESTIVE_ULCER:
      sprintf (buf2, "stomach ulcer");
      break;
    case SOMA_DIGESTIVE_VOMITING:
      sprintf (buf2, "vomiting");
      break;
    case SOMA_DIGESTIVE_BLEEDING:
      sprintf (buf2, "vomiting blood");
      break;
    case SOMA_EYE_BLINDNESS:
      sprintf (buf2, "blindness");
      break;
    case SOMA_EYE_BLURRED:
      sprintf (buf2, "blurred vision");
      break;
    case SOMA_EYE_DOUBLE:
      sprintf (buf2, "double vision");
      break;
    case SOMA_EYE_DILATION:
      sprintf (buf2, "dilated pupils");
      break;
    case SOMA_EYE_CONTRACTION:
      sprintf (buf2, "contracted pupils");
      break;
    case SOMA_EYE_LACRIMATION:
      sprintf (buf2, "lacrimation");
      break;
    case SOMA_EYE_PTOSIS:
      sprintf (buf2, "ptosis");
      break;
    case SOMA_EAR_TINNITUS:
      sprintf (buf2, "tinnitus");
      break;
    case SOMA_EAR_DEAFNESS:
      sprintf (buf2, "deafness");
      break;
    case SOMA_EAR_EQUILLIBRIUM:
      sprintf (buf2, "ear imbalance");
      break;
    case SOMA_NOSE_ANOSMIA:
      sprintf (buf2, "anosmia");
      break;
    case SOMA_NOSE_RHINITIS:
      sprintf (buf2, "rhinitis");
      break;
    case SOMA_MOUTH_SALIVATION:
      sprintf (buf2, "salivation");
      break;
    case SOMA_MOUTH_TOOTHACHE:
      sprintf (buf2, "toothache");
      break;
    case SOMA_MOUTH_DRYNESS:
      sprintf (buf2, "dry mouth");
      break;
    case SOMA_MOUTH_HALITOSIS:
      sprintf (buf2, "halitosis");
      break;
    case SOMA_CHEST_DIFFICULTY:
      sprintf (buf2, "difficulty breathing");
      break;
    case SOMA_CHEST_WHEEZING:
      sprintf (buf2, "wheezing");
      break;
    case SOMA_CHEST_RAPIDBREATH:
      sprintf (buf2, "rapid breathing");
      break;
    case SOMA_CHEST_SLOWBREATH:
      sprintf (buf2, "shallow breathing");
      break;
    case SOMA_CHEST_FLUID:
      sprintf (buf2, "fluidous lungs");
      break;
    case SOMA_CHEST_PALPITATIONS:
      sprintf (buf2, "heart palpitations");
      break;
    case SOMA_CHEST_COUGHING:
      sprintf (buf2, "coughing fits");
      break;
    case SOMA_CHEST_PNEUMONIA:
      sprintf (buf2, "pneumonia");
      break;
    case SOMA_NERVES_PSYCHOSIS:
      sprintf (buf2, "psychosis");
      break;
    case SOMA_NERVES_DELIRIUM:
      sprintf (buf2, "delerium ");
      break;
    case SOMA_NERVES_COMA:
      sprintf (buf2, "a comatose state");
      break;
    case SOMA_NERVES_CONVULSIONS:
      sprintf (buf2, "convulsions");
      break;
    case SOMA_NERVES_HEADACHE:
      sprintf (buf2, "a headache");
      break;
    case SOMA_NERVES_CONFUSION:
      sprintf (buf2, "confusion");
      break;
    case SOMA_NERVES_PARETHESIAS:
      sprintf (buf2, "parethesias");
      break;
    case SOMA_NERVES_ATAXIA:
      sprintf (buf2, "ataxia");
      break;
    case SOMA_NERVES_EQUILLIBRIUM:
      sprintf (buf2, "nervous imbalance");
      break;
    case SOMA_SKIN_CYANOSIS:
      sprintf (buf2, "cyanosis of the skin");
      break;
    case SOMA_SKIN_DRYNESS:
      sprintf (buf2, "dryness of the skin");
      break;
    case SOMA_SKIN_CORROSION:
      sprintf (buf2, "corrosion of the skin");
      break;
    case SOMA_SKIN_JAUNDICE:
      sprintf (buf2, "jaundice of the skin");
      break;
    case SOMA_SKIN_REDNESS:
      sprintf (buf2, "redness of the skin");
      break;
    case SOMA_SKIN_RASH:
      sprintf (buf2, "a rash on the skin");
      break;
    case SOMA_SKIN_HAIRLOSS:
      sprintf (buf2, "hairloss");
      break;
    case SOMA_SKIN_EDEMA:
      sprintf (buf2, "edema of the skin");
      break;
    case SOMA_SKIN_BURNS:
      sprintf (buf2, "burns on the skin");
      break;
    case SOMA_SKIN_PALLOR:
      sprintf (buf2, "pallor of the skin");
      break;
    case SOMA_SKIN_SWEATING:
      sprintf (buf2, "the sweats");
      break;
    case SOMA_GENERAL_WEIGHTLOSS:
      sprintf (buf2, "weight loss");
      break;
    case SOMA_GENERAL_LETHARGY:
      sprintf (buf2, "lethargy");
      break;
    case SOMA_GENERAL_APPETITELOSS:
      sprintf (buf2, "appetite loss");
      break;
    case SOMA_GENERAL_PRESSUREDROP:
      sprintf (buf2, "low blood pressure");
      break;
    case SOMA_GENERAL_PRESSURERISE:
      sprintf (buf2, "high blood pressure");
      break;
    case SOMA_GENERAL_FASTPULSE:
      sprintf (buf2, "a fast pulse");
      break;
    case SOMA_GENERAL_SLOWPULSE:
      sprintf (buf2, "a slow pulse");
      break;
    case SOMA_GENERAL_HYPERTHERMIA:
      sprintf (buf2, "hyperthermia");
      break;
    case SOMA_GENERAL_HYPOTHERMIA:
      sprintf (buf2, "hypothermia");
      break;
    default:
      sprintf (buf2, "an unknown somatic effect");
      break;
    }

	send_to_char("\n", ch);
	if (!IS_MORTAL (ch))
		{
  sprintf (buf,
	   "#2%5d#0   Suffers from %s for %d more in-game hours.\n        Latency: %d hrs Power: %d to %d (%d @ %d min)\n        A: %d min, D: %d min, S: %d min, R: %d min\n",
	   af->type, buf2, af->a.soma.duration, af->a.soma.latency,
	   af->a.soma.max_power, af->a.soma.lvl_power, af->a.soma.atm_power,
	   af->a.soma.minute, af->a.soma.attack, af->a.soma.decay,
	   af->a.soma.sustain, af->a.soma.release);
	   }
	 else
	 {
	 sprintf (buf, "You suffer from %s.", buf2);
	 }
  send_to_char (buf, ch);
}