interp.h add the following: DECLARE_DO_FUN( do_award );
-------------------------------------------------------------------------------- interp.c
add the following: { "award", do_award, POS_DEAD, IM, LOG_ALWAYS, 1 },
--------------------------------------------------------------------------------
/***********************************************************************
* Award was written by Robbert of The Inquisition MUD. Use of this *
* code is held to the same licensing agreements of ROM, Diku, et al. *
* If you use this code, either in its entirety or as a basis for *
* something of your own, this header must be included with the file. *
***********************************************************************/
void do_reward(CHAR_DATA *ch, char *argument)
/*
*Written by Robbert for The Inquisition!
*webmaster@theinquisition.net
*modified by Synon
*synch23@titan.kyndig.com
*/
{
CHAR_DATA *victim;
DESCRIPTOR_DATA *d;
char buf [MSL];
char arg1 [MSL];
char arg2 [MSL];
char arg3 [MSL];
int value;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
argument = one_argument( argument, arg3 );
if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) || arg3[0] == '\0' )
{
send_to_char( "Syntax: award <char | all> <amount> <type>.\n\r", ch);
send_to_char( "Valid types are: qp | exp\n\r", ch );
return;
}
if ( !str_cmp( arg1, "all" ) )
{
value = atoi( arg2 );
if ( value < -1000 || value > 1000 )
{
send_to_char( "Award range is -1000 to 1000.\n\r", ch );
return;
}
if ( value == 0 )
{
send_to_char( "Value cannot be 0.\n\r", ch );
return;
}
if ( !str_cmp( arg3, "qp" ) )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
victim = d->character;
if ( victim == NULL || IS_NPC(victim) || victim == ch || victim->level >= LEVEL_IMMORTAL )
continue;
if ( value > 0 )
{
victim->pcdata->questpoints += value;
printf_to_char( victim, "{BYou have been awarded {Y%d{x Quest Points by %s!\n\r", value, ch->name );
}
else
{
victim->pcdata->questpoints += value;
sprintf( buf, "{RYou have been penalized {Y%d{x Quest Points by %s!\n\r", value, ch->name );
send_to_char( buf, victim );
}
}
if ( value > 0 )
{
info( ch, 0, "{G[INFO]:{x {B%s has awarded everyone with %d quest points!{x\n\r", ch->name, value );
printf_to_char( ch, "You just awared everyone %d quest points!\n\r", value );
}
else
{
printf_to_char( ch, "You just penalized everyone for %d quest points!\n\r", value );
info( ch, 0, "{G[INFO]:{x {R%s has penalized everyone for %d quest points!{x\n\r", ch->name, value );
}
return;
}
if ( !str_cmp( arg3, "exp" ) )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
victim = d->character;
if ( victim == NULL || IS_NPC(victim) || victim == ch || victim->level >= LEVEL_IMMORTAL )
continue;
gain_exp(victim, value);
if ( value > 0 )
{
printf_to_char( victim, "{BYou have been awarded {Y%d{x Exp Points by %s!\n\r", value, ch->name );
}
else
{
sprintf( buf, "{RYou have been penalized {Y%d{x Exp Points by %s!\n\r", value, ch->name );
send_to_char( buf, victim );
}
}
if ( value > 0 )
{
printf_to_char( ch, "You just awarded everyone with %d exp points!\n\r", value );
info( ch, 0, "{G[INFO]:{x {B%s has awarded everyone with %d exp points!{x\n\r", ch->name, value );
}
else
{
printf_to_char( ch, "You just penalized everyone for %d exp points!\n\r", value );
info( ch, 0, "{G[INFO]:{x {R%s has penalized everyone for %d exp points!{x\n\r", ch->name, value );
}
}
return;
}
if (( victim = get_char_world ( ch, arg1 ) ) == NULL )
{
send_to_char( "That player is not here.\n\r", ch);
return;
}
if ( IS_NPC( victim ) )
{
send_to_char( "Not on NPC's!\n\r", ch);
return;
}
if ( ch == victim )
{
send_to_char( "You may not award yourself!", ch );
return;
}
if (IS_IMMORTAL(victim) || victim->level >= LEVEL_IMMORTAL)
{
send_to_char( "You cannot award an immortal!\n\r", ch );
return;
}
value = atoi( arg2 );
if ( value < -5000 || value > 5000 )
{
send_to_char( "Award range is -5000 to 5000.\n\r", ch );
return;
}
if ( value == 0 )
{
send_to_char( "Value cannot be 0.\n\r", ch );
return;
}
if ( !str_cmp( arg3, "qp" ) )
{
sprintf( buf, "{wYou have awarded %s {Y%d{w Quest Points!\n\r", victim->name, value );
send_to_char(buf, ch);
if ( value > 0 )
{
victim->pcdata->questpoints += value;
sprintf( buf, "{wYou have been awarded {Y%d{w Quest Points by %s!\n\r", value, ch->name );
send_to_char( buf, victim );
do_save(victim, "");
sprintf( buf, "{R$N awards %d Quest Points to %s{x", value, victim->name);
wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
return;
}
else
{
victim->pcdata->questpoints += value;
sprintf( buf, "{wYou have been penalized {Y%d{w Quest Points by %s!\n\r", value, ch->name );
send_to_char( buf, victim );
do_save(victim, "");
sprintf( buf, "$N penalizes %s %d Quest Points.", victim->name, value );
wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
return;
}
}
else if ( !str_cmp( arg3, "exp" ) )
{
printf_to_char( ch, "You have awarded %s {G%d{x Exp Points!\n\r", victim->name, value );
gain_exp(victim, value);
if ( value > 0 )
{
sprintf( buf,"You have been bonused %d experience points by %s!\n\r", value, ch->name );
send_to_char( buf, victim );
return;
}
else
{
sprintf( buf,"You have been penalized %d experience points by %s!\n\r", value, ch->name );
send_to_char( buf, victim );
return;
}
}
send_to_char( "Syntax: award <char | all> <amount> <type>\n\r", ch);
send_to_char( "Valid types are: exp | qp\n\r", ch );
return;
}