I want to have a mod that allows Imms to use the command powerlevel <on/off> <num> to make the exp players recieve multiplyed times num. I know this can be somewhat dangerous, but I still want to do it and I want it to apply to the whole game. The part I am struggling with is where to put the bit and num? Should they go into mud.h? if so, where?
Also, what would I need to change in this function?
void gain_exp( CHAR_DATA * ch, int gain )
{
double modgain;
if( IS_NPC( ch ) || ch->level >= LEVEL_AVATAR )
return;
/*
* Bonus for deadly lowbies
*/
modgain = gain;
if( modgain > 0 && IS_PKILL( ch ) && ch->level < 17 )
{
if( ch->level <= 6 )
{
send_to_char( "The Favor of Gravoc fosters your learning.\n\r", ch );
modgain *= 2;
}
if( ch->level <= 10 && ch->level >= 7 )
{
send_to_char( "The Hand of Gravoc hastens your learning.\n\r", ch );
modgain *= 1.75;
}
if( ch->level <= 13 && ch->level >= 11 )
{
send_to_char( "The Cunning of Gravoc succors your learning.\n\r", ch );
modgain *= 1.5;
}
if( ch->level <= 16 && ch->level >= 14 )
{
send_to_char( "The Patronage of Gravoc reinforces your learning.\n\r", ch );
modgain *= 1.25;
}
}
/*
* per-race experience multipliers
*/
modgain *= ( race_table[ch->race]->exp_multiplier / 100.0 );
/*
* Deadly exp loss floor is exp floor of level
*/
if( IS_PKILL( ch ) && modgain < 0 )
{
if( ch->exp + modgain < exp_level( ch, ch->level ) )
{
modgain = exp_level( ch, ch->level ) - ch->exp;
send_to_char( "Gravoc's Pandect protects your insight.\n\r", ch );
}
}
/*
* xp cap to prevent any one event from giving enuf xp to
*/
/*
* gain more than one level - FB
*/
modgain = UMIN( modgain, exp_level( ch, ch->level + 2 ) - exp_level( ch, ch->level + 1 ) );
ch->exp = UMAX( 0, ch->exp + ( int )modgain );
if( NOT_AUTHED( ch ) && ch->exp >= exp_level( ch, ch->level + 1 ) )
{
send_to_char( "You can not ascend to a higher level until you are authorized.\n\r", ch );
ch->exp = ( exp_level( ch, ( ch->level + 1 ) ) - 1 );
return;
}
while( ch->level < LEVEL_AVATAR && ch->exp >= exp_level( ch, ch->level + 1 ) )
{
set_char_color( AT_WHITE + AT_BLINK, ch );
ch->level += 1;
ch_printf( ch, "You have now obtained experience level %d!\n\r", ch->level );
advance_level( ch );
}
return;
}
|