コード例 #1
0
ファイル: quest.c プロジェクト: zachflower/oasis-mud
/* The main quest function */
void do_quest( CHAR_DATA * ch, char * argument ) {
  CHAR_DATA        * questman;
  OBJ_DATA         * obj = NULL;
  OBJ_DATA         * obj_next;
  OBJ_INDEX_DATA   * rewardObj;
  char               buf[ MAX_STRING_LENGTH ];
  char               result[ MAX_STRING_LENGTH * 2 ];
  char               arg1[ MAX_INPUT_LENGTH ];
  char               arg2[ MAX_INPUT_LENGTH ];
  char               arg3[ MAX_INPUT_LENGTH ];
  int                amt = 0;

  argument = one_argument( argument, arg1 );
  argument = one_argument( argument, arg2 );
  argument = one_argument( argument, arg3 );

  if ( arg3[ 0 ] != '\0' ) {
    amt = is_number( arg3 ) ? atoi( arg3 ) : 1;
  } else {
    amt = 1;
  }

  if ( !strcmp( arg1, "info" ) ) {
    if ( CHECK_BIT( ch->act, PLR_QUESTOR ) ) {
      if ( ( !ch->questmob && !ch->questobj ) && ch->questgiver->short_descr != NULL ) {
        send_to_char( AT_YELLOW, "&YYour quest is ALMOST complete!\n\r", ch );
      } else if ( ch->questobj ) {
        sprintf( buf, "You are on a quest to find %s!\n\r", ch->questobj->short_descr );
        send_to_char( AT_WHITE, buf, ch );
        return;
      } else if ( ch->questmob ) {
        sprintf( buf, "You are on a quest to kill %s!\n\r", ch->questmob->short_descr );
        send_to_char( AT_WHITE, buf, ch );
        return;
      }
    } else {
      send_to_char( AT_WHITE, "You aren't currently on a quest.\n\r", ch );
    }

    return;
  }

  if ( !strcmp( arg1, "area" ) ) {
    if ( CHECK_BIT( ch->act, PLR_QUESTOR ) ) {
      sprintf( buf, "AREA: %s\n\r", room->area->name );
      send_to_char( AT_WHITE, buf, ch );
      return;
    } else {
      send_to_char( AT_WHITE, "You aren't currently on a quest.\n\r", ch );
    }

    return;
  }

  if ( !strcmp( arg1, "points" ) ) {
    sprintf( buf, "You have %d quest points.\n\r", ch->questpoints );
    send_to_char( AT_WHITE, buf, ch );
    return;
  } else if ( !strcmp( arg1, "time" ) ) {
    if ( !CHECK_BIT( ch->act, PLR_QUESTOR ) ) {
      send_to_char( AT_WHITE, "You aren't currently on a quest.\n\r", ch );

      if ( ch->nextquest > 1 ) {
        sprintf( buf, "There are %d minutes remaining until you can go on another quest.\n\r", ch->nextquest );
        send_to_char( AT_WHITE, buf, ch );
      } else if ( ch->nextquest == 1 ) {
        sprintf( buf, "There is less than a minute remaining until you can go on another quest.\n\r" );
        send_to_char( AT_WHITE, buf, ch );
      }
    } else if ( ch->countdown > 0 ) {
      sprintf( buf, "Time left for current quest: %d\n\r", ch->countdown );
      send_to_char( AT_WHITE, buf, ch );
    }

    return;
  }

  /* Checks for a Questmaster in the room */

  for ( questman = ch->in_room->people; questman; questman = questman->next_in_room ) {
    if ( IS_NPC( questman ) && CHECK_BIT( questman->act, ACT_QUESTMASTER ) ) {
      break;
    }
  }

  if ( !questman ) {
    send_to_char( AT_WHITE, "You can't do that here.\n\r", ch );
    return;
  }

  if ( questman->fighting != NULL ) {
    send_to_char( AT_WHITE, "Wait until the fighting stops.\n\r", ch );
    return;
  }

  /* Can have multiple questmasters, ch must report back to the one who gave quest */

  ch->questgiver = questman;

  /* List displaying items one can buy with quest points */

  if ( !strcmp( arg1, "list" ) ) {
    act( AT_WHITE, "$n asks $N for a list of quest items.", ch, NULL, questman, TO_ROOM );
    act( AT_WHITE, "You ask $N for a list of quest items.", ch, NULL, questman, TO_CHAR );
    if ( IS_IMMORTAL(ch) ) {
      sprintf( result, "&Y[ &RVnum   &Y] &C[ &R%5s %10s &C] [ &R%44s &C]\n\r", "Lvl", "Points", "Item" );
    } else {
      sprintf( result, "&C[ &R%5s %10s &C] [ &R%44s &C]\n\r", "Lvl", "Points", "Item" );
    }

    for ( cnt = 0; quest_table[ cnt ].vnum != -1; cnt++ ) {
      if ( (rewardObj = get_obj_index( quest_table[ cnt ].vnum) ) ) {
        if ( IS_IMMORTAL(ch) ) {
          sprintf( buf, "&Y[ &R%-6d &Y] &C[ &R%5d &P%10d &C] &C[ &R%*s &C]\n\r",
                  rewardObj->vnum,
                  rewardObj->level,
                  quest_table[ cnt ].qp,
                  (int)( 44 + strlen( rewardObj->short_descr ) - strlen_wo_col( rewardObj->short_descr ) ),
                  capitalize(rewardObj->short_descr) );
        } else {
          sprintf( buf, "&C[ &R%5d &P%10d &C] &C[ &R%*s &C]\n\r",
                  rewardObj->level,
                  quest_table[ cnt ].qp,
                  (int)( 44 + strlen( rewardObj->short_descr ) - strlen_wo_col( rewardObj->short_descr ) ),
                  capitalize(rewardObj->short_descr) );
        }

        strcat( result, buf );
      }
    }

    send_to_char( AT_WHITE, result, ch );
    return;
  } else if ( !strcmp( arg1, "buy" ) ) {
    if ( arg2[ 0 ] == '\0' ) {
      send_to_char( AT_WHITE, "To buy an item, type 'QUEST BUY <item> <amount>'.\n\rAmount is optional.\n\r", ch );
      return;
    }

    for ( cnt = 0; quest_table[ cnt ].vnum != -1; cnt++ ) {
      if ( (rewardObj = get_obj_index( quest_table[ cnt ].vnum) ) ) {
        if ( is_name( ch, arg2, rewardObj->name ) ) {
          if ( ch->questpoints >= ( quest_table[ cnt ].qp * amt ) && amt > -1 ) {
            if ( rewardObj->level <= ch->level ) {
              ch->questpoints -= quest_table[ cnt ].qp * amt;

              while ( amt > 0 ) {
                obj = create_object( rewardObj, rewardObj->level );
                act( AT_WHITE, "$N gives $p to $n.", ch, obj, questman, TO_ROOM );
                act( AT_WHITE, "$N gives you $p.", ch, obj, questman, TO_CHAR );
                obj_to_char( obj, ch );
                amt--;
              }
            } else {
              sprintf( buf, "Sorry, %s, but you are too inexperienced to use that item.\n\r", ch->name );
              do_say( questman, buf );
              return;
            }
          } else {
            sprintf( buf, "Sorry, %s, but you don't have enough quest points for that.\n\r", ch->name );
            do_say( questman, buf );
            return;
          }

          break;
        }
      }
    }

    if ( obj == NULL ) {
      sprintf( buf, "I don't have that item, %s.\n\r", ch->name );
      do_say( questman, buf );
    }

    return;
  } else if ( !strcmp( arg1, "request" ) ) {
    act( AT_WHITE, "$n asks $N for a quest.", ch, NULL, questman, TO_ROOM );
    act( AT_WHITE, "You ask $N for a quest.", ch, NULL, questman, TO_CHAR );

    if ( CHECK_BIT( ch->act, PLR_QUESTOR ) ) {
      sprintf( buf, "But you're already on a quest!" );
      do_say( questman, buf );
      return;
    }

    if ( ch->nextquest > 0 ) {
      sprintf( buf, "You're very brave, %s, but let someone else have a chance.", ch->name );
      do_say( questman, buf );
      sprintf( buf, "Come back later." );
      do_say( questman, buf );
      return;
    }

    sprintf( buf, "Thank you, brave %s!", ch->name );
    do_say( questman, buf );

    generate_quest( ch, questman );

    if ( ch->questmob || ch->questobj ) {
      if ( ch->questmob ) {
        ch->countdown = number_range( 10, 30 );   /* time to complete quest */

      }

      /* Allow longer chance for an object quest */

      if ( ch->questobj ) {
        ch->countdown = number_range( 20, 45 );
      }

      SET_BIT( ch->act, PLR_QUESTOR );
      sprintf( buf, "You have %d minutes to complete this quest.", ch->countdown );
      do_say( questman, buf );
      sprintf( buf, "May the gods go with you!" );
      do_say( questman, buf );
    }

    return;
  } else if ( !strcmp( arg1, "complete" ) ) {
    act( AT_WHITE, "$n informs $N $e has completed $S quest.", ch, NULL, questman, TO_ROOM );
    act( AT_WHITE, "You inform $N you have completed $S quest.", ch, NULL, questman, TO_CHAR );

    /* Check if ch returned to correct QuestMaster */
    if ( ch->questgiver != questman ) {
      sprintf( buf, "I never sent you on a quest! Perhaps you're thinking of someone else." );
      do_say( questman, buf );
      return;
    }

    if ( CHECK_BIT( ch->act, PLR_QUESTOR ) ) {
      if ( ( !ch->questmob && !ch->questobj ) && ch->countdown > 0 ) {
        int pointreward, pracreward;

        pointreward = number_range( 10, 30 );

        sprintf( buf, "Congratulations on completing your quest!" );
        do_say( questman, buf );

        sprintf( buf, "As a reward, I am giving you %d quest points!", pointreward );
        do_say( questman, buf );

        /* 5% chance of getting between 1 and 6 practices :> */
        if ( chance( 5 ) ) {
          pracreward = number_range( 1, 6 );
          sprintf( buf, "You gain %d practices!\n\r", pracreward );
          send_to_char( AT_WHITE, buf, ch );
          ch->practice += pracreward;
        }

        REMOVE_BIT( ch->act, PLR_QUESTOR );
        ch->questgiver = NULL;
        ch->countdown  = 0;
        ch->questmob   = NULL;
        ch->questobj   = NULL;
        ch->nextquest  = 30; /* 30 */
        /*	ch->gold += reward;*/
        ch->questpoints += pointreward;

        return;
      }
      /* Look to see if ch has quest obj in inventory */
      else if ( ch->questobj && ch->countdown > 0 ) {
        bool obj_found = FALSE;

        for ( obj = ch->carrying; obj != NULL; obj = obj_next ) {
          obj_next = obj->next_content;

          if ( obj == ch->questobj ) {
            obj_found = TRUE;
            break;
          }
        }

        /* If ch returned without quest obj... */
        if ( !obj_found ) {
          sprintf( buf, "You haven't completed the quest yet, but there is still time!" );
          do_say( questman, buf );
          return;
        }

        {
          int pointreward, pracreward;

          /* Ch receives between 10 and 30 qp for completing quest :> */
          pointreward = number_range( 10, 30 );

          /* Player doesn't keep quest object */
          act( AT_WHITE, "You hand $p to $N.", ch, obj, questman, TO_CHAR );
          act( AT_WHITE, "$n hands $p to $N.", ch, obj, questman, TO_ROOM );

          sprintf( buf, "Congratulations on completing your quest!" );
          do_say( questman, buf );
          sprintf( buf, "As a reward, I am giving you %d quest points!", pointreward );
          do_say( questman, buf );

          /* 5% chance to get pracs.. */
          if ( chance( 5 ) ) {
            pracreward = number_range( 1, 6 );
            sprintf( buf, "You gain %d practices!\n\r", pracreward );
            send_to_char( AT_WHITE, buf, ch );
            ch->practice += pracreward;
          }

          REMOVE_BIT( ch->act, PLR_QUESTOR );
          ch->questgiver   = NULL;
          ch->countdown    = 0;
          ch->questmob     = NULL;
          ch->questobj     = NULL;
          ch->nextquest    = 30; /* 30 min till ch can quest again */
          ch->questpoints += pointreward;
          extract_obj( obj );
          return;
        }
      }
      /* Quest not complete, but still time left */
      else if ( ( ch->questmob || ch->questobj )
                && ch->countdown > 0 ) {
        sprintf( buf, "You haven't completed the quest yet, but there is still time!" );
        do_say( questman, buf );
        return;
      }
    }

    if ( ch->nextquest > 0 ) {
      sprintf( buf, "But you didn't complete your quest in time!" );
    } else {
      sprintf( buf, "You have to REQUEST a quest first, %s.", ch->name );
    }

    do_say( questman, buf );
    return;
  }

  if ( arg1[ 0 ] == '\0' ) {
    if ( CHECK_BIT( ch->act, PLR_QUESTOR ) ) {
      if ( ch->questobj ) {
        sprintf( buf, "You are on a quest to find %s!\n\r", ch->questobj->short_descr );
        send_to_char( AT_WHITE, buf, ch );
      } else if ( ch->questmob ) {
        sprintf( buf, "You are on a quest to kill %s!\n\r", ch->questmob->short_descr );
        send_to_char( AT_WHITE, buf, ch );
      }

      sprintf( buf, "You have %d quest points.\n\r", ch->questpoints );
      send_to_char( AT_WHITE, buf, ch );

      if ( ch->countdown > 0 ) {
        sprintf( buf, "Time left for current quest: %d\n\r", ch->countdown );
        send_to_char( AT_WHITE, buf, ch );
      }
    }

    if ( ch->nextquest > 1 ) {
      sprintf( buf, "There are %d minutes remaining until you can go on another quest.\n\r", ch->nextquest );
      send_to_char( AT_WHITE, buf, ch );
    } else if ( ch->nextquest == 1 ) {
      sprintf( buf, "There is less than a minute remaining until you can go on another quest.\n\r" );
      send_to_char( AT_WHITE, buf, ch );
    }

    send_to_char( AT_RED, "QUEST commands: POINTS INFO TIME REQUEST COMPLETE LIST BUY AREA.\n\r", ch );
    send_to_char( AT_WHITE, "For more information, type 'HELP AUTOQUEST'.\n\r", ch );
    return;
  }
}
コード例 #2
0
ファイル: mapper.c プロジェクト: andycervantes/SMAUG-Pi
char *get_exits( CHAR_DATA * ch )
{
	static char buf[MAX_STRING_LENGTH];
	EXIT_DATA *pexit;
	bool found = FALSE;

	buf[0] = '\0';

	if ( !check_blind( ch ) )
		return buf;

	set_char_color( AT_EXITS, ch );

	mudstrlcpy( buf, "[Exits:", MAX_STRING_LENGTH );

	for ( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
	{
		if ( IS_IMMORTAL( ch ) )
			/*
			 * Immortals see all exits, even secret ones 
			 */
		{
			if ( pexit->to_room )
			{
				found = TRUE;
				mudstrlcat( buf, " ", MAX_STRING_LENGTH );

				mudstrlcat( buf, capitalize( dir_name[pexit->vdir] ), MAX_STRING_LENGTH );

				/*
				 * New code added to display closed, or otherwise invisible exits to immortals 
				 * Installed by Samson 1-25-98 
				 */
				if ( IS_SET( pexit->exit_info, EX_CLOSED ) )
					mudstrlcat( buf, "->(Closed)", MAX_STRING_LENGTH );
				if ( IS_SET( pexit->exit_info, EX_DIG ) )
					mudstrlcat( buf, "->(Dig)", MAX_STRING_LENGTH );
				if ( IS_SET( pexit->exit_info, EX_WINDOW ) )
					mudstrlcat( buf, "->(Window)", MAX_STRING_LENGTH );
				if ( IS_SET( pexit->exit_info, EX_HIDDEN ) )
					mudstrlcat( buf, "->(Hidden)", MAX_STRING_LENGTH );
				if ( xIS_SET( pexit->to_room->room_flags, ROOM_DEATH ) )
					mudstrlcat( buf, "->(Deathtrap)", MAX_STRING_LENGTH );
			}
		}
		else
		{
			if ( pexit->to_room
				&& !IS_SET( pexit->exit_info, EX_SECRET ) && ( !IS_SET( pexit->exit_info, EX_WINDOW ) || IS_SET( pexit->exit_info, EX_ISDOOR ) ) && !IS_SET( pexit->exit_info, EX_HIDDEN ) )
			{
				found = TRUE;
				mudstrlcat( buf, " ", MAX_STRING_LENGTH );

				mudstrlcat( buf, capitalize( dir_name[pexit->vdir] ), MAX_STRING_LENGTH );

				if ( IS_SET( pexit->exit_info, EX_CLOSED ) )
					mudstrlcat( buf, "->(Closed)", MAX_STRING_LENGTH );
				if ( IS_AFFECTED( ch, AFF_DETECTTRAPS ) && xIS_SET( pexit->to_room->room_flags, ROOM_DEATH ) )
					mudstrlcat( buf, "->(Deathtrap)", MAX_STRING_LENGTH );
			}
		}
	}

	if ( !found )
		mudstrlcat( buf, " none]", MAX_STRING_LENGTH );
	else
		mudstrlcat( buf, "]", MAX_STRING_LENGTH );
	mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
	return buf;
}
コード例 #3
0
ファイル: ninja.c プロジェクト: pfchrono/Anotherland_Mud
void do_ninjaarmor( CHAR_DATA *ch, char *argument )
{
    OBJ_INDEX_DATA *pObjIndex;
    OBJ_DATA *obj;
    char arg[MAX_INPUT_LENGTH];
    int vnum = 0;

    argument = one_argument( argument, arg );

    if (IS_NPC(ch)) return;

    if(!IS_IMMORTAL(ch))
    {
        if (!IS_CLASS(ch, CLASS_NINJA))
        {
            send_to_char("What?\n\r",ch);
            return;
        }
    }

    if (arg[0] == '\0')
    {
        send_to_char("Please specify which piece of ninja eq you wish to make: Ring Collar Robe Cap Leggings Boots Gloves Sleeves Cloak Belt Bracer Mask Sword Dagger.\n\r",ch);
        return;
    }

    if ( ch->practice < 60 )
    {
        send_to_char("You don't have the 60 primal needed.\n\r",ch);
        return;
    }
    if (ch->pcdata->upgrade_level >= 1)
    {
        if      (!str_cmp(arg,"sword"               )) vnum = 110600;
        else if (!str_cmp(arg,"ring"                )) vnum = 110601;
        else if (!str_cmp(arg,"collar"              )) vnum = 110602;
        else if (!str_cmp(arg,"bracer"              )) vnum = 110603;
        else if (!str_cmp(arg,"robe"                )) vnum = 110604;
        else if (!str_cmp(arg,"cap"                 )) vnum = 110605;
        else if (!str_cmp(arg,"leggings"            )) vnum = 110606;
        else if (!str_cmp(arg,"boots"               )) vnum = 110607;
        else if (!str_cmp(arg,"gloves"              )) vnum = 110608;
        else if (!str_cmp(arg,"sleeves"             )) vnum = 110609;
        else if (!str_cmp(arg,"cloak"               )) vnum = 110610;
        else if (!str_cmp(arg,"belt"                )) vnum = 110611;
        else if (!str_cmp(arg,"mask"                )) vnum = 110612;
        else if (!str_cmp(arg,"dagger"              )) vnum = 110613;
        else
        {
            do_ninjaarmor(ch,"");
            return;
        }
    }

    else
    {
        if (!str_cmp(arg,"mask" )) vnum = 33093;
        else if (!str_cmp(arg,"dagger" )) vnum = 33080;
        else if (!str_cmp(arg,"sword"   )) vnum = 33081;
        else if (!str_cmp(arg,"ring"   )) vnum = 33082;
        else if (!str_cmp(arg,"collar"   )) vnum = 33083;
        else if (!str_cmp(arg,"robe"   )) vnum = 33085;
        else if (!str_cmp(arg,"cap"   )) vnum = 33086;
        else if (!str_cmp(arg,"leggings"   )) vnum = 33087;
        else if (!str_cmp(arg,"boots"   )) vnum = 33088;
        else if (!str_cmp(arg,"gloves"   )) vnum = 33091;
        else if (!str_cmp(arg,"sleeves"   )) vnum = 33089;
        else if (!str_cmp(arg,"cloak"   )) vnum = 33090;
        else if (!str_cmp(arg,"belt"   )) vnum = 33092;
        else if (!str_cmp(arg,"bracer"   )) vnum = 33084;
        else
        {
            do_ninjaarmor(ch,"");
            return;
        }
    }

    if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
    {
        send_to_char("Missing object, please inform a God .\n\r",ch);
        return;
    }

    if( !IS_IMMORTAL(ch) )
    {
        ch->practice -= 60;
    }
    obj = create_object(pObjIndex, 50);
    obj->questowner = str_dup(ch->pcdata->switchname);
    obj_to_char(obj, ch);
    act("You make $p from the shadows.",ch,obj,NULL,TO_CHAR);
    act("$n forms $p from the shadows.",ch,obj,NULL,TO_ROOM);
    return;
}
コード例 #4
0
ファイル: act_comm.c プロジェクト: zachflower/oasis-mud
void do_tell( CHAR_DATA * ch, char * argument ) {
  CHAR_DATA * victim;
  char        arg[ MAX_INPUT_LENGTH ];
  int         position;
  char        buf[ MAX_STRING_LENGTH ];

  if ( !IS_NPC( ch ) && (   CHECK_BIT( ch->act, PLR_SILENCE ) || CHECK_BIT( ch->act, PLR_NO_TELL ) ) ) {
    send_to_char( AT_WHITE, "Your message didn't get through.\n\r", ch );
    return;
  }

  if ( CHECK_BIT( ch->in_room->room_flags, ROOM_SILENT ) ) {
    send_to_char( AT_WHITE, "You can't do that here.\n\r", ch );
    return;
  }

  argument = one_argument( argument, arg );

  if ( arg[ 0 ] == '\0' || argument[ 0 ] == '\0' ) {
    send_to_char( AT_WHITE, "Tell whom what?\n\r", ch );
    return;
  }

  /*
   * Can tell to PC's anywhere, but NPC's only in same room.
   * -- Furey
   */

  /*   if ( !( victim = get_char_world( ch, arg ) )
  || ( IS_NPC( victim ) && victim->in_room != ch->in_room ) ) */
  if ( (    !( victim = get_pc_world( ch, arg ) ) && !( victim = get_char_world( ch, arg ) ) ) || ( IS_NPC( victim ) && victim->in_room != ch->in_room ) ) {
    send_to_char( AT_WHITE, "They aren't here.\n\r", ch );
    return;
  }

  if ( CHECK_BIT( victim->in_room->room_flags, ROOM_SILENT ) ) {
    act( AT_WHITE, "$E can't hear you.", ch, 0, victim, TO_CHAR );
    return;
  }

  if ( !IS_IMMORTAL( ch ) && !IS_AWAKE( victim ) ) {
    act( AT_WHITE, "$E can't hear you.", ch, 0, victim, TO_CHAR );
    return;
  }

  if ( !IS_NPC( victim ) && ( !( victim->desc ) ) ) {
    act( AT_WHITE, "$E is link-dead.", ch, 0, victim, TO_CHAR );
    return;
  }

  /*    if ( !IS_NPC( victim ) && CHECK_BIT( victim->act, PLR_AFK ) )
      {
      act( AT_WHITE, "$E is AFK at the moment.", ch, 0, victim,
      TO_CHAR );
      return;
      } */
  if ( !IS_NPC( victim ) && CHECK_BIT( victim->act, PLR_AFK ) ) {
    sprintf( buf, "%s %s.", victim->name, ( victim->pcdata && victim->pcdata->afkchar[ 0 ] != '\0' ) ? victim->pcdata->afkchar : "is AFK at the moment" );
    act( AT_WHITE, buf, ch, NULL, victim, TO_CHAR );
    return;
  }

  if ( victim->desc && victim->desc->pString ) {
    act( AT_WHITE, "$E is in a writing buffer.", ch, 0, victim, TO_CHAR );
    return;
  }

  act( AT_WHITE, "You tell $N '$t'", ch, argument, victim, TO_CHAR );
  position         = victim->position;
  victim->position = POS_STANDING;

  act( AT_WHITE, "$n tells you '$t'", ch, argument, victim, TO_VICT );
  victim->position = position;
  victim->reply    = ch;

  return;
}
コード例 #5
0
ファイル: login_menu.c プロジェクト: blakepell/CrimsonSkies
/*
* Shows who is logged into the mud from the login menu.
*/
void show_login_who(DESCRIPTOR_DATA *d)
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *dl;
    int col = 0;
    int count = 0;
    int total_count = 0;
    bool end_row = TRUE;

    show_menu_top(d);
    show_menu_header("Online Players", d);
    write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);
    write_to_descriptor(d->descriptor, "{w   |                            {G( {WImmortals {G){w                               |\r\n", d);
    write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);

    for (dl = descriptor_list; dl != NULL; dl = dl->next)
    {
        CHAR_DATA *ch;

        if (dl->connected != CON_PLAYING)
        {
            continue;
        }

        ch = (dl->original != NULL) ? dl->original : dl->character;

        if (!IS_IMMORTAL(ch) || ch->invis_level >= LEVEL_HERO || ch->incog_level >= LEVEL_HERO)
        {
            continue;
        }

        count++;
        col++;

        // Start a row?
        if (end_row)
        {
            write_to_descriptor(d->descriptor, "{w   |    ", d);
            end_row = FALSE;
        }

        sprintf(buf, "{g%-16s{x", ch->name);
        write_to_descriptor(d->descriptor, buf, d);

        // End a row?
        if (col % 4 == 0)
        {
            write_to_descriptor(d->descriptor, "{w|\r\n", d);
            end_row = TRUE;
        }
    }

    // Fill out the rest of the last row if it wasn't a full row
    while (col % 4 != 0)
    {
        write_to_descriptor(d->descriptor, "                ", d);
        col++;
    }

    if (count > 0 && end_row == FALSE)
    {
        // End that row
        write_to_descriptor(d->descriptor, "    {w|\r\n", d);
        write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);
    }
    else if (count > 0 && end_row == TRUE)
    {
        write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);
    }

    // Display if there are no immortals online.
    if (count == 0)
    {
        write_to_descriptor(d->descriptor, "{w   |    * {CThere are no immortals currently online.{w                          |\r\n", d);
        write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);
    }

    write_to_descriptor(d->descriptor, "{w   |                             {G( {WMortals {G){w                                |\r\n", d);
    write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);

    total_count += count;

    // The characters playing
    end_row = TRUE;
    count = 0;
    col = 0;

    for (dl = descriptor_list; dl != NULL; dl = dl->next)
    {
        CHAR_DATA *ch;

        if (dl->connected != CON_PLAYING)
        {
            continue;
        }

        ch = (dl->original != NULL) ? dl->original : dl->character;

        if (IS_IMMORTAL(ch))
        {
            continue;
        }

        count++;
        col++;

        // Start a row?
        if (end_row)
        {
            write_to_descriptor(d->descriptor, "{w   |    ", d);
            end_row = FALSE;
        }

        sprintf(buf, "{g%-16s{x", ch->name);
        write_to_descriptor(d->descriptor, buf, d);

        // End a row?
        if (col % 4 == 0)
        {
            write_to_descriptor(d->descriptor, "    {w|\r\n", d);
            end_row = TRUE;
        }

    }

    // Fill out the rest of the last row if it wasn't a full row
    while (col % 4 != 0)
    {
        write_to_descriptor(d->descriptor, "                ", d);
        col++;
    }

    if (count > 0 && end_row == FALSE)
    {
        // End that row
        write_to_descriptor(d->descriptor, "    {w|\r\n", d);
        write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);
    }
    else if (count > 0 && end_row == TRUE)
    {
        write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);
    }

    // Display if there are no mortals online.
    if (count == 0)
    {
        write_to_descriptor(d->descriptor, "{w   |    * {CThere are no mortals currently online.{w                            |\r\n", d);
        write_to_descriptor(d->descriptor, BLANK_MENU_LINE, d);
    }

    total_count += count;

    if (total_count > 0)
    {
        sprintf(buf, "{w   |    Total Players Online: %-3d                                           |\r\n", total_count);
        write_to_descriptor(d->descriptor, buf, d);
    }

    show_menu_bottom(d);

    return;
}
コード例 #6
0
ファイル: finger.c プロジェクト: michaelmwu/bota
void do_finger( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    CHAR_DATA *victim;
    FILE *fp;
    bool fOld;

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char( "Finger whom?\n\r", ch );
	return;
    }

    if ( ( victim = get_char_world( ch, arg ) ) != NULL)
    {
	if (!IS_NPC(victim))
	{
	    act( "$N is on right now!", ch, NULL, victim, TO_CHAR );
	    return;
	}
    }

    if(!check_valid_name(arg) && !IS_IMMORTAL(ch))
    {
        send_to_char("That's not a valid name.\n\r",ch);
    }

    victim = new_char();
    victim->pcdata = new_pcdata();
    fOld = FALSE;

    fclose( fpReserve );
    
    sprintf( buf, "%s%s", PLAYER_DIR, capitalize( arg ) );
    if ( ( fp = fopen( buf, "r" ) ) != NULL )
    {
	int iNest;

	for ( iNest = 0; iNest < MAX_NEST; iNest++ )
	    rgObjNest[iNest] = NULL;

	fOld = TRUE;
	for ( ; ; )
	{
	    char letter;
	    char *word;

	    letter = fread_letter( fp );
	    if ( letter == '*' )
	    {
		fread_to_eol( fp );
		continue;
	    }

	    if ( letter != '#' )
	    {
		bug( "do_finger: Load_char_obj: # not found.", 0 );
		break;
	    }

	    word = fread_word( fp );
	    if      ( !str_cmp( word, "PLAYER" ) ) fread_char( victim, fp );
	    else if ( !str_cmp( word, "OBJECT" ) ) break;
	    else if ( !str_cmp( word, "O"      ) ) break;
	    else if ( !str_cmp( word, "PET"    ) ) break;
	    else if ( !str_cmp( word, "BANK-ACCOUNT"    ) ) break;
	    else if ( !str_cmp( word, "END"    ) ) break;
	    else
	    {
		bug( "Load_char_obj: bad section.", 0 );
		break;
	    }
	}
	fclose( fp );
    }

    fpReserve = fopen( NULL_FILE, "r" );

    if ( !fOld )
    {
	send_to_char("No player by that name exists.\n\r",ch);
	free_pcdata(victim->pcdata);
	free_char(victim);
	return;
    }
    if ( (victim->level > LEVEL_HERO) && (victim->level > ch->level) )
    {
	send_to_char("The gods wouldn't like that.\n\r",ch);
	free_pcdata(victim->pcdata);
	free_char(victim);
	return;
    }
    sprintf(buf,"%s last logged off on %s\n\r",
	victim->name, (char *) ctime(&victim->llogoff));
    send_to_char(buf,ch);

    if(get_trust(ch) == MAX_LEVEL)
    {
        sprintf(buf, "Last IP: %s\n\r", victim->pcdata->last_ip);
        send_to_char(buf,ch);
    }

    free_pcdata(victim->pcdata);
    free_char(victim);
    return;
}
コード例 #7
0
ファイル: news.c プロジェクト: Igdra/smaugfuss
/* olc editnews command */
void do_editnews( CHAR_DATA* ch, const char* argument)
{
   char arg[MAX_INPUT_LENGTH];

   if( IS_NPC( ch ) || !IS_IMMORTAL( ch ) )
   {
      send_to_char( "Huh?\r\n", ch );
      return;
   }

   set_char_color( AT_GREEN, ch );

   switch ( ch->substate )
   {
      default:
         break;

      case SUB_NEWS_POST:
      {
         NEWS *news = NULL;

         news = ( NEWS * ) ch->dest_buf;
         STRFREE( news->post );
         news->post = copy_buffer( ch );
         stop_editing( ch );
         ch->substate = ch->tempnum;
         renumber_news(  );
         save_news(  );
         return;
      }
         break;

      case SUB_NEWS_EDIT:
      {
         NEWS *news = NULL;

         news = ( NEWS * ) ch->dest_buf;
         STRFREE( news->post );
         news->post = copy_buffer( ch );
         stop_editing( ch );
         ch->substate = ch->tempnum;
         renumber_news(  );
         save_news(  );
         return;
      }
         break;
   }

   argument = one_argument( argument, arg );

   if( arg[0] == '\0' )
   {
      send_to_char( "Syntax: editnews addtype <name>\r\n"
                    "        editnews addnews <type> <subject>\r\n"
                    "        editnews removetype <number>\r\n"
                    "        editnews removenews <type> <number>\r\n"
                    "        editnews edittype <field> <value>\r\n"
                    "        editnews editnews <type> <number> <new subject [optional]>\r\n"
                    " Fields being one of the following:\r\n" " name header cmd_name level\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "save" ) )
   {
      renumber_news(  );
      save_news(  );
      send_to_char( "News saved.\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "addtype" ) )
   {
      NEWS_TYPE *type = NULL;

      if( argument[0] == '\0' )
      {
         send_to_char( "Syntax: editnews addtype <name>\r\n", ch );
         return;
      }

      if( top_news_type >= NEWS_MAX_TYPES )
      {
         send_to_char( "There are too many news types.\r\n", ch );
         return;
      }

      CREATE( type, NEWS_TYPE, 1 );
      type->name = STRALLOC( argument );
      type->cmd_name = STRALLOC( argument );
      type->vnum = top_news_type++;
      type->level = -1;

      news_command_table[type->vnum] = STRALLOC( type->cmd_name );

      LINK( type, first_news_type, last_news_type, next, prev );
      ch_printf( ch, "Newstype '%s' created.\r\n", argument );
      return;
   }

   if( !str_cmp( arg, "removetype" ) )
   {
      NEWS_TYPE *type = NULL;
      NEWS *news = NULL, *news_next;

      if( argument[0] == '\0' )
      {
         send_to_char( "Syntax: editnews removetype <name>\r\n", ch );
         return;
      }

      if( ( type = figure_type( argument ) ) == NULL )
      {
         send_to_char( "Invaild newstype.\r\n", ch );
         return;
      }

      UNLINK( type, first_news_type, last_news_type, next, prev );
      STRFREE( type->name );
      STRFREE( type->header );
      STRFREE( type->cmd_name );
      STRFREE( news_command_table[type->vnum] );
      STRFREE( news_command_table[type->level] );

      for( news = type->first_news; news; news = news_next )
      {
         news_next = news->next;

         UNLINK( news, type->first_news, type->last_news, next, prev );
         STRFREE( news->name );
         STRFREE( news->title );
         STRFREE( news->date );
         STRFREE( news->post );
         DISPOSE( news );
      }

      DISPOSE( type );
      --top_news_type;
      renumber_news(  );
      save_news(  );
      ch_printf( ch, "Newstype '%s' removed.\r\n", argument );
      return;
   }

   if( !str_cmp( arg, "edittype" ) )
   {
      char arg2[MAX_INPUT_LENGTH];
      char arg3[MAX_INPUT_LENGTH];
      NEWS_TYPE *type = NULL;

      argument = one_argument( argument, arg2 );
      argument = one_argument( argument, arg3 );
      if( arg2[0] == '\0' || arg3[0] == '\0' )
      {
         send_to_char( "Syntax: editnews edittype <type> <field> <value>\r\n", ch );
         send_to_char( "Fields being one of the following:\r\n" "name header cmd_name level\r\n", ch );
         return;
      }

      if( ( type = figure_type( arg2 ) ) == NULL )
      {
         send_to_char( "Invalid newstype.\r\n", ch );
         return;
      }

      if( !str_cmp( arg3, "cmd_name" ) )
      {
         type->cmd_name = STRALLOC( argument );
         news_command_table[type->vnum] = STRALLOC( type->cmd_name );
         send_to_char( "Cmd_name set.\r\n", ch );
         save_news(  );
         return;
      }
      else if( !str_cmp( arg3, "name" ) )
      {
         type->name = STRALLOC( argument );
         send_to_char( "Name set.\r\n", ch );
         save_news(  );
         return;
      }
      else if( !str_cmp( arg3, "level" ) )
      {
         if( argument[0] == '\0' )
         {
            ch_printf( ch, "%d\r\n", type->level );
            return;
         }
         else
            type->level = atoi( argument );
         send_to_char( "Level set.\r\n", ch );
         save_news(  );
         return;
      }
      else
      {
         send_to_char( "Syntax: editnews edittype <type> <field> <value>\r\n", ch );
         send_to_char( "Fields being one of the following:\r\n" "name header cmd_name level\r\n", ch );
         return;
      }
   }

   if( !str_cmp( arg, "addnews" ) )
   {
      char arg2[MAX_INPUT_LENGTH];
      NEWS_TYPE *type = NULL;
      NEWS *news = NULL;

      argument = one_argument( argument, arg2 );

      if( arg2[0] == '\0' || argument[0] == '\0' )
      {
         send_to_char( "Syntax: editnews addnews <type> <subject>\r\n", ch );
         return;
      }

      if( ( type = figure_type( arg2 ) ) == NULL )
      {
         send_to_char( "Invaild newstype. Use 'newstypes' to get a valid listing.\r\n", ch );
         return;
      }

      CREATE( news, NEWS, 1 );
      news->title = STRALLOC( argument );
      news->name = STRALLOC( ch->name );
      news->date = STRALLOC( stamp_time(  ) );
      news->post = STRALLOC( "" );

      /*
       * pop character into a writing buffer 
       */
      if( ch->substate == SUB_REPEATCMD )
         ch->tempnum = SUB_REPEATCMD;
      else
         ch->tempnum = SUB_NONE;

      ch->substate = SUB_NEWS_POST;
      ch->dest_buf = news;
      start_editing( ch, news->post );
      LINK( news, type->first_news, type->last_news, next, prev );
      return;
   }

   if( !str_cmp( arg, "editnews" ) )
   {
      char arg2[MAX_INPUT_LENGTH];
      char arg3[MAX_INPUT_LENGTH];
      NEWS *news = NULL;
      NEWS_TYPE *type = NULL;

      argument = one_argument( argument, arg2 );
      argument = one_argument( argument, arg3 );
      if( arg2[0] == '\0' )
      {
         send_to_char( "Syntax: editnews editnews <type> <number> <new subject [optional]>\r\n", ch );
         return;
      }

      /*
       * changed for new -newstype- indexing - 5/5/02 
       */
      if( ( type = figure_type( arg2 ) ) == NULL )
      {
         send_to_char( "Invalid newstype. Use 'newstypes' to get a valid listing.\r\n", ch );
         return;
      }

      if( ( news = grab_news( type, arg3 ) ) == NULL )
      {
         pager_printf_color( ch, "That's not a valid news number.\r\nUse '%s' to view the valid numbers.\r\n",
                             type->cmd_name );
         return;
      }

      /*
       * a changed title 
       */
      if( argument[0] != '\0' )
         news->title = STRALLOC( argument );

      /*
       * new date news was edited 
       */
      news->date = STRALLOC( stamp_time(  ) );
      /*
       * pop character into a writing buffer 
       */
      if( ch->substate == SUB_REPEATCMD )
         ch->tempnum = SUB_REPEATCMD;
      else
         ch->tempnum = SUB_NONE;

      ch->substate = SUB_NEWS_EDIT;
      ch->dest_buf = news;
      start_editing( ch, news->post );
      return;
   }

   if( !str_cmp( arg, "removenews" ) )
   {
      char arg2[MAX_INPUT_LENGTH];
      NEWS *news = NULL;
      NEWS_TYPE *type = NULL;

      argument = one_argument( argument, arg2 );
      if( argument[0] == '\0' || arg2[0] == '\0' )
      {
         send_to_char( "Syntax: editnews remove <number>\r\n", ch );
         return;
      }

      /*
       * changed for new -newstype- indexing - 5/5/02 
       */
      if( ( type = figure_type( arg2 ) ) == NULL )
      {
         send_to_char( "Invalid newstype. Use 'newstypes' to get a valid listing.\r\n", ch );
         return;
      }

      if( ( news = grab_news( type, argument ) ) == NULL )
      {
         send_to_char( "Type 'news' to gain a list of the news numbers.\r\n", ch );
         return;
      }

      UNLINK( news, type->first_news, type->last_news, next, prev );
      STRFREE( news->name );
      STRFREE( news->title );
      STRFREE( news->date );
      STRFREE( news->post );
      DISPOSE( news );
      renumber_news(  );
      save_news(  );
      send_to_char( "News item removed.\r\n", ch );
      return;
   }
}
コード例 #8
0
ファイル: handler.c プロジェクト: okeuday/sillymud
/* Extract a ch completely from the world, and leave his stuff behind */
void extract_char_smarter(struct char_data *ch, int save_room)
{
  struct obj_data *i;
  struct char_data *k, *next_char;
  struct descriptor_data *t_desc;
  int l, was_in, j;

  extern long mob_count;  
  extern struct char_data *combat_list;
  
  void do_save(struct char_data *ch, char *argument, int cmd);
  void do_return(struct char_data *ch, char *argument, int cmd);
  
  void die_follower(struct char_data *ch);

  if(IS_SET(ch->specials.act, ACT_FIGURINE) && ch->link)
     extract_obj(ch->link);
  
  if(!IS_NPC(ch) && !ch->desc)	{
    for(t_desc = descriptor_list; t_desc; t_desc = t_desc->next)
      if(t_desc->original==ch)
	do_return(t_desc->character, "", 0);
  }
  
  if (ch->in_room == NOWHERE) {
    logE("NOWHERE extracting char. (handler.c, extract_char)");
    /*
     **  problem from linkdeath
     */
    char_to_room(ch, 4);  /* 4 == all purpose store */
  }
  
  if (ch->followers || ch->master)
    die_follower(ch);
  
  if(ch->desc) {
    /* Forget snooping */
    if ((ch->desc->snoop.snooping) && (ch->desc->snoop.snooping->desc))
      ch->desc->snoop.snooping->desc->snoop.snoop_by = 0;
    
    if (ch->desc->snoop.snoop_by) {
      send_to_char("Your victim is no longer among us.\n\r",
		   ch->desc->snoop.snoop_by);
      if (ch->desc->snoop.snoop_by->desc)
      ch->desc->snoop.snoop_by->desc->snoop.snooping = 0;
    }
    
    ch->desc->snoop.snooping = ch->desc->snoop.snoop_by = 0;
  }
  
  if (ch->carrying)	{
    /* transfer ch's objects to room */
    
    if (!IS_IMMORTAL(ch)) {

      while(ch->carrying) {
	i=ch->carrying;
	obj_from_char(i);
	obj_to_room(i, ch->in_room);
	check_falling_obj(i, ch->in_room);

      }
    } else {

      send_to_char("Here, you dropped some stuff, let me help you get rid of that.\n\r",ch);

      /*
	equipment too
	*/
      for (j=0; j<MAX_WEAR; j++) {
	if (ch->equipment[j])
	  obj_to_char(unequip_char(ch, j), ch);
      }      

      while (ch->carrying) {
         i = ch->carrying;
	 obj_from_char(i);
	 extract_obj(i);
      }
    }
    
  }
  
  if (ch->specials.fighting)
    stop_fighting(ch);
  
  for (k = combat_list; k ; k = next_char)	{
    next_char = k->next_fighting;
    if (k->specials.fighting == ch)
      stop_fighting(k);
  }

  if (MOUNTED(ch)) {
    Dismount(ch, MOUNTED(ch), POSITION_STANDING);    
  }

  if (RIDDEN(ch)) {
    Dismount(RIDDEN(ch), ch, POSITION_STANDING);
  }
  
  /* Must remove from room before removing the equipment! */
  was_in = ch->in_room;
  char_from_room(ch);
  
  /* clear equipment_list */
  for (l = 0; l < MAX_WEAR; l++)
    if (ch->equipment[l])
      obj_to_room(unequip_char(ch,l), was_in);
  
  
  if (IS_NPC(ch)) {
    for (k=character_list; k; k=k->next) {
      if (k->specials.hunting)
	if (k->specials.hunting == ch) {
	  k->specials.hunting = 0;
	}
      if (Hates(k, ch)) {
	RemHated(k, ch);
      }
      if (Fears(k, ch)) {
	RemFeared(k, ch);
      }
      if (k->orig == ch) {
	k->orig = 0;
      }
    }          
  } else {
    for (k=character_list; k; k=k->next) {
      if (k->specials.hunting)
	if (k->specials.hunting == ch) {
	  k->specials.hunting = 0;
	}
      if (Hates(k, ch)) {
	ZeroHatred(k, ch);
      }
      if (Fears(k, ch)) {
	ZeroFeared(k, ch);
      }
      if (k->orig == ch) {
	k->orig = 0;
      }
    }
    
  }
  /* pull the char from the list */
  
  if (ch == character_list)  
    character_list = ch->next;
  else   {
    for(k = character_list; (k) && (k->next != ch); k = k->next);
    if(k)
      k->next = ch->next;
    else {
      logE("Trying to remove ?? from character_list.(handler.c,extract_char)");
      exit(0);
    }
  }

  if (ch->specials.gname)
    free(ch->specials.gname);
  
  GET_AC(ch) = 100;
  
  if (ch->desc)	{
    if (ch->desc->original)
      do_return(ch, "", 0);
    if (!strcmp(GET_NAME(ch), "Odin's heroic minion")) {
      free(GET_NAME(ch));
      GET_NAME(ch) = strdup("111111");
    }
    save_char(ch, save_room);
  }
  

  t_desc = ch->desc;

  if(ch->term) {
    ScreenOff(ch);
    ch->term = 0;
  }

  if (IS_NPC(ch)) 	{
    if (ch->nr > -1) /* if mobile */
      mob_index[ch->nr].number--;
    FreeHates(ch);
    FreeFears(ch);
    mob_count--;
    free_char(ch);
  }
  
  if (t_desc) {
    t_desc->connected = CON_SLCT;
    SEND_TO_Q(MENU, t_desc);
  }
}
コード例 #9
0
ファイル: player.c プロジェクト: m241dan/swrproject
void do_oldscore( CHAR_DATA * ch, const char *argument )
{
   AFFECT_DATA *paf;
   SKILLTYPE *skill;

   if( IS_AFFECTED( ch, AFF_POSSESS ) )
   {
      send_to_char( "You can't do that in your current state of mind!\r\n", ch );
      return;
   }

   set_char_color( AT_SCORE, ch );
   ch_printf( ch,
              "You are %s%s, level %d, %d years old (%d hours).\r\n",
              ch->name, IS_NPC( ch ) ? "" : ch->pcdata->title, ch->top_level, get_age( ch ), ( get_age( ch ) - 17 ) );

   if( get_trust( ch ) != ch->top_level )
      ch_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) );

   if( IS_SET( ch->act, ACT_MOBINVIS ) )
      ch_printf( ch, "You are mobinvis at level %d.\r\n", ch->mobinvis );


   ch_printf( ch, "You have %d/%d hit, %d/%d movement.\r\n", ch->hit, ch->max_hit, ch->move, ch->max_move );

   ch_printf( ch,
              "You are carrying %d/%d items with weight %d/%d kg.\r\n",
              ch->carry_number, can_carry_n( ch ), ch->carry_weight, can_carry_w( ch ) );

   ch_printf( ch,
              "Str: %d  Int: %d  Wis: %d  Dex: %d  Con: %d  Cha: %d  Lck: ??  Frc: ??\r\n",
              get_curr_str( ch ),
              get_curr_int( ch ), get_curr_wis( ch ), get_curr_dex( ch ), get_curr_con( ch ), get_curr_cha( ch ) );

   ch_printf( ch, "You have have %d credits.\r\n", ch->gold );

   if( !IS_NPC( ch ) )
      ch_printf( ch,
                 "You have achieved %d glory during your life, and currently have %d.\r\n",
                 ch->pcdata->quest_accum, ch->pcdata->quest_curr );

   ch_printf( ch,
              "Autoexit: %s   Autoloot: %s   Autosac: %s   Autocred: %s\r\n",
              ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOEXIT ) ) ? "yes" : "no",
              ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOLOOT ) ) ? "yes" : "no",
              ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOSAC ) ) ? "yes" : "no",
              ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOGOLD ) ) ? "yes" : "no" );

   ch_printf( ch, "Wimpy set to %d hit points.\r\n", ch->wimpy );

   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_DRUNK] > 10 )
      send_to_char( "You are drunk.\r\n", ch );
   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_THIRST] == 0 )
      send_to_char( "You are thirsty.\r\n", ch );
   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_FULL] == 0 )
      send_to_char( "You are hungry.\r\n", ch );

   switch ( ch->mental_state / 10 )
   {
      default:
         send_to_char( "You're completely messed up!\r\n", ch );
         break;
      case -10:
         send_to_char( "You're barely conscious.\r\n", ch );
         break;
      case -9:
         send_to_char( "You can barely keep your eyes open.\r\n", ch );
         break;
      case -8:
         send_to_char( "You're extremely drowsy.\r\n", ch );
         break;
      case -7:
         send_to_char( "You feel very unmotivated.\r\n", ch );
         break;
      case -6:
         send_to_char( "You feel sedated.\r\n", ch );
         break;
      case -5:
         send_to_char( "You feel sleepy.\r\n", ch );
         break;
      case -4:
         send_to_char( "You feel tired.\r\n", ch );
         break;
      case -3:
         send_to_char( "You could use a rest.\r\n", ch );
         break;
      case -2:
         send_to_char( "You feel a little under the weather.\r\n", ch );
         break;
      case -1:
         send_to_char( "You feel fine.\r\n", ch );
         break;
      case 0:
         send_to_char( "You feel great.\r\n", ch );
         break;
      case 1:
         send_to_char( "You feel energetic.\r\n", ch );
         break;
      case 2:
         send_to_char( "Your mind is racing.\r\n", ch );
         break;
      case 3:
         send_to_char( "You can't think straight.\r\n", ch );
         break;
      case 4:
         send_to_char( "Your mind is going 100 miles an hour.\r\n", ch );
         break;
      case 5:
         send_to_char( "You're high as a kite.\r\n", ch );
         break;
      case 6:
         send_to_char( "Your mind and body are slipping appart.\r\n", ch );
         break;
      case 7:
         send_to_char( "Reality is slipping away.\r\n", ch );
         break;
      case 8:
         send_to_char( "You have no idea what is real, and what is not.\r\n", ch );
         break;
      case 9:
         send_to_char( "You feel immortal.\r\n", ch );
         break;
      case 10:
         send_to_char( "You are a Supreme Entity.\r\n", ch );
         break;
   }

   switch ( ch->position )
   {
      case POS_DEAD:
         send_to_char( "You are DEAD!!\r\n", ch );
         break;
      case POS_MORTAL:
         send_to_char( "You are mortally wounded.\r\n", ch );
         break;
      case POS_INCAP:
         send_to_char( "You are incapacitated.\r\n", ch );
         break;
      case POS_STUNNED:
         send_to_char( "You are stunned.\r\n", ch );
         break;
      case POS_SLEEPING:
         send_to_char( "You are sleeping.\r\n", ch );
         break;
      case POS_RESTING:
         send_to_char( "You are resting.\r\n", ch );
         break;
      case POS_STANDING:
         send_to_char( "You are standing.\r\n", ch );
         break;
      case POS_FIGHTING:
         send_to_char( "You are fighting.\r\n", ch );
         break;
      case POS_MOUNTED:
         send_to_char( "Mounted.\r\n", ch );
         break;
      case POS_SHOVE:
         send_to_char( "Being shoved.\r\n", ch );
         break;
      case POS_DRAG:
         send_to_char( "Being dragged.\r\n", ch );
         break;
   }

   if( ch->top_level >= 25 )
      ch_printf( ch, "Evasion: %d.  \r\n", GET_EVASION( ch ) );

   if( ch->top_level >= 15 )
      ch_printf( ch, "Hitroll: %d  Damroll: %d.\r\n", GET_HITROLL( ch ), GET_DAMROLL( ch ) );

   if( ch->top_level >= 10 )
      ch_printf( ch, "Alignment: %d.  ", ch->alignment );

   send_to_char( "You are ", ch );
   if( ch->alignment > 900 )
      send_to_char( "angelic.\r\n", ch );
   else if( ch->alignment > 700 )
      send_to_char( "saintly.\r\n", ch );
   else if( ch->alignment > 350 )
      send_to_char( "good.\r\n", ch );
   else if( ch->alignment > 100 )
      send_to_char( "kind.\r\n", ch );
   else if( ch->alignment > -100 )
      send_to_char( "neutral.\r\n", ch );
   else if( ch->alignment > -350 )
      send_to_char( "mean.\r\n", ch );
   else if( ch->alignment > -700 )
      send_to_char( "evil.\r\n", ch );
   else if( ch->alignment > -900 )
      send_to_char( "demonic.\r\n", ch );
   else
      send_to_char( "satanic.\r\n", ch );

   if( ch->first_affect )
   {
      send_to_char( "You are affected by:\r\n", ch );
      for( paf = ch->first_affect; paf; paf = paf->next )
         if( ( skill = get_skilltype( paf->type ) ) != NULL )
         {
            ch_printf( ch, "Spell: '%s'", skill->name );

            if( ch->top_level >= 20 )
               ch_printf( ch,
                          " modifies %s by %d for %d rounds",
                          affect_loc_name( paf->location ), paf->modifier, paf->duration );

            send_to_char( ".\r\n", ch );
         }
   }

   if( !IS_NPC( ch ) && IS_IMMORTAL( ch ) )
   {
      ch_printf( ch, "WizInvis level: %d   WizInvis is %s\r\n",
                 ch->pcdata->wizinvis, IS_SET( ch->act, PLR_WIZINVIS ) ? "ON" : "OFF" );
      if( ch->pcdata->r_range_lo && ch->pcdata->r_range_hi )
         ch_printf( ch, "Room Range: %d - %d\r\n", ch->pcdata->r_range_lo, ch->pcdata->r_range_hi );
      if( ch->pcdata->o_range_lo && ch->pcdata->o_range_hi )
         ch_printf( ch, "Obj Range : %d - %d\r\n", ch->pcdata->o_range_lo, ch->pcdata->o_range_hi );
      if( ch->pcdata->m_range_lo && ch->pcdata->m_range_hi )
         ch_printf( ch, "Mob Range : %d - %d\r\n", ch->pcdata->m_range_lo, ch->pcdata->m_range_hi );
   }

   return;
}
コード例 #10
0
ファイル: bank.cpp プロジェクト: Swiftam/ForgottenLegends
void do_bank_clan(Character *ch, char *argument)
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    arg1[0] = '\0';
    arg2[0] = '\0';
    long amount;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    if (!IS_CLANNED(ch) && !IS_IMMORTAL(ch))
    {
	send_to_char("You are not in a clan.\n\r",ch);
	return;
    }

    if (IS_IMMORTAL(ch))
    {
	CLAN_DATA *clan;
	int debit;

	if ((clan = get_clan(arg1)) == NULL)
	{
	    send_to_char("Syntax: bank clan <clan name> <amount to withdraw (in k)>\n\r",ch);
	    return;
	}

	if ((debit = atoi(arg2)) <= 0)
	{
	    send_to_char("Syntax: bank clan <clan name> <amount to withdraw (in k)>\n\r",ch);
	    return;
	}

	if (clan->money < debit * 100000)
	{
	    send_to_char("The clan doesn't have that much money!\n\r",ch);
	    return;
	}

	clan->money -= debit * 100000;
	ch->gold += debit * 1000;
	append_file( ch, UPGRADE_FILE, argument ); 
	save_clan(clan);
	return;
    }
    else
    {
	if (str_cmp(ch->pcdata->clan->leader, ch->getName() ))
	{
	    send_to_char("Only your clan leader may access the clan account.\n\r", ch);
	    return;
	}

	if (arg2[0] == '\0' || (str_cmp(arg2, "gold") && str_cmp(arg2, "silver")))
	{
	    send_to_char("Syntax: bank clan (+/- amount) (gold/silver)\n\r",ch);
	    return;
	}

	if (!str_cmp(arg2, "gold"))
	    amount = atoi(arg1) * 100;
	else
	    amount = atoi(arg1);

	if ( amount == 0 )
	{
	    send_to_char("Nothing much happens.\n\r", ch);
	    return;
	}

	if ( amount < 0 && amount * -1 > ch->pcdata->clan->money )
	{
	    send_to_char("You cannot withdraw more than your clan has.\n\r", ch);
	    return;
	}

	if ((ch->gold * 100) + ch->silver < amount && amount > 0)
	{
	    send_to_char("You cannot afford to deposit that much.\n\r",ch);
	    return;
	}

	if (amount > 0)
	{
	    if (ch->silver < amount)
	    {
	        ch->gold -= ((amount - ch->silver + 99) / 100);
	        ch->silver -= amount - (100 * ((amount - ch->silver + 99) / 100));
	    }
	    else
		ch->silver -= amount;

	}
	
	ch->pcdata->clan->money += amount;
	save_clan(ch->pcdata->clan);

	if ( amount < 0 )
	{
	    amount = amount * -1;

	    ch->gold += amount / 100;
	    ch->silver += amount - (amount / 100);

	    send_to_char("You withdraw from your clan fund.\n\r",ch);
	    return;
	}
	else
	{
	    send_to_char("You add to your clan fund.\n\r",ch);
	    return;
	}
    }
}
コード例 #11
0
ファイル: note.c プロジェクト: kalendae/emlenmud-for-centos
void 
do_note (CHAR_DATA * ch, char *argy)
{
  char buf[STD_LENGTH * 17];
  char buf1[STD_LENGTH * 17];
  char arg[SML_LENGTH];
  NOTE_DATA *pnote;
  int vnum;
  int board_here;		/*Boards and board nums by Owen Emlen */
  SINGLE_OBJECT *obj;
  int anum;
  DEFINE_COMMAND ("note", do_note, POSITION_DEAD, 0, LOG_NORMAL, "This command is used to post/read/remove notes.")

    if (IS_MOB (ch))
    return;
  board_here = 0;
  obj = get_obj_here (ch, "board", SEARCH_ROOM_FIRST);
  if (obj == NULL)
    {
      board_here = 1;
    }
  else
    board_here = obj->pIndexData->value[9];
  buf1[0] = '\0';
  argy = one_argy (argy, arg);
  smash_tilde (argy);
  if (arg[0] == '\0')
    {
      do_note (ch, "read");
      return;
    }
  if (!str_cmp (arg, "list"))
    {
      vnum = 0;
      
 	sprintf(buf1,"\x1B[1;30m------------------------------------------------------------------------\x1B[37;0m\n\r");
      sprintf(buf1+strlen(buf1),"\x1B[1;36m New  ###  Sender/From         Subject\x1B[37;0m\n\r");
	sprintf(buf1+strlen(buf1),"\x1B[1;30m------------------------------------------------------------------------\x1B[37;0m\n\r");

      for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	{
	  if (is_note_to (ch, pnote) &&
	      (board_here == pnote->board_num || IS_IMMORTAL (ch)))
	    {
		  if (strlen(pnote->subject)>35) {
			pnote->subject[35]='\0';
			}
	      sprintf (buf, "%s \x1B[1;36m%3d\x1B[37;0m  From \x1b[1;37m%-14s\x1B[37;0m '\x1B[1;36m%s\x1B[37;0m'\n\r",
		       (pnote->date_stamp > ch->pcdata->last_note
			&& str_cmp (pnote->sender, NAME (ch))) ? "\x1B[1;34m(New)\x1B[37;0m" : "     ",
		       vnum,
		pnote->sender, pnote->subject);
	      strcat (buf1, buf);
	      vnum++;
	    }
	  else
	    vnum++;
	  if (strlen (buf1) > (STD_LENGTH * 16))
	    {
	      strcat (buf1, "\n\rTOO MANY NOTES.. WAIT UNTIL A GOD REMOVES SOME!\n\r");
	      break;
	    }
	}
      page_to_char_limited (buf1, ch); 
      return;
    }
  if (!str_cmp (arg, "read"))
    {
      bool fAll;
      if (!str_cmp (argy, "all"))
	{
	  fAll = TRUE;
	  anum = 0;
	}
      else if (argy[0] == '\0' || !str_prefix (argy, "next"))
	/* read next unread note */
	{
	  vnum = 0;
	  for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	    {
	      if (is_note_to (ch, pnote) &&
		  (board_here == pnote->board_num || IS_IMMORTAL (ch))
		  && str_cmp (NAME (ch), pnote->sender)
		  && ch->pcdata->last_note < pnote->date_stamp)
		{
		  sprintf (buf,"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
		  sprintf (buf+strlen(buf), "[Note #\x1B[1;37m%d:%d\x1B[37;0m] From: \x1B[1;37m%s\x1B[37;0m  To: \x1B[1;37m%s\x1B[37;0m\n\r",
			   vnum,
			   pnote->board_num,
			   pnote->sender,
			   pnote->to_list);
		  if (strlen(pnote->subject)>35) {
			pnote->subject[35]='\0';
			}
		  sprintf (buf+strlen(buf),"%s.  Subject: \x1B[1;36m%s\x1B[37;0m\n\r",
			   pnote->date,
			   pnote->subject);
		  sprintf (buf+strlen(buf),"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
		  strcat (buf1, buf);
		  strcat (buf1, pnote->text);
		  ch->pcdata->last_note = UMAX (ch->pcdata->last_note, pnote->date_stamp);
		
                  page_to_char_limited (buf1, ch); 
		  return;
		}
	      else
		vnum++;
	    }
	  send_to_char ("You have no unread notes.\n\r", ch);
	  return;
	}
      else if (is_number (argy))
	{
	  fAll = FALSE;
	  anum = atoi (argy);
	}
      else
	{
	  send_to_char ("Note read which number?\n\r", ch);
	  return;
	}
      vnum = 0;
      for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	{
	  if ((vnum++ == anum || fAll) && is_note_to (ch, pnote) &&
	      (board_here == pnote->board_num || IS_IMMORTAL (ch)))
	    {
		  sprintf (buf,"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
		  sprintf (buf+strlen(buf), "[Note #\x1B[1;37m%d:%d\x1B[37;0m] From: \x1B[1;37m%s\x1B[37;0m  To: \x1B[1;37m%s\x1B[37;0m\n\r",
			   vnum - 1,
			   pnote->board_num,
			   pnote->sender,
			   pnote->to_list);
		  if (strlen(pnote->subject)>35) {
			pnote->subject[35]='\0';
			}
		  sprintf (buf+strlen(buf),"Dated %s.  Subject: \x1B[1;36m%s\x1B[37;0m\n\r",
			   pnote->date,
			   pnote->subject);
		  sprintf (buf+strlen(buf),"\x1B[1;30m---------------------------------------------------------------------------\x1B[37;0m\n\r");
	      strcat (buf1, buf);
	      strcat (buf1, pnote->text);
	  
              page_to_char_limited (buf1, ch); 
	      return;
	    }
	}
      send_to_char ("No such note.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "write"))
    {
      if (LEVEL (ch) < IMM_LEVEL && board_here == 1)
	{
	  send_to_char ("You can't write on the immortal notice board.\n\r", ch);
	  return;
	}
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      string_append (ch, &ch->ced->pnote->text);
      return;
    }
  if (!str_cmp (arg, "fwrite"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      if (LEVEL (ch) < IMM_LEVEL && board_here == 1)
	{
	  send_to_char ("You can't write on the immortal notice board.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      fullscreen_editor (ch, &ch->ced->pnote->text);
      return;
    }

  if (!str_cmp (arg, "+"))
    {
      
      check_ced (ch);
      note_attach (ch);
      strcpy (buf, ch->ced->pnote->text);
      if (strlen (buf) + strlen (argy) >= STD_LENGTH - 200)
	{
	  send_to_char ("Note too long.\n\r", ch);
	  return;
	}
      strcat (buf, argy);
      strcat (buf, "\n\r");
      free_string (ch->ced->pnote->text);
      ch->ced->pnote->text = str_dup (buf);
      ch->ced->pnote->lines += 1;
      send_to_char ("Ok.\n\r", ch);
      return;
    }  
  if (!str_cmp (arg, "-"))
    {
      int num, cnt;
      char new_buf[STD_LENGTH];
      const char *str;
      check_ced (ch);
      if (ch->ced->pnote == NULL)
	{
	  send_to_char ("You have to start a note first.\n\r", ch);
	  return;
	}
      if (ch->ced->pnote->lines == 0)
	{
	  send_to_char ("Nothing to delete.\n\r", ch);
	  return;
	}
      new_buf[0] = '\0';
      str = ch->ced->pnote->text;
      cnt = 1;
      for (num = 1; num <= ch->ced->pnote->lines; num++)
	{
	  while (*str != '\r' && *str != '\0')
	    {
	      ++str;
	      ++cnt;
	    }
	}
      strncpy (new_buf, ch->ced->pnote->text, cnt);
      new_buf[cnt] = '\0';
      free_string (ch->ced->pnote->text);
      ch->ced->pnote->text = str_dup (new_buf);
      ch->ced->pnote->lines -= 1;
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "subject"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      free_string (ch->ced->pnote->subject);
      ch->ced->pnote->subject = str_dup (argy);
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "to"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      note_attach (ch);
      free_string (ch->ced->pnote->to_list);
      ch->ced->pnote->to_list = str_dup (argy);
      send_to_char("\x1b[1;31mBe sure to put 'pkill' or 'flame' if this is a pkill flame note.\x1b[0;37m", ch);
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "clear"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      if (ch->ced->pnote != NULL)
	{
	  free_string (ch->ced->pnote->text);
	  free_string (ch->ced->pnote->subject);
	  free_string (ch->ced->pnote->to_list);
	  free_string (ch->ced->pnote->date);
	  free_string (ch->ced->pnote->sender);
	  ch->ced->pnote->next = note_free;
	  note_free = ch->ced->pnote;
	  ch->ced->pnote = NULL;
	}
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "show"))
    {
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      check_ced (ch);
      if (ch->ced->pnote == NULL)
	{
	  send_to_char ("You have no note in progress.\n\r", ch);
	  return;
	}
      sprintf (buf, "%s: %s\n\rTo: %s\n\rLines: %d\n\r",
	       ch->ced->pnote->sender,
	       ch->ced->pnote->subject,
	       ch->ced->pnote->to_list,
	       ch->ced->pnote->lines
	);
      strcat (buf1, buf);
      strcat (buf1, ch->ced->pnote->text);

      page_to_char_limited (buf1, ch); 
      return;
    }
  if (!str_cmp (arg, "post") || !str_prefix (arg, "send"))
    {
      FILE *fp;
      char *strtime;
      
      check_ced (ch);
      
      if (ch->ced->pnote == NULL)
	{
	  send_to_char ("You have no note in progress.\n\r", ch);
	  return;
	}
      if (board_here == 1 && LEVEL (ch) < IMM_LEVEL)
	{
	  send_to_char ("This board is reserved for immortals posting messages to mortals.\n\r", ch);
	  send_to_char ("Please post on a public board if you wish to write a note.\n\r", ch);
	  return;
	}
      if (!str_cmp (ch->ced->pnote->to_list, ""))
	{
	  send_to_char (
	    "You need to provide a recipient (name, all, or immortal).\n\r",
			 ch);
	  return;
	}
      if (!str_cmp (ch->ced->pnote->subject, ""))
	{
	  send_to_char ("You need to provide a subject.\n\r", ch);
	  return;
	}
      if (IS_SET(ch->act, PLR_LAMER))
	{
	  send_to_char("You have lost your board writing privileges.\n\r", ch);
	  send_to_char("Maybe if you grow up you will be allowed to start\n\r", ch);
	  send_to_char("posting on the board again, however since you have\n\r", ch);
	  send_to_char("consistently shown yourself to be lame this is not likely.\n\r", ch);
	  return;
	}
      ch->pcdata->online_spot->notes_this_reboot++;
      if(ch->pcdata->online_spot->notes_this_reboot > 8)
	{
	  send_to_char("You have already written too many notes this reboot.\n\r", ch);
	  return;
	}

      ch->ced->pnote->next = NULL;
      strtime = ctime (&current_time);
      strtime[strlen (strtime) - 1] = '\0';
      ch->ced->pnote->board_num = board_here;
      ch->ced->pnote->date = str_dup (strtime);
      ch->ced->pnote->date_stamp = current_time;
      if (note_list == NULL)
	{
	  note_list = ch->ced->pnote;
	}
      else
	{
	  for (pnote = note_list; pnote->next != NULL; pnote = pnote->next)
	    ;
	  pnote->next = ch->ced->pnote;
	}
      pnote = ch->ced->pnote;
      ch->ced->pnote = NULL;
#ifndef WINDOWS
//      fclose (fpReserve);
#endif
      if ((fp = fopen (NOTE_FILE, "a")) == NULL)
	{
	  perror (NOTE_FILE);
	}
      else
	{
	  fprintf (fp, "Sender %s~\n", fix_string (pnote->sender));
	  fprintf (fp, "TBoard %d\n", pnote->board_num);
	  fprintf (fp, "Date %s~\n", pnote->date);
	  fprintf (fp, "Stamp %ld\n", pnote->date_stamp);
	  fprintf (fp, "To %s~\n", fix_string (pnote->to_list));
	  fprintf (fp, "Subject %s~\n", fix_string (pnote->subject));
	  fprintf (fp, "Text\n%s~\n", pnote->text);
	  fprintf (fp, "End\n\n");
	  fclose (fp);
	}
#ifndef WINDOWS
//      fpReserve = fopen (NULL_FILE, "r");
#endif
      send_to_char ("Ok.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "remove"))
    {
      if (!is_number (argy))
	{
	  send_to_char ("Note remove which number?\n\r", ch);
	  return;
	}
      anum = atoi (argy);
      vnum = 0;
      for (pnote = note_list; pnote != NULL; pnote = pnote->next)
	{
	  if (vnum++ == anum && (
				  (is_note_to (ch, pnote) && !is_name ("all", pnote->to_list)) || LEVEL (ch) > 109))
	    {
	      note_remove (ch, pnote);
	      send_to_char ("Ok.\n\r", ch);
	      return;
	    }
	}
      send_to_char ("No such note.\n\r", ch);
      return;
    }
  send_to_char ("Huh? Type 'help note' for usage.\n\r", ch);
  return;
}
コード例 #12
0
ファイル: interp.C プロジェクト: SinaC/OldMud
/*
 * The main entry point for executing commands.
 * Can be recursively called from 'at', 'order', 'force'.
 */
void interpret( CHAR_DATA *ch, const char *argument0 )
{
  char command[MAX_INPUT_LENGTH];
  char logline[MAX_INPUT_LENGTH];
  int cmd;
  int trust;
  bool found;
  // Added by SinaC 2001, true if it's a mob program command
  bool found_mob;

  char *argument = new char [MAX_INPUT_LENGTH];
  strcpy(argument,argument0);
  for( char *s = argument; *s; s++ )
    *s = ( *s == '~' ? '-' : *s );

  /*
   * Strip leading spaces.
   */
  while ( isspace(*argument) )
    argument++;
  if ( argument[0] == '\0' )
    return;

  // Added by SinaC 2001
  if ( ch->in_room == NULL ) {
    send_to_char("You're not in a room ... How did you do that ?", ch );
    return;
  }


  /*
   * No hiding.
   */
  /* Oxtal> I still don't figure out what this does */
  // when we're Hiding, if we do something, Hide disappears  SinaC 2000
  if (IS_SET(ch->bstat(affected_by),AFF_HIDE)) {
    REMOVE_BIT( ch->bstat(affected_by), AFF_HIDE );
    recompute(ch);
  }

  /*
   * Implement freeze command.
   */
  if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_FREEZE) ) {
    send_to_char( "You're totally frozen!\n\r", ch );
    return;
  }

  /*
   * Grab the command word.
   * Special parsing so ' can be a command,
   *   also no spaces needed after punctuation.
   */
  strcpy( logline, argument );

  sprintf(last_command,"%s(%d) in room[%d]: %s.",
	  ch->name,
	  IS_NPC(ch)?ch->pIndexData->vnum:-1,
	  ch->in_room?ch->in_room->vnum:-1,
	  argument );

  const char* argument2;
  if ( !isalpha(argument[0]) && !isdigit(argument[0])) {
    command[0] = argument[0];
    command[1] = '\0';
    argument++;
    while ( isspace(*argument) )
      argument++;

    argument2 = argument;
  }
  else {
    // Added by SinaC 2003, really crappy
    if ( !str_prefix( "jog", argument ) || !str_prefix( "jo", argument ) ) // for jog command
      argument2 = no_lower_one_argument( argument, command );
    else
      argument2 = one_argument( argument, command );
  }

  /*
   * Look for command in command table.
   */
  // Added by SinaC 2001
  found_mob = FALSE;
  found = FALSE;
  trust = get_trust( ch );
  //for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) {
  for ( cmd = 0; cmd < MAX_COMMANDS; cmd++ ) {
    if ( command[0] == cmd_table[cmd].name[0]
	 &&   !str_prefix( command, cmd_table[cmd].name )
	 &&   cmd_table[cmd].level <= trust ) {
      found = TRUE;
      break;
    }
  }

  /*
   * Log and snoop.
   */
  if ( found && cmd_table[cmd].log == LOG_NEVER )
    strcpy( logline, "" );

  if ( found && 
       ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) )
	 ||   fLogAll
	 ||   cmd_table[cmd].log == LOG_ALWAYS ) ) {
    // Modified by SinaC 2000
    sprintf( log_buf, "Log %s: %s (%s)", 
	     ch->name, 
	     logline, 
	     cmd_table[cmd].name
	     );
    wiznet(log_buf,ch,NULL,WIZ_SECURE,0,get_trust(ch));
    log_string( log_buf );
  }

  
  // Added by SinaC 2001, if player was afk, afk is removed.
  if ( IS_SET(ch->comm,COMM_AFK)
       // unless player is trying to remove afk with afk command
       && ( found && str_cmp(cmd_table[cmd].name,"afk") )
       && !IS_IMMORTAL(ch) ) {
    send_to_char("{GAFK{x mode removed.\n\r",ch);
    if (buf_string(ch->pcdata->buffer)[0] != '\0' )
      send_to_char("{rYou have received tells: Type {Y'replay'{r to see them.{x\n\r",ch);
    REMOVE_BIT(ch->comm,COMM_AFK);
  }


  if ( ch->desc != NULL && ch->desc->snoop_by != NULL ) {
    write_to_buffer( ch->desc->snoop_by, "% ",    2 );
    write_to_buffer( ch->desc->snoop_by, logline, 0 );
    write_to_buffer( ch->desc->snoop_by, "\n\r",  2 );
  }

  if ( !found ) {
    if( !check_social( ch, command, argument2 ) ) {
      // Modified by SinaC 2000
      //	    send_to_char( "Huh?\n\r", ch );
      random_error( ch );
      if ( SCRIPT_VERBOSE > 0 ) {
	if ( IS_NPC(ch) ) // Added by SinaC 2003
	  log_stringf("%s (%d) tries to use command: %s %s", 
		      NAME(ch), ch->pIndexData->vnum,
		      command, argument2 );
      }
    }
      
      return;
  }
  else {
    if ( check_disabled(&cmd_table[cmd]) ) {
      send_to_char( "This command has been temporarily disabled.\n\r", ch );
      return;
    }
    // Added by SinaC 2001 for player disabled commands
    if ( check_disabled_plr( ch, &cmd_table[cmd] ) ) {
      send_to_char( "The gods has removed your ability to use that command.\n\r", ch );
      return;
    }
  }

  /*
   * Character not in position for command?
   */
  if ( ch->position < cmd_table[cmd].position ) {
    switch( ch->position ) {
    case POS_DEAD:
      send_to_char( "Lie still; you are DEAD.\n\r", ch );
      break;

    case POS_MORTAL:
    case POS_INCAP:
      send_to_char( "You are hurt far too bad for that.\n\r", ch );
      break;

      // Added by SinaC 2003
    case POS_PARALYZED:
      send_to_char( "You are paralyzed, you can't move.\n\r", ch);
      break;

    case POS_STUNNED:
      send_to_char( "You are too stunned to do that.\n\r", ch );
      break;

    case POS_SLEEPING:
      send_to_char( "In your dreams, or what?\n\r", ch );
      break;

    case POS_RESTING:
      send_to_char( "Nah... You feel too relaxed...\n\r", ch);
      break;

    case POS_SITTING:
      send_to_char( "Better stand up first.\n\r",ch);
      break;

    case POS_FIGHTING:
      send_to_char( "No way!  You are still fighting!\n\r", ch);
      break;

    }
    return;
  }

  /*
   * Dispatch the command.
   */

  /* Oxtal -- Output the commands */
  /* SinaC --- We don't need that for the moment
   *if ( cmd_table[cmd].log != LOG_NEVER ) {
   * char *strtime;
   *
   * strtime = ctime( &current_time );
   * strtime[strlen(strtime)-1] = '\0';
   * fprintf( stdout, "%s %15s [%5d] %s %s\n",
   *  strtime,
   *  ch->name,
   *  ch->in_room ? ch->in_room->vnum : 0,
   *  cmd_table[cmd].name,
   *  argument);
   *}
   */ // removed by SinaC 2000
  
  // Modified by SinaC 2001 to detect memory leak
  char buf[MAX_STRING_LENGTH];

  // Modified by SinaC 2001
  if ( found )
    (*cmd_table[cmd].do_fun) ( ch, argument2 );

  return;
}
コード例 #13
0
ファイル: hint.c プロジェクト: johnbellone/SmaugFUSS
void do_hintedit( CHAR_DATA* ch, const char* argument)
{
   char arg[MAX_STRING_LENGTH];
   char arg2[MAX_STRING_LENGTH];
   char arg3[MAX_STRING_LENGTH];
   HINT_DATA *hintData;
   int i;
   int no = 0;
   int ano = 0;
   bool found = FALSE;

   if( IS_NPC( ch ) )
      return;

   if( !IS_IMMORTAL( ch ) )
      return;

   set_char_color( AT_LBLUE, ch );
   argument = one_argument( argument, arg );
   argument = one_argument( argument, arg2 );
   argument = one_argument( argument, arg3 );
   if( !str_cmp( arg, "help" ) || arg[0] == '\0' )
   {
      do_help( ch, "imm_hints" );
      return;
   }

   if( !str_cmp( arg, "list" ) )
   {
      if( first_hint )
      {
         pager_printf( ch, "No | Low | High |            Text             \r\n" );
         pager_printf( ch, "---|-----|------|--------------------------------------------------\r\n" );
         i = 0;
         for( hintData = first_hint; hintData; hintData = hintData->next )
         {
            ++i;
            pager_printf( ch, "%2d | %3d | %4d | %-30s\r\n", i, hintData->low, hintData->high, hintData->text );
         }
         pager_printf( ch, "\r\n%d hints in file.\r\n", i );
      }
      else
         send_to_char( "No hints in file.\r\n", ch );
      return;
   }

   else if( !str_cmp( arg, "remove" ) )
   {
      no = 0;
      if( !is_number( arg2 ) )
      {
         send_to_char_color( "Remove which hint?\r\n", ch );
         return;
      }
      ano = atoi( arg2 );
      found = FALSE;
      for( hintData = first_hint; hintData; hintData = hintData->next )
      {
         ++no;
         if( no == ano )
         {
            ch_printf_color( ch, "&CHint Number %d removed\r\n", ano );
            UNLINK( hintData, first_hint, last_hint, next, prev );
            STRFREE( hintData->text );
            DISPOSE( hintData );
            found = TRUE;
            break;
         }
      }
      if( !found )
      {
         send_to_char( "Hint not found\r\n", ch );
         return;
      }
      return;
   }
   else if( !str_cmp( arg, "add" ) )
   {
      if( arg2 == '\0' )
      {
         send_to_char( "What is the minimum level for this hint?\r\n", ch );
         return;
      }
      if( arg3 == '\0' )
      {
         send_to_char( "What is the maximum level for this hint?\r\n", ch );
         return;
      }
      if( atoi( arg2 ) > atoi( arg3 ) )
      {
         send_to_char( "Aborting:  max less than min!\r\n", ch );
         return;
      }
      CREATE( hintData, HINT_DATA, 1 );
      hintData->low = atoi( arg2 );
      hintData->high = atoi( arg3 );
      hintData->text = STRALLOC( argument );
      LINK( hintData, first_hint, last_hint, next, prev );
      send_to_char( "Ok.  Hint created\r\n", ch );
      return;
   }
   else if( !str_cmp( arg, "force" ) )
   {
      ch_printf_color( ch, "&p( &wHINT&p ):  &P%s\r\n", get_hint( LEVEL_AVATAR ) );
      return;
   }
   else if( !str_cmp( arg, "edit" ) )
   {
      no = 0;
      i = 0;

      if( arg2[0] == '\0' )
      {
         send_to_char( "Edit which hint number?\r\n", ch );
         return;
      }
      else
         no = atoi( arg2 );
      if( arg3[0] == '\0' )
      {
         ch_printf( ch, "Edit which field of hint %d (low/high/text)?\r\n", no );
         return;
      }
      if( argument[0] == '\0' )
      {
         ch_printf( ch, "Change hint %d's field %s to what ?\r\n", no, arg3 );
         return;
      }
      for( hintData = first_hint; hintData; hintData = hintData->next )
      {
         ++i;
         if( i == no )
         {
            found = TRUE;
            break;
         }
      }
      if( !found )
      {
         ch_printf( ch, "Hint %d not found.\r\n", no );
         return;
      }
      else
      {
         if( !str_cmp( arg3, "text" ) )
         {
            STRFREE( hintData->text );
            hintData->text = STRALLOC( argument );
            send_to_char( "Hint text changed!\r\n", ch );
            return;
         }
         else if( !str_cmp( arg3, "low" ) )
         {
            if( atoi( argument ) > hintData->high )
            {
               send_to_char( "Aborting:  min higher than max.\r\n", ch );
               return;
            }
            hintData->low = atoi( argument );
            send_to_char( "Minimum level for hint changed.\r\n", ch );
            return;
         }
         else if( !str_cmp( arg3, "high" ) )
         {
            if( atoi( argument ) < hintData->low )
            {
               send_to_char( "Aborting:  max lower than min.\r\n", ch );
               return;
            }
            hintData->high = atoi( argument );
            send_to_char( "Maximum level for hint changed.\r\n", ch );
            return;
         }
         else
         {
            send_to_char( "Valid fields are:  low/high/text\r\n", ch );
            return;
         }
      }
   }
   else if( !str_cmp( arg, "save" ) )
   {
      write_hint(  );
      send_to_char( "Saved.\r\n", ch );
      return;
   }
   else
   {
      send_to_char( "Syntax:  hint (list/add/remove/edit/save/force)\r\n", ch );
      return;
   }
}
コード例 #14
0
ファイル: interp.c プロジェクト: InfiniteAxis/SmaugFUSS
bool check_social( CHAR_DATA * ch, const char *command, const char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   CHAR_DATA *victim, *victim_next;
   SOCIALTYPE *social;
   CHAR_DATA *removed[128];   /* What are the chances of more than 128? */
   ROOM_INDEX_DATA *room;
   int i = 0, k = 0;

   if( ( social = find_social( command ) ) == NULL )
      return FALSE;

   if( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_NO_EMOTE ) )
   {
      send_to_char( "You are anti-social!\r\n", ch );
      return TRUE;
   }

   switch ( ch->position )
   {
      case POS_DEAD:
         send_to_char( "Lie still; you are DEAD.\r\n", ch );
         return TRUE;

      case POS_INCAP:
      case POS_MORTAL:
         send_to_char( "You are hurt far too bad for that.\r\n", ch );
         return TRUE;

      case POS_STUNNED:
         send_to_char( "You are too stunned to do that.\r\n", ch );
         return TRUE;

      case POS_SLEEPING:
         /*
          * I just know this is the path to a 12" 'if' statement.  :(
          * But two players asked for it already!  -- Furey
          */
         if( !str_cmp( social->name, "snore" ) )
            break;
         send_to_char( "In your dreams, or what?\r\n", ch );
         return TRUE;
   }

   /*
    * Search room for chars ignoring social sender and 
    * remove them from the room until social has been  
    * completed              
    */
   room = ch->in_room;
   for( victim = ch->in_room->first_person; victim; victim = victim_next )
   {
      if( i == 127 )
         break;
      victim_next = victim->next_in_room;
      if( is_ignoring( victim, ch ) )
      {
         if( !IS_IMMORTAL( ch ) || get_trust( victim ) > get_trust( ch ) )
         {
            removed[i] = victim;
            i++;
            UNLINK( victim, room->first_person, room->last_person, next_in_room, prev_in_room );
         }
         else
         {
            set_char_color( AT_IGNORE, victim );
            ch_printf( victim, "You attempt to ignore %s, but are unable to do so.\r\n", !can_see( victim, ch ) ? "Someone" : ch->name );
         }
      }
   }

   one_argument( argument, arg );
   victim = NULL;
   if( arg[0] == '\0' )
   {
      act( AT_SOCIAL, social->others_no_arg, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_no_arg, ch, NULL, victim, TO_CHAR );
   }
   else if( ( victim = get_char_room( ch, arg ) ) == NULL )
   {
      /*
       * If they aren't in the room, they may be in the list of 
       * people ignoring...                 
       */
      if( i != 0 )
      {
         for( k = 0, victim = removed[0]; k < i; k++, victim = removed[k] )
         {
            if( nifty_is_name( victim->name, arg ) || nifty_is_name_prefix( arg, victim->name ) )
            {
               set_char_color( AT_IGNORE, ch );
               ch_printf( ch, "%s is ignoring you.\r\n", victim->name );
               break;
            }
         }
      }

      if( !victim )
         send_to_char( "They aren't here.\r\n", ch );
   }
   else if( victim == ch )
   {
      act( AT_SOCIAL, social->others_auto, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_auto, ch, NULL, victim, TO_CHAR );
   }
   else
   {
      act( AT_SOCIAL, social->others_found, ch, NULL, victim, TO_NOTVICT );
      act( AT_SOCIAL, social->char_found, ch, NULL, victim, TO_CHAR );
      act( AT_SOCIAL, social->vict_found, ch, NULL, victim, TO_VICT );

      if( !IS_NPC( ch ) && IS_NPC( victim ) && !IS_AFFECTED( victim, AFF_CHARM ) && IS_AWAKE( victim ) && !victim->desc // This was just really annoying.. lemme do my own socials! -- Alty
          && !HAS_PROG( victim->pIndexData, ACT_PROG ) )
      {
         switch ( number_bits( 4 ) )
         {
            case 0:
               if( IS_EVIL( ch ) && !is_safe( victim, ch, TRUE ) )   /* was IS_EVIL(ch) ||.... didn't make sense to me - FB */
                  multi_hit( victim, ch, TYPE_UNDEFINED );
               else if( IS_NEUTRAL( ch ) )
               {
                  act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               }
               else
               {
                  act( AT_ACTION, "$n acts like $N doesn't even exist.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You just ignore $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n appears to be ignoring you.", victim, NULL, ch, TO_VICT );
               }
               break;

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
               act( AT_SOCIAL, social->others_found, victim, NULL, ch, TO_NOTVICT );
               act( AT_SOCIAL, social->char_found, victim, NULL, ch, TO_CHAR );
               act( AT_SOCIAL, social->vict_found, victim, NULL, ch, TO_VICT );
               break;

            case 9:
            case 10:
            case 11:
            case 12:
               act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
               act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
               act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               break;
         }
      }
   }

   /*
    * Replace the chars in the ignoring list to the room 
    * note that the ordering of the players in the room  
    * might change                
    */
   if( i != 0 )
   {
      for( k = 0, victim = removed[0]; k < i; k++, victim = removed[k] )
      {
         LINK( victim, room->first_person, room->last_person, next_in_room, prev_in_room );
      }
   }

   return TRUE;
}
コード例 #15
0
ファイル: Opinion.c プロジェクト: frasten/openleu
int RemHated( struct char_data *ch, struct char_data *pud) 
{
  struct char_list *t, **ppOp;

  if( IS_PC( ch ) )
  { 
    return FALSE;
  }

  if (pud) 
  {
#if defined( EMANUELE )
    for( ppOp = &ch->hates.clist; *ppOp; )
    {
      if( (*ppOp)->op_ch )
      {
        if( (*ppOp)->op_ch == pud )
        {
          if (IS_IMMORTAL(pud))  
          {
            send_to_char("$c0004Qualcuno smette di odiarti.\n\r",pud);
          }
          t = *ppOp;
          *ppOp = (*ppOp)->next;
          free(t);
          continue;
        }
      }
      else 
      {
        if( !strcmp( (*ppOp)->name, GET_NAME( pud ) ) ) 
        {
          if (IS_IMMORTAL(pud))  
          {
            send_to_char("$c0004Qualcuno smette di odiarti.\n\r",pud);
          }
          t = *ppOp;
          *ppOp = (*ppOp)->next;
          free(t);
          continue;
        }
      }
      ppOp = &(*ppOp)->next;
    }
#else
    
    for( oldpud = ch->hates.clist; oldpud; oldpud = oldpud->next )
    {
      if( oldpud->op_ch )
      {
        if( oldpud->op_ch == pud )
        {
          if (IS_IMMORTAL(pud))  
          {
            send_to_char("$c0004Qualcuno smette di odiarti.\n\r",pud);
          }      
          
          t = oldpud;
          if( ch->hates.clist == t )
          {
            ch->hates.clist = t->next;
            oldpud = t->next;
            free(t);
          }
          else 
          {
            for( oldpud = ch->hates.clist; oldpud->next != t; 
                 oldpud = oldpud->next);
            oldpud->next = oldpud->next->next;
            free(t);
            break;
          }
        }
      }
      else 
      {
        if (!strcmp(oldpud->name,GET_NAME(pud))) 
        {
          t = oldpud;
          if (ch->hates.clist == t) 
          {
            ch->hates.clist = 0;
            free(t);
            break;
          }
          else 
          {
            for( oldpud = ch->hates.clist; oldpud->next != t; 
                 oldpud = oldpud->next);
            oldpud->next = oldpud->next->next;
            free(t);
            break;
          }
        }
      }
    }
#endif    
  } 

  if( !ch->hates.clist )
    REMOVE_BIT( ch->hatefield, HATE_CHAR );
  if( !ch->hatefield )
    REMOVE_BIT( ch->specials.act, ACT_HATEFUL );

  return( (pud) ? TRUE : FALSE);
}
コード例 #16
0
ファイル: player.c プロジェクト: m241dan/swrproject
/*
 * New score command by Haus
 */
void do_score( CHAR_DATA * ch, const char *argument )
{
   AFFECT_DATA *paf;
   int iLang, x;

   if( IS_NPC( ch ) )
   {
      do_oldscore( ch, argument );
      return;
   }

   ch_printf( ch, "\r\n&zScore for %s.\r\n", ch->pcdata->title );
   if( get_trust( ch ) != ch->top_level )
      ch_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) );

   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );
   ch_printf( ch, "&r|&zRace      &r:&W %-3d&z year old %-10.10s      Log In&r:&W %-25.24s&r|\r\n",
              get_age( ch ), capitalize( get_race( ch ) ), ctime( &( ch->logon ) ) );
   ch_printf( ch, "&r|&zHitroll   &r: &W%-5d    &zDamroll&r:&W %-5d      &zSaved &r:&W %-25.24s&r|\r\n",
              GET_HITROLL( ch ), GET_DAMROLL( ch ), ch->save_time ? ctime( &( ch->save_time ) ) : "no" );
   ch_printf( ch, "&r|&zGlobal AC &r: &W%-5d    &zEvasion&r: &W%-5d      &zTime  &r: &W%-25.24s&r|\r\n",
              GET_ARMOR( ch ), GET_EVASION( ch ), ctime( &current_time ) );
   ch_printf( ch, "&r|&zAlign     &r: &W%-5d    &zWimpy  &r:&W %-3d                                         &r|\r\n",
              ch->alignment, ch->wimpy  );
   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );
   send_to_char( " &zBarehand Damtypes&r:", ch );
   for( x = 0; x < MAX_DAMTYPE; x++ )
      if( xIS_SET( ch->damtype, x ) )
         ch_printf( ch, " &W%s&r,", d_type[x] );
   send_to_char( "\r\n", ch );
   ch_printf( ch, " &r&zHit Points&r: &W%d&z of&W %d &z    Move&r: &W%d&z of&W %d   &z  Force&r:&W %d&z of&W %d&z\r\n",
                 ch->hit, ch->max_hit, ch->move, ch->max_move, ch->mana, ch->max_mana );

   ch_printf( ch, " &zStr&r: &W%2d  &zDex&r:&W %2d  &zCon&r: &W%2d  &zAgi&r:&W %2d &z Int&r:&W %2d  &zWis&r:&W %2d&z  Cha&r: &w%2d&z\r\n",
              get_curr_str( ch ), get_curr_dex( ch ), get_curr_con( ch ), get_curr_agi( ch ), get_curr_int( ch ), get_curr_wis( ch ),
              get_curr_cha( ch ) );


   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );

   {
      int ability;

      for( ability = 0; ability < MAX_ABILITY; ability++ )
      {
          if( ch->skill_level[ability] < 1 )
             continue;
          ch_printf( ch, " &W%-15s   &zLevel&r: &W%-3d   &zMax&r: &W%-3d   &zExp&r: &W%-10ld   &zNext&r: &W%-10ld&z\r\n",
                     ability_name[ability], ch->skill_level[ability], max_level( ch, ability ), ch->experience[ability],
                     exp_level( ch->skill_level[ability] + 1 ) );
          if( ability == COMBAT_ABILITY )
          {
             for( x = 0; x < MAX_DISCIPLINE; x++ )
                if( ch->known_disciplines[x] != NULL )
                   ch_printf( ch, " - %s%s&g\r\n",
                              is_discipline_set( ch, ch->known_disciplines[x] ) ? "&z" : "&W",
                              ch->known_disciplines[x]->name );
          }
      }
   }

   send_to_char( "&r----------------------------------------------------------------------------\r\n", ch );
   send_to_char( "&r|&zDamage &zType      &r|    &zPenetrate     &r|      &zResist      &r|     &zPotency      &r|\r\n", ch );
   send_to_char( "&r----------------------------------------------------------------------------\r\n", ch );
   for( x = 0; x < MAX_DAMTYPE; x++ )
      ch_printf( ch, "&r|%-19.19s&r:       &W%3d        &r|       &W%3d        &r|       &W%3d        &r|\r\n",
             d_type_score[x], ch->penetration[x], ch->resistance[x], ch->damtype_potency[x] );
   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );

   ch_printf( ch, "&zCREDITS&r:&W %-10d   &zBANK&r: &W%-10d    &zPkills&r: &W%-5.5d   &zMkills&r:&W %-5.5d\r\n",
              ch->gold, ch->pcdata->bank, ch->pcdata->pkills, ch->pcdata->mkills );

   ch_printf( ch, "&zWeight&r: &W%5.5d &r(&zmax&W %7.7d&r)&z    Items&r: &W%5.5d &r(&zmax&W %5.5d&r)\r\n",
              ch->carry_weight, can_carry_w( ch ), ch->carry_number, can_carry_n( ch ) );

   ch_printf( ch, "&zPager&r: &r(&W%c&r)&W %3d &z  AutoExit&r(&W%c&r) &z AutoLoot&r(&W%c&r)&z  Autosac&r(&W%c&r)\r\n",
              IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ',
              ch->pcdata->pagerlen, IS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ',
              IS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ', IS_SET( ch->act, PLR_AUTOSAC ) ? 'X' : ' ' );

   send_to_char( "\r\n&zLanguages&r: ", ch );
   for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ )
      if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) )
      {
         if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) )
            set_char_color( AT_RED, ch );
         send_to_char( lang_names[iLang], ch );
         send_to_char( " ", ch );
         set_char_color( AT_SCORE, ch );
      }

   send_to_char( "\r\n", ch );
   ch_printf( ch, "&zWANTED ON&r: &W%s\r\n", flag_string( ch->pcdata->wanted_flags, planet_flags ) );

   if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' )
      ch_printf( ch, "&zYou are bestowed with the command&r(&zs&r):&W %s.\r\n", ch->pcdata->bestowments );

   if( ch->pcdata->clan )
   {
      send_to_char( "&r----------------------------------------------------------------------------\r\n", ch );
      ch_printf( ch, "&zORGANIZATION&r:&W %-35s &zPkills&r/&zDeaths&r: &W%3.3d&r/&W%3.3d",
                 ch->pcdata->clan->name, ch->pcdata->clan->pkills, ch->pcdata->clan->pdeaths );
      send_to_char( "\r\n", ch );
   }
   if( IS_IMMORTAL( ch ) )
   {
      send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );

      ch_printf( ch, "IMMORTAL DATA:  Wizinvis [%s]  Wizlevel (%d)\r\n",
                 IS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis );

      ch_printf( ch, "Bamfin:  %s\r\n", ( ch->pcdata->bamfin[0] != '\0' )
                 ? ch->pcdata->bamfin : "%s appears in a swirling mist.", ch->name );
      ch_printf( ch, "Bamfout: %s\r\n", ( ch->pcdata->bamfout[0] != '\0' )
                 ? ch->pcdata->bamfout : "%s leaves in a swirling mist.", ch->name );


      /*
       * Area Loaded info - Scryn 8/11
       */
      if( ch->pcdata->area )
      {
         ch_printf( ch, "Vnums:   Room (%-5.5d - %-5.5d)   Object (%-5.5d - %-5.5d)   Mob (%-5.5d - %-5.5d)\r\n",
                    ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum,
                    ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum,
                    ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum );
         ch_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" );
      }
   }
   if( ch->first_affect )
   {
      int i;
      const char *skname;

      i = 0;
      send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );
      send_to_char( "&zAFFECT DATA&r:\r\n", ch );
      for( paf = ch->first_affect; paf; paf = paf->next )
      {
         skname = paf->from;

         if( paf->modifier == 0 )
            ch_printf( ch, "&r[&W%-63.64s&r;&W%5d &zrds&r]", skname, (int)paf->duration );
         else if( paf->modifier > 999 )
            ch_printf( ch, "&r[&W%-54.55s&r; &W%7.7s&r;&W%5d &zrds&r]",
                       skname, tiny_affect_loc_name( paf->location ), (int)paf->duration );
         else
            ch_printf( ch, "&r[&W%-51.52s&r;&W%+-3.3d %7.7s&r;%5d &zrds&r]",
                       skname, paf->modifier, tiny_affect_loc_name( paf->location ), (int)paf->duration );
         if( i == 0 )
            i = 1;
         if( ( ++i % 1 ) == 0 )
            send_to_char( "\r\n", ch );
      }
   }
   send_to_char( "\r\n&w", ch );
   return;
}
コード例 #17
0
ファイル: note.c プロジェクト: rezalas/riftshadow
void parse_note( CHAR_DATA *ch, char *argument, int type )
{
    BUFFER *buffer;
    char buf[MAX_STRING_LENGTH], query[MSL];
    char arg[MAX_INPUT_LENGTH];
    MYSQL_RES *res;
    MYSQL_ROW row;
    char *list_name;
    int vnum;
    int anum;

    switch(type)
    {
	default:
	    return;
        case NOTE_NOTE:
	    list_name = "notes";
            break;
        case NOTE_IDEA:
	    list_name = "ideas";
            break;
        case NOTE_PENALTY:
	    list_name = "penalties";
            break;
        case NOTE_NEWS:
	    list_name = "news";
            break;
        case NOTE_CHANGES:
	    list_name = "changes";
            break;
    }

    argument = one_argument( argument, arg );
    smash_tilde( argument );

    if ( arg[0] == '\0' || !str_prefix( arg, "read" ) )
    {
        bool fAll;

        if ( !str_cmp( argument, "all" ) )
        {
            fAll = TRUE;
            anum = 0;
        }

        else if ( argument[0] == '\0' || !str_prefix(argument, "next"))
        /* read next unread note */
        {
            vnum = 0;
	    sprintf(query,"SELECT * FROM notes WHERE type=%d ORDER BY timestamp ASC",type);
	    res	= one_query_res(query);
            while((row=mysql_fetch_row(res)))
            {
                if (!hide_note(ch,row))
                {
                    sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r",
                        vnum, row[1], row[4], row[2], row[3]);
                    send_to_char( buf, ch );
                    page_to_char( row[5], ch );
                    update_read(ch,atol(row[6]),atoi(row[0]));
		    mysql_free_result(res);
                    return;
                }
		else if(is_note_to(ch,row[1],row[3]))
		    vnum++;
            }
	    sprintf(buf,"You have no unread %s.\n\r",list_name);
	    send_to_char(buf,ch);
	    mysql_free_result(res);
            return;
        }

        else if ( is_number( argument ) )
        {
            fAll = FALSE;
            anum = atoi( argument );
        }
        else
        {
            send_to_char( "Read which number?\n\r", ch );
            return;
        }

        vnum = 0;
	sprintf(query,"SELECT * FROM notes WHERE type=%d ORDER BY timestamp ASC",type);
	res	= one_query_res(query);
        while((row=mysql_fetch_row(res)))
        {
            if (is_note_to(ch,row[1],row[3]) && (vnum++ == anum))
            {
                sprintf( buf, "[%3d] %s: %s\n\r%s\n\rTo: %s\n\r",
                        anum, row[1], row[4], row[2], row[3]);
                send_to_char( buf, ch );
                page_to_char( row[5], ch );
		update_read(ch,atol(row[6]),atoi(row[0]));
		mysql_free_result(res);
                return;
            }
        }

	sprintf(buf,"There aren't that many %s.\n\r",list_name);
	send_to_char(buf,ch);
	mysql_free_result(res);
        return;
    }

    if ( !str_prefix( arg, "list" ) )
    {
	vnum = 0;
	sprintf(query,"SELECT * FROM notes WHERE type=%d ORDER BY timestamp ASC",type);
	res	= one_query_res(query);

        while((row=mysql_fetch_row(res)))
	{
	    if (is_note_to(ch,row[1],row[3]))
	    {
		sprintf( buf, "[%3d%s] %s: %s\n\r",
		    vnum, hide_note(ch,row) ? " " : "N",
		    row[1], row[4]);
		send_to_char( buf, ch );
		vnum++;
	    }
	}
	if (!vnum)
	{
	    switch(type)
	    {
		case NOTE_NOTE:	
		    send_to_char("There are no notes for you.\n\r",ch);
		    break;
		case NOTE_IDEA:
		    send_to_char("There are no ideas for you.\n\r",ch);
		    break;
		case NOTE_PENALTY:
		    send_to_char("There are no penalties for you.\n\r",ch);
		    break;
		case NOTE_NEWS:
		    send_to_char("There is no news for you.\n\r",ch);
		    break;
		case NOTE_CHANGES:
		    send_to_char("There are no changes for you.\n\r",ch);
		    break;
	    }
	}
	mysql_free_result(res);
	return;
    }

    if ( !str_prefix( arg, "remove" ) )
    {
        if ( !is_number( argument ) )
            return send_to_char( "Note remove which number?\n\r", ch );


        anum = atoi( argument );
        vnum = 0;
	sprintf(query,"SELECT * FROM notes WHERE type=%d ORDER BY timestamp ASC",type);
	res	= one_query_res(query);
        while((row=mysql_fetch_row(res)))
	{
            if (!str_cmp(ch->true_name, row[1]) && vnum++ == anum )
            {
                sprintf(query,"DELETE FROM notes WHERE timestamp=%s AND sender=\"%s\"", row[6], row[1]);
		one_query(query);
                send_to_char( "Ok.\n\r", ch );
		mysql_free_result(res);
                return;
            }
        }

	send_to_char("You must provide the number of a note you have written to remove.\n\r",ch);
	mysql_free_result(res);
        return;
    }

    if ( !str_prefix( arg, "delete" ) && get_trust(ch) >= MAX_LEVEL - 2)
    {
        if ( !is_number( argument ) )
            return send_to_char( "Note delete which number?\n\r", ch );

        anum = atoi( argument );
        vnum = 0;
        sprintf(query,"SELECT * FROM notes WHERE type=%d ORDER BY timestamp ASC",type);
	res	= one_query_res(query);
        while((row=mysql_fetch_row(res)))
	{
            if ( is_note_to( ch,row[1],row[3] ) && vnum++ == anum )
            {
                sprintf(query,"DELETE FROM notes WHERE timestamp=%s AND sender=\"%s\"", row[6], row[1]);
		one_query(query);
		send_to_char("Ok.\n\r",ch);
		mysql_free_result(res);
		return;
            }
        }

 	sprintf(buf,"There aren't that many %s.\n\r",list_name);
	send_to_char(buf,ch);
	mysql_free_result(res);
        return;
    }

    /* below this point only certain people can edit notes */
    if ((type == NOTE_NEWS && !IS_TRUSTED(ch,ANGEL))
    ||  (type == NOTE_CHANGES && !IS_TRUSTED(ch,CREATOR)))
    {
	sprintf(buf,"You aren't high enough level to write %s.",list_name);
	send_to_char(buf,ch);
	return;
    }

    if ( !str_cmp( arg, "+" ) )
    {
	note_attach( ch,type );
	if (ch->pnote->type != type)
	    return send_to_char("You already have a different note in progress.\n\r",ch);

	if (strlen(ch->pnote->text)+strlen(argument) >= 4096)
	    return send_to_char( "Note too long.\n\r", ch );

 	buffer = new_buf();

	add_buf(buffer,ch->pnote->text);
	add_buf(buffer,argument);
	add_buf(buffer,"\n\r");
	free_pstring( ch->pnote->text );
	ch->pnote->text = palloc_string( buf_string(buffer) );
	free_buf(buffer);
	send_to_char( "Ok.\n\r", ch );
	return;
    }

    if (!str_cmp(arg,"-"))
    {
 	int len;
	bool found = FALSE;

	note_attach(ch,type);
        if (ch->pnote->type != type)
            return send_to_char("You already have a different note in progress.\n\r",ch);

	if (ch->pnote->text == NULL || ch->pnote->text[0] == '\0')
	    return send_to_char("No lines left to remove.\n\r",ch);

	strcpy(buf,ch->pnote->text);

	for (len = strlen(buf); len > 0; len--)
 	{
	    if (buf[len] == '\r')
	    {
		if (!found)  /* back it up */
		{
		    if (len > 0)
			len--;
		    found = TRUE;
		}
		else /* found the second one */
		{
		    buf[len + 1] = '\0';
		    free_pstring(ch->pnote->text);
		    ch->pnote->text = palloc_string(buf);
		    return;
		}
	    }
	}
	buf[0] = '\0';
	free_pstring(ch->pnote->text);
	ch->pnote->text = palloc_string(buf);
	return;
    }

    if ( !str_prefix( arg, "subject" ) )
    {
	note_attach( ch,type );
        if (ch->pnote->type != type)
            return send_to_char("You already have a different note in progress.\n\r",ch);

	free_pstring( ch->pnote->subject );
	ch->pnote->subject = palloc_string( argument );
	send_to_char( "Ok.\n\r", ch );
	return;
    }

    if ( !str_prefix( arg, "to" ) )
    {
	note_attach( ch,type );
        if (ch->pnote->type != type)
            return send_to_char("You already have a different note in progress.\n\r",ch);

	if (is_name("all", argument)
	&& !IS_IMMORTAL(ch)
	&& !IS_HEROIMM(ch)
	&& !(ch->pcdata->induct == CABAL_LEADER))
		return	send_to_char("Sorry, you can't do that!\n\r",ch);
	if (is_number(argument) && !IS_IMMORTAL(ch))
		return send_to_char("You can't do that.\n\r",ch);	
	free_pstring( ch->pnote->to_list );
	ch->pnote->to_list = palloc_string( argument );
	send_to_char( "Ok.\n\r", ch );
	return;
	}

    if ( !str_prefix( arg, "clear" ) )
    {
	if ( ch->pnote != NULL )
	{
	    free_note(ch->pnote);
	    ch->pnote = NULL;
	}

	send_to_char( "Ok.\n\r", ch );
	return;
    }

    if ( !str_prefix( arg, "show" ) )
    {
	if ( ch->pnote == NULL )
	    return send_to_char( "You have no note in progress.\n\r", ch );

	if (ch->pnote->type != type)
	    return send_to_char("You aren't working on that kind of note.\n\r",ch);

	sprintf( buf, "%s: %s\n\rTo: %s\n\r",
	    ch->pnote->sender,
	    ch->pnote->subject,
	    ch->pnote->to_list
	    );
	send_to_char( buf, ch );
	send_to_char( ch->pnote->text, ch );
	return;
    }

    if ( !str_prefix( arg, "post" ) || !str_prefix(arg, "send"))
    {
	char *strtime;

	if ( ch->pnote == NULL )
	    return send_to_char( "You have no note in progress.\n\r", ch );

        if (ch->pnote->type != type)
            return send_to_char("You aren't working on that kind of note.\n\r",ch);

	if (!str_cmp(ch->pnote->to_list,""))
	    return send_to_char("You need to provide a recipient (name, all, or immortal).\n\r", ch);

	if (!str_cmp(ch->pnote->subject,""))
	    return send_to_char("You need to provide a subject.\n\r",ch);
	if (is_affected_prof(ch, "note_written") && !IS_IMMORTAL(ch))
	    return send_to_char("You have written a note too recently.\n\r",ch);
	ch->pnote->next			= NULL;
	strtime				= ctime( &current_time );
	strtime[strlen(strtime)-1]	= '\0';
	ch->pnote->date			= palloc_string( strtime );
	ch->pnote->date_stamp		= current_time;

	append_note(ch->pnote);
	ch->pnote = NULL;
	send_to_char("Note sent.\n\r",ch);
	add_prof_affect(ch, "note_written", 4, TRUE);
	return;
    }

    send_to_char( "You can't do that.\n\r", ch );
    return;
}
コード例 #18
0
ファイル: player.c プロジェクト: Igdra/smaugfuss
/*
 * New score command by Haus
 */
