From: takeda@mathlab.sunysb.edu

Snippets of a Immortal commanded
called avator which let an immortal to level down to a certain level by
type level blah  you can use your character to test stuff and also your
character can also die :)
i am also commenting this so you newbies coders can understand it and can
help learn how to code faster :)
got lazy on the commenting at the end...wonder if i teacher is on this
list if so i'm dead :p.

/* Written by takeda (takeda@mathlab.sunysb.edu) */
void do_avator( CHAR_DATA *ch, char *argument ) /* Procedure Avator */
{  /* Declaration */
    char buf[MAX_STRING_LENGTH];	/* buf */
    char arg1[MAX_INPUT_LENGTH];	/* arg1 */
    OBJ_DATA *obj_next;			/* obj data which is a pointer */
     OBJ_DATA *obj;			/* obj */
    int level;				/* level */
    int iLevel;				/* ilevel */

    argument = one_argument( argument, arg1 );
/* Check statements */
   if ( arg1[0] == '\0' || !is_number( arg1 ) )
    {
        send_to_char( "Syntax: avator <level>.\n\r", ch );
        return;
    }

    if ( IS_NPC(ch) )
    {
        send_to_char( "Not on NPC's.\n\r", ch );
        return;
    }

        if ( ( level = atoi( arg1 ) ) < 1 || level > MAX_LEVEL )
        {
       sprintf(buf, "Level must be 1 to %d.\n\r", MAX_LEVEL );
        send_to_char( buf, ch );
      return;
    }

    if ( level > get_trust( ch ) )
    {
        send_to_char( "Limited to your trust level.\n\r", ch );
        sprintf(buf, "Your Trust is %d.\n\r",ch->trust);
        send_to_char(buf,ch);
        return;
    }
/* Your trust stays so you will have all immortal command */
        /* SO their trust stays there */
        if(ch->trust == 0) {
        ch->trust = ch->level;
        }
/* Level gains*/
   if ( level <= ch->level )
    {
       int temp_prac;

        send_to_char( "Lowering a player's level!\n\r", ch );
        send_to_char( "**** OOOOHHHHHHHHHH  NNNNOOOO ****\n\r",ch );
        temp_prac = ch->practice;
        ch->level    = 1;
        ch->exp      = exp_per_level(ch,ch->pcdata->points);
        ch->max_hit  = 20;
        ch->max_mana = 100;
        ch->max_move = 100;
        ch->practice = 0;
        ch->hit      = ch->max_hit;
        ch->mana     = ch->max_mana;
        ch->move     = ch->max_move;
        advance_level( ch, TRUE );
        ch->practice = temp_prac;
    }
    else
    {
        send_to_char( "Raising a player's level!\n\r", ch );
        send_to_char( "**** OOOOHHHHHHHHHH  YYYYEEEESSS ****\n\r", ch);
    }

    for ( iLevel = ch->level ; iLevel < level; iLevel++ )
    {
        ch->level += 1;
        advance_level( ch,TRUE);
    }
    sprintf(buf,"You are now level %d.\n\r",ch->level);
    send_to_char(buf,ch);
    ch->exp   = exp_per_level(ch,ch->pcdata->points)
                  * UMAX( 1, ch->level );
/* Forces the person to remove all the eq....  so level restriction still apply */
   if(ch->level < 103) {
  for (obj = ch->carrying; obj; obj = obj_next)
    }
   obj_next = obj->next_content;

    if (obj->wear_loc != WEAR_NONE && can_see_obj (ch, obj))
    remove_obj (ch, obj->wear_loc, TRUE);

    }
}
    save_char_obj(ch); /* save character */
    return;
}
