Beispiel #1
0
void record_map_position(int index, int x, int y, uint8_t value) {
  if (in_arena(x, y))
    map[index][buffer_index_from_x_y(x, y)] = value;
}
Beispiel #2
0
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;
   }
}
Beispiel #3
0
/*
 * Make a corpse out of a character.
 */
OBJ_DATA *make_corpse( CHAR_DATA * ch, CHAR_DATA * killer )
{
   char buf[MAX_STRING_LENGTH];
   OBJ_DATA *corpse;
   OBJ_DATA *obj;
   OBJ_DATA *obj_next;
   const char *name;

   if( IS_NPC( ch ) )
   {
      name = ch->short_descr;
      corpse = create_object( get_obj_index( OBJ_VNUM_CORPSE_NPC ), 0 );
      corpse->timer = 6;
      if( ch->gold > 0 )
      {
         if( ch->in_room )
         {
            ch->in_room->area->gold_looted += ch->gold;
            sysdata.global_looted += ch->gold / 100;
         }
         obj_to_obj( create_money( ch->gold ), corpse );
         ch->gold = 0;
      }

/* Cannot use these!  They are used.
	corpse->value[0] = (int)ch->pIndexData->vnum;
	corpse->value[1] = (int)ch->max_hit;
*/
/*	Using corpse cost to cheat, since corpses not sellable */
      corpse->cost = ( -( int )ch->pIndexData->vnum );
      corpse->value[2] = corpse->timer;
   }
   else
   {
      name = ch->name;
      corpse = create_object( get_obj_index( OBJ_VNUM_CORPSE_PC ), 0 );
      if( in_arena( ch ) )
         corpse->timer = 0;
      else
         corpse->timer = 40;
      corpse->value[2] = ( int )( corpse->timer / 8 );
      corpse->value[4] = ch->level;
      if( CAN_PKILL( ch ) && sysdata.pk_loot )
         xSET_BIT( corpse->extra_flags, ITEM_CLANCORPSE );
      /*
       * Pkill corpses get save timers, in ticks (approx 70 seconds)
       * This should be anough for the killer to type 'get all corpse'. 
       */
      if( !IS_NPC( ch ) && !IS_NPC( killer ) )
         corpse->value[3] = 1;
      else
         corpse->value[3] = 0;
   }

   if( CAN_PKILL( ch ) && CAN_PKILL( killer ) && ch != killer )
   {
      snprintf( buf, MAX_STRING_LENGTH, "%s", killer->name );
      STRFREE( corpse->action_desc );
      corpse->action_desc = STRALLOC( buf );
   }

   /*
    * Added corpse name - make locate easier , other skills 
    */
   snprintf( buf, MAX_STRING_LENGTH, "corpse %s", name );
   STRFREE( corpse->name );
   corpse->name = STRALLOC( buf );

   snprintf( buf, MAX_STRING_LENGTH, corpse->short_descr, name );
   STRFREE( corpse->short_descr );
   corpse->short_descr = STRALLOC( buf );

   snprintf( buf, MAX_STRING_LENGTH, corpse->description, name );
   STRFREE( corpse->description );
   corpse->description = STRALLOC( buf );

   for( obj = ch->first_carrying; obj; obj = obj_next )
   {
      obj_next = obj->next_content;
      obj_from_char( obj );
      if( IS_OBJ_STAT( obj, ITEM_INVENTORY ) || IS_OBJ_STAT( obj, ITEM_DEATHROT ) )
         extract_obj( obj );
      else
         obj_to_obj( obj, corpse );
   }
   return obj_to_room( corpse, ch->in_room );
}