New Name:
-
+
Please enter your character name.
@@ -744,36 +737,36 @@ if(!$logged)
//## CREATE CHARACTER on account ###
if($action == "createcharacter") {
echo '';
- $newchar_name = isset($_POST['newcharname']) ? stripslashes(ucwords(strtolower($_POST['newcharname']))) : NULL;
- $newchar_sex = isset($_POST['newcharsex']) ? $_POST['newcharsex'] : NULL;
- $newchar_vocation = isset($_POST['newcharvocation']) ? $_POST['newcharvocation'] : NULL;
- $newchar_town = isset($_POST['newchartown']) ? $_POST['newchartown'] : NULL;
- $newchar_errors = array();
+ $newchar_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : NULL;
+ $newchar_sex = isset($_POST['sex']) ? $_POST['sex'] : NULL;
+ $newchar_vocation = isset($_POST['vocation']) ? $_POST['vocation'] : NULL;
+ $newchar_town = isset($_POST['town']) ? $_POST['town'] : NULL;
+ $errors = array();
$newchar_created = false;
if(isset($_POST['savecharacter']) && $_POST['savecharacter'] == 1) {
if(empty($newchar_name))
- $newchar_errors[] = 'Please enter a name for your character!';
+ $errors[] = 'Please enter a name for your character!';
if(strlen($newchar_name) > 25)
- $newchar_errors[] = 'Name is too long. Max. lenght 25 letters.';
+ $errors[] = 'Name is too long. Max. lenght 25 letters.';
else if(strlen($newchar_name) < 3)
- $newchar_errors[] = 'Name is too short. Min. lenght 25 letters.';
+ $errors[] = 'Name is too short. Min. lenght 25 letters.';
if(empty($newchar_sex) && $newchar_sex != "0")
- $newchar_errors[] = 'Please select the sex for your character!';
+ $errors[] = 'Please select the sex for your character!';
if(count($config['character_samples']) > 1)
{
if(!isset($newchar_vocation))
- $newchar_errors[] = 'Please select a vocation for your character.';
+ $errors[] = 'Please select a vocation for your character.';
}
else
$newchar_vocation = $config['character_samples'][0];
if(count($config['character_towns']) > 1) {
if(!isset($newchar_town))
- $newchar_errors[] = 'Please select a town for your character.';
+ $errors[] = 'Please select a town for your character.';
}
else {
$newchar_town = $config['character_towns'][0];
@@ -782,18 +775,18 @@ if(!$logged)
$exist = new OTS_Player();
$exist->find($newchar_name);
if($exist->isLoaded()) {
- $newchar_errors[] .= 'Character with this name already exist.';
+ $errors[] .= 'Character with this name already exist.';
}
- if(empty($newchar_errors)) {
+ if(empty($errors)) {
$error = '';
if(!admin() && !check_name_new_char($newchar_name, $error)) {
- $newchar_errors[] = $error;
+ $errors[] = $error;
}
if(!isset($config['genders'][$newchar_sex]))
- $newchar_errors[] = 'Sex is invalid.';
+ $errors[] = 'Sex is invalid.';
if(!in_array($newchar_town, $config['character_towns']))
- $newchar_errors[] = 'Please select valid town.';
+ $errors[] = 'Please select valid town.';
if(count($config['character_samples']) > 1)
{
$newchar_vocation_check = false;
@@ -801,29 +794,29 @@ if(!$logged)
if($newchar_vocation == $char_vocation_key)
$newchar_vocation_check = true;
if(!$newchar_vocation_check)
- $newchar_errors[] = 'Unknown vocation. Please fill in form again.';
+ $errors[] = 'Unknown vocation. Please fill in form again.';
}
else
$newchar_vocation = 0;
}
- if(empty($newchar_errors))
+ if(empty($errors))
{
$number_of_players_on_account = $account_logged->getPlayersList()->count();
if($number_of_players_on_account >= $config['characters_per_account'])
- $newchar_errors[] .= 'You have too many characters on your account ('.$number_of_players_on_account.'/'.$config['characters_per_account'].') !';
+ $errors[] .= 'You have too many characters on your account ('.$number_of_players_on_account.'/'.$config['characters_per_account'].') !';
}
- if(empty($newchar_errors))
+ if(empty($errors))
{
$char_to_copy_name = $config['character_samples'][$newchar_vocation];
$char_to_copy = new OTS_Player();
$char_to_copy->find($char_to_copy_name);
if(!$char_to_copy->isLoaded())
- $newchar_errors[] .= 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy: '.$char_to_copy_name.' doesn\'t exist.';
+ $errors[] .= 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy: '.$char_to_copy_name.' doesn\'t exist.';
}
- if(empty($newchar_errors))
+ if(empty($errors))
{
if($newchar_sex == "0")
$char_to_copy->setLookType(136);
@@ -924,46 +917,27 @@ if(!$logged)
}
}
- if(count($newchar_errors) > 0) {
- echo $twig->render('error_box.html', array('errors' => $newchar_errors));
+ if(count($errors) > 0) {
+ echo $twig->render('error_box.html', array('errors' => $errors));
}
if(!$newchar_created) {
- echo 'Please choose a name';
- if(count($config['character_samples']) > 1)
- echo ', vocation';
- echo ' and sex for your character. In any case the name must not violate the naming conventions stated in the '.$config['lua']['serverName'].' Rules , or your character might get deleted or name locked.';
- if($account_logged->getPlayersList()->count() >= $config['characters_per_account']) {
- echo ' You have maximum number of characters per account on your account. Delete one before you make new. ';
- }
- echo '