void do_score( CHAR_DATA* ch, const char* argument )
{
   char buf[MAX_STRING_LENGTH];
   AFFECT_DATA *paf;
   int iLang;
   /*const char *suf;
   short day;

   day = ch->pcdata->day + 1;

   if( day > 4 && day < 20 )
      suf = "th";
   else if( day % 10 == 1 )
      suf = "st";
   else if( day % 10 == 2 )
      suf = "nd";
   else if( day % 10 == 3 )
      suf = "rd";
   else
      suf = "th";
   * - Uncomment this if you want Birthdays dispayed on score for players - Kayle 1/22/08
   */

   set_pager_color( AT_SCORE, ch );

   pager_printf( ch, "\r\nScore for %s%s.\r\n", ch->name, IS_NPC(ch) ? "" : ch->pcdata->title );
   if( get_trust( ch ) != ch->level )
      pager_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) );

   send_to_pager( "----------------------------------------------------------------------------\r\n", ch );

   /*if( time_info.day == ch->pcdata->day && time_info.month == ch->pcdata->month )
      send_to_char( "Today is your birthday!\r\n", ch );
   else
      ch_printf( ch, "Your birthday is: Day of %s, %d%s day in the Month of %s, in the year %d.\r\n",
                 day_name[ch->pcdata->day % sysdata.daysperweek], day, suf, month_name[ch->pcdata->month], ch->pcdata->year );
   send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
   * - Uncomment this if you want players to see their birthday's on score. - Kayle 1/22/08
   */

   pager_printf( ch, "LEVEL: %-3d         Race : %-10.10s        Played: %ld hours\r\n",
                 ch->level, capitalize( get_race( ch ) ), ( long int )GET_TIME_PLAYED( ch ) );

   pager_printf( ch, "YEARS: %-6d      Class: %-11.11s       Log In: %s\r",
                 calculate_age( ch ), capitalize( get_class( ch ) ), ctime( &( ch->logon ) ) );

   if( ch->level >= 15 || IS_PKILL( ch ) )
   {
      pager_printf( ch, "STR  : %2.2d(%2.2d)    HitRoll: %-4d              Saved:  %s\r",
                    get_curr_str( ch ), ch->perm_str, GET_HITROLL( ch ),
                    ch->save_time ? ctime( &( ch->save_time ) ) : "no save this session\n" );

      pager_printf( ch, "INT  : %2.2d(%2.2d)    DamRoll: %-4d              Time:   %s\r",
                    get_curr_int( ch ), ch->perm_int, GET_DAMROLL( ch ), ctime( &current_time ) );
   }
   else
   {
      pager_printf( ch, "STR  : %2.2d(%2.2d)                               Saved:  %s\r",
                    get_curr_str( ch ), ch->perm_str, ch->save_time ? ctime( &( ch->save_time ) ) : "no\n" );

      pager_printf( ch, "INT  : %2.2d(%2.2d)                               Time:   %s\r",
                    get_curr_int( ch ), ch->perm_int, ctime( &current_time ) );
   }

   if( GET_AC( ch ) >= 101 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the rags of a beggar" );
   else if( GET_AC( ch ) >= 80 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "improper for adventure" );
   else if( GET_AC( ch ) >= 55 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "shabby and threadbare" );
   else if( GET_AC( ch ) >= 40 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "of poor quality" );
   else if( GET_AC( ch ) >= 20 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "scant protection" );
   else if( GET_AC( ch ) >= 10 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "that of a knave" );
   else if( GET_AC( ch ) >= 0 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "moderately crafted" );
   else if( GET_AC( ch ) >= -10 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "well crafted" );
   else if( GET_AC( ch ) >= -20 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of squires" );
   else if( GET_AC( ch ) >= -40 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "excellently crafted" );
   else if( GET_AC( ch ) >= -60 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of knights" );
   else if( GET_AC( ch ) >= -80 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of barons" );
   else if( GET_AC( ch ) >= -100 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of dukes" );
   else if( GET_AC( ch ) >= -200 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of emperors" );
   else
      snprintf( buf, MAX_STRING_LENGTH, "%s", "that of an avatar" );
   if( ch->level > 24 )
      pager_printf( ch, "WIS  : %2.2d(%2.2d)      Armor: %4.4d, %s\r\n",
                    get_curr_wis( ch ), ch->perm_wis, GET_AC( ch ), buf );
   else
      pager_printf( ch, "WIS  : %2.2d(%2.2d)      Armor: %s \r\n", get_curr_wis( ch ), ch->perm_wis, buf );

   if( ch->alignment > 900 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "devout" );
   else if( ch->alignment > 700 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "noble" );
   else if( ch->alignment > 350 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "honorable" );
   else if( ch->alignment > 100 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "worthy" );
   else if( ch->alignment > -100 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "neutral" );
   else if( ch->alignment > -350 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "base" );
   else if( ch->alignment > -700 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "evil" );
   else if( ch->alignment > -900 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "ignoble" );
   else
      snprintf( buf, MAX_STRING_LENGTH, "%s", "fiendish" );
   if( ch->level < 10 )
      pager_printf( ch, "DEX  : %2.2d(%2.2d)      Align: %-20.20s    Items: %5.5d   (max %5.5d)\r\n",
                    get_curr_dex( ch ), ch->perm_dex, buf, ch->carry_number, can_carry_n( ch ) );
   else
      pager_printf( ch, "DEX  : %2.2d(%2.2d)      Align: %+4.4d, %-14.14s   Items: %5.5d   (max %5.5d)\r\n",
                    get_curr_dex( ch ), ch->perm_dex, ch->alignment, buf, ch->carry_number, can_carry_n( ch ) );

   switch ( ch->position )
   {
      case POS_DEAD:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "slowly decomposing" );
         break;
      case POS_MORTAL:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "mortally wounded" );
         break;
      case POS_INCAP:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "incapacitated" );
         break;
      case POS_STUNNED:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "stunned" );
         break;
      case POS_SLEEPING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "sleeping" );
         break;
      case POS_RESTING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "resting" );
         break;
      case POS_STANDING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "standing" );
         break;
      case POS_FIGHTING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting" );
         break;
      case POS_EVASIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (evasive)" );   /* Fighting style support -haus */
         break;
      case POS_DEFENSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (defensive)" );
         break;
      case POS_AGGRESSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (aggressive)" );
         break;
      case POS_BERSERK:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (berserk)" );
         break;
      case POS_MOUNTED:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "mounted" );
         break;
      case POS_SITTING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "sitting" );
         break;
   }
   pager_printf( ch, "CON  : %2.2d(%2.2d)      Pos'n: %-21.21s  Weight: %5.5d (max %7.7d)\r\n",
                 get_curr_con( ch ), ch->perm_con, buf, ch->carry_weight, can_carry_w( ch ) );


   /*
    * Fighting style support -haus
    */
   pager_printf( ch, "CHA  : %2.2d(%2.2d)      Wimpy: %-5d      ", get_curr_cha( ch ), ch->perm_cha, ch->wimpy );

   switch ( ch->style )
   {
      case STYLE_EVASIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "evasive" );
         break;
      case STYLE_DEFENSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "defensive" );
         break;
      case STYLE_AGGRESSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "aggressive" );
         break;
      case STYLE_BERSERK:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "berserk" );
         break;
      default:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "standard" );
         break;
   }
   pager_printf( ch, "Style: %-10.10s\r\n", buf );

   pager_printf( ch, "LCK  : %2.2d(%2.2d) \r\n", get_curr_lck( ch ), ch->perm_lck );

   pager_printf( ch, "Glory: %4.4d(%4.4d) \r\n", ch->pcdata->quest_curr, ch->pcdata->quest_accum );

   pager_printf( ch, "PRACT: %3.3d         Hitpoints: %-5d of %5d   Pager: (%c) %3d    AutoExit(%c)\r\n",
                 ch->practice, ch->hit, ch->max_hit,
                 IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ',
                 ch->pcdata->pagerlen, xIS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ' );

   if( IS_VAMPIRE( ch ) )
      pager_printf( ch, "XP   : %-9d       Blood: %-5d of %5d   MKills:  %-5.5d    AutoLoot(%c)\r\n",
                    ch->exp, ch->pcdata->condition[COND_BLOODTHIRST], 10 + ch->level, ch->pcdata->mkills,
                    xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' );
   else if( ch->Class == CLASS_WARRIOR )
      pager_printf( ch, "XP   : %-9d                               MKills:  %-5.5d    AutoLoot(%c)\r\n",
                    ch->exp, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' );
   else
      pager_printf( ch, "XP   : %-9d        Mana: %-5d of %5d   MKills:  %-5.5d    AutoLoot(%c)\r\n",
                    ch->exp, ch->mana, ch->max_mana, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' );

   pager_printf( ch, "GOLD : %-13s    Move: %-5d of %5d   Mdeaths: %-5.5d    AutoSac (%c)\r\n",
                 num_punct( ch->gold ), ch->move, ch->max_move, ch->pcdata->mdeaths, xIS_SET( ch->act,
                                                                                              PLR_AUTOSAC ) ? 'X' : ' ' );

   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_DRUNK] > 10 )
      send_to_pager( "You are drunk.\r\n", ch );
   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_THIRST] == 0 )
      send_to_pager( "You are in danger of dehydrating.\r\n", ch );
   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_FULL] == 0 )
      send_to_pager( "You are starving to death.\r\n", ch );
   if( ch->position != POS_SLEEPING )
      switch ( ch->mental_state / 10 )
      {
         default:
            send_to_pager( "You're completely messed up!\r\n", ch );
            break;
         case -10:
            send_to_pager( "You're barely conscious.\r\n", ch );
            break;
         case -9:
            send_to_pager( "You can barely keep your eyes open.\r\n", ch );
            break;
         case -8:
            send_to_pager( "You're extremely drowsy.\r\n", ch );
            break;
         case -7:
            send_to_pager( "You feel very unmotivated.\r\n", ch );
            break;
         case -6:
            send_to_pager( "You feel sedated.\r\n", ch );
            break;
         case -5:
            send_to_pager( "You feel sleepy.\r\n", ch );
            break;
         case -4:
            send_to_pager( "You feel tired.\r\n", ch );
            break;
         case -3:
            send_to_pager( "You could use a rest.\r\n", ch );
            break;
         case -2:
            send_to_pager( "You feel a little under the weather.\r\n", ch );
            break;
         case -1:
            send_to_pager( "You feel fine.\r\n", ch );
            break;
         case 0:
            send_to_pager( "You feel great.\r\n", ch );
            break;
         case 1:
            send_to_pager( "You feel energetic.\r\n", ch );
            break;
         case 2:
            send_to_pager( "Your mind is racing.\r\n", ch );
            break;
         case 3:
            send_to_pager( "You can't think straight.\r\n", ch );
            break;
         case 4:
            send_to_pager( "Your mind is going 100 miles an hour.\r\n", ch );
            break;
         case 5:
            send_to_pager( "You're high as a kite.\r\n", ch );
            break;
         case 6:
            send_to_pager( "Your mind and body are slipping apart.\r\n", ch );
            break;
         case 7:
            send_to_pager( "Reality is slipping away.\r\n", ch );
            break;
         case 8:
            send_to_pager( "You have no idea what is real, and what is not.\r\n", ch );
            break;
         case 9:
            send_to_pager( "You feel immortal.\r\n", ch );
            break;
         case 10:
            send_to_pager( "You are a Supreme Entity.\r\n", ch );
            break;
      }
   else if( ch->mental_state > 45 )
      send_to_pager( "Your sleep is filled with strange and vivid dreams.\r\n", ch );
   else if( ch->mental_state > 25 )
      send_to_pager( "Your sleep is uneasy.\r\n", ch );
   else if( ch->mental_state < -35 )
      send_to_pager( "You are deep in a much needed sleep.\r\n", ch );
   else if( ch->mental_state < -25 )
      send_to_pager( "You are in deep slumber.\r\n", ch );
   send_to_pager( "Languages: ", ch );
   for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ )
      if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) )
      {
         if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) )
            set_pager_color( AT_RED, ch );
         send_to_pager( lang_names[iLang], ch );
         send_to_pager( " ", ch );
         set_pager_color( AT_SCORE, ch );
      }
   send_to_pager( "\r\n", ch );

   if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' )
      pager_printf( ch, "You are bestowed with the command(s): %s.\r\n", ch->pcdata->bestowments );

   if( ch->morph && ch->morph->morph )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      if( IS_IMMORTAL( ch ) )
         pager_printf( ch, "Morphed as (%d) %s with a timer of %d.\r\n",
                       ch->morph->morph->vnum, ch->morph->morph->short_desc, ch->morph->timer );
      else
         pager_printf( ch, "You are morphed into a %s.\r\n", ch->morph->morph->short_desc );
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
   }
   if( CAN_PKILL( ch ) )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "PKILL DATA:  Pkills (%3.3d)     Illegal Pkills (%3.3d)     Pdeaths (%3.3d)\r\n",
                    ch->pcdata->pkills, ch->pcdata->illegal_pk, ch->pcdata->pdeaths );
   }
   if( ch->pcdata->clan && ch->pcdata->clan->clan_type != CLAN_ORDER && ch->pcdata->clan->clan_type != CLAN_GUILD )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "CLAN STATS:  %-14.14s  Clan AvPkills : %-5d  Clan NonAvpkills : %-5d\r\n",
                    ch->pcdata->clan->name, ch->pcdata->clan->pkills[6],
                    ( ch->pcdata->clan->pkills[1] + ch->pcdata->clan->pkills[2] +
                      ch->pcdata->clan->pkills[3] + ch->pcdata->clan->pkills[4] + ch->pcdata->clan->pkills[5] ) );
      pager_printf( ch, "                             Clan AvPdeaths: %-5d  Clan NonAvpdeaths: %-5d\r\n",
                    ch->pcdata->clan->pdeaths[6],
                    ( ch->pcdata->clan->pdeaths[1] + ch->pcdata->clan->pdeaths[2] +
                      ch->pcdata->clan->pdeaths[3] + ch->pcdata->clan->pdeaths[4] + ch->pcdata->clan->pdeaths[5] ) );
   }
   if( ch->pcdata->deity )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      if( ch->pcdata->favor > 2250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "loved" );
      else if( ch->pcdata->favor > 2000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "cherished" );
      else if( ch->pcdata->favor > 1750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "honored" );
      else if( ch->pcdata->favor > 1500 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "praised" );
      else if( ch->pcdata->favor > 1250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "favored" );
      else if( ch->pcdata->favor > 1000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "respected" );
      else if( ch->pcdata->favor > 750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "liked" );
      else if( ch->pcdata->favor > 250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "tolerated" );
      else if( ch->pcdata->favor > -250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "ignored" );
      else if( ch->pcdata->favor > -750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "shunned" );
      else if( ch->pcdata->favor > -1000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "disliked" );
      else if( ch->pcdata->favor > -1250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "dishonored" );
      else if( ch->pcdata->favor > -1500 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "disowned" );
      else if( ch->pcdata->favor > -1750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "abandoned" );
      else if( ch->pcdata->favor > -2000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "despised" );
      else if( ch->pcdata->favor > -2250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "hated" );
      else
         snprintf( buf, MAX_STRING_LENGTH, "%s", "damned" );
      pager_printf( ch, "Deity:  %-20s  Favor: %s\r\n", ch->pcdata->deity->name, buf );
   }
   if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_ORDER )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "Order:  %-20s  Order Mkills:  %-6d   Order MDeaths:  %-6d\r\n",
                    ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths );
   }
   if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_GUILD )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "Guild:  %-20s  Guild Mkills:  %-6d   Guild MDeaths:  %-6d\r\n",
                    ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths );
   }
   if( IS_IMMORTAL( ch ) )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );

      pager_printf( ch, "IMMORTAL DATA:  Wizinvis [%s]  Wizlevel (%d)\r\n",
                    xIS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis );

      pager_printf( ch, "Bamfin:  %s %s\r\n", ch->name, ( ch->pcdata->bamfin[0] != '\0' )
                    ? ch->pcdata->bamfin : "appears in a swirling mist." );
      pager_printf( ch, "Bamfout: %s %s\r\n", ch->name, ( ch->pcdata->bamfout[0] != '\0' )
                    ? ch->pcdata->bamfout : "leaves in a swirling mist." );


      /*
       * Area Loaded info - Scryn 8/11
       */
      if( ch->pcdata->area )
      {
         pager_printf( ch, "Vnums:   Room (%-5.5d - %-5.5d)   Object (%-5.5d - %-5.5d)   Mob (%-5.5d - %-5.5d)\r\n",
                       ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum,
                       ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum,
                       ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum );
         pager_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" );
      }
   }
   if( ch->first_affect )
   {
      int i;
      SKILLTYPE *sktmp;

      i = 0;
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      send_to_pager( "AFFECT DATA:                            ", ch );
      for( paf = ch->first_affect; paf; paf = paf->next )
      {
         if( ( sktmp = get_skilltype( paf->type ) ) == NULL )
            continue;
         if( ch->level < 20 )
         {
            pager_printf( ch, "[%-34.34s]    ", sktmp->name );
            if( i == 0 )
               i = 2;
            if( ( ++i % 3 ) == 0 )
               send_to_pager( "\r\n", ch );
         }
         if( ch->level >= 20 )
         {
            if( paf->modifier == 0 )
               pager_printf( ch, "[%-24.24s;%5d rds]    ", sktmp->name, paf->duration );
            else if( paf->modifier > 999 )
               pager_printf( ch, "[%-15.15s; %7.7s;%5d rds]    ",
                             sktmp->name, tiny_affect_loc_name( paf->location ), paf->duration );
            else
               pager_printf( ch, "[%-11.11s;%+-3.3d %7.7s;%5d rds]    ",
                             sktmp->name, paf->modifier, tiny_affect_loc_name( paf->location ), paf->duration );
            if( i == 0 )
               i = 1;
            if( ( ++i % 2 ) == 0 )
               send_to_pager( "\r\n", ch );
         }
      }
   }
   send_to_pager( "\r\n", ch );
   return;
}
コード例 #19
0
ファイル: wizard.c プロジェクト: pfchrono/Anotherland_Mud
void do_wrath( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char arg1[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    int dam;
    argument = one_argument( argument, arg1 );

    if (!IS_CLASS(ch, CLASS_WIZARD))
    {
        send_to_char("Huh?\n\r",ch);
        return;
    }

    if ( arg1[0] == '\0')
    {
        send_to_char( "#CRelease the Wrath of the Damned on who?\n\r", ch );
        return;
    }

    if ((victim = get_char_room(ch, arg1)) == NULL)
    {
        stc("#CThey aren't here.\n\r", ch);
        return;
    }

    if (ch->pcdata->stats[WL_SPELLS] < 9)
    {
        stc("#CYou do not yet have mastery of this spell.\n\r",ch);
        return;
    }

    if ((victim = get_char_world(ch, arg1)) == NULL)
    {
        sprintf(buf, "#7%s#C is not here.\n\r",arg1);
        stc( buf, ch);
        return;
    }

    if (victim->level < LEVEL_AVATAR)
    {
        stc("#CNot on mortals.\n\r",ch);
        return;
    }

    if(IS_IMMORTAL(victim))
    {
        send_to_char("Not on immortals.\n\r", ch);
        stcf(victim,"%s tried to wrath you!\n\r",ch->name);
        return;
    }

    if (ch->mana < 5000)
    {
        stc("#CYou do not have the 5000 required mana.\n\r",ch);
        return;
    }

    if ((victim = get_char_room(ch, arg1)) == NULL)
    {
        send_to_char("They are not here.\n\r", ch);
        return;
    }

    if (IS_BODY(victim, BROKEN_SPINE))
    {
        sprintf(buf, "#7%s#C already has a broken spine.\n\r",victim->name);
        stc( buf, ch);
        return;
    }

    act("#CYou close your eyes and chant dark words, calling forth the damned to release their wrath upon #7$N#C.", ch, NULL, victim, TO_CHAR);
    act("#7$n#C chants dark words, calling forth the damned to release their wrath upon #7$N#C.", ch, NULL, victim, TO_NOTVICT);
    act("#7$n#C chants dark words, calling forth the damned to release their wrath upon you.#n", ch, NULL, victim, TO_VICT);
    SET_BIT(victim->loc_hp[1],BROKEN_SPINE);
    act("#7$N#C screams in agony as $S spine is snapped with a gruesome #C*#yPOP#C*#n.", ch, NULL, victim, TO_NOTVICT);
    act("#7$N#C screams in agony as $S spine is snapped with a gruesome #C*#yPOP#C*#n", ch, NULL, victim, TO_CHAR);
    stc("#CYou scream in agony as your spine is snapped with a gruesome #C*#yPOP#C*#n", victim);
    dam = (victim->hit) / 45;
    if (ch->pcdata->powers[WL_SKILLS] > 3) dam *= 2;
    hurt_person(ch, victim, dam);
    ch->mana -= 5000;

    if(!IS_NPC(victim))
    {
        ch->fight_timer += 5;
    }
    WAIT_STATE(ch, PULSE_VIOLENCE);

    return;
}
コード例 #20
0
ファイル: quests.c プロジェクト: jpavonabian/6Dragones
void do_setquest( CHAR_DATA *ch, char *argument )
{
    char                    arg1[MIL],
                            arg2[MIL],
                            arg3[MIL],
                            arg4[MIL];
    QUEST_DATA             *quest;
    int                     x;

    set_char_color( AT_PLAIN, ch );

    if ( IS_NPC( ch ) ) {
        error( ch );
        return;
    }

    if ( !IS_IMMORTAL( ch ) ) {
        error( ch );
        return;
    }

    if ( !ch->desc ) {
        bug( "%s", "do_setquest (desc): no descriptor" );
        return;
    }

    switch ( ch->substate ) {
        default:
            break;

        case SUB_QUEST_DESC:
            if ( !ch->dest_buf || !( quest = ( QUEST_DATA * ) ch->dest_buf ) ) {
                bug( "%s: sub_quest_desc: NULL ch->dest_buf", __FUNCTION__ );
                ch->substate = SUB_NONE;
                return;
            }
            ch->dest_buf = NULL;
            if ( VLD_STR( quest->desc ) )
                STRFREE( quest->desc );
            quest->desc = copy_buffer( ch );
            stop_editing( ch );
            write_quest_list(  );
            ch->substate = SUB_NONE;
            return;
    }

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( arg1[0] == '\0' ) {
        send_to_char( "&cUsage: setquest save all\r\n", ch );
        send_to_char( "       setquest <&Cqname&c> create\r\n", ch );
        send_to_char( "       setquest <&Cqname&c> delete\r\n", ch );
        send_to_char( "       setquest <&Cqname&c> chapter <#> delete\r\n", ch );
        send_to_char( "       setquest <&Cqname&c> desc\r\n", ch );
        send_to_char( "       setquest <&Cqname&c> <&Cfield&c>\r\n", ch );
        send_to_char( "       setquest <&Cquest&c> remove <&Cplayer&c>\r\n", ch );
        send_to_char( "       showquest <&Cqname&c>\r\n", ch );
        send_to_char( "  Field being one of:\r\n", ch );
        send_to_char( "level svnum stype chapters chapter timelimit skipchapters glory\r\n", ch );
        send_to_char( "\r\nchapter <n> <field2>\r\n", ch );
        send_to_char( "  Field2 being one of:\r\n", ch );
        send_to_char( "create delete svnum stype\r\n", ch );
        send_to_char( "name timelimit level kamount\r\n", ch );
        send_to_char( "Note: 3600 = 1 hour timelimit\r\n", ch );
        return;
    }

    if ( ( !str_cmp( arg1, "tutorial" ) && ch->level < 108 )
         || ( !str_cmp( arg1, "etutorial" ) && ch->level < 108 ) || ( !str_cmp( arg1, "dtutorial" )
                                                                      && ch->level < 108 ) ) {
        send_to_char( "You need Vladaar's permission to change anything with tutorials.\r\n", ch );
        return;
    }

    if ( !str_cmp( arg1, "save" ) ) {
        if ( !str_cmp( arg2, "all" ) ) {
            write_quest_list(  );
            send_to_char( "All quests saved.\r\n", ch );
            return;
        }
    }

    quest = get_quest_from_name( arg1 );

    if ( !str_cmp( arg2, "create" ) ) {
        if ( quest && VLD_STR( quest->name ) && !str_cmp( quest->name, arg1 ) ) {
            ch_printf( ch, "(%s): quest already exists!\r\n", quest->name );
            return;
        }

        CREATE( quest, QUEST_DATA, 1 );
        quest->name = STRALLOC( arg1 );
        quest->number = -1;
        add_new_quest( ch, quest );
        write_quest_list(  );
        return;
    }

    if ( !quest ) {
        send_to_char( "No quest by that name.\r\n", ch );
        return;
    }

    if ( !str_cmp( arg2, "desc" ) ) {
        if ( !ch->desc ) {
            bug( "%s", "do_setquest (desc): no descriptor" );
            return;
        }

        ch->substate = SUB_QUEST_DESC;
        ch->dest_buf = quest;
        start_editing( ch, quest->desc );
        return;
    }

    if ( !str_cmp( arg2, "delete" ) ) {
        free_quest( quest );
        send_to_char( "Deleted.\r\n", ch );
        return;
    }

    if ( !str_cmp( arg2, "skipchapters" ) ) {
        quest->skipchapters = !quest->skipchapters;
        ch_printf( ch, "That quest will %s allow chapters to be skipped.\r\n",
                   quest->skipchapters ? "now" : "no longer" );
        return;
    }

    if ( !str_cmp( arg2, "chapters" ) ) {
        x = atoi( argument );
        if ( x < 0 || x > 30 ) {
            send_to_char( "Chapters must be between 0 and 30.\r\n", ch );
            return;
        }
        quest->chapters = x;
        send_to_char( "Done.\r\n", ch );
        return;
    }

    if ( !str_cmp( arg2, "svnum" ) ) {
        quest->svnum = atoi( argument );
        ch_printf( ch, "That quest's svnum (starting vnum) is set to %d.\r\n", quest->svnum );
        return;
    }

    if ( !str_cmp( arg2, "stype" ) ) {
        x = atoi( argument );
        if ( x < 0 || x > 2 ) {
            send_to_char
                ( "Can only set stype (starting type) to 0 for Mobiles, 1 for Objects, 2 for Rooms.\r\n",
                  ch );
            return;
        }
        quest->stype = x;
        ch_printf( ch, "That quest's stype (starting type) is set to %d[%s].\r\n", quest->stype,
                   ( quest->stype == 0 ) ? "Mobile" : ( quest->stype ==
                                                        1 ) ? "Object" : ( quest->stype ==
                                                                           2 ) ? "Room" :
                   "Unknown" );
        return;
    }

    if ( !str_cmp( arg2, "glory" ) ) {
        x = atoi( argument );
        if ( x < 0 || x > 1 ) {
            send_to_char( "Can only set 0 for no glory, or 1 for glory.\r\n", ch );
            return;
        }
        quest->glory = x;
        return;
    }

    if ( !str_cmp( arg2, "chapter" ) ) {
        CHAP_DATA              *chap = NULL;

        argument = one_argument( argument, arg3 );
        argument = one_argument( argument, arg4 );

        int                     chapno = atoi( arg3 );

        if ( chapno < 1 || chapno > MAX_CHAPTERS ) {
            ch_printf( ch, "Chapter range is 1 to %d.\r\n", MAX_CHAPTERS );
            return;
        }

        if ( !str_cmp( arg4, "create" ) ) {
            if ( get_chap_from_quest( chapno, quest ) ) {
                send_to_char( "That chapter already exists!\r\n", ch );
                return;
            }

            if ( !get_chap_from_quest( ( chapno - 1 ), quest ) && chapno > 1 ) {
                ch_printf( ch, "How can you create chapter %d before chapter %d even exists?\r\n",
                           chapno, chapno - 1 );
                return;
            }
            if ( chapno > quest->chapters ) {
                ch_printf( ch, "How can you create chapter %d when there are only %d chapters?\r\n",
                           chapno, quest->chapters );
                send_to_char( "Set more - 'setquest (questname) chapters (number)'.\r\n", ch );
                return;
            }
            CREATE( chap, CHAP_DATA, 1 );
            chap->number = chapno;
            add_chapter( quest, chap );
            send_to_char( "New chapter added.\r\n", ch );
            write_quest_list(  );
            return;
        }

        chap = get_chap_from_quest( chapno, quest );

        if ( !chap ) {
            send_to_char( "No such chapter.\r\n", ch );
            return;
        }

        if ( !str_cmp( arg4, "delete" ) ) {
            free_chapter( quest, chap );
            send_to_char( "Chapter Deleted.\r\n", ch );
            return;
        }

        if ( !str_cmp( arg4, "name" ) ) {
            if ( VLD_STR( chap->desc ) )
                STRFREE( chap->desc );
            if ( VLD_STR( argument ) ) {
                if ( strlen( argument ) > 50 )
                    argument[50] = '\0';
                chap->desc = STRALLOC( argument );
            }
            write_quest_list(  );
            send_to_char( "Done.\r\n", ch );
            return;
        }

        if ( !str_cmp( arg4, "timelimit" ) ) {
            x = atoi( argument );

            if ( x < 0 || x > 3600 ) {
                send_to_char( "Time limit is between 0 and 3600 (one hour).\r\n", ch );
                return;
            }

            chap->timelimit = x;
            send_to_char( "Done.\r\n", ch );
            return;
        }

        if ( !str_cmp( arg4, "kamount" ) ) {
            int                     kamount = atoi( argument );

            if ( kamount < 0 ) {
                send_to_char( "You have to set kamount to 0 or higher.\r\n", ch );
                return;
            }
            chap->kamount = kamount;
            send_to_char( "Done.\r\n", ch );
            return;
        }

        if ( !str_cmp( arg4, "level" ) ) {
            int                     level = atoi( argument );

            if ( level < 0 || level > MAX_LEVEL ) {
                ch_printf( ch, "Level range is between 0 and %d.\r\n", MAX_LEVEL );
                return;
            }

            chap->level = level;
            send_to_char( "Done.\r\n", ch );
            return;
        }
        do_setquest( ch, ( char * ) "" );
        return;
    }

    if ( !str_cmp( arg2, "level" ) ) {
        x = atoi( argument );
        if ( x < 1 || x > MAX_LEVEL ) {
            send_to_char( "Quest level must be between 1 and max.\r\n", ch );
            return;
        }
        quest->level = x;
        send_to_char( "Done.\r\n", ch );
        return;
    }

    if ( !str_cmp( arg2, "timelimit" ) ) {
        x = atoi( argument );
        if ( x < 0 || x > 3600 ) {
            send_to_char
                ( "Quest time limit must be between 0 (no timer) and 3600 seconds (1 hour).\r\n",
                  ch );
            return;
        }
        quest->timelimit = x;
        send_to_char( "Done.\r\n", ch );
        return;
    }

    if ( !str_cmp( arg2, "remove" ) ) {
        CHAR_DATA              *victim;
        CHQUEST_DATA           *chquest;

        if ( ( victim = get_char_world( ch, argument ) ) != NULL && !IS_NPC( victim ) ) {
            x = get_number_from_quest( quest );
            for ( chquest = victim->pcdata->first_quest; chquest; chquest = chquest->next ) {
                if ( chquest->questnum != quest->number )
                    continue;
                UNLINK( chquest, victim->pcdata->first_quest, victim->pcdata->last_quest, next,
                        prev );
                DISPOSE( chquest );
                ch_printf( ch, "You remove quest %s from %s.\r\n", quest->name, victim->name );
                ch_printf( victim, "Quest %s has been removed from your journal.\r\n",
                           quest->name );
                return;
            }
            send_to_char( "That player isn't currently on that quest.\r\n", ch );
            return;
        }
        else
            send_to_char( "That player isn't currently online.\r\n", ch );
        return;
    }

    do_setquest( ch, ( char * ) "" );
    return;
}
コード例 #21
0
ファイル: hunter.c プロジェクト: ccubed/SWFoteCustom
void do_plantbug( CHAR_DATA * ch, char *argument )
{
   CHAR_DATA *victim;
   BUG_DATA *pbug;
   BUG_DATA *cbug;
   OBJ_DATA *obj;
   bool checkbug = FALSE;
   int schance;

   if( IS_NPC( ch ) )
      return;

   if( ( victim = get_char_room( ch, argument ) ) == NULL )
   {
      send_to_char( "They aren't here.\n\r", ch );
      return;
   }

   if( IS_NPC( victim ) )
   {
      send_to_char( "You can't bug NPC's!\n\r", ch );
      return;
   }

   if( IS_IMMORTAL( victim ) )
   {
      send_to_char( "Don't try to plant bugs on immortals.\n\r", ch );
      return;
   }

   if( in_arena( ch ) )
   {
      send_to_char( "You're here to FIGHT, not spy.\n\r", ch );
      return;
   }

   if( ch == victim )
   {
      send_to_char( "You can't bug yourself!\n\r", ch );
      return;
   }

   for( obj = ch->last_carrying; obj; obj = obj->prev_content )
      if( obj->item_type == ITEM_BUG )
         checkbug = TRUE;

   if( checkbug == FALSE )
   {
      send_to_char( "You don't have any bugs to plant.\n\r", ch );
      return;
   }

   for( cbug = victim->first_bug; cbug; cbug = cbug->next_in_bug )
      if( !str_cmp( ch->name, cbug->name ) )
      {
         send_to_char( "You have already planted a bug on this person.\n\r", ch );
         return;
      }

   schance = number_percent(  ) - UMIN( 0, ( get_curr_lck( ch ) - 14 ) ) + UMIN( 0, ( get_curr_lck( victim ) - 13 ) );

   if( schance < ch->pcdata->learned[gsn_plantbug] )
   {
      act( AT_WHITE, "You carefully reach into $N's pocket and place a bug.", ch, NULL, victim, TO_CHAR );
      CREATE( pbug, BUG_DATA, 1 );
      pbug->name = ch->name;
      LINK( pbug, victim->first_bug, victim->last_bug, next_in_bug, prev_in_bug );
      learn_from_success( ch, gsn_plantbug );

      for( obj = ch->last_carrying; obj; obj = obj->prev_content )
      {
         if( obj->item_type == ITEM_BUG )
         {
            separate_obj( obj );
            obj_from_char( obj );
            extract_obj( obj );
            break;
         }
      }
      return;
   }
   else
   {
      send_to_char( "&RYou try to find a pocket to plant the bug in but fail!\n\r", ch );
      learn_from_failure( ch, gsn_plantbug );
      if( number_bits( 0 ) == 0 )
         ch_printf( victim, "You feel a slight brush against your pocket to find %s's hand there.\n\r", PERS( ch, victim ) );
      return;
   }
}
コード例 #22
0
ファイル: quests.c プロジェクト: jpavonabian/6Dragones
void do_journal( CHAR_DATA *ch, char *argument )
{
    QUEST_DATA             *quest;
    CHQUEST_DATA           *chquest;
    CHAP_DATA              *chap;
    char                    arg1[MIL],
                            arg2[MIL];
    char                   *chapdesc;
    int                     x = 0,
        total = 0,
        cando = 0,
        done = 0,
        num = 0,
        progress = 0,
        avail = 0;
    bool                    found = FALSE,
        completed = FALSE;

    set_char_color( AT_PLAIN, ch );

    if ( IS_NPC( ch ) ) {
        error( ch );
        return;
    }

    argument = one_argument( argument, arg1 );

    if ( VLD_STR( arg1 ) && !str_cmp( arg1, "completados" ) ) {
        completed = TRUE;
        argument = one_argument( argument, arg1 );
    }

    argument = one_argument( argument, arg2 );

    if ( !arg1 || arg1[0] == '\0' ) {
        char                    questtime[MSL] = "";
        char                    chaptime[MSL] = "";
        char                    minsecs[MSL] = "";
        int                     time = 0,
            mins = 0,
            secs = 0;

        ch_printf( ch, "\r\n&YQUESTS De  %s&D\r\n\r\n", ch->name );
        send_to_char( "&cNIV           Quest      Capítulo      Progreso&D\r\n", ch );

        for ( quest = first_quest; quest; quest = quest->next ) {
            num = quest->number;
            total++;
            if ( ch->level < quest->level )
                continue;
            cando++;

            for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) {
                if ( chquest->questnum == quest->number ) {
                    progress = chquest->progress;
                    break;
                }
            }
            if ( !progress || !chquest )
                continue;

            chap = get_chap_from_quest( progress, quest );

            if ( !completed ) {
                if ( progress > quest->chapters ) {
                    done++;
                    continue;
                }

                if ( !chap )
                    continue;

                if ( chap && chap->desc )
                    chapdesc = chap->desc;
                else
                    chapdesc = ( char * ) "NULL: No desc for this chapter.";
            }
            else {                                     /* Only show completed quest */

                if ( progress > quest->chapters ) {
                    chapdesc = ( char * ) "¡quest completado!";
                    done++;
                }
                else
                    continue;
            }

            avail++;

            if ( ch->level == quest->level )
                send_to_char( "&Y", ch );
            else if ( quest->level >= ( ch->level - 3 ) )
                send_to_char( "&G", ch );
            else
                send_to_char( "&z", ch );
            ch_printf( ch, "%3d %20s %7d %s", quest->level, capitalize( quest->name ), progress,
                       chapdesc );
            if ( chquest->kamount > 0 )
                ch_printf( ch, "&R(%d)&D", chquest->kamount );
            send_to_char( "\r\n", ch );
            if ( chquest->chaplimit > 0 )
                ch_printf( ch, "Te queda %s para completar el capítulo.\r\n",
                           show_timeleft( chquest->chaplimit ) );
            if ( chquest->questlimit > 0 )
                ch_printf( ch, "Te queda %s para finalizar el quest.\r\n",
                           show_timeleft( chquest->questlimit ) );
        }

        if ( avail == 0 && done == 0 )
            send_to_char( "&B¡No has terminado ningún quest! ¡Ve a explorar!&D", ch );

        send_to_char( "\r\n\r\n", ch );

        if ( IS_IMMORTAL( ch ) )
            ch_printf( ch, "&cquest disponibles:  &C%d\r\n", total );
        ch_printf( ch, "&cQuests encontrado: &C%d    &cQuests Finalizados: &C%d&D\r\n", avail, done );
        send_to_char( "\r\n&GMás información de un quest: &WDiario <nombre>&D\r\n", ch );
        send_to_char( "\r\n&Gpara ver los quest completados: &Wdiario completados&D\r\n", ch );
        return;
    }

    quest = get_quest_from_name( arg1 );
    if ( !quest ) {
        send_to_char( "&Gsintaxis: diario \r\n                diario <nombre del quest>&D\r\n",
                      ch );
        return;
    }

    for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) {
        if ( chquest->questnum != quest->number )
            continue;
        send_to_char( "&GLeyendo la descripción del quest...\r\n", ch );
        pager_printf( ch, "&W%s&D\r\n", quest->desc ? quest->desc : "(Not created!)" );
        found = TRUE;
        break;
    }

    if ( !found )
        send_to_char( "¡Este no es un quest de tu diario!\r\n", ch );
}
コード例 #23
0
ファイル: act_comm.c プロジェクト: zachflower/oasis-mud
/*
 * Generic channel function.
 */
