Ok, well, I solved the problem, but in quite the inelegant way.
I copied the guts of exp_gain that I wanted to use into the mpcommand and everything worked... a little too well, actually and for a few minutes it leveled me down to a mortal. (I had mset myself really low, and it correct my level according to my pl, fun stuff. =p)
So, yeah, in short: copied what I needed, the code ended up looking like this:
void do_mpgivepl( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *victim;
char arg[MAX_INPUT_LENGTH];
char buf[MAX_INPUT_LENGTH];
long double modgain;
int rank = 0, newRank = 0;
int trueRank = 0;
if ( !IS_NPC( ch ) )
{
send_to_char( "Huh?\n\r", ch );
return;
}
argument = one_argument(argument, arg);
modgain = atoi(argument);
if ( arg[0] == '\0' || argument[0] == '\0' )
{
progbug( "Mpgivepl - Bad argument", ch );
return;
}
if( (victim = get_char_room(ch,arg)) == NULL )
{
progbug( "Mpgivepl - Target not found", ch );
return;
}
if ( IS_NPC(victim) )
{
progbug( "Mpadvance - Victim is NPC", ch );
return;
}
rank = get_rank_number(victim);
trueRank = get_true_rank(victim);
victim->exp += modgain;
if (NOT_AUTHED(victim) && victim->exp >= MAX_EXP_PRE_AUTH)
{
send_to_char("Your power level can not increase until you are authorized.\n\r", victim);
victim->exp = MAX_EXP_PRE_AUTH;
victim->pl = (victim->pl - (victim->pl - MAX_EXP_PRE_AUTH ));
return;
}
if ( rank != get_rank_number(victim) )
{
sprintf( buf, "%s's rank has changed to %s", victim->name, get_rank_color(victim));
do_info(victim, buf);
}
if ( trueRank != (newRank = get_true_rank(victim)) && !IS_IMMORTAL(victim) )
{
victim->level = newRank;
}
if ( (victim->exp >= ( pow(victim->max_train, 1.916056) * 6000) )
&& (victim->max_train < 370) )
{
set_char_color( AT_LBLUE + AT_BLINK, victim );
ch_printf( victim, "You gained an additional training point!\n\r" );
victim->train += 1;
victim->max_train += 1;
}
sprintf( buf, "Your powerlevel increases by %s points!", num_punct(modgain) );
act( AT_HIT, buf, ch, NULL, victim, TO_VICT );
}
|