示例#1
0
bool spec_executioner( CHAR_DATA *ch )
{
    char buf[MAX_STRING_LENGTH];
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    char *crime;

    if ( !IS_AWAKE(ch) || ch->fighting != NULL )
	return FALSE;

    crime = "";
    for ( victim = ch->in_room->people; victim != NULL; victim = v_next )
    {
	v_next = victim->next_in_room;

	if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) )
	    { crime = "KILLER"; break; }

	if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) )
	    { crime = "THIEF"; break; }
    }

    if ( victim == NULL )
	return FALSE;

    sprintf( buf, "%s is a %s!  PROTECT THE INNOCENT!  MORE BLOOOOD!!!",
	victim->name, crime );
    do_shout( ch, buf );
    multi_hit( ch, victim, TYPE_UNDEFINED );
    char_to_room( create_mobile( get_mob_index(MOB_VNUM_CITYGUARD) ),
	ch->in_room );
    char_to_room( create_mobile( get_mob_index(MOB_VNUM_CITYGUARD) ),
	ch->in_room );
    return TRUE;
}
示例#2
0
文件: special.c 项目: bkero/Smaug
bool spec_executioner( CHAR_DATA *ch )
{
    char buf[MAX_STRING_LENGTH];
    MOB_INDEX_DATA *cityguard;
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    char *crime;

    if ( !IS_AWAKE(ch) || ch->fighting )
	return FALSE;

    crime = "";
    for ( victim = ch->in_room->first_person; victim; victim = v_next )
    {
	v_next = victim->next_in_room;

	if ( !IS_NPC(victim) && xIS_SET(victim->act, PLR_KILLER) )
	    { crime = "KILLER"; break; }

	if ( !IS_NPC(victim) && xIS_SET(victim->act, PLR_THIEF) )
	    { crime = "THIEF"; break; }
    }

    if ( !victim )
	return FALSE;

    if ( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
    {
	sprintf( buf, "%s is a %s!  As well as a COWARD!",
		victim->name, crime );
	do_yell( ch, buf );
	return TRUE;
    }

    sprintf( buf, "%s is a %s!  PROTECT THE INNOCENT!  MORE BLOOOOD!!!",
	victim->name, crime );
    do_yell( ch, buf );
    multi_hit( ch, victim, TYPE_UNDEFINED );
    if ( char_died(ch) )
      return TRUE;

    /* Added log in case of missing cityguard -- Tri */

    cityguard = get_mob_index( MOB_VNUM_CITYGUARD );

    if ( !cityguard )
    {
      sprintf( buf, "Missing Cityguard - Vnum:[%d]", MOB_VNUM_CITYGUARD );
      bug( buf, 0 );
      return TRUE;
    }

    char_to_room( create_mobile( cityguard ), ch->in_room );
    char_to_room( create_mobile( cityguard ), ch->in_room );
    return TRUE;
}
示例#3
0
void do_mpmload( CHAR_DATA *ch, char *argument )
{
    char            arg[ MAX_INPUT_LENGTH ];
    MOB_INDEX_DATA *pMobIndex;
    CHAR_DATA      *victim;

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

    if ( IS_AFFECTED( ch, AFF_CHARM ) )
    {
        return;
    }

    one_argument( argument, arg );

    if ( arg[0] == '\0' || !is_number(arg) )
    {
	bug( "Mpmload - Bad vnum as arg: vnum %d.", ch->pIndexData->vnum );
	return;
    }

    if ( ( pMobIndex = get_mob_index( atoi( arg ) ) ) == NULL )
    {
	bug( "Mpmload - Bad mob vnum: vnum %d.", ch->pIndexData->vnum );
	return;
    }

    victim = create_mobile( pMobIndex );
    char_to_room( victim, ch->in_room );
    return;
}
示例#4
0
void find_buddy( char_data* ch, obj_data* obj, int level,
  int species_list, int obj_list )
{
  char_data*         buddy;
  player_data*      pc;
  species_data*    species;
  int                    i;

  if( obj == NULL ) {
    bug( "Find_Buddy: Null Object as reagent!?" );
    return;
    }

  if( ( pc = player( ch ) ) == NULL )
    return;

  for( i = 0; i < 10; i++ )
    if( obj->pIndexData->vnum
      == list_value[ obj_list ][ 10*(ch->shdata->alignment%3)+i ] )
      break;

  if( i == 10 ) {
    send( ch, "Nothing happens.\n\r" );
    return;
    }

  send( *ch->array, "%s disintegrates in a burst of blue flame.\n\r", obj );
  obj->Extract( 1 );

  if( number_range( 0,100 ) < 50-7*level+10*i ) {
    send( ch, "You feel the summoning fail.\n\r" );
    return;
    }

  i = list_value[ species_list ][ 10*(ch->shdata->alignment%3)+i ];

  if( ( species = get_species( i ) ) == NULL ) {
    bug( "Find_buddy: unknown species." );
    return;
    }

  buddy = create_mobile( species );

  set_bit( &buddy->status, STAT_PET );

  remove_bit( &buddy->status, STAT_AGGR_ALL );
  remove_bit( &buddy->status, STAT_AGGR_GOOD );
  remove_bit( &buddy->status, STAT_AGGR_EVIL );

  buddy->To( ch->array );

  send( ch,
    "%s comes to your summons, stepping from the shadows.\n\r",
    buddy );

  add_follower( buddy, ch );

  return;
}
示例#5
0
void InvadeArea(AREA_DATA * pArea, MOB_INDEX_DATA * pMobIndex, int count)
{
    int created;
    int nTries = 5000;                                      //Limiting factor to keep from going on contiously.
    ROOM_INDEX_DATA * location;
    CHAR_DATA * victim;
    char * victimname;
    char buffer[MAX_STRING_LENGTH];

    if(pArea == NULL || pMobIndex == NULL)
    {
        return;
    }

    victimname = pMobIndex->short_descr;
    if ( !IS_SET(pArea->area_flags,AREA_QUESTOK) )
    {
        log_string( "Autoquest: Illegal zone." );
        wiznet( NULL, WIZ_DEBUG, 0, "Autoquest: Illegal zone...retrying." );
        pulse_autoquest = 1;
        return;
    }

    for ( created=0; (created < count) && (nTries > 0); created++ )
    {
        if ( (location = get_room_index(number_range(pArea->lvnum, pArea->uvnum ))) == NULL )
        {
            --created;
            nTries--;
            continue;
        }
        if (IS_SET( location->room_flags, ROOM_SAFE) || IS_SET(location->room_flags, ROOM_ASTRAL) || IS_SET(location->room_flags, ROOM_NO_MOB))
        {
            --created;
            nTries--;
            continue;
        }

        victim = create_mobile( pMobIndex );
        char_to_room( victim, location );
        if ( !IS_SET(victim->act, ACT_QUEST) )
            SET_BIT(victim->act,ACT_QUEST);
    }

    if(nTries == 0)
    {
        sprintf( buffer, "#RA half-hearted force of %d %s's has invaded #y%s.\n\r", created, victimname, pArea->name);
        do_questchat2( buffer );
    }
    else
    {
        sprintf( buffer, "#RAn Invasion on the area#y %s #Rhas occurred by %d deadly %s's !!!\n\r", pArea->name, created, victimname );
        do_questchat2( buffer );
    }

    return;
}
示例#6
0
/* These are for creating the super-mob so that the t_progs can use
 * mprog stuff..
 * -- Altrag
 */
static void check_smob(void)
{
	if (!smob) {
		smob = create_mobile(get_mob_index(MOB_VNUM_SUPERMOB));
		char_list = char_list->next;	/*Don't want it in the char_list */
		mobs_in_game--;	/* Doesn't count as a mob in the game */
	}

	if (smob->in_room)
		char_from_room(smob);

	free_string(smob->name);
	free_string(smob->short_descr);
}
示例#7
0
/*
 * Lets the mobile load another mobile.
 *
 * Syntax: mob mload [vnum]
 */
void do_mpmload(CHAR_DATA * ch, char *argument)
{
    char arg[MAX_INPUT_LENGTH];
    MOB_INDEX_DATA *pMobIndex;
    CHAR_DATA *victim;
    int vnum;

    one_argument(argument, arg);

    if (ch->in_room == NULL || arg[0] == '\0' || !is_number(arg))
	return;

    vnum = atoi(arg);
    if ((pMobIndex = get_mob_index(vnum)) == NULL) {
	sprintf(arg, "Mpmload: bad mob index (%d) from mob %d",
		vnum, IS_NPC(ch) ? ch->pIndexData->vnum : 0);
	bug(arg, 0);
	return;
    }
    victim = create_mobile(pMobIndex);
    char_to_room(victim, ch->in_room);
    return;
}
示例#8
0
/* lets the mobile load an item or mobile.  All items
are loaded into inventory.  you can specify a level with
the load object portion as well. */
void do_mpmload( CHAR_DATA *ch, char *argument )
{
    char            arg[ MAX_INPUT_LENGTH ];
    MOB_INDEX_DATA *pMobIndex;
    CHAR_DATA      *victim;

    if ( !IS_NPC( ch ) )
    {
	typo_message( ch );
	return;
    }

    if ( IS_SET( ch->act , ACT_PET ) || IS_AFFECTED( ch, AFF_CHARM ) )
      return;

    one_argument( argument, arg );

    if ( arg[0] == '\0' || !is_number(arg) )
    {
        sprintf( log_buf, "Mpmload - Bad vnum as arg: vnum %d name %s short %s.",
                ch->pIndexData->vnum, ch->name, ch->short_descr );
        bug( log_buf, -1 );
	return;
    }

    if ( ( pMobIndex = get_mob_index( atoi( arg ) ) ) == NULL )
    {
        sprintf( log_buf, "Mpmload - Bad mob vnum: vnum %d name %s short %s.",
                ch->pIndexData->vnum, ch->name, ch->short_descr );
        bug( log_buf, -1 );
	return;
    }

    victim = create_mobile( pMobIndex );
    char_to_room( victim, ch->in_room );
    return;
}
示例#9
0
void find_familiar( char_data* ch, obj_data* obj, int level,
  int species_list, int obj_list )
{
  char_data*      familiar;
  player_data*      pc;
  species_data*    species;
  int                    i;

  if( obj == NULL ) {
    bug( "Find_Familiar: Null Object as reagent!?" );
    return;
    }

  if( ( pc = player( ch ) ) == NULL )
    return;

  if( ch->shdata->level < LEVEL_APPRENTICE
    && is_set( ch->pcdata->pfile->flags, PLR_FAMILIAR ) ) {
    send( ch, "Nothing happens.\n\r" );
    send( ch, "You can only summon one familiar per level.\n\r" );
    return;
    }

  if( pc->familiar != NULL ) {
    send( ch, "Nothing happens.\n\r" );
    send( ch, "You can only have one familiar at a time.\n\r" );
    return;
    }

  for( i = 0; i < 10; i++ )
    if( obj->pIndexData->vnum
      == list_value[ obj_list ][ 10*(ch->shdata->alignment%3)+i ] )
      break;

  if( i == 10 ) {
    send( ch, "Nothing happens.\n\r" );
    return;
    }

  send( *ch->array, "%s disintegrates in a burst of blue flame.\n\r", obj );
  obj->Extract( 1 );

  if( number_range( 0,100 ) < 50-7*level+10*i ) {
    send( ch, "You feel the summoning fail.\n\r" );
    return;
    }

  i = list_value[ species_list ][ 10*(ch->shdata->alignment%3)+i ];

  if( ( species = get_species( i ) ) == NULL ) {
    bug( "Find_familiar: unknown species." );
    return;
    }

  familiar         = create_mobile( species );
  familiar->reset  = NULL;
  pc->familiar = familiar;

  set_bit( &familiar->status, STAT_PET );
  set_bit( &familiar->status, STAT_FAMILIAR );
  set_bit( ch->pcdata->pfile->flags, PLR_FAMILIAR );

  remove_bit( &familiar->status, STAT_AGGR_ALL );
  remove_bit( &familiar->status, STAT_AGGR_GOOD );
  remove_bit( &familiar->status, STAT_AGGR_EVIL );

  familiar->To( ch->array );

  send( ch,
    "%s comes to your summons, stepping from the shadows.\n\r",
    familiar );

  add_follower( familiar, ch );

  return;
}
示例#10
0
文件: shops.c 项目: smthbh/SWFotE-Mud
void do_buy( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    int maxgold;
    bool debit;
    OBJ_DATA *obj;    

    argument = one_argument( argument, arg );

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

    if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) )
    {
	char buf[MAX_STRING_LENGTH];
	CHAR_DATA *pet;
	ROOM_INDEX_DATA *pRoomIndexNext;
	ROOM_INDEX_DATA *in_room;

   if ( argument[0] == '\0' )
      debit = FALSE;
   else if ( !str_cmp( "atm", argument ) || !str_cmp( "debit", argument ) )
   {
      bool has_card = FALSE;
      
      for ( obj = ch->last_carrying; obj; obj = obj->prev_content )        
      {
          if ( obj->item_type == ITEM_DEBIT_CARD )
            has_card = TRUE;
      }   
      
     if ( has_card == TRUE )
      debit = TRUE;
     else
     {
       send_to_char( "You don't even have your card with you!\n\r", ch );
       return;    
     }    
    }

	if ( IS_NPC(ch) )
	    return;

	pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 );
	if ( !pRoomIndexNext )
	{
	    bug( "Do_buy: bad pet shop at vnum %d.", ch->in_room->vnum );
	    send_to_char( "Sorry, you can't buy that here.\n\r", ch );
	    return;
	}

	in_room     = ch->in_room;
	ch->in_room = pRoomIndexNext;
	pet         = get_char_room( ch, arg );
	ch->in_room = in_room;

	if ( pet == NULL || !IS_NPC( pet ) || !IS_SET(pet->act, ACT_PET) )
	{
	    send_to_char( "Sorry, you can't buy that here.\n\r", ch );
	    return;
	}

	if (( ch->gold < 10 * pet->top_level * pet->top_level ) && debit == FALSE)
	{
	    send_to_char( "You can't afford it.\n\r", ch );
	    return;
	}
	else if ( (ch->pcdata->bank < 10 * pet->top_level * pet->top_level) && debit == TRUE )
	{
	  send_to_char( "You dont have enough money in your bank account for it.\n\r", ch );
          return;    
        } 

	maxgold = 10 * pet->top_level * pet->top_level;
        if ( debit == FALSE )
	  ch->gold	-= maxgold; /* this was already here, btw */
	else
	  ch->pcdata->bank  -= maxgold;

	boost_economy( ch->in_room->area, maxgold );
	pet		= create_mobile( pet->pIndexData );
	SET_BIT(pet->act, ACT_PET);
	SET_BIT(pet->affected_by, AFF_CHARM);

	argument = one_argument( argument, arg );
	if ( arg[0] != '\0' )
	{
	    sprintf( buf, "%s %s", pet->name, arg );
	    STRFREE( pet->name );
	    pet->name = STRALLOC( buf );
	}

	sprintf( buf, "%sA neck tag says 'I belong to %s'.\n\r",
	    pet->description, ch->name );
	STRFREE( pet->description );
	pet->description = STRALLOC( buf );

	char_to_room( pet, ch->in_room );
	add_follower( pet, ch );
	send_to_char( "Enjoy your pet.\n\r", ch );
    	act( AT_ACTION, "$n bought $N as a pet.", ch, NULL, pet, TO_ROOM );
	return;
    }
    else
    {
	CHAR_DATA *keeper;
	int cost;
	int noi = 1;		/* Number of items */
	sh_int mnoi = 20;	/* Max number of items to be bought at once */

	if ( ( keeper = find_keeper( ch ) ) == NULL )
	    return;

	maxgold = keeper->top_level * 10;

	if ( is_number( arg ) )
	{
	    noi = atoi( arg );
	    argument = one_argument( argument, arg );
	    if ( noi > mnoi )
	    {
		act( AT_TELL, "$n tells you 'I don't sell that many items at"
		  " once.'", keeper, NULL, ch, TO_VICT );
		ch->reply = keeper;
		return;
	    }
	}

    if ( argument[0] == '\0' )
      debit = FALSE;
    else if ( !str_cmp( "atm", argument ) || !str_cmp( "debit", argument ) )
    {
      bool has_card = FALSE;
      
      for ( obj = ch->last_carrying; obj; obj = obj->prev_content )        
      {
          if ( obj->item_type == ITEM_DEBIT_CARD )
            has_card = TRUE;
      }   
      
      if ( has_card == TRUE )
       debit = TRUE;
      else
      {
        send_to_char( "You don't even have your card with you!\n\r", ch );
        return;    
      }    
     }  

	obj  = get_obj_carry( keeper, arg );
	
	if ( !obj && arg[0] == '#' )
        {     
              int onum, oref;
              bool ofound = FALSE;
              
              onum =0;
              oref = atoi(arg+1);
              for ( obj = keeper->last_carrying; obj; obj = obj->prev_content )
	      { 
	        if ( obj->wear_loc == WEAR_NONE
	        &&   can_see_obj( ch, obj ) )
	            onum++;
                if ( onum == oref ) 
                {
                    ofound = TRUE;
                    break;
                }
                else if ( onum > oref )
                   break;
	      }
	      if (!ofound)
	         obj = NULL;
        }
	if (keeper->home != NULL && obj->cost > 0)
          cost= obj->cost;
	cost = ( get_cost( ch, keeper, obj, TRUE ) * noi );

	if( !IS_NPC(ch) && ch->pcdata->learned[gsn_bargain] > 0 && ch->pcdata->learned[gsn_bargain] > number_percent())
	 {
	   ch_printf(ch,"You are able to bargain from %d credits to %d credits!\n\r", cost, (cost/3)+(cost/2));
	   cost = (cost/3) + (cost/2);
	   if(number_percent() > 50)
	    learn_from_success(ch, gsn_bargain);
	 }

	if ( cost <= 0 || !can_see_obj( ch, obj ) )
	{
	    act( AT_TELL, "$n tells you 'I don't sell that -- try 'list'.'",
		keeper, NULL, ch, TO_VICT );
	    ch->reply = keeper;
	    return;
	}

	if ( !IS_OBJ_STAT( obj, ITEM_INVENTORY ) && ( noi > 1 ) )
	{
	    interpret( keeper, "laugh" );
	    act( AT_TELL, "$n tells you 'I don't have enough of those in stock"
	     " to sell more than one at a time.'", keeper, NULL, ch, TO_VICT );
	    ch->reply = keeper;
	    return;
	}
	
	if ( ch->gold < cost && debit == FALSE)
	{
	    act( AT_TELL, "$n tells you 'You can't afford to buy $p.'",
		keeper, obj, ch, TO_VICT );
	    ch->reply = keeper;
	    return;
	}
	
        if ( ch->pcdata->bank < cost && debit == TRUE)
	{
	    send_to_char( "You are almost slide your card through, but you remember you don't have enough money!\n\r", ch );
	    return;	    
        }  

	if ( IS_SET(obj->extra_flags, ITEM_PROTOTYPE) 
             && get_trust( ch ) < LEVEL_IMMORTAL )
	{
	    act( AT_TELL, "$n tells you 'This is a only a prototype!  I can't sell you that...'", 
		keeper, NULL, ch, TO_VICT );
      	    ch->reply = keeper;
	    return;
	}

	if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) )
	{
	    send_to_char( "You can't carry that many items.\n\r", ch );
	    return;
	}

	if ( ch->carry_weight + ( get_obj_weight( obj ) * noi )
		+ (noi > 1 ? 2 : 0) > can_carry_w( ch ) )
	{
	    send_to_char( "You can't carry that much weight.\n\r", ch );
	    return;
	}

	if ( noi == 1 )
	{
	    if ( !IS_OBJ_STAT( obj, ITEM_INVENTORY ) )  
	       separate_obj( obj );
	    act( AT_ACTION, "$n buys $p.", ch, obj, NULL, TO_ROOM );
    	    act( AT_ACTION, "You buy $p.", ch, obj, NULL, TO_CHAR );
	}
        else
	{
	    sprintf( arg, "$n buys %d $p%s.", noi,
		( obj->short_descr[strlen(obj->short_descr)-1] == 's'
		? "" : "s" ) );
	    act( AT_ACTION, arg, ch, obj, NULL, TO_ROOM );
	    sprintf( arg, "You buy %d $p%s.", noi,
		( obj->short_descr[strlen(obj->short_descr)-1] == 's'
		? "" : "s" ) );
	    act( AT_ACTION, arg, ch, obj, NULL, TO_CHAR );
	    act( AT_ACTION, "$N puts them into a bag and hands it to you.",
		ch, NULL, keeper, TO_CHAR );
	}

        if ( debit == FALSE )
	  ch->gold     -= cost; /* this line was already here, btw */
        else if ( debit == TRUE )
          ch->pcdata->bank     -= cost;
	keeper->gold += cost;

	if ( keeper->gold > maxgold )
	{
	    boost_economy( keeper->in_room->area, keeper->gold - maxgold/2 );
	    keeper->gold = maxgold/2;
	    act( AT_ACTION, "$n puts some credits into a large safe.", keeper, NULL, NULL, TO_ROOM );
	}

	if ( IS_OBJ_STAT( obj, ITEM_INVENTORY ) )
	{
	    OBJ_DATA *buy_obj, *bag;

	    buy_obj = create_object( obj->pIndexData, obj->level );

	    /*
	     * Due to grouped objects and carry limitations in SMAUG
	     * The shopkeeper gives you a bag with multiple-buy,
	     * and also, only one object needs be created with a count
	     * set to the number bought.		-Thoric
	     */
	    if ( noi > 1 )
	    {
		bag = create_object( get_obj_index( OBJ_VNUM_SHOPPING_BAG ), 1 );
		/* perfect size bag ;) */
		bag->value[0] = bag->weight + (buy_obj->weight * noi);
		buy_obj->count = noi;
		obj->pIndexData->count += (noi - 1);
		numobjsloaded += (noi - 1);
		obj_to_obj( buy_obj, bag );
		obj_to_char( bag, ch );
	    }
	    else
		obj_to_char( buy_obj, ch );
	}
        else
	{
	    obj_from_char( obj );
	    obj_to_char( obj, ch );
	}

	return;
    }
}
示例#11
0
/*
 * Reset one room.
 */
