[Release] DT Web 0.1

You have this settings and reset character function

PHP:
// rc = Reset Character
$option['rc_level'] = 400; // Level required to reset a character
$option['rc_zen'] = 1000000; // Zen required to reset a character
$option['rc_zen_type'] = 0; // Increase required zen for every reset: 1 = enable, 0 = disable 
$option['rc_stats_type'] = 1; // Increase stats for every reset(1r=500,2r=1000,...): 1 = enable, 0 = disable 
$option['rc_max_resets'] = 100; // Max resets
$option['rc_stats_per_reset'] = 0; // Bonus stats per reset
$option['rc_clear_stats'] = 0; // Clear stats after reset: 1 = enable, 0 = disable

// Bonus points for every class
$option['rc_bonus_points'] = 0; // Bonus points for every class: 1 = enable, 0 = disable 
$option['rc_stats_for_sm'] = 300; // Points for dw,sm and grm 
$option['rc_stats_for_bk'] = 400; // Points for dk,bk and bm
$option['rc_stats_for_me'] = 500; // Points for elf,me and he
$option['rc_stats_for_mg'] = 600; // Points for mg and dum 
$option['rc_stats_for_dl'] = 700; // Points for dl and le


	function do_reset_character()
	{
		global $option;
		$acc = $_SESSION['dt_username'];
		$char = $_POST['character'];

		$show_msg=array(
			'error'=>array()
		);
		
		if(empty($char))
		{
			$show_msg['error'][] = 'Please select a character!';
		}
		elseif(preg_match('/[^a-zA-Z0-9\_\-]/', $char))
		{
			$show_msg['error'][] = 'Invalid symbols!';
		}
		elseif(strlen($char) < 3 || strlen($char) > 10)
		{
			$show_msg['error'][] = 'Invalid Character Name!';
		}
		else
		{
			$is_acc_char = mssql_num_rows(
				mssql_query("SELECT Name FROM Character WHERE AccountID='". $acc ."' AND Name='". $char ."'")
			);
			
			$is_online=is_online($char, 1);
			$character=char_info($char);
			
			$new_res=($character['Resets'] + 1);
			
			if($option['rc_zen_type'] === 1)
			{
				$option['rc_zen'] = ($option['rc_zen'] * $new_res);
			}
			
			$new_money=($character['Money'] - $option['rc_zen']);
			if($option['rc_bonus_points'] == 1)
			{
				switch($character['Class'])
				{
					case 0:
					case 1:
					case 2:
						$option['rc_stats_per_reset'] = $option['rc_stats_for_sm'];
						break;
					case 16:
					case 17:
					case 18:
						$option['rc_stats_per_reset'] = $option['rc_stats_for_bk'];
						break;
					case 32:
					case 33:
					case 34:
						$option['rc_stats_per_reset'] = $option['rc_stats_for_me'];
						break;
					case 48:
					case 49:
						$option['rc_stats_per_reset'] = $option['rc_stats_for_mg'];
						break;
					case 64:
					case 65:
						$option['rc_stats_per_reset'] = $option['rc_stats_for_dl'];
						break;
				}
			}
			$level_up_points = $option['rc_stats_per_reset'];
			if($option['rc_stats_type'] === 1)
			{
				 $level_up_points = $level_up_points * $new_res;
			}
			if($option['rc_gr_bonus'] === 1)
			{
				 $level_up_points += ($option['gr_reward'] * $character['GrandResets']);
			}
		
			if($is_acc_char == 0)
			{
				$show_msg['error'][] = 'This character is not yours!';
			}
			elseif($is_online === 1)
			{
				$show_msg['error'][] = 'You need to leave the game!';
			}
			elseif($character['cLevel'] < $option['rc_level'])
			{
				$show_msg['error'][] = 'You need '.($option['rc_level'] - $character['cLevel']).' more levels!';
			}
			elseif($new_money < 0)
			{
				$show_msg['error'][] = 'You don't have enough money(zen)!';
			}
			elseif($new_res > $option['rc_max_resets'])
			{
				$show_msg['error'][] = 'You have reach the maximum resets!';
			}
			else
			{
				$sql='UPDATE Character SET ';
				if($option['rc_clear_stats'] === 1)
				{
					$sql .='Strength = 25, Dexterity = 25, Vitality = 25, Energy = 25, ';
				}
				$sql .="Resets = ".$new_res.", Money = ".$new_money.", LevelUpPoint = ".$level_up_points.",cLevel = 1,Experience = 0 WHERE Name='".$character['Name']."' AND AccountID='".$acc."'";
				mssql_query($sql);
				$show_msg['success'][0] = $char .' have successfully reset for '.$new_res.' time.';
			}
		}
		return $show_msg;
	}


I still can't understand what you exactly want to do. And keeping level up points after resetting a character is wrong and out of any logic for me

As we said you need to edit your reset character function if you want to keep level up points after resetting. But I saw something else:

You have these settings :
$option['rc_bonus_points'] = 0;
$option['rc_stats_per_reset'] =0;


and with this settings you do not calculate different points to different classes which is at least unbalanced

Next in the reset function :

$level_up_points = $option['rc_stats_per_reset'];
if($option['rc_stats_type'] === 1)
{
$level_up_points = $level_up_points * $new_res;
}


so from your settings you have $level_up_points = 0;
but case $option['rc_stats_type'] === 0 doesn't exist, so $level_up_points will remain 0 and will be updated in the final query with 0, because as you know from the very basic maths 0xsomething = 0

You have wrong config settings and with this config settings the function can't work properly and need editing


P.S If you want to have default points for every class (for example 500pts), just add a variable in the config settings

$option['rc_default_points'] = 500;

and


if($option['rc_stats_type'] === 0)
{
$level_up_points = $option['rc_default_points'] * $new_res;
}

after

$level_up_points = $option['rc_stats_per_reset'];
if($option['rc_stats_type'] === 1)
{
$level_up_points = $level_up_points * $new_res;
}


and you will get the new reset multiplied with the default points in the config as a level up points

* This is only in case you do not have any additional reset bonuses (from quests and etc)

thanks I'll see ..