void talk_channel( CHAR_DATA * ch, char * argument, int channel, const char * verb ) {
  DESCRIPTOR_DATA * d;
  char              buf[ MAX_STRING_LENGTH ];
  int               position;

  if ( argument[ 0 ] == '\0' ) {
    sprintf( buf, "%s what?\n\r", verb );
    buf[ 0 ] = UPPER( buf[ 0 ] );
    return;
  }

  if ( !IS_NPC( ch ) && CHECK_BIT( ch->act, PLR_SILENCE ) ) {
    sprintf( buf, "You can't %s.\n\r", verb );
    send_to_char( AT_WHITE, buf, ch );
    return;
  }

  if ( CHECK_BIT( ch->in_room->room_flags, ROOM_SILENT ) && ( get_trust( ch ) < L_DIR ) ) {
    send_to_char( AT_WHITE, "You can't do that here.\n\r", ch );
    return;
  }

  REMOVE_BIT( ch->deaf, channel );

  switch ( channel ) {
    default:
      sprintf( buf, "You %s '%s'\n\r", verb, argument );
      send_to_char( AT_LBLUE, buf, ch );
      sprintf( buf, "$n %ss '$t'", verb );
      break;
    case CHANNEL_GOSSIP:
      sprintf( buf, "&cYou %s '&W%s&c'\n\r", verb, argument );
      send_to_char( C_DEFAULT, buf, ch );
      sprintf( buf, "&c$n %ss '&W$t&c'", verb );
      break;
    case CHANNEL_IMMTALK:
      sprintf( buf, "&C-&c=&B|&c<&C$n&c>&B|&c=&C-&B : $t" );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_YELLOW, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_CLAN:
      sprintf( buf, "<%s&R> $n: '$t'", ( get_clan_index( ch->clan ) && ( get_clan_index( ch->clan ) )->name ? ( get_clan_index( ch->clan ) )->name : "Unclanned" ) );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_RED, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_CLASS:
      sprintf( buf, "{%s} $n: $t", class_table[ prime_class( ch ) ].who_long );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_LBLUE, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_HERO:
      sprintf( buf, "(HERO) $n: '$t'" );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_GREEN, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_OOC:
      sprintf( buf, "OOC - $n: '$t'" );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_PINK, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
  }

  for ( d = descriptor_list; d; d = d->next ) {
    CHAR_DATA * och;
    CHAR_DATA * vch;

    och = d->original ? d->original : d->character;
    vch = d->character;

    if ( d->connected == CON_PLAYING && vch != ch && !CHECK_BIT( och->deaf, channel ) && !CHECK_BIT( och->in_room->room_flags, ROOM_SILENT ) ) {
      if ( IS_QUESTOR( och ) && channel != CHANNEL_YELL ) {
        continue;
      }

      if ( channel == CHANNEL_IMMTALK && !IS_IMMORTAL( och ) ) {
        continue;
      }

      if ( channel == CHANNEL_HERO && !IS_HERO( och ) ) {
        continue;
      }

      if ( ( channel == CHANNEL_CLASS ) && (( prime_class( vch ) != prime_class( ch ) ) || !IS_IMMORTAL( och )) ) {
        continue;
      }

      if ( ( channel == CHANNEL_CLAN ) && (( vch->clan != ch->clan ) || !IS_IMMORTAL( och )) ) {
        continue;
      }

      if ( channel == CHANNEL_YELL && vch->in_room->area != ch->in_room->area ) {
        continue;
      }

      position = vch->position;

      if ( channel != CHANNEL_YELL ) {
        vch->position = POS_STANDING;
      }

      switch ( channel ) {
        default:
          act( AT_LBLUE, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_GOSSIP:
          act( C_DEFAULT, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_IMMTALK:
          act( AT_YELLOW, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_HERO:
          act( AT_GREEN, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_CLAN:
          act( AT_RED, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_CLASS:
          act( AT_LBLUE, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_OOC:
          act( AT_PINK, buf, ch, argument, vch, TO_VICT );
          break;
      }

      vch->position = position;
    }
  }

  return;
}
コード例 #24
0
ファイル: mpxset.c プロジェクト: andycervantes/SMAUG-Pi
void do_mpmset( CHAR_DATA * ch, const char *argument )
{
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char arg3[MAX_INPUT_LENGTH];
	char buf[MAX_STRING_LENGTH];
	char log_buf[MAX_STRING_LENGTH];
	char outbuf[MAX_STRING_LENGTH];
	CHAR_DATA *victim;
	int value, v2;
	int minattr, maxattr;

	/*
	 * A desc means switched.. too many loopholes if we allow that.. 
	 */
	if ( !IS_NPC( ch ) || IS_AFFECTED( ch, AFF_CHARM ) || ch->desc )
	{
		send_to_char( "Huh?\r\n", ch );
		return;
	}

	smash_tilde( argument );

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	mudstrlcpy( arg3, argument, MAX_INPUT_LENGTH );

	if ( !*arg1 )
	{
		progbug( "MpMset: no args", ch );
		return;
	}

	if ( ( victim = get_char_room( ch, arg1 ) ) == NULL )
	{
		progbug( "MpMset: no victim", ch );
		return;
	}

	if ( IS_IMMORTAL( victim ) )
	{
		send_to_char( "You can't do that!\r\n", ch );
		return;
	}

	if ( IS_NPC( victim ) && xIS_SET( victim->act, ACT_PROTOTYPE ) )
	{
		progbug( "MpMset: victim is proto", ch );
		return;
	}

	if ( IS_NPC( victim ) )
	{
		minattr = 1;
		maxattr = 25;
	}
	else
	{
		minattr = 3;
		maxattr = 18;
	}

	value = is_number( arg3 ) ? atoi( arg3 ) : -1;
	if ( atoi( arg3 ) < -1 && value == -1 )
		value = atoi( arg3 );

	if ( !str_cmp( arg2, "str" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid str", ch );
			return;
		}
		victim->perm_str = value;
		return;
	}

	if ( !str_cmp( arg2, "int" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid int", ch );
			return;
		}
		victim->perm_int = value;
		return;
	}

	if ( !str_cmp( arg2, "wis" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid wis", ch );
			return;
		}
		victim->perm_wis = value;
		return;
	}

	if ( !str_cmp( arg2, "dex" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid dex", ch );
			return;
		}
		victim->perm_dex = value;
		return;
	}

	if ( !str_cmp( arg2, "con" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid con", ch );
			return;
		}
		victim->perm_con = value;
		return;
	}

	if ( !str_cmp( arg2, "cha" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid cha", ch );
			return;
		}
		victim->perm_cha = value;
		return;
	}

	if ( !str_cmp( arg2, "lck" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid lck", ch );
			return;
		}
		victim->perm_lck = value;
		return;
	}

	if ( !str_cmp( arg2, "sav1" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav1", ch );
			return;
		}
		victim->saving_poison_death = value;
		return;
	}

	if ( !str_cmp( arg2, "sav2" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav2", ch );
			return;
		}
		victim->saving_wand = value;
		return;
	}

	if ( !str_cmp( arg2, "sav3" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav3", ch );
			return;
		}
		victim->saving_para_petri = value;
		return;
	}

	if ( !str_cmp( arg2, "sav4" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav4", ch );
			return;
		}
		victim->saving_breath = value;
		return;
	}

	if ( !str_cmp( arg2, "sav5" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav5", ch );
			return;
		}
		victim->saving_spell_staff = value;
		return;
	}

	if ( !str_cmp( arg2, "sex" ) )
	{
		if ( value < 0 || value > 2 )
		{
			progbug( "MpMset: Invalid sex", ch );
			return;
		}
		victim->sex = value;
		return;
	}

	if ( !str_cmp( arg2, "class" ) )
	{
		if ( IS_NPC( victim ) )	/* Broken by Haus... fixed by Thoric */
		{
			if ( value >= MAX_NPC_CLASS || value < 0 )
			{
				progbug( "MpMset: Invalid npc class", ch );
				return;
			}
			victim->Class = value;
			return;
		}
		progbug( "MpMset: can't set pc class", ch );
	}

	if ( !str_cmp( arg2, "race" ) )
	{
		value = get_npc_race( arg3 );
		if ( value < 0 )
			value = atoi( arg3 );
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc race", ch );
			return;
		}
		if ( value < 0 || value >= MAX_NPC_RACE )
		{
			progbug( "MpMset: Invalid npc race", ch );
			return;
		}
		victim->race = value;
		return;
	}

	if ( !str_cmp( arg2, "armor" ) )
	{
		if ( value < -300 || value > 300 )
		{
			send_to_char( "AC range is -300 to 300.\r\n", ch );
			return;
		}
		victim->armor = value;
		return;
	}

	if ( !str_cmp( arg2, "level" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc level", ch );
			return;
		}

		if ( value < 0 || value > LEVEL_AVATAR + 5 )
		{
			progbug( "MpMset: Invalid npc level", ch );
			return;
		}
		victim->level = value;
		return;
	}

	if ( !str_cmp( arg2, "numattacks" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc numattacks", ch );
			return;
		}

		if ( value < 0 || value > 20 )
		{
			progbug( "MpMset: Invalid npc numattacks", ch );
			return;
		}
		victim->numattacks = value;
		return;
	}

	if ( !str_cmp( arg2, "gold" ) )
	{
		victim->gold = value;
		return;
	}

	if ( !str_cmp( arg2, "hitroll" ) )
	{
		victim->hitroll = URANGE( 0, value, 85 );
		return;
	}

	if ( !str_cmp( arg2, "damroll" ) )
	{
		victim->damroll = URANGE( 0, value, 65 );
		return;
	}

	if ( !str_cmp( arg2, "hp" ) )
	{
		if ( value < 1 || value > 32700 )
		{
			progbug( "MpMset: Invalid hp", ch );
			return;
		}
		victim->max_hit = value;
		return;
	}

	if ( !str_cmp( arg2, "mana" ) )
	{
		if ( value < 0 || value > 30000 )
		{
			progbug( "MpMset: Invalid mana", ch );
			return;
		}
		victim->max_mana = value;
		return;
	}

	if ( !str_cmp( arg2, "move" ) )
	{
		if ( value < 0 || value > 30000 )
		{
			progbug( "MpMset: Invalid move", ch );
			return;
		}
		victim->max_move = value;
		return;
	}

	if ( !str_cmp( arg2, "practice" ) )
	{
		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid practice", ch );
			return;
		}
		victim->practice = value;
		return;
	}

	if ( !str_cmp( arg2, "align" ) )
	{
		if ( value < -1000 || value > 1000 )
		{
			progbug( "MpMset: Invalid align", ch );
			return;
		}
		victim->alignment = value;
		return;
	}

/* non-functional for now -- Blod
    if ( !str_cmp( arg2, "quest" ) )
    {
	if ( IS_NPC(victim) )
	{
	    progbug("MpMset: can't set npc quest", ch);
	    return;
	}

	if ( value < 0 || value > 500 )
	{
	    progbug("MpMset: Invalid pc quest", ch);
	    return;
	}

	victim->pcdata->quest = value;
	return;
    }
*/

	if ( !str_cmp( arg2, "questplus" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc qp", ch );
			return;
		}

		if ( value < 0 || value > 5000 )
		{
			progbug( "MpMset: Invalid pc qp", ch );
			return;
		}
		snprintf( log_buf, MAX_STRING_LENGTH, "%s raising glory of %s by %d ...", ch->name, victim->name, value );
		log_string( log_buf );
		victim->pcdata->quest_curr += value;
		victim->pcdata->quest_accum += value;
		return;
	}

	if ( !str_cmp( arg2, "favor" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc favor", ch );
			return;
		}

		if ( value < -2500 || value > 2500 )
		{
			progbug( "MpMset: Invalid pc favor", ch );
			return;
		}

		victim->pcdata->favor = value;
		return;
	}

	if ( !str_cmp( arg2, "mentalstate" ) )
	{
		if ( value < -100 || value > 100 )
		{
			progbug( "MpMset: Invalid mentalstate", ch );
			return;
		}
		victim->mental_state = value;
		return;
	}

	if ( !str_cmp( arg2, "emotion" ) )
	{
		if ( value < -100 || value > 100 )
		{
			progbug( "MpMset: Invalid emotion", ch );
			return;
		}
		victim->emotional_state = value;
		return;
	}

	if ( !str_cmp( arg2, "thirst" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc thirst", ch );
			return;
		}

		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid pc thirst", ch );
			return;
		}

		victim->pcdata->condition[COND_THIRST] = value;
		return;
	}

	if ( !str_cmp( arg2, "drunk" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc drunk", ch );
			return;
		}

		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid pc drunk", ch );
			return;
		}

		victim->pcdata->condition[COND_DRUNK] = value;
		return;
	}

	if ( !str_cmp( arg2, "full" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc full", ch );
			return;
		}

		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid pc full", ch );
			return;
		}

		victim->pcdata->condition[COND_FULL] = value;
		return;
	}

	if ( !str_cmp( arg2, "blood" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc blood", ch );
			return;
		}

		if ( value < 0 || value > MAX_LEVEL + 10 )
		{
			progbug( "MpMset: Invalid pc blood", ch );
			return;
		}

		victim->pcdata->condition[COND_BLOODTHIRST] = value;
		return;
	}

	if ( !str_cmp( arg2, "name" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc name", ch );
			return;
		}

		STRFREE( victim->name );
		victim->name = STRALLOC( arg3 );
		return;
	}

	if ( !str_cmp( arg2, "deity" ) )
	{
		DEITY_DATA *deity;

		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc deity", ch );
			return;
		}

		if ( arg3[0] == '\0' )
		{
			STRFREE( victim->pcdata->deity_name );
			victim->pcdata->deity_name = STRALLOC( "" );
			victim->pcdata->deity = NULL;
			return;
		}

		deity = get_deity( arg3 );
		if ( !deity )
		{
			progbug( "MpMset: Invalid deity", ch );
			return;
		}
		STRFREE( victim->pcdata->deity_name );
		victim->pcdata->deity_name = QUICKLINK( deity->name );
		victim->pcdata->deity = deity;
		return;
	}

	if ( !str_cmp( arg2, "short" ) )
	{
		STRFREE( victim->short_descr );
		victim->short_descr = STRALLOC( arg3 );
		return;
	}

	if ( !str_cmp( arg2, "long" ) )
	{
		STRFREE( victim->long_descr );
		mudstrlcpy( buf, arg3, MAX_STRING_LENGTH );
		mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
		victim->long_descr = STRALLOC( buf );
		return;
	}

	if ( !str_cmp( arg2, "title" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc title", ch );
			return;
		}

		set_title( victim, arg3 );
		return;
	}

	if ( !str_cmp( arg2, "spec" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc spec", ch );
			return;
		}

		if ( !str_cmp( arg3, "none" ) )
		{
			victim->spec_fun = NULL;
			return;
		}

		if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 )
		{
			progbug( "MpMset: Invalid spec", ch );
			return;
		}
		return;
	}

	if ( !str_cmp( arg2, "flags" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc flags", ch );
			return;
		}

		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no flags", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_actflag( arg3 );
			if ( value < 0 || value >= MAX_BITS )
				progbug( "MpMset: Invalid flag", ch );
			else
			{
				if ( value == ACT_PROTOTYPE )
					progbug( "MpMset: can't set prototype flag", ch );
				else if ( value == ACT_IS_NPC )
					progbug( "MpMset: can't remove npc flag", ch );
				else
					xTOGGLE_BIT( victim->act, value );
			}
		}
		return;
	}

	if ( !str_cmp( arg2, "affected" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't modify pc affected", ch );
			return;
		}

		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no affected", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_aflag( arg3 );
			if ( value < 0 || value >= MAX_BITS )
				progbug( "MpMset: Invalid affected", ch );
			else
				xTOGGLE_BIT( victim->affected_by, value );
		}
		return;
	}

	/*
	 * save some more finger-leather for setting RIS stuff
	 * Why there's can_modify checks here AND in the called function, Ill
	 * never know, so I removed them.. -- Alty
	 */
	if ( !str_cmp( arg2, "r" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "i" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "s" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "ri" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}

	if ( !str_cmp( arg2, "rs" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "is" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "ris" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}

	if ( !str_cmp( arg2, "resistant" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc resistant", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no resistant", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_risflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid resistant", ch );
			else
				TOGGLE_BIT( victim->resistant, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "immune" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc immune", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no immune", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_risflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid immune", ch );
			else
				TOGGLE_BIT( victim->immune, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "susceptible" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc susceptible", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no susceptible", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_risflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid susceptible", ch );
			else
				TOGGLE_BIT( victim->susceptible, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "part" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc part", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no part", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_partflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid part", ch );
			else
				TOGGLE_BIT( victim->xflags, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "attack" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc attack", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no attack", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_attackflag( arg3 );
			if ( value < 0 )
				progbug( "MpMset: Invalid attack", ch );
			else
				xTOGGLE_BIT( victim->attacks, value );
		}
		return;
	}

	if ( !str_cmp( arg2, "defense" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc defense", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no defense", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_defenseflag( arg3 );
			if ( value < 0 || value >= MAX_BITS )
				progbug( "MpMset: Invalid defense", ch );
			else
				xTOGGLE_BIT( victim->defenses, value );
		}
		return;
	}

	if ( !str_cmp( arg2, "pos" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc pos", ch );
			return;
		}
		if ( value < 0 || value > POS_STANDING )
		{
			progbug( "MpMset: Invalid pos", ch );
			return;
		}
		victim->position = value;
		return;
	}

	if ( !str_cmp( arg2, "defpos" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc defpos", ch );
			return;
		}
		if ( value < 0 || value > POS_STANDING )
		{
			progbug( "MpMset: Invalid defpos", ch );
			return;
		}
		victim->defposition = value;
		return;
	}

	if ( !str_cmp( arg2, "speaks" ) )
	{
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no speaks", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_langflag( arg3 );
			v2 = get_langnum( arg3 );
			if ( value == LANG_UNKNOWN )
				progbug( "MpMset: Invalid speaks", ch );
			else if ( !IS_NPC( victim ) )
			{
				if ( !( value &= VALID_LANGS ) )
				{
					progbug( "MpMset: Invalid player language", ch );
					continue;
				}
				if ( v2 == -1 )
					ch_printf( ch, "Unknown language: %s\r\n", arg3 );
				else
					TOGGLE_BIT( victim->speaks, 1 << v2 );
			}
			else
			{
				if ( v2 == -1 )
					ch_printf( ch, "Unknown language: %s\r\n", arg3 );
				else
					TOGGLE_BIT( victim->speaks, 1 << v2 );
			}
		}
		if ( !IS_NPC( victim ) )
		{
			REMOVE_BIT( victim->speaks, race_table[victim->race]->language );
			if ( !knows_language( victim, victim->speaking, victim ) )
				victim->speaking = race_table[victim->race]->language;
		}
		return;
	}

	if ( !str_cmp( arg2, "speaking" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc speaking", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no speaking", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_langflag( arg3 );
			if ( value == LANG_UNKNOWN )
				progbug( "MpMset: Invalid speaking", ch );
			else
			{
				v2 = get_langnum( arg3 );
				if ( v2 == -1 )
					ch_printf( ch, "Unknown language: %s\r\n", arg3 );
				else
					TOGGLE_BIT( victim->speaks, 1 << v2 );
			}
		}
		return;
	}

	progbug( "MpMset: Invalid field", ch );
	return;
}
コード例 #25
0
void get_obj(struct char_data *ch, struct gameobject *obj, struct gameobject *container)
{
    struct char_data *gch;
    int members;
    char buffer[100];

    if (!CAN_WEAR(obj, ITEM_TAKE)) {
	send_to_char("You can't take that.\n\r", ch);
	return;
    }

    if ((ch->carry_number + get_obj_number(obj)) > can_carry_n(ch)
	    && (!IS_IMMORTAL(ch))) {
	act("$d: you can't carry that many items.",
		ch, NULL, object_name_get(obj), TO_CHAR);
	return;
    }


    if ((ch->carry_weight + get_obj_weight(obj)) > can_carry_w(ch)) {
	act("$d: you can't carry that much weight.", ch, NULL, object_name_get(obj), TO_CHAR);
	return;
    }

    if (obj->in_room != NULL) {
	for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) {
	    if (gch->on == obj) {
		act("$N appears to be using $p.", ch, obj, gch, TO_CHAR);
		return;
	    }
	}
    }


    if (container != NULL) {
	if (container->objprototype->vnum == OBJ_VNUM_PIT
		&& get_trust(ch) < obj->level) {
	    send_to_char("You are not powerful enough to use it.\n\r", ch);
	    return;
	}

	if (container->objprototype->vnum == OBJ_VNUM_PIT
		&& !CAN_WEAR(container, ITEM_TAKE)
		&& !IS_OBJ_STAT(obj, ITEM_HAD_TIMER))
	    obj->timer = 0;
	act_new("You get $p from $P.", ch, obj, container, TO_CHAR, POS_RESTING, true);
	act_new("$n gets $p from $P.", ch, obj, container, TO_ROOM, POS_RESTING, true);
	REMOVE_BIT(obj->extra_flags, ITEM_HAD_TIMER);
	obj_from_obj(obj);
    } else {
	act_new("You get $p.", ch, obj, container, TO_CHAR, POS_RESTING, true);
	act_new("$n gets $p.", ch, obj, container, TO_ROOM, POS_RESTING, true);
	obj_from_room(obj);
    }

    if (obj->item_type == ITEM_MONEY) {
	ch->silver += obj->value[0];
	ch->gold += obj->value[1];

	if (IS_SET(ch->act, PLR_AUTOSPLIT)) {
	    members = 0;
	    for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
		if (!IS_AFFECTED(gch, AFF_CHARM) && is_same_group(gch, ch))
		    members++;

	    if (members > 1 && (obj->value[0] > 1 || obj->value[1])) {
		sprintf(buffer, "%ld %ld", obj->value[0], obj->value[1]);
		do_split(ch, buffer);
	    }
	}

	extract_obj(obj);
    } else {
	obj_to_char(obj, ch);
    }

    return;
}
コード例 #26
0
ファイル: track.c プロジェクト: blanciq/bq-killer
void do_track( CHAR_DATA *ch, char *argument )
{
	char       buf [ MAX_STRING_LENGTH ];
	char       arg [ MAX_STRING_LENGTH ];
	CHAR_DATA *victim;
	int        direction, skill;
	bool       fArea=TRUE;

	skill=get_skill(ch, gsn_track);

	if (IS_NPC(ch))
	{
		return;
	}

	if ( ch->mount )
	{
		send_to_char( "Najpierw zsi±d¼ ze swojego wierzchowca.\n\r", ch );
		return;
	}

	if ( !IS_IMMORTAL( ch ) && IS_AFFECTED( ch, AFF_BLIND ) )
	{
		act("$n klêka i bezradnie potrz±sa g³ow±.",ch,NULL,NULL,TO_ROOM);
		send_to_char("Klekasz, ale przecie¿ niczego nie widzisz.\n\r",ch);
		return;
	}
	if ( room_is_dark( ch, ch->in_room ) &&  !(IS_AFFECTED( ch, AFF_DARK_VISION ) || IS_IMMORTAL( ch ) ))
	{
		send_to_char("Klekasz, ale jest tu tak ciemno, ¿e niczego nie widzisz.\n\r",ch);
		return;
	}

	// wycinamy niektóre ze sektorów
	switch ( ch->in_room->sector_type )
	{
		case  6:  //woda p³yw
		case  7:  //woda niep
		case 19:  //rzeka
		case 20:  //jezioro
		case 21:  //morze
		case 22:  //ocean
		case 23:  //lawa
		case 24:  //ruchome piaski
		case 25:  //gor±ce ¼ród³o
		case 34:  //pod wod±
		case 37:  //ciemna woda
		case 39:  //podziemne jezioro
			send_to_char( "Tutaj chyba nie da siê szukaæ ¶ladów.\n\r", ch );
			return;
	}

	// komunikaty dla tych, którzy nie umiej± szukaæ ¶ladów
	if ( skill == 0 )
	{
		switch (number_range(1,7))
		{
			case 1:
				act("$n klêka i nie wie co robiæ dalej.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i nie za bardzo wiesz co robiæ dalej.\n\r",ch);
				break;
			case 2:
				act("$n klêka i niczego nie widzi.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i niczego nie widzisz.\n\r",ch);
				break;
			case 3:
				act("$n mocno tupie, klêka i przygl±da siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Mocno tupiesz, klêkasz i przygl±dasz siê ¶ladom.\n\r",ch);
				break;
			case 4:
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i ¶ledzisz tropy, choæ nie masz o tym zielonego pojêcia.\n\r",ch);
				break;
			case 5:
				act("$n klêka i robi nieszczê¶liw± minê.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i robisz nieszczê¶liw± minê.\n\r",ch);
				break;
			case 6:
				act("$n rozgl±da siê dooko³a.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Rozgl±dasz siê dooko³a, ale to nie pomaga.\n\r",ch);
				break;
			case 7:
				act("$n zastanawia siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Zastanawiasz siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.\n\r",ch);
				break;
			default :
				send_to_char( "Nie masz pojêcia jak to siê robi.\n\r", ch );
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				break;
		}
		return;
	}

	// bonus/kara od dobrej lokacji s± wiêksze ni¿ od z³ej
	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_CONSECRATE ))
	{
		if (IS_EVIL( ch ) ) skill -= number_range(1,5);
		if (IS_GOOD( ch ) ) skill += number_range(1,5);
	}

	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_DESECRATE ))
	{
		if (IS_EVIL( ch ) ) skill += number_range(0,4);
		if (IS_GOOD( ch ) ) skill -= number_range(0,4);
	}

	// sprawdzamy czy skill nie zrobi³ siê nam mniejszy ni¿ 1
	if (skill < 1)
	{
		skill = 1;
	}

	// no to zaczynamy w³a¶ciwe trackowanie :D
	one_argument( argument, arg );

