// Detox from Eve of Destruction
// With an improvement by Xrakisis
// so that all things from the previous 
// class are gone.

void do_detox (CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char buf[MAX_STRING_LENGTH];    
  char class[MAX_STRING_LENGTH];
  int j;
  argument = one_argument( argument, arg);
         
if (IS_NPC(ch)) return;
        
if (arg[0] == '\0')
{
send_to_char("Detox now sets hp/mana/move to 5k.\n\r",ch);
send_to_char("If you would still like to, type detox continue.\n\r",ch);     
return;
}    

 if (!str_cmp(arg,"continue"))
{        
  if (IS_NPC(ch)) return;
  if ((ch->in_room == NULL || ch->in_room->vnum != 3054))
  {
    send_to_char("You can only detox at the Temple Altar of Midgaard.\n\r",ch);
    return;
  }

   if (ch->class == 0)
     {
    send_to_char("You already have no class.\n\r",ch);
    return;
     }
                
  do_clearstats(ch,"");

  ch->class = 0; 
  if (IS_SET(ch->newbits, NEW_MASTERY)) REMOVE_BIT(ch->newbits, NEW_MASTERY);
  clearshit(ch);
  sprintf(buf,"#7%s #0has forsaken his class, and become human.\n\r", ch->name );
  do_info(ch,buf);
  set_learnable_disciplines(ch);
  do_save(ch,"");
  return;
}
return; 
 }