void reset_room( ROOM_INDEX_DATA * room )
{
	RESET_DATA *pReset, *tReset, *gReset;
	OBJ_DATA *nestmap[MAX_NEST];
	CHAR_DATA *mob;
	OBJ_DATA *obj, *lastobj, *to_obj;
	ROOM_INDEX_DATA *pRoomIndex = NULL;
	MOB_INDEX_DATA *pMobIndex = NULL;
	OBJ_INDEX_DATA *pObjIndex = NULL, *pObjToIndex;
	EXIT_DATA *pexit;
	const char *filename = room->area->filename;
	int level = 0, n, num = 0, lastnest, onreset = 0;

	mob = NULL;
	obj = NULL;
	lastobj = NULL;
	if ( !room->first_reset )
		return;
	level = 0;
	for ( pReset = room->first_reset; pReset; pReset = pReset->next )
	{
		++onreset;
		switch ( pReset->command )
		{
			default:
				bug( "%s: %s: bad command %c.", __FUNCTION__, filename, pReset->command );
				break;

			case 'M':
				if ( !( pMobIndex = get_mob_index( pReset->arg1 ) ) )
				{
					bug( "%s: %s: 'M': bad mob vnum %d.", __FUNCTION__, filename, pReset->arg1 );
					continue;
				}
				if ( !( pRoomIndex = get_room_index( pReset->arg3 ) ) )
				{
					bug( "%s: %s: 'M': bad room vnum %d.", __FUNCTION__, filename, pReset->arg3 );
					continue;
				}
				if ( !pReset->sreset )
				{
					mob = NULL;
					break;
				}
				mob = create_mobile( pMobIndex );
				{
					ROOM_INDEX_DATA *pRoomPrev = get_room_index( pReset->arg3 - 1 );

					if ( pRoomPrev && xIS_SET( pRoomPrev->room_flags, ROOM_PET_SHOP ) )
						xSET_BIT( mob->act, ACT_PET );
				}
				if ( room_is_dark( pRoomIndex ) )
					xSET_BIT( mob->affected_by, AFF_INFRARED );
				mob->resetvnum = pRoomIndex->vnum;
				mob->resetnum = onreset;
				pReset->sreset = false;
				char_to_room( mob, pRoomIndex );
				level = URANGE( 0, mob->level - 2, LEVEL_AVATAR );

				if ( pReset->first_reset )
				{
					for ( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset )
					{
						++onreset;
						switch ( tReset->command )
						{
							case 'G':
							case 'E':
								if ( !( pObjIndex = get_obj_index( tReset->arg1 ) ) )
								{
									bug( "%s: %s: 'E' or 'G': bad obj vnum %d.", __FUNCTION__, filename, tReset->arg1 );
									continue;
								}
								if ( !mob )
								{
									lastobj = NULL;
									break;
								}

								if ( mob->pIndexData->pShop )
								{
									int olevel = generate_itemlevel( room->area, pObjIndex );

									obj = create_object( pObjIndex, olevel );
									xSET_BIT( obj->extra_flags, ITEM_INVENTORY );
								}
								else
									obj = create_object( pObjIndex, number_fuzzy( level ) );
								obj->level = URANGE( 0, obj->level, LEVEL_AVATAR );
								obj = obj_to_char( obj, mob );
								if ( tReset->command == 'E' )
								{
									if ( obj->carried_by != mob )
									{
										bug( "'E' reset: can't give object %d to mob %d.", obj->pIndexData->vnum, mob->pIndexData->vnum );
										break;
									}
									equip_char( mob, obj, tReset->arg3 );
								}
								for ( n = 0; n < MAX_NEST; n++ )
									nestmap[n] = NULL;
								nestmap[0] = obj;
								lastobj = nestmap[0];
								lastnest = 0;

								if ( tReset->first_reset )
								{
									for ( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset )
									{
										int iNest;

										to_obj = lastobj;

										++onreset;
										switch ( gReset->command )
										{
											case 'H':
												if ( !lastobj )
													break;
												xSET_BIT( lastobj->extra_flags, ITEM_HIDDEN );
												break;

											case 'P':
												if ( !( pObjIndex = get_obj_index( gReset->arg1 ) ) )
												{
													bug( "%s: %s: 'P': bad obj vnum %d.", __FUNCTION__, filename, gReset->arg1 );
													continue;
												}
												iNest = gReset->extra;

												if ( !( pObjToIndex = get_obj_index( gReset->arg3 ) ) )
												{
													bug( "%s: %s: 'P': bad objto vnum %d.", __FUNCTION__, filename, gReset->arg3 );
													continue;
												}
												if ( iNest >= MAX_NEST )
												{
													bug( "%s: %s: 'P': Exceeded nesting limit of %d", __FUNCTION__, filename, MAX_NEST );
													obj = NULL;
													break;
												}
												if ( count_obj_list( pObjIndex, to_obj->first_content ) > 0 )
												{
													obj = NULL;
													break;
												}

												if ( iNest < lastnest )
													to_obj = nestmap[iNest];
												else if ( iNest == lastnest )
													to_obj = nestmap[lastnest];
												else
													to_obj = lastobj;

												obj = create_object( pObjIndex, number_fuzzy( UMAX( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) );
												if ( num > 1 )
													pObjIndex->count += ( num - 1 );
												obj->count = gReset->arg2;
												obj->level = UMIN( obj->level, LEVEL_AVATAR );
												obj->count = gReset->arg2;
												obj_to_obj( obj, to_obj );
												if ( iNest > lastnest )
												{
													nestmap[iNest] = to_obj;
													lastnest = iNest;
												}
												lastobj = obj;
												/*
												 * Hackish fix for nested puts 
												 */
												if ( gReset->arg3 == OBJ_VNUM_MONEY_ONE )
													gReset->arg3 = to_obj->pIndexData->vnum;
												break;
										}
									}
								}
								break;
						}
					}
				}
				break;

			case 'O':
				if ( !( pObjIndex = get_obj_index( pReset->arg1 ) ) )
				{
					bug( "%s: %s: 'O': bad obj vnum %d.", __FUNCTION__, filename, pReset->arg1 );
					continue;
				}
				if ( !( pRoomIndex = get_room_index( pReset->arg3 ) ) )
				{
					bug( "%s: %s: 'O': bad room vnum %d.", __FUNCTION__, filename, pReset->arg3 );
					continue;
				}

				if ( count_obj_list( pObjIndex, pRoomIndex->first_content ) < 1 )
				{
					obj = create_object( pObjIndex, number_fuzzy( generate_itemlevel( room->area, pObjIndex ) ) );
					if ( num > 1 )
						pObjIndex->count += ( num - 1 );
					obj->count = pReset->arg2;
					obj->level = UMIN( obj->level, LEVEL_AVATAR );
					obj->cost = 0;
					obj_to_room( obj, pRoomIndex );
				}
				else
				{
					int x;

					if ( !( obj = get_obj_room( pObjIndex, pRoomIndex ) ) )
					{
						obj = NULL;
						lastobj = NULL;
						break;
					}
					obj->extra_flags = pObjIndex->extra_flags;
					for ( x = 0; x < 6; ++x )
						obj->value[x] = pObjIndex->value[x];
				}
				for ( n = 0; n < MAX_NEST; n++ )
					nestmap[n] = NULL;
				nestmap[0] = obj;
				lastobj = nestmap[0];
				lastnest = 0;
				if ( pReset->first_reset )
				{
					for ( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset )
					{
						int iNest;

						to_obj = lastobj;
						++onreset;

						switch ( tReset->command )
						{
							case 'H':
								if ( !lastobj )
									break;
								xSET_BIT( lastobj->extra_flags, ITEM_HIDDEN );
								break;

							case 'T':
								if ( !IS_SET( tReset->extra, TRAP_OBJ ) )
								{
									bug( "%s: Room reset found on object reset list", __FUNCTION__ );
									break;
								}
								else
								{
									/*
									 * We need to preserve obj for future 'T' checks 
									 */
									OBJ_DATA *pobj;

									if ( tReset->arg3 > 0 )
									{
										if ( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) )
										{
											bug( "%s: %s: 'T': bad objto vnum %d.", __FUNCTION__, filename, tReset->arg3 );
											continue;
										}
										if ( room->area->nplayer > 0 || !( to_obj = get_obj_type( pObjToIndex ) ) ||
											( to_obj->carried_by && !IS_NPC( to_obj->carried_by ) ) || is_trapped( to_obj ) )
											break;
									}
									else
									{
										if ( !lastobj || !obj )
											break;
										to_obj = obj;
									}
									pobj = make_trap( tReset->arg2, tReset->arg1, number_fuzzy( to_obj->level ), tReset->extra );
									obj_to_obj( pobj, to_obj );
								}
								break;

							case 'P':
								if ( !( pObjIndex = get_obj_index( tReset->arg1 ) ) )
								{
									bug( "%s: %s: 'P': bad obj vnum %d.", __FUNCTION__, filename, tReset->arg1 );
									continue;
								}
								iNest = tReset->extra;

								if ( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) )
								{
									bug( "%s: %s: 'P': bad objto vnum %d.", __FUNCTION__, filename, tReset->arg3 );
									continue;
								}

								if ( iNest >= MAX_NEST )
								{
									bug( "%s: %s: 'P': Exceeded nesting limit of %d. Room %d.", __FUNCTION__, filename, MAX_NEST, room->vnum );
									obj = NULL;
									break;
								}

								if ( count_obj_list( pObjIndex, to_obj->first_content ) > 0 )
								{
									obj = NULL;
									break;
								}
								if ( iNest < lastnest )
									to_obj = nestmap[iNest];
								else if ( iNest == lastnest )
									to_obj = nestmap[lastnest];
								else
									to_obj = lastobj;

								obj = create_object( pObjIndex, number_fuzzy( UMAX( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) );
								if ( num > 1 )
									pObjIndex->count += ( num - 1 );
								obj->count = tReset->arg2;
								obj->level = UMIN( obj->level, LEVEL_AVATAR );
								obj->count = tReset->arg2;
								obj_to_obj( obj, to_obj );
								if ( iNest > lastnest )
								{
									nestmap[iNest] = to_obj;
									lastnest = iNest;
								}
								lastobj = obj;
								/*
								 * Hackish fix for nested puts 
								 */
								if ( tReset->arg3 == OBJ_VNUM_MONEY_ONE )
									tReset->arg3 = to_obj->pIndexData->vnum;
								break;
						}
					}
				}
				break;

			case 'T':
				if ( IS_SET( pReset->extra, TRAP_OBJ ) )
				{
					bug( "%s: Object trap found in room %d reset list", __FUNCTION__, room->vnum );
					break;
				}
				else
				{
					if ( !( pRoomIndex = get_room_index( pReset->arg3 ) ) )
					{
						bug( "%s: %s: 'T': bad room %d.", __FUNCTION__, filename, pReset->arg3 );
						continue;
					}
					if ( room->area->nplayer > 0 || count_obj_list( get_obj_index( OBJ_VNUM_TRAP ), pRoomIndex->first_content ) > 0 )
						break;
					to_obj = make_trap( pReset->arg1, pReset->arg1, 10, pReset->extra );
					obj_to_room( to_obj, pRoomIndex );
				}
				break;

			case 'D':
				if ( !( pRoomIndex = get_room_index( pReset->arg1 ) ) )
				{
					bug( "%s: %s: 'D': bad room vnum %d.", __FUNCTION__, filename, pReset->arg1 );
					continue;
				}
				if ( !( pexit = get_exit( pRoomIndex, pReset->arg2 ) ) )
					break;
				switch ( pReset->arg3 )
				{
					case 0:
						REMOVE_BIT( pexit->exit_info, EX_CLOSED );
						REMOVE_BIT( pexit->exit_info, EX_LOCKED );
						break;
					case 1:
						SET_BIT( pexit->exit_info, EX_CLOSED );
						REMOVE_BIT( pexit->exit_info, EX_LOCKED );
						if ( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) )
							SET_BIT( pexit->exit_info, EX_SECRET );
						break;
					case 2:
						SET_BIT( pexit->exit_info, EX_CLOSED );
						SET_BIT( pexit->exit_info, EX_LOCKED );
						if ( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) )
							SET_BIT( pexit->exit_info, EX_SECRET );
						break;
				}
				break;

			case 'R':
				if ( !( pRoomIndex = get_room_index( pReset->arg1 ) ) )
				{
					bug( "%s: %s: 'R': bad room vnum %d.", __FUNCTION__, filename, pReset->arg1 );
					continue;
				}
				randomize_exits( pRoomIndex, pReset->arg2 - 1 );
				break;
		}
	}
}
示例#12
0
void do_resurrect(CHAR_DATA *ch, char *argument )
{
    char buf2[MAX_STRING_LENGTH];
    char buf [MAX_INPUT_LENGTH];
    char arg [MAX_STRING_LENGTH];
    CHAR_DATA *victim;
    AFFECT_DATA af;
    OBJ_DATA *obj;
    one_argument(argument,arg);
    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_WIZARD))
    {
        send_to_char("Huh?\n\r",ch);
        return;
    }
    if (arg[0] == '\0')
    {
        send_to_char("Resurrect what corpse?\n\r",ch);
        return;
    }
    if ( IS_CLASS(ch, CLASS_WIZARD) && ch->pcdata->powers[WL_SKILLS] < 1 )
    {
        stc("You need level 1 in Wizard Skills\n\r",ch);
        return;
    }
    if (ch->pcdata->followers > 5)
    {
        send_to_char("Nothing happens.\n\r",ch);
        return;
    }
    if ((obj = get_obj_carry(ch,arg)) == NULL)
    {
        send_to_char("You dont have that corpse.",ch);
        return;
    }
    if (obj->item_type != ITEM_CORPSE_NPC)
    {
        send_to_char("You can only Resurrect original corpses.\n\r",ch);
        return;
    }
    ch->pcdata->followers++;

    victim=create_mobile( get_mob_index( obj->value[2] ) );
    sprintf(buf,"Resurrection of %s",victim->short_descr);
    sprintf(buf2,"Resurrection of %s is here.\n\r",victim->short_descr);
    free_string(victim->short_descr);
    victim->short_descr = str_dup(buf);
    free_string(victim->name);
    SET_BIT(victim->act, ACT_NOEXP);
    if ( IS_SET(victim->act,ACT_QUEST) ) REMOVE_BIT(victim->act,ACT_QUEST);
    victim->name = str_dup(buf);
    free_string(victim->long_descr);
    victim->long_descr= str_dup(buf2);
    victim->spec_fun = NULL;
    sprintf(buf,"I invoke the rebirth of %s!",victim->name);
    do_say( ch, buf );
    sprintf(buf, "%s clambers back up to its feet.\n\r",obj->short_descr);
    act(buf,ch,NULL,NULL,TO_ROOM);
    send_to_char(buf,ch);
    char_to_room( victim, ch->in_room );

    WAIT_STATE(ch,10);
    extract_obj(obj);

    if(victim->level > ((ch->pcdata->upgrade_level + 1) * 500))
    {
        send_to_char("You are unable to control the resurrected creature.\n\r", ch);
        return;
    }

    add_follower( victim, ch );
    af.type      = skill_lookup ("charm person");
    af.duration  = 666;
    af.location  = APPLY_NONE;
    af.modifier  = 0;
    af.bitvector = AFF_CHARM;
    affect_to_char( victim, &af );
    sprintf(buf,"%s",victim->name);
    do_group(ch,buf);
    return;
}
示例#13
0
文件: db.c 项目: MUDOmnibus/Merc21
/*
 * Reset one area.
 */
