<?php

	//Security
	if( ! defined( 'IS_INIT' ) )
	{
		die( 'Unauthorized Access');
	}
        
    $class = $_POST['JC'];
    if( $Handler->char->IsOnline() == false )
    {
        if( $Handler->char->charinfo['nLevel'] >= 100 )
        {
            if( $class == 'Gladiator' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Warrior' )
                {
                    $Handler->char->UpdateClass( 4 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );
                }
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }                
            }
            elseif( $class == 'Knight' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Warrior' )
                {
                    $Handler->char->UpdateClass( 5 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );                   
                }   
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }                
            }
            elseif( $class == 'HolyKnight' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Paladin' )
                {
                    $Handler->char->UpdateClass( 11 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );                    
                }   
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }                
            }
            elseif( $class == 'Guardian' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Paladin' )
                {
                    $Handler->char->UpdateClass( 12 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );                    
                }     
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }                
            }
            elseif( $class == 'SharpShooter' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Scout' )
                {
                    $Handler->char->UpdateClass( 18 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );                    
                }    
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }                
            }          
            elseif( $class == 'Ranger' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Scout' )
                {
                    $Handler->char->UpdateClass( 19 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );                    
                }  
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }                
            }    
            elseif( $class == 'Warlock' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Enchanter' )
                {
                    $Handler->char->UpdateClass( 25 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );                    
                }  
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }                
            }    
            elseif( $class == 'Wizard' )
            {
                if( $Handler->char->charinfo['nClass'] == 'Enchanter' )
                {
                    $Handler->char->UpdateClass( 26 );
                    $Handler->theme->SetValue( 'MESSAGE' , $Handler->theme->GetValue( 'JC_UPDATED' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , 'Refresh' );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . "?view=cp&do=characters&char=" . $Handler->char->charinfo['sID'] );
                    $Handler->theme->Parse( 'success.html' );                    
                }
                else
                {
                    $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_CLASS' ) );
                    $Handler->theme->SetValue( 'GO_BACK' , null );
                    $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
                    $Handler->theme->Parse( 'error.html' );  
                }
            }            
        }
        else
        {
            $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'JC_LVL' ) );
            $Handler->theme->SetValue( 'GO_BACK' , null );
            $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
            $Handler->theme->Parse( 'error.html' );
        }
    }
    else
    {
        $Handler->theme->SetValue( 'ERROR' , $Handler->theme->GetValue( 'CHAR_LOGGED_IN' ) );
        $Handler->theme->SetValue( 'GO_BACK' , null );
        $Handler->theme->SetValue( 'RED_URL' , MAIN_URL . $_SERVER['REQUEST_URI'] );
        $Handler->theme->Parse( 'error.html' );
    }
?>