#ifdef ENABLE_NEW_TRACK
	if(MAX_TRACK_LEN > 0)
	{
		track_new(ch, skill, argument);
		return;
	}
#endif

	if ( arg[0] == '\0' )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i z uwag± przygl±dasz siê ¶ladom.",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( fArea )
	{
		victim = get_char_area( ch, arg );
	}
	else
	{
		victim = get_char_world( ch, arg );
	}

	if ( !victim )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}

	if(victim==ch)
	{
		act("Zastanawiasz siê przez chwilê czy to ma sens, no có¿...",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( ch->in_room == victim->in_room )
	{
		act( "Klêkasz i badasz trop, po chwili zdajesz sobie sprawê, ¿e $N stoi ko³o ciebie.", ch, NULL, victim, TO_CHAR );
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		return;
	}

	if ( skill < number_range( 20, 40 ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		check_improve(ch, NULL, gsn_track, FALSE, 12);
		return;
	}

	if ( IS_AFFECTED ( victim, AFF_SPIRIT_WALK ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}
	else
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i przygladasz siê ¶ladom, chyba widzisz jaki¶ trop.",ch,NULL,NULL,TO_CHAR);
	}

	WAIT_STATE( ch, skill_table[gsn_track].beats );


	direction = find_path( ch->in_room->vnum, victim->in_room->vnum, ch, -40000, fArea );

	if ( direction == -1 )
	{
		act( "Niestety, nie mo¿esz nic wiêcej odczytaæ ze ¶ladów.", ch, NULL, victim, TO_CHAR );
		return;
	}

	if ( direction < 0 || direction >= MAX_DIR )
	{
		send_to_char( "Hmm... co¶ jest nie tak.\n\r", ch );
		return;
	}

/*
 * Give a random direction if the player misses the die roll.
 */
	if ( number_percent() > skill )
	{
		do
		{
			direction = number_door( );
		}
		while (   !( ch->in_room->exit[direction] ) || !( ch->in_room->exit[direction]->u1.to_room ) );
	}

	check_improve(ch, NULL, gsn_track, TRUE, 9);

/*
 * Display the results of the search.
 */


	sprintf( buf, "Znajdujesz ¶lady $Z prowadz±ce na %s.", direction == 4 ? "górê" : dir_name[direction] );
	act( buf, ch, NULL, victim, TO_CHAR );
	return;
}
コード例 #27
0
void Character::update() {
    AFFECT_DATA *paf;
    AFFECT_DATA *paf_next;

    if ( this->desc && this->desc->connected == CON_PLAYING )
        send_to_char("\n\r",this);

    if ( this->position >= POS_STUNNED )
    {
        if ( this->hit  < this->max_hit )
            this->hit  += this->hit_gain();
        else
            this->hit = this->max_hit;

        if ( this->mana < this->max_mana )
            this->mana += this->mana_gain();
        else
            this->mana = this->max_mana;

        if ( this->move < this->max_move )
            this->move += this->move_gain();
        else
            this->move = this->max_move;
    }

    if ( this->position == POS_STUNNED )
        update_pos( this );

    for ( paf = this->affected; paf != NULL; paf = paf_next )
    {
        paf_next	= paf->next;
        if ( paf->duration > 0 )
        {
            paf->duration--;
            if (number_range(0,4) == 0 && paf->level > 0)
                paf->level--;  /* spell strength fades with time */
        }
        else if ( paf->duration < 0 )
            ;
        else
        {
            if ( paf_next == NULL
                    ||   paf_next->type != paf->type
                    ||   paf_next->duration > 0 )
            {
                if ( paf->type > 0 && skill_table[paf->type].msg_off )
                {
                    send_to_char( skill_table[paf->type].msg_off, this );
                    send_to_char( "\n\r", this );
                }
            }

            affect_remove( this, paf );
        }
    }

    /*
     * Careful with the damages here,
     *   MUST NOT refer to ch after damage taken,
     *   as it may be lethal damage (on NPC).
     */

    if (is_affected(this, gsn_plague) && this != NULL)
    {
        if (this->in_room == NULL)
            return;

        ::act("$n writhes in agony as plague sores erupt from $s skin.",
                this,NULL,NULL,TO_ROOM);
        send_to_char("You writhe in agony from the plague.\n\r",this);

        AFFECT_DATA *af;
        for ( af = this->affected; af != NULL; af = af->next )
        {
            if (af->type == gsn_plague)
                break;
        }

        if (af == NULL)
        {
            REMOVE_BIT(this->affected_by,AFF_PLAGUE);
            return;
        }

        if (af->level == 1)
            return;

        AFFECT_DATA plague;
        plague.where		= TO_AFFECTS;
        plague.type 		= gsn_plague;
        plague.level 		= af->level - 1;
        plague.duration 	= number_range(1,2 * plague.level);
        plague.location		= APPLY_STR;
        plague.modifier 	= -5;
        plague.bitvector 	= AFF_PLAGUE;

        for ( Character* vch = this->in_room->people; vch != NULL; vch = vch->next_in_room)
        {
            if (!saves_spell(plague.level - 2,vch,DAM_DISEASE)
                    &&  !IS_IMMORTAL(vch)
                    &&  !IS_AFFECTED(vch,AFF_PLAGUE) && number_bits(4) == 0)
            {
                send_to_char("You feel hot and feverish.\n\r",vch);
                ::act("$n shivers and looks very ill.",vch,NULL,NULL,TO_ROOM);
                affect_join(vch,&plague);
            }
        }

        int dam = UMIN(this->level,af->level/5+1);
        this->mana -= dam;
        this->move -= dam;
        damage_old( this, this, dam, gsn_plague,DAM_DISEASE,FALSE);
    }
    else if ( IS_AFFECTED(this, AFF_POISON) && this != NULL
            &&   !IS_AFFECTED(this,AFF_SLOW))

    {
        AFFECT_DATA *poison;

        poison = affect_find(this->affected,gsn_poison);

        if (poison != NULL)
        {
            ::act( "$n shivers and suffers.", this, NULL, NULL, TO_ROOM );
            send_to_char( "You shiver and suffer.\n\r", this );
            damage_old(this,this,poison->level/10 + 1,gsn_poison,
                    DAM_POISON,FALSE);
        }
    }

    else if ( this->position == POS_INCAP && number_range(0,1) == 0)
    {
        ::damage( this, this, 1, TYPE_UNDEFINED, DAM_NONE,FALSE);
    }
    else if ( this->position == POS_MORTAL )
    {
        ::damage( this, this, 1, TYPE_UNDEFINED, DAM_NONE,FALSE);
    }
}
コード例 #28
0
ファイル: Opinion.c プロジェクト: frasten/openleu
int RemFeared( struct char_data *ch, struct char_data *pud) 
{

  struct char_list *t, **ppOp;

  if( IS_PC( ch ) )
  { 
    return FALSE;
  }

  if (!IS_SET(ch->specials.act, ACT_AFRAID)) 
    return(FALSE);

  if( pud )
  {
#if defined( EMANUELE )
    for( ppOp = &ch->fears.clist; *ppOp; )
    {
      if( (*ppOp)->op_ch )
      {
        if( (*ppOp)->op_ch == pud )
        {
          if (IS_IMMORTAL(pud))  
          {
            send_to_char("$c0004Qualcuno smette di temerti.\n\r",pud);
          }
          t = *ppOp;
          *ppOp = (*ppOp)->next;
          free(t);
          continue;
        }
      }
      else 
      {
        if( !strcmp( (*ppOp)->name, GET_NAME( pud ) ) ) 
        {
          if (IS_IMMORTAL(pud))  
          {
            send_to_char("$c0004Qualcuno smette di temerti.\n\r",pud);
          }
          t = *ppOp;
          *ppOp = (*ppOp)->next;
          free(t);
          continue;          
        }
      }
      ppOp = &(*ppOp)->next;
    }
#else
    tmp = ch->fears.clist;    
    for (oldpud = ch->fears.clist; (oldpud!=0); oldpud = tmp)
    {
      if (oldpud==0)
        return(FALSE);
      tmp = oldpud->next;
      if (oldpud->op_ch)
      {
        if (oldpud->op_ch == pud)
        {
          t = oldpud;
          if (ch->fears.clist == t)
          {
            ch->fears.clist = 0;
            free(t);
            break;
          }
          else
          {
            for (oldpud = ch->fears.clist; oldpud->next != t; 
                 oldpud = oldpud->next);
            oldpud->next = oldpud->next->next;
            free(t);
            break;
          }
        }
      }
      else
      {
        if (!strcmp(oldpud->name,GET_NAME(pud)))
        {
          t = oldpud;
          if (ch->fears.clist == t)
          {
            ch->fears.clist = 0;
            free(t);
            break;
          }
          else
          {
            for (oldpud = ch->fears.clist; oldpud->next != t; 
                 oldpud = oldpud->next);
            oldpud->next = oldpud->next->next;
            free(t);
            break;
          }
        }
      }
    }
#endif    
  }
  if (!ch->fears.clist)
    REMOVE_BIT(ch->fearfield, FEAR_CHAR);
  if (!ch->fearfield)
    REMOVE_BIT(ch->specials.act, ACT_AFRAID);
  return( (pud) ? TRUE : FALSE);
}
コード例 #29
0
ファイル: magic2.cpp プロジェクト: Swiftam/ForgottenLegends
void spell_nexus( int sn, int level, Character *ch, void *vo, int target)
{
    Character *victim;
    OBJ_DATA *portal, *stone;
    ROOM_INDEX_DATA *to_room, *from_room;

    from_room = ch->in_room;
 
        if ( ( victim = get_char_world( ch, target_name ) ) == NULL
    ||   victim == ch
    ||   (to_room = victim->in_room) == NULL
    ||   !can_see_room(ch,to_room) || !can_see_room(ch,from_room)
    ||   IS_SET(to_room->room_flags, ROOM_SAFE)
    ||	 IS_SET(from_room->room_flags,ROOM_SAFE)
    ||   IS_SET(to_room->room_flags, ROOM_PRIVATE)
    ||   IS_SET(to_room->room_flags, ROOM_SOLITARY)
    ||   IS_SET(to_room->room_flags, ROOM_NO_RECALL)
    ||   IS_SET(from_room->room_flags,ROOM_NO_RECALL)
    ||   victim->level >= level + 3
    ||   (!IS_NPC(victim) && victim->level >= LEVEL_HERO)  /* NOT trust */
    ||   (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON))
    ||   (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) 
    ||	 (IS_CLANNED(victim) && !is_same_clan(ch,victim)))
    {
        send_to_char( "You failed.\n\r", ch );
        return;
    }   
 
    stone = get_eq_char(ch,WEAR_HOLD);
    if (!IS_IMMORTAL(ch)
    &&  (stone == NULL || stone->item_type != ITEM_WARP_STONE))
    {
        send_to_char("You lack the proper component for this spell.\n\r",ch);
        return;
    }
 
    if (stone != NULL && stone->item_type == ITEM_WARP_STONE)
    {
        act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR);
        act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR);
        extract_obj(stone);
    }

    /* portal one */ 
    portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0);
    portal->timer = 1 + level / 10;
    portal->value[3] = to_room->vnum;
 
    obj_to_room(portal,from_room);
 
    act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM);
    act("$p rises up before you.",ch,portal,NULL,TO_CHAR);

    /* no second portal if rooms are the same */
    if (to_room == from_room)
	return;

    /* portal two */
    portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0);
    portal->timer = 1 + level/10;
    portal->value[3] = from_room->vnum;

    obj_to_room(portal,to_room);

    if (to_room->people != NULL)
    {
	act("$p rises up from the ground.",to_room->people,portal,NULL,TO_ROOM);
	act("$p rises up from the ground.",to_room->people,portal,NULL,TO_CHAR);
    }
}
コード例 #30
0
ファイル: logs.c プロジェクト: h3rb/Assault-3.0
void do_logs( CHAR_DATA *ch, char *argument )
{
    char bug_buf[MSL], idea_buf[MSL], typo_buf[MSL], bugs_buf[MSL];
    char *this_list;
    int i = 0;
    bool validcmd=FALSE;
    /* Empty the three buffers */
    *bug_buf = '\0';
    *idea_buf = '\0';
    *typo_buf = '\0';

    /* Populate the 3 lists */
    for (i = 0; i < totLogs; i++)
    {
        if ( !str_cmp(log_table[i].type, "bug") )  
            this_list = bug_buf;
        else if ( !str_cmp(log_table[i].type, "idea") ) 
            this_list = idea_buf;
        else if ( !str_cmp(log_table[i].type, "typo") ) 
            this_list = typo_buf;
        else
        {
            sprintf(bugs_buf, "Log type not recognised (%s) at log line %d", log_table[i].type, i);
            monitor_chan( NULL, bugs_buf, MONITOR_DEBUG);
            return;
        }

        if( IS_IMMORTAL(ch))
        {
            sprintf(this_list, "%s@@d[@@y%2d@@d]@@w @@r%-9s @@e%c%-4s @@a*%-6s  @@W%-55s@@N\r\n", this_list, ( i + 1 ), log_table[i].reporter, UPPER(*log_table[i].type), log_table[i].type + 1, log_table[i].date, log_table[i].log );
        }
        else
        {
            sprintf(this_list, "%s@@d[@@y%2d@@d]@@w @@e%c%-4s @@a*%-6s  @@W%-55s@@N\r\n", this_list, ( i + 1 ), UPPER(*log_table[i].type), log_table[i].type + 1, log_table[i].date, log_table[i].log );    
        }
    }

    if ( !str_cmp(argument, "bug") || !str_cmp(argument, "all") )
    {
        validcmd = TRUE;
        
        if (*bug_buf)
        {
            send_to_char("\r\n@@e------------------------@@d[@@WBug List@@d]@@N\r\n", ch);
            send_to_char(bug_buf, ch);
        }
        
        else
        send_to_char("\r\nNo bugs logged.\r\n", ch);
    }
    
    if ( !str_cmp(argument, "idea") || !str_cmp(argument, "all") )
    {
        validcmd = TRUE;

        if (*idea_buf)
        {
            send_to_char("\r\n@@e-----------------------@@d[@@WIdea List@@d]@@N\r\n", ch);
            send_to_char(idea_buf, ch);
        }
        
        else
            send_to_char("\r\nNo ideas logged.\r\n", ch);
    }
    
    if ( !str_cmp(argument, "typo") || !str_cmp(argument, "all") )
    {
        validcmd = TRUE;
        
        if (*typo_buf)
        {
            send_to_char("\r\n@@e-----------------------@@d[@@WTypo List@@d]@@N\r\n", ch);
            send_to_char(typo_buf, ch);
        }
        
        else
            send_to_char("\r\nNo typos logged.\r\n", ch);
    }
    
    if (!validcmd)
    {
        send_to_char( "Syntax: logs [bug/typo/idea/all]\r\nType 'log' if you want to log a bug, typo or idea.\r\n", ch);
        return;
    }
}