void reset_area( AREA_DATA *pArea )
{
    RESET_DATA *pReset;
    CHAR_DATA *mob;
    bool last;
    int level;

    mob 	= NULL;
    last	= TRUE;
    level	= 0;
    for ( pReset = pArea->reset_first; pReset != NULL; pReset = pReset->next )
    {
	ROOM_INDEX_DATA *pRoomIndex;
	MOB_INDEX_DATA *pMobIndex;
	OBJ_INDEX_DATA *pObjIndex;
	OBJ_INDEX_DATA *pObjToIndex;
	EXIT_DATA *pexit;
	OBJ_DATA *obj;
	OBJ_DATA *obj_to;

	switch ( pReset->command )
	{
	default:
	    bug( "Reset_area: bad command %c.", pReset->command );
	    break;

	case 'M':
	    if ( ( pMobIndex = get_mob_index( pReset->arg1 ) ) == NULL )
	    {
		bug( "Reset_area: 'M': bad vnum %d.", pReset->arg1 );
		continue;
	    }

	    if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL )
	    {
		bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 );
		continue;
	    }

	    level = URANGE( 0, pMobIndex->level - 2, LEVEL_HERO );
	    if ( pMobIndex->count >= pReset->arg2 )
	    {
		last = FALSE;
		break;
	    }

	    mob = create_mobile( pMobIndex );

	    /*
	     * Check for pet shop.
	     */
	    {
		ROOM_INDEX_DATA *pRoomIndexPrev;
		pRoomIndexPrev = get_room_index( pRoomIndex->vnum - 1 );
		if ( pRoomIndexPrev != NULL
		&&   IS_SET(pRoomIndexPrev->room_flags, ROOM_PET_SHOP) )
		    SET_BIT(mob->act, ACT_PET);
	    }

	    if ( room_is_dark( pRoomIndex ) )
		SET_BIT(mob->affected_by, AFF_INFRARED);

	    char_to_room( mob, pRoomIndex );
	    level = URANGE( 0, mob->level - 2, LEVEL_HERO );
	    last  = TRUE;
	    break;

	case 'O':
	    if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL )
	    {
		bug( "Reset_area: 'O': bad vnum %d.", pReset->arg1 );
		continue;
	    }

	    if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL )
	    {
		bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 );
		continue;
	    }

	    if ( pArea->nplayer > 0
	    ||   count_obj_list( pObjIndex, pRoomIndex->contents ) > 0 )
	    {
		last = FALSE;
		break;
	    }

	    obj       = create_object( pObjIndex, number_fuzzy( level ) );
	    obj->cost = 0;
	    obj_to_room( obj, pRoomIndex );
	    last = TRUE;
	    break;

	case 'P':
	    if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL )
	    {
		bug( "Reset_area: 'P': bad vnum %d.", pReset->arg1 );
		continue;
	    }

	    if ( ( pObjToIndex = get_obj_index( pReset->arg3 ) ) == NULL )
	    {
		bug( "Reset_area: 'P': bad vnum %d.", pReset->arg3 );
		continue;
	    }

	    if ( pArea->nplayer > 0
	    || ( obj_to = get_obj_type( pObjToIndex ) ) == NULL
	    ||   obj_to->in_room == NULL
	    ||   count_obj_list( pObjIndex, obj_to->contains ) > 0 )
	    {
		last = FALSE;
		break;
	    }
	    
	    obj = create_object( pObjIndex, number_fuzzy( obj_to->level ) );
	    obj_to_obj( obj, obj_to );
	    last = TRUE;
	    break;

	case 'G':
	case 'E':
	    if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL )
	    {
		bug( "Reset_area: 'E' or 'G': bad vnum %d.", pReset->arg1 );
		continue;
	    }

	    if ( !last )
		break;

	    if ( mob == NULL )
	    {
		bug( "Reset_area: 'E' or 'G': null mob for vnum %d.",
		    pReset->arg1 );
		last = FALSE;
		break;
	    }

	    if ( mob->pIndexData->pShop != NULL )
	    {
		int olevel;

		switch ( pObjIndex->item_type )
		{
		default:		olevel = 0;                      break;
		case ITEM_PILL:		olevel = number_range(  0, 10 ); break;
		case ITEM_POTION:	olevel = number_range(  0, 10 ); break;
		case ITEM_SCROLL:	olevel = number_range(  5, 15 ); break;
		case ITEM_WAND:		olevel = number_range( 10, 20 ); break;
		case ITEM_STAFF:	olevel = number_range( 15, 25 ); break;
		case ITEM_ARMOR:	olevel = number_range(  5, 15 ); break;
		case ITEM_WEAPON:	olevel = number_range(  5, 15 ); break;
		}

		obj = create_object( pObjIndex, olevel );
		SET_BIT( obj->extra_flags, ITEM_INVENTORY );
	    }
	    else
	    {
		obj = create_object( pObjIndex, number_fuzzy( level ) );
	    }
	    obj_to_char( obj, mob );
	    if ( pReset->command == 'E' )
		equip_char( mob, obj, pReset->arg3 );
	    last = TRUE;
	    break;

	case 'D':
	    if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL )
	    {
		bug( "Reset_area: 'D': bad vnum %d.", pReset->arg1 );
		continue;
	    }

	    if ( ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL )
		break;

	    switch ( pReset->arg3 )
	    {
	    case 0:
		REMOVE_BIT( pexit->exit_info, EX_CLOSED );
		REMOVE_BIT( pexit->exit_info, EX_LOCKED );
		break;

	    case 1:
		SET_BIT(    pexit->exit_info, EX_CLOSED );
		REMOVE_BIT( pexit->exit_info, EX_LOCKED );
		break;

	    case 2:
		SET_BIT(    pexit->exit_info, EX_CLOSED );
		SET_BIT(    pexit->exit_info, EX_LOCKED );
		break;
	    }

	    last = TRUE;
	    break;

	case 'R':
	    if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL )
	    {
		bug( "Reset_area: 'R': bad vnum %d.", pReset->arg1 );
		continue;
	    }

	    {
		int d0;
		int d1;

		for ( d0 = 0; d0 < pReset->arg2 - 1; d0++ )
		{
		    d1                   = number_range( d0, pReset->arg2-1 );
		    pexit                = pRoomIndex->exit[d0];
		    pRoomIndex->exit[d0] = pRoomIndex->exit[d1];
		    pRoomIndex->exit[d1] = pexit;
		}
	    }
	    break;
	}
    }

    return;
}
示例#14
0
void gen_random_battle(CHAR_DATA *ch)
{
int monsters[10];
int i=0;
CHAR_DATA *leader;
CHAR_DATA *crone;
CHAR_DATA *wch;
int mob_top=0;
char buf[50];
int total=0;
int charcnt = 0;
MOB_INDEX_DATA *pMobIndex;

for (wch = ch->in_room->people; wch != NULL; wch = wch->next_in_room)
charcnt++;

pMobIndex = get_mob_index (number_range(20,30));
leader = create_mobile(pMobIndex);
total = ch->level + number_range(-6,4);

if(total > 100)
total = 99;

for(i=0;i<total;i++)
advance_level(leader,FALSE);

char_to_room (leader, ch->in_room);
charcnt--;

while(charcnt!=0)
{
pMobIndex = get_mob_index (number_range(20,30));
crone = create_mobile(pMobIndex);
total = ch->level + number_range(-6,4);

if(total > 100)
total = 99;

for(i=0;i<total;i++)
advance_level(crone,FALSE);

char_to_room (crone, ch->in_room);
charcnt--;
}

send_to_char("\n\r{c******{RRANDOM BATTLE!!!!{c******{x\n\r",ch);
sprintf(buf,"%s",ch->name);

do_kill(leader,buf);

sprintf(buf,"%d",leader->team);

charcnt += number_range(-2,3);

if(charcnt<1) charcnt = 1;

for (wch = ch->in_room->people; wch != NULL; wch = wch->next_in_room)
{
switch(atoi(buf))
{
case TEAM_BLUE: do_join(wch,"red"); break;
case TEAM_RED: do_join(wch,"blue"); break;
default: do_join(wch,"none"); break;
}
}

for (i=0;i!=charcnt-1;i++)
{

CHAR_DATA *mob;

pMobIndex = get_mob_index (monsters[number_range(0,mob_top-1)]);

if(pMobIndex == NULL)
continue;

mob = create_mobile(pMobIndex);
char_to_room (mob, ch->in_room);

total = ch->level + number_range(-6,4);
for(i=0;i<total;i++)
advance_level(mob,FALSE);

switch(atoi(buf))
{
case TEAM_BLUE: do_join(mob,"blue"); break;
case TEAM_RED: do_join(mob,"red");  break;
default: do_join(mob,"none");  break;
}

mob->in_room->turn=mob;
mob->AttackLeft=1;
mob->MoveLeft=3;
}

}
示例#15
0
void Drakes::WakenStone(CHAR_DATA & ch, const char * argument, int skill)
{
    // Check for location
    if (ch.in_room == NULL || !ON_GROUND(&ch))
    {
        send_to_char("You cannot reach the earth from this place.\n", &ch);
        return;
    }

    // Get the location's stone type and use it to lookup the drake info
    int stoneType(ch.in_room->stone_type);
    if (stoneType < 0) stoneType = ch.in_room->area->stone_type;
    const Info * info(Lookup(stoneType));
    if (info == NULL)
    {
        send_to_char("You probe your will into the earth, but cannot reach its stony heart from here.\n", &ch);
        return;
    }

    // Check whether an argument was provided
    if (argument[0] == '\0')
    {
        std::ostringstream mess;
        mess << "You probe your will into the earth, which resonates with a strong sense of ";
        mess << material_table[stoneType].name << ".\n";
        send_to_char(mess.str().c_str(), &ch);
        return;
    }

    // Check for an earth elemental pet present
    CHAR_DATA * elemental(get_char_room(&ch, argument));
    if (elemental == NULL)
    {
        send_to_char("You see nobody here by that name.\n", &ch);
        return;
    }

    // Verify the elemental
    if (ch.pet != elemental || elemental->master != &ch || !IS_NPC(elemental) || elemental->pIndexData->vnum != MOB_VNUM_EARTH_ELEMENTAL)
    {
        send_to_char("You may only waken an earth elemental which belongs to you.\n", &ch);
        return;
    }

    // Check for mana
    if (ch.mana < skill_table[gsn_wakenedstone].min_mana)
    {
        send_to_char("You lack the energy to waken stone right now.\n", &ch);
        return;
    }

    // Starting echoes
    act("You bind your will around $N, seeking a path from $M to the stony heart of the earth.", &ch, NULL, elemental, TO_CHAR);
    act("A steady murmur of energy flows back up the link, pouring into $N!", &ch, NULL, elemental, TO_CHAR);
    act("The ground begins to throb with energy, concentrated between $n and $N!", &ch, NULL, elemental, TO_ROOM);
    act("Shards of rock break and fall away from $M as you call out, waking the stone with your power!", &ch, NULL, elemental, TO_CHAR);
    act("$n calls out suddenly, and shards of rock break and fall away from $M!", &ch, NULL, elemental, TO_ROOM);

    // Check for skill success
    if (number_percent() <= skill)
    {
        // Make the base mob and adjust for age and type
        CHAR_DATA * drake(create_mobile(get_mob_index(MOB_VNUM_DRAKE)));
        AdjustDrake(ch, *drake, stoneType, *info, UMAX(ch.level, elemental->level), Hatchling);

        drake->hit = drake->max_hit;
        drake->mana = drake->max_mana;
        drake->move = drake->max_move;

        // Replace the elemental with the drake
        check_improve(&ch, NULL, gsn_wakenedstone, true, 1);
        char_to_room(drake, ch.in_room);
        ch.pet = drake;
        drake->master = &ch;
        drake->leader = &ch;

        // Success echo
        act("The last bits slough away, leaving behind $n.", drake, NULL, NULL, TO_ROOM);
    }
    else
    {
        // Failure echo
        act("You lose control, and $N crumbles away completely!", &ch, NULL, elemental, TO_CHAR);
        act("$N crumbles away completely, reduced to mere dust in moments.", &ch, NULL, elemental, TO_ROOM);
    }

    // Destroy the elemental
    elemental->master = NULL;
    extract_char(elemental, true);

    // Charge mana and lag
    expend_mana(&ch, skill_table[gsn_wakenedstone].min_mana);
    WAIT_STATE(&ch, skill_table[gsn_wakenedstone].beats);
}
示例#16
0
CHAR_DATA *load_mobile( FILE * fp )
{
   CHAR_DATA *mob = NULL;
   const char *word;
   bool fMatch;
   int inroom = 0;
   ROOM_INDEX_DATA *pRoomIndex = NULL;

   word = feof( fp ) ? "EndMobile" : fread_word( fp );
   if( !str_cmp( word, "Vnum" ) )
   {
      int vnum;

      vnum = fread_number( fp );
      if( get_mob_index( vnum ) == NULL )
      {
         bug( "%s: No index data for vnum %d", __FUNCTION__, vnum );
         return NULL;
      }
      mob = create_mobile( get_mob_index( vnum ) );
      if( !mob )
      {
         for( ;; )
         {
            word = feof( fp ) ? "EndMobile" : fread_word( fp );
            /*
             * So we don't get so many bug messages when something messes up
             * * --Shaddai 
             */
            if( !str_cmp( word, "EndMobile" ) )
               break;
         }
         bug( "%s: Unable to create mobile for vnum %d", __FUNCTION__, vnum );
         return NULL;
      }
   }
   else
   {
      for( ;; )
      {
         word = feof( fp ) ? "EndMobile" : fread_word( fp );
         /*
          * So we don't get so many bug messages when something messes up
          * * --Shaddai 
          */
         if( !str_cmp( word, "EndMobile" ) )
            break;
      }
      extract_char( mob, TRUE );
      bug( "%s: Vnum not found", __FUNCTION__ );
      return NULL;
   }

   for( ;; )
   {
      word = feof( fp ) ? "EndMobile" : fread_word( fp );
      fMatch = FALSE;
      switch ( UPPER( word[0] ) )
      {
         case '*':
            fMatch = TRUE;
            fread_to_eol( fp );
            break;

         case '#':
            if( !str_cmp( word, "#OBJECT" ) )
            {
               mob->tempnum = -9999;   /* Hackish, yes. Works though doesn't it? */
               fread_obj( mob, fp, OS_CARRY );
            }
            break;

         case 'A':
            if( !str_cmp( word, "Affect" ) || !str_cmp( word, "AffectData" ) )
            {
               AFFECT_DATA *paf;

               CREATE( paf, AFFECT_DATA, 1 );
               if( !str_cmp( word, "Affect" ) )
               {
                  paf->type = fread_number( fp );
               }
               else
               {
                  int sn;
                  const char *sname = fread_word( fp );

                  if( ( sn = skill_lookup( sname ) ) < 0 )
                  {
                     if( ( sn = herb_lookup( sname ) ) < 0 )
                        bug( "%s", "load_mobile: unknown skill." );
                     else
                        sn += TYPE_HERB;
                  }
                  paf->type = sn;
               }

               paf->duration = fread_number( fp );
               paf->modifier = fread_number( fp );
               paf->location = fread_number( fp );
               if( paf->location == APPLY_WEAPONSPELL
                   || paf->location == APPLY_WEARSPELL
                   || paf->location == APPLY_REMOVESPELL || paf->location == APPLY_STRIPSN )
                  paf->modifier = slot_lookup( paf->modifier );
               paf->bitvector = fread_bitvector( fp );
               LINK( paf, mob->first_affect, mob->last_affect, next, prev );
               fMatch = TRUE;
               break;
            }
            KEY( "AffectedBy", mob->affected_by, fread_bitvector( fp ) );
            break;

#ifdef OVERLANDCODE
         case 'C':
            if( !str_cmp( word, "Coordinates" ) )
            {
               mob->x = fread_number( fp );
               mob->y = fread_number( fp );
               mob->map = fread_number( fp );

               fMatch = TRUE;
               break;
            }
            break;
#endif

         case 'D':
            if( !str_cmp( word, "Description" ) )
            {
               STRFREE( mob->description );
               mob->description = fread_string( fp );
               fMatch = TRUE;
               break;
            }
            break;

         case 'E':
            if( !str_cmp( word, "EndMobile" ) )
            {
               if( inroom == 0 )
                  inroom = ROOM_VNUM_LIMBO;
               pRoomIndex = get_room_index( inroom );
               if( !pRoomIndex )
                  pRoomIndex = get_room_index( ROOM_VNUM_LIMBO );
               char_to_room( mob, pRoomIndex );
               mob->tempnum = -9998;   /* Yet another hackish fix! */
               update_room_reset( mob, FALSE );
               return mob;
            }
            if( !str_cmp( word, "End" ) ) /* End of object, need to ignore this. sometimes they creep in there somehow -- Scion */
               fMatch = TRUE; /* Trick the system into thinking it matched something */
            break;

         case 'F':
            KEY( "Flags", mob->act, fread_number( fp ) );
            break;

         case 'G':
            KEY( "Gold", mob->gold, fread_number( fp ) );
            break;

         case 'H':
            if( !str_cmp( word, "HpManaMove" ) )
            {
               mob->hit = fread_number( fp );
               mob->max_hit = fread_number( fp );
               mob->mana = fread_number( fp );
               mob->max_mana = fread_number( fp );
               mob->move = fread_number( fp );
               mob->max_move = fread_number( fp );

               if( mob->max_move <= 0 )
                  mob->max_move = 150;

               fMatch = TRUE;
               break;
            }
            break;

         case 'L':
            if( !str_cmp( word, "Long" ) )
            {
               STRFREE( mob->long_descr );
               mob->long_descr = fread_string( fp );
               fMatch = TRUE;
               break;
            }
            KEY( "Level", mob->top_level, fread_number( fp ) );
            break;

         case 'M':
            if( !str_cmp( word, "Mobclan" ) )
            {
               STRFREE( mob->mob_clan );
               mob->mob_clan = fread_string( fp );
               fMatch = TRUE;
               break;
            }
            break;

         case 'N':
            if( !str_cmp( word, "Name" ) )
            {
               STRFREE( mob->name );
               mob->name = fread_string( fp );
               fMatch = TRUE;
               break;
            }
            break;

         case 'P':
            KEY( "Position", mob->position, fread_number( fp ) );
            break;

         case 'R':
            KEY( "Room", inroom, fread_number( fp ) );
            KEY( "Resetvnum", mob->resetvnum, fread_number( fp ) );
            KEY( "Resetnum", mob->resetnum, fread_number( fp ) );
            break;

         case 'S':
            if( !str_cmp( word, "Short" ) )
            {
               STRFREE( mob->short_descr );
               mob->short_descr = fread_string( fp );
               fMatch = TRUE;
               break;
            }
            break;
      }
      if( !fMatch && str_cmp( word, "End" ) )
         bug( "%s: no match: %s", __FUNCTION__, word );
   }
   return NULL;
}
示例#17
0
void do_buy_mount( CHAR_DATA *ch, char *argument )
{
    int cost,roll;
    char arg[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    char color[80], name[30], size[30];
    CHAR_DATA *mount;
    ROOM_INDEX_DATA *pRoomIndexNext;
    ROOM_INDEX_DATA *in_room;
    
    name[0] = '\0';
    size[0] = '\0';
    color[0] = '\0'; 

    if ( IS_NPC(ch) )
        return;

    if (!IS_NPC(ch) && !ch->pcdata->learned[gsn_riding])
    {
	send_to_char("How do you expect to buy a horse when you can't even ride?\n\r", ch);
        return;
    }

    argument = one_argument(argument,arg);

    pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 );

    if ( pRoomIndexNext == NULL )
    {
	bug( "Do_buy: bad mount shop at vnum %d.", ch->in_room->vnum );
        send_to_char( "I'm afraid the stalls where I keep my mounts don't exist.\n\r", ch );
        return;
    }

    in_room     = ch->in_room;
    ch->in_room = pRoomIndexNext;
    mount       = get_char_room( ch, arg );
    ch->in_room = in_room;

    if ( mount == NULL)
    {
	send_to_char( "Sorry, we don't sell any of those here.\n\r", ch );
	return;
    }

    if ( !IS_SET(mount->act3, ACT3_MOUNT) )
    {
	send_to_char( "Sorry, we don't sell any of those here.\n\r", ch );
	return;
    }
 
    if ( MOUNTED(ch) || ch->mount != NULL)
    {
        send_to_char("You already have a mount.\n\r",ch);
        return;
    }

    cost = 100 * ch->level;
    
    if ( ch->gold < cost )
    {
	send_to_char( "You can't afford it.\n\r", ch );
	return;
    }
 
    roll = number_percent();

    if (!IS_NPC(ch) && roll < ch->pcdata->learned[gsn_haggle])
    {
        cost -= cost / 2 * roll / 100;
        sprintf(buf,"You haggle the price down to %d coins.\n\r",cost);
        send_to_char(buf,ch);
        check_improve(ch,gsn_haggle,TRUE,4);
    }

    ch->gold -= cost;
    mount = create_mobile( mount->pIndexData );
        
    mount->comm = COMM_NOTELL|COMM_NOSHOUT|COMM_NOCHANNELS;
    mount->max_hit  = mount->hit  = (ch->level * 4) - (25 + number_range(1,50));
    if( mount->max_hit < 25 ) 
        mount->max_hit = mount->hit = 25;
    mount->max_mana = mount->mana = 50;
    mount->max_move = mount->move = 200 + ch->level * 10;
    mount->level = ch->level / 1.25;
    mount->sex = ch->sex;

    switch( number_range(1,11) )
    {
	case 1:  strcpy(color, "dappled grey" );		break;
        case 2:  strcpy(color, "charcoal grey" );               break;
        case 3:  strcpy(color, "midnight black" );              break;
        case 4:  strcpy(color, "dark burgundy" );               break;
        case 5:  strcpy(color, "cream yellow" );                break;
        case 6:  strcpy(color, "pure white");                   break;
        case 7:  strcpy(color, "dark brown");                   break;
        case 8:  strcpy(color, "light brown");                  break;
        case 9:  strcpy(color, "white and brown spotted");  	break;
        case 10: strcpy(color, "black and white spotted");  	break;
        case 11: strcpy(color, "purple and green striped"); 
                 strcpy(size,  "mutant ");
                 mount->hit     += 100;
                 mount->max_hit += 100;                        	break;
    }        

    if( ch->level >= 41 )
    {
	strcpy(name, "pegasus"); 
        SET_BIT(mount->affected_by, AFF_FLYING); 
    }
    else if( ch->level >= 30 )
    {
	if (ch->sex == 1)
	    strcpy(name, "gelding"); 
	else
	{
	    strcpy(name, "mare");
	    strcat(size, "majestic ");
	}
    }
    else if( ch->level >= 20 )
    {
	if (ch->sex == 1)
	    strcpy(name, "stallion"); 
	else
	    strcpy(name, "mare");
    }
    else if( ch->level >= 15 )
    {
	strcpy(name, "horse");  
    }
    else if( ch->level >= 10 )
    {
	strcpy(name, "horse");
	strcat(size, "small ");
    }
    else
    {
	strcpy(name, "pony");
    }

    argument = one_argument( argument, arg );

    if ( arg[0] != '\0' )
        sprintf( buf, "%s %s", name, arg );
    else
        sprintf( buf, "%s", name );
    free_string( mount->name );
    mount->name = str_dup( buf );

    sprintf( buf, "a %s%s %s", size, color, name );
    free_string( mount->short_descr );
    mount->short_descr = str_dup( buf );

    sprintf( buf, "A %s%s %s is standing here.\n\r", size, color, name );
    free_string( mount->long_descr );
    mount->long_descr = str_dup( buf );

    sprintf( buf, "%sThe name %s is branded on its hind leg.\n\r",
             mount->description, ch->name );
    free_string( mount->description );
    mount->description = str_dup( buf );

    char_to_room( mount, ch->in_room );
    add_follower( mount, ch );

    act( "$n bought $N as a mount.", ch, NULL, mount, TO_ROOM );
    
    sprintf( buf, "Enjoy your %s.\n\r", name );
    send_to_char( buf, ch);
    
    do_mount( ch, name );

    return;
}