void clearshit(CHAR_DATA *ch)
{
  int sn;
  int x;

  if (IS_SET(ch->pcdata->powers[AURAS], MIGHT_AURA))
    {
      REMOVE_BIT(ch->pcdata->powers[AURAS], MIGHT_AURA);
     // send_to_char("Your aura of might fades.\n\r",ch);
      ch->damroll -= 500;
      ch->hitroll -= 500;
      return;
    }
/*
 * Go into save.c and see what your cpowers goes to
 * swap out the 54 for whatever the max number is
 * this will get rid of all class powers and all 
 * class bits. -Xrakisis
`*/ 
 for (ch->power[x];x<54;x++)
 {
  ch->power[x] = 0;
 }
// ch->pcdata->kingdom                 = 0;
  ch->pcdata->jflags                  = 0;
  ch->extra                           = 0;
  ch->exp			      = 0;
  ch->expmult 			      = 0;
  ch->practice                        = 0;
  ch->special                         = 0;
  ch->newbits                         = 0;
  ch->max_hit			      = 5000;
  ch->max_mana                        = 5000;
  ch->max_move                        = 5000;
  ch->hit                             = 5000;
  ch->mana                            = 5000;
  ch->move                            = 5000;
  ch->generation		      = 5;
  ch->pcdata->familiar                = NULL;
  ch->pcdata->chobj                   = NULL;
  ch->pcdata->memorised               = NULL;
  ch->pcdata->disc_research           = -1;
  ch->pcdata->relrank		      = 0;
  ch->lord                            = str_dup( "" );
  ch->morph                           = str_dup( "" );
  ch->pload                           = str_dup( "" );
  ch->poweraction                     = str_dup( "" );
  ch->powertype                       = str_dup( "" );
  ch->hunting                         = str_dup( "" );
  ch->pcdata->followers               = 0; 
  ch->spectype                        = 0;
  ch->specpower                       = 0;
  ch->mounted                         = 0;
  ch->home                            = 3001;
  ch->vampgen_a                       = 0;
  ch->paradox[0]                      = 0;    /* Total paradox */
  ch->paradox[1]                      = 0;    /* Current Paradox */
  ch->paradox[2]                      = 0;    /* Paradox Ticker */
  ch->damcap[0]                       = 1000;
  ch->damcap[1]                       = 0;
  ch->vampaff_a                       = 0;
  ch->itemaffect                      = 0;
  ch->polyaff                         = 0;
  ch->immune                          = 0; 
  ch->form                            = 1048575;
  ch->beast                           = 15;
  for( sn=0 ; sn < 7 ; sn ++ )
         ch->loc_hp[sn]               = 0;   
  //for( sn=0 ; sn < 13 ; sn++ )
      //   ch->wpn[sn]                  = 0;
  //for( sn=0 ; sn < 5 ; sn++ )
    //     ch->spl[sn]                  = 4;
  for( sn=0 ; sn < 8 ; sn++ )
         ch->cmbt[sn]                 = 0;
  for( sn=0 ; sn < 11 ; sn++ )
         ch->cmbt[sn]                 = 0;
  ch->pcdata->followers               = 0;   
  ch->pcdata->perm_str                = 13;
  ch->pcdata->perm_int                = 13;
  ch->pcdata->perm_wis                = 13;
  ch->pcdata->perm_dex                = 13;
  ch->pcdata->perm_con                = 13;
  ch->pcdata->wolf                    = 0;
  ch->pcdata->rank                    = 0;
  ch->pcdata->language[0]             = 0;
  ch->pcdata->language[1]             = 0; 
  ch->pcdata->stage[0]                = 0;
  ch->pcdata->stage[1]                = 0; 
  ch->pcdata->stage[2]                = 0;
  ch->pcdata->wolfform[0]             = 1;   
  ch->pcdata->wolfform[1]             = 1; 
  ch->pcdata->score[0]                = 0; 
  ch->pcdata->score[1]                = 0; 
  ch->pcdata->score[2]                = 0; 
  ch->pcdata->score[3]                = 0; 
  ch->pcdata->score[4]                = 0;
  ch->pcdata->score[5]                = 0;
  for( sn=0 ; sn < 11 ; sn++ )
         ch->pcdata->disc_a[sn]       = 0;
 // for( sn=0 ; sn < 10 ; sn++ )
   //      ch->pcdata->genes[sn]        = 0;
  for ( sn=0 ; sn < 18 ; sn++)
        ch->pcdata->powers[sn]        = 0;   
  for ( sn=0 ; sn < 12 ; sn++)
        ch->pcdata->stats[sn]         = 0; 
  //for  ( sn=0; sn < 19; sn++)
      //  ch->stance[sn]		      = 0;
  //for  ( sn=19; sn < 24; sn++)
    //    ch->stance[sn]                = -1;
  for  ( sn=0; sn < 44; sn++)
        ch->power[sn]                 = -2;
  ch->pcdata->fake_skill              = 0;
  ch->pcdata->fake_stance             = 0;
  ch->pcdata->fake_hit                = 0;
  ch->pcdata->fake_dam                = 0;
  ch->pcdata->fake_ac                 = 0;
  ch->pcdata->fake_hp                 = 0;
  ch->pcdata->fake_mana               = 0;
  ch->pcdata->fake_move               = 0;
  ch->pcdata->obj_vnum                = 0;   
  ch->pcdata->condition[COND_THIRST]  = 48;
  ch->pcdata->condition[COND_FULL]    = 48;
  ch->pcdata->stat_ability[STAT_STR]  = 0; 
  ch->pcdata->stat_ability[STAT_END]  = 0;
  ch->pcdata->stat_ability[STAT_REF]  = 0;
  ch->pcdata->stat_ability[STAT_FLE]  = 0;
  ch->pcdata->stat_amount[STAT_STR]   = 0;
  ch->pcdata->stat_amount[STAT_END]   = 0;
  ch->pcdata->stat_amount[STAT_REF]   = 0;
  ch->pcdata->stat_amount[STAT_FLE]   = 0;
  ch->pcdata->stat_duration[STAT_STR] = 0;
  ch->pcdata->stat_duration[STAT_END] = 0;
  ch->pcdata->stat_duration[STAT_REF] = 0;
  ch->pcdata->stat_duration[STAT_FLE] = 0;
  ch->pcdata->exhaustion              = 0;   
  if (IS_SET(ch->act, PLR_HOLYLIGHT)) REMOVE_BIT(ch->act, PLR_HOLYLIGHT);
if (IS_SET(ch->newbits, NEW_MASTERY)) REMOVE_BIT(ch->newbits, NEW_MASTERY);
/* Before charachters trust was being set to 0 so they couldnt do some things */
  SET_BIT(ch->extra, EXTRA_TRUSTED);
  return;
}