OBJ_DATA *raw_kill( CHAR_DATA * ch, CHAR_DATA * victim )
{
CHAR_DATA *victmp;
CLAN_DATA *clan;
OBJ_DATA *corpse_to_return = NULL;
OBJ_DATA *obj, *obj_next;
SHIP_DATA *ship;
PLANET_DATA *planet;
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
char arg[MAX_STRING_LENGTH];
if( !victim )
{
bug( "%s: null victim!", __FUNCTION__ );
return NULL;
}
strcpy( arg, victim->name );
stop_fighting( victim, TRUE );
if( ch && !IS_NPC( ch ) && !IS_NPC( victim ) )
claim_disintigration( ch, victim );
/*
* Take care of polymorphed chars
*/
if( IS_NPC( victim ) && IS_SET( victim->act, ACT_POLYMORPHED ) )
{
char_from_room( victim->desc->original );
char_to_room( victim->desc->original, victim->in_room );
victmp = victim->desc->original;
do_revert( victim, "" );
return raw_kill( ch, victmp );
}
if( victim->in_room && IS_NPC( victim ) && victim->vip_flags != 0 && victim->in_room->area
&& victim->in_room->area->planet )
{
victim->in_room->area->planet->population--;
victim->in_room->area->planet->population = UMAX( victim->in_room->area->planet->population, 0 );
victim->in_room->area->planet->pop_support -= ( float )( 1 + 1 / ( victim->in_room->area->planet->population + 1 ) );
if( victim->in_room->area->planet->pop_support < -100 )
victim->in_room->area->planet->pop_support = -100;
}
if( !IS_NPC( victim ) || !IS_SET( victim->act, ACT_NOKILL ) )
mprog_death_trigger( ch, victim );
if( char_died( victim ) )
return NULL;
if( !IS_NPC( victim ) || !IS_SET( victim->act, ACT_NOKILL ) )
rprog_death_trigger( ch, victim );
if( char_died( victim ) )
return NULL;
if( !IS_NPC( victim ) || ( !IS_SET( victim->act, ACT_NOKILL ) && !IS_SET( victim->act, ACT_NOCORPSE ) ) )
corpse_to_return = make_corpse( victim, ch );
else
{
for( obj = victim->last_carrying; obj; obj = obj_next )
{
obj_next = obj->prev_content;
obj_from_char( obj );
extract_obj( obj );
}
}
if( IS_NPC( victim ) )
{
victim->pIndexData->killed++;
extract_char( victim, TRUE );
victim = NULL;
return corpse_to_return;
}
planet = victim->in_room->area->planet;
if( !planet )
{
if( get_age( victim ) >= 50 )
{
sprintf( buf, "&CAn old &W%s &Cnamed &W%s&C, has just lost %s life, on &WUnknown&C!\n\r",
capitalize( get_race( victim ) ), victim->name,
victim->sex == SEX_MALE ? "his" : victim->sex == SEX_FEMALE ? "her" : "its" );
infochan( buf );
}
else if( get_age( victim ) <= 49 )
{
sprintf( buf, "&CA young &W%s &Cnamed &W%s&C, has just lost %s life, on &WUnknown&C!\n\r",
capitalize( get_race( victim ) ), victim->name,
victim->sex == SEX_MALE ? "his" : victim->sex == SEX_FEMALE ? "her" : "its" );
infochan( buf );
}
else
{
sprintf( buf, "&CA &W%s &Chas just lost %s life, on &WUnknown&C!\n\r", capitalize( get_race( victim ) ),
victim->sex == SEX_MALE ? "his" : victim->sex == SEX_FEMALE ? "her" : "its" );
infochan( buf );
}
}
else
{
if( get_age( victim ) >= 50 )
{
sprintf( buf, "&CAn old &W%s &Cnamed &W%s&C, has just lost %s life, on &W%s&C!\n\r",
capitalize( get_race( victim ) ), victim->name,
victim->sex == SEX_MALE ? "his" : victim->sex == SEX_FEMALE ? "her" : "its", planet->name );
infochan( buf );
}
else if( get_age( victim ) <= 49 )
{
sprintf( buf, "&CA young &W%s &Cnamed &W%s&C, has just lost %s life, on &W%s&C!\n\r",
capitalize( get_race( victim ) ), victim->name,
victim->sex == SEX_MALE ? "his" : victim->sex == SEX_FEMALE ? "her" : "its", planet->name );
infochan( buf );
}
else
{
sprintf( buf, "&CA &W%s &Chas just lost %s life, on &W%s&C!\n\r", capitalize( get_race( victim ) ),
victim->sex == SEX_MALE ? "his" : victim->sex == SEX_FEMALE ? "her" : "its", planet->name );
infochan( buf );
}
}
set_char_color( AT_DIEMSG, victim );
do_help( victim, "_DIEMSG_" );
/* swreality changes begin here */
/*
* Check if they have an ongoing auction
*/
if( auction->item && ( auction->seller == victim ) )
{
talk_auction( "Auction has been halted." );
obj_to_char( auction->item, auction->seller );
auction->item = NULL;
if( auction->buyer != NULL && auction->buyer != auction->seller )
{
auction->buyer->gold += auction->bet;
send_to_char( "&YYour money has been returned.\n\r", auction->buyer );
}
}
for( ship = first_ship; ship; ship = ship->next )
{
if( !str_cmp( ship->owner, victim->name ) )
{
STRFREE( ship->owner );
ship->owner = STRALLOC( "" );
STRFREE( ship->pilot );
ship->pilot = STRALLOC( "" );
STRFREE( ship->copilot );
ship->copilot = STRALLOC( "" );
save_ship( ship );
}
}
close_accounts( victim->name );
if( victim->plr_home )
{
ROOM_INDEX_DATA *room = victim->plr_home;
STRFREE( room->name );
room->name = STRALLOC( "An Empty Apartment" );
if( IS_SET( room->room_flags, ROOM_PLR_HOME ) )
REMOVE_BIT( room->room_flags, ROOM_PLR_HOME );
SET_BIT( room->room_flags, ROOM_EMPTY_HOME );
fold_area( room->area, room->area->filename, FALSE );
}
if( victim->pcdata->vendor )
remove_vendor( victim, get_char_world( victim, victim->pcdata->vendor->player_name ) );
clan = victim->pcdata->clan;
if( victim->pcdata && victim->pcdata->clan )
{
if( !str_cmp( victim->name, victim->pcdata->clan->leader ) )
{
STRFREE( victim->pcdata->clan->leader );
if( victim->pcdata->clan->number1 )
{
victim->pcdata->clan->leader = STRALLOC( victim->pcdata->clan->number1 );
STRFREE( victim->pcdata->clan->number1 );
victim->pcdata->clan->number1 = STRALLOC( "" );
}
else if( victim->pcdata->clan->number2 )
{
victim->pcdata->clan->leader = STRALLOC( victim->pcdata->clan->number2 );
STRFREE( victim->pcdata->clan->number2 );
victim->pcdata->clan->number2 = STRALLOC( "" );
}
else
victim->pcdata->clan->leader = STRALLOC( "" );
}
if( !str_cmp( victim->name, victim->pcdata->clan->number1 ) )
{
STRFREE( victim->pcdata->clan->number1 );
if( victim->pcdata->clan->number2 )
{
victim->pcdata->clan->number1 = STRALLOC( victim->pcdata->clan->number2 );
STRFREE( victim->pcdata->clan->number2 );
victim->pcdata->clan->number2 = STRALLOC( "" );
}
else
victim->pcdata->clan->number1 = STRALLOC( "" );
}
if( !str_cmp( victim->name, victim->pcdata->clan->number2 ) )
{
STRFREE( victim->pcdata->clan->number2 );
victim->pcdata->clan->number1 = STRALLOC( "" );
}
if( victim->pcdata->clanlevel == 1 )
{
if( clan->roster_1[0] != '\0' )
{
char roster_1[MAX_STRING_LENGTH];
char *members;
members = clan->roster_1;
roster_1[0] = '\0';
while( members[0] != '\0' )
{
members = one_argument( members, arg );
if( str_cmp( victim->name, arg ) )
{
arg[0] = UPPER( arg[0] );
if( roster_1[0] != '\0' )
strcat( roster_1, " " );
else
strcat( roster_1, "" );
strcat( roster_1, arg );
}
}
STRFREE( clan->roster_1 );
clan->roster_1 = STRALLOC( roster_1 );
}
}
if( victim->pcdata->clanlevel == 2 )
{
if( clan->roster_2[0] != '\0' )
{
char roster_2[MAX_STRING_LENGTH];
char *members;
members = clan->roster_2;
roster_2[0] = '\0';
while( members[0] != '\0' )
{
members = one_argument( members, arg );
if( str_cmp( victim->name, arg ) )
{
arg[0] = UPPER( arg[0] );
if( roster_2[0] != '\0' )
strcat( roster_2, " " );
else
strcat( roster_2, "" );
strcat( roster_2, arg );
}
}
STRFREE( clan->roster_2 );
clan->roster_2 = STRALLOC( roster_2 );
}
}
if( victim->pcdata->clanlevel == 3 )
{
if( clan->roster_3[0] != '\0' )
{
char roster_3[MAX_STRING_LENGTH];
char *members;
members = clan->roster_3;
roster_3[0] = '\0';
while( members[0] != '\0' )
{
members = one_argument( members, arg );
if( str_cmp( victim->name, arg ) )
{
arg[0] = UPPER( arg[0] );
if( roster_3[0] != '\0' )
strcat( roster_3, " " );
else
strcat( roster_3, "" );
strcat( roster_3, arg );
}
}
STRFREE( clan->roster_3 );
clan->roster_3 = STRALLOC( roster_3 );
}
}
if( victim->pcdata->clanlevel == 4 )
{
if( clan->roster_4[0] != '\0' )
{
char roster_4[MAX_STRING_LENGTH];
char *members;
members = clan->roster_4;
roster_4[0] = '\0';
while( members[0] != '\0' )
{
members = one_argument( members, arg );
if( str_cmp( victim->name, arg ) )
{
arg[0] = UPPER( arg[0] );
if( roster_4[0] != '\0' )
strcat( roster_4, " " );
else
strcat( roster_4, "" );
strcat( roster_4, arg );
}
}
STRFREE( clan->roster_4 );
clan->roster_4 = STRALLOC( roster_4 );
}
}
if( victim->pcdata->clanlevel == 5 )
{
if( clan->roster_5[0] != '\0' )
{
char roster_5[MAX_STRING_LENGTH];
char *members;
members = clan->roster_5;
roster_5[0] = '\0';
while( members[0] != '\0' )
{
members = one_argument( members, arg );
if( str_cmp( victim->name, arg ) )
{
arg[0] = UPPER( arg[0] );
if( roster_5[0] != '\0' )
strcat( roster_5, " " );
else
strcat( roster_5, "" );
strcat( roster_5, arg );
}
}
STRFREE( clan->roster_5 );
clan->roster_5 = STRALLOC( roster_5 );
}
}
victim->pcdata->clan->members--;
}
if( !victim )
{
DESCRIPTOR_DATA *d;
/*
* Make sure they aren't halfway logged in.
*/
for( d = first_descriptor; d; d = d->next )
if( ( victim = d->character ) && !IS_NPC( victim ) )
break;
if( d )
close_socket( d, TRUE );
}
else
{
int x, y;
quitting_char = victim;
save_char_obj( victim );
saving_char = NULL;
extract_char( victim, TRUE );
for( x = 0; x < MAX_WEAR; x++ )
for( y = 0; y < MAX_LAYERS; y++ )
save_equipment[x][y] = NULL;
}
sprintf( buf, "%s%c/%s", PLAYER_DIR, tolower( arg[0] ), capitalize( arg ) );
sprintf( buf2, "%s%c/%s", BACKUP_DIR, tolower( arg[0] ), capitalize( arg ) );
rename( buf, buf2 );
sprintf( buf, "%s%c/%s.clone", PLAYER_DIR, tolower( arg[0] ), capitalize( arg ) );
sprintf( buf2, "%s%c/%s", PLAYER_DIR, tolower( arg[0] ), capitalize( arg ) );
rename( buf, buf2 );
return corpse_to_return;
}