Create character directly on create account page

This commit is contained in:
tobi132 2019-12-02 23:10:32 +01:00
parent 092a03e2cf
commit 1e2267bd31
11 changed files with 570 additions and 358 deletions

1
TODO
View File

@ -95,6 +95,5 @@ x.x - At any time between (version not specified)
* some interface for this would be nice to have (phpmyadmin commands/queries)
* https://otland.net/threads/phpmyadmin-commands-to-edit-database.7751/
* migrations: option to downgrade the database
* create account: create character
* suggest name option in create character:
* https://github.com/nubs/random-name-generator

View File

@ -91,6 +91,7 @@ $config = array(
// account
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
'account_create_auto_login' => false, // auto login after creating account?
'account_create_character_create' => true, // allow directly to create character on create account page?
'account_mail_verify' => false, // force users to confirm their email addresses when registering account
'account_mail_unique' => true, // email addresses cannot be duplicated? (one account = one email)
'account_premium_days' => 0, // default premium days on new account

View File

@ -0,0 +1,222 @@
<?php
/**
* CreateCharacter
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2019 MyAAC
* @link https://my-aac.org
*/
class CreateCharacter
{
/**
* @param string $name
* @param int $sex
* @param int $vocation
* @param int $town
* @param array $errors
* @return bool
*/
public function check($name, $sex, &$vocation, &$town, &$errors) {
$minLength = config('character_name_min_length');
$maxLength = config('character_name_max_length');
if(empty($name))
$errors['name'] = 'Please enter a name for your character!';
else if(strlen($name) > $maxLength)
$errors['name'] = 'Name is too long. Max. lenght <b>'.$maxLength.'</b> letters.';
else if(strlen($name) < $minLength)
$errors['name'] = 'Name is too short. Min. lenght <b>'.$minLength.'</b> letters.';
else {
if(!admin() && !Validator::newCharacterName($name)) {
$errors['name'] = Validator::getLastError();
}
$exist = new OTS_Player();
$exist->find($name);
if($exist->isLoaded()) {
$errors['name'] = 'Character with this name already exist.';
}
}
if(empty($sex) && $sex != "0")
$errors['sex'] = 'Please select the sex for your character!';
if(count(config('character_samples')) > 1)
{
if(!isset($vocation))
$errors['vocation'] = 'Please select a vocation for your character.';
}
else
$vocation = config('character_samples')[0];
if(count(config('character_towns')) > 1) {
if(!isset($town))
$errors['town'] = 'Please select a town for your character.';
}
else {
$town = config('character_towns')[0];
}
if(empty($errors)) {
if(!isset(config('genders')[$sex]))
$errors['sex'] = 'Sex is invalid.';
if(!in_array($town, config('character_towns'), false))
$errors['town'] = 'Please select valid town.';
if(count(config('character_samples')) > 1)
{
$newchar_vocation_check = false;
foreach((array)config('character_samples') as $char_vocation_key => $sample_char)
if($vocation === $char_vocation_key)
$newchar_vocation_check = true;
if(!$newchar_vocation_check)
$errors['vocation'] = 'Unknown vocation. Please fill in form again.';
}
else
$vocation = 0;
}
return empty($errors);
}
/**
* @param string $name
* @param int $sex
* @param int $vocation
* @param int $town
* @param OTS_Account $account
* @param array $errors
* @return bool
* @throws E_OTS_NotLoaded
* @throws Twig_Error_Loader
* @throws Twig_Error_Runtime
* @throws Twig_Error_Syntax
*/
public function doCreate($name, $sex, $vocation, $town, $account, &$errors)
{
if(!$this->check($name, $sex, $vocation, $town, $errors)) {
return false;
}
if(empty($errors))
{
$number_of_players_on_account = $account->getPlayersList()->count();
if($number_of_players_on_account >= config('characters_per_account'))
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
}
if(empty($errors))
{
$char_to_copy_name = config('character_samples')[$vocation];
$char_to_copy = new OTS_Player();
$char_to_copy->find($char_to_copy_name);
if(!$char_to_copy->isLoaded())
$errors[] = 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config.php and set valid characters to copy names. Character to copy: <b>'.$char_to_copy_name.'</b> doesn\'t exist.';
}
if(!empty($errors)) {
return false;
}
global $db, $twig;
if($sex == "0")
$char_to_copy->setLookType(136);
$player = new OTS_Player();
$player->setName($name);
$player->setAccount($account);
$player->setGroupId(1);
$player->setSex($sex);
$player->setVocation($char_to_copy->getVocation());
if($db->hasColumn('players', 'promotion'))
$player->setPromotion($char_to_copy->getPromotion());
if($db->hasColumn('players', 'direction'))
$player->setDirection($char_to_copy->getDirection());
$player->setConditions($char_to_copy->getConditions());
$rank = $char_to_copy->getRank();
if($rank->isLoaded()) {
$player->setRank($char_to_copy->getRank());
}
if($db->hasColumn('players', 'lookaddons'))
$player->setLookAddons($char_to_copy->getLookAddons());
$player->setTownId($town);
$player->setExperience($char_to_copy->getExperience());
$player->setLevel($char_to_copy->getLevel());
$player->setMagLevel($char_to_copy->getMagLevel());
$player->setHealth($char_to_copy->getHealth());
$player->setHealthMax($char_to_copy->getHealthMax());
$player->setMana($char_to_copy->getMana());
$player->setManaMax($char_to_copy->getManaMax());
$player->setManaSpent($char_to_copy->getManaSpent());
$player->setSoul($char_to_copy->getSoul());
for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++)
$player->setSkill($skill, 10);
$player->setLookBody($char_to_copy->getLookBody());
$player->setLookFeet($char_to_copy->getLookFeet());
$player->setLookHead($char_to_copy->getLookHead());
$player->setLookLegs($char_to_copy->getLookLegs());
$player->setLookType($char_to_copy->getLookType());
$player->setCap($char_to_copy->getCap());
$player->setBalance(0);
$player->setPosX(0);
$player->setPosY(0);
$player->setPosZ(0);
if($db->hasColumn('players', 'stamina')) {
$player->setStamina($char_to_copy->getStamina());
}
if($db->hasColumn('players', 'loss_experience')) {
$player->setLossExperience($char_to_copy->getLossExperience());
$player->setLossMana($char_to_copy->getLossMana());
$player->setLossSkills($char_to_copy->getLossSkills());
}
if($db->hasColumn('players', 'loss_items')) {
$player->setLossItems($char_to_copy->getLossItems());
$player->setLossContainers($char_to_copy->getLossContainers());
}
$player->save();
$player->setCustomField("created", time());
$player = new OTS_Player();
$player->find($name);
if(!$player->isLoaded()) {
error("Error. Can't create character. Probably problem with database. Please try again later or contact with admin.");
return false;
}
if($db->hasTable('player_skills')) {
for($i=0; $i<7; $i++) {
$skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $i);
if($skillExists->rowCount() <= 0) {
$db->query('INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('.$player->getId().', '.$i.', 10, 0)');
}
}
}
$loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
foreach($loaded_items_to_copy as $save_item)
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
$twig->display('success.html.twig', array(
'title' => 'Character Created',
'description' => 'The character <b>' . $name . '</b> has been created.<br/>
Please select the outfit when you log in for the first time.<br/><br/>
<b>See you on ' . configLua('serverName') . '!</b>'
));
$account->logAction('Created character <b>' . $name . '</b>.');
return true;
}
}

View File

@ -10,8 +10,6 @@
*/
defined('MYAAC') or die('Direct access not allowed!');
echo '<script type="text/javascript" src="tools/check_name.js"></script>';
$player_id = isset($_POST['player_id']) ? (int)$_POST['player_id'] : NULL;
$name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : NULL;
if((!$config['account_change_character_name']))

View File

@ -10,206 +10,32 @@
*/
defined('MYAAC') or die('Direct access not allowed!');
echo '<script type="text/javascript" src="tools/check_name.js"></script>';
$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;
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null;
$character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null;
$character_vocation = isset($_POST['vocation']) ? (int)$_POST['vocation'] : null;
$character_town = isset($_POST['town']) ? (int)$_POST['town'] : null;
$newchar_created = false;
$character_created = false;
$save = isset($_POST['save']) && $_POST['save'] == 1;
$errors = array();
if($save) {
$minLength = $config['character_name_min_length'];
$maxLength = $config['character_name_max_length'];
require_once LIBS . 'CreateCharacter.php';
$createCharacter = new CreateCharacter();
if(empty($newchar_name))
$errors['name'] = 'Please enter a name for your character!';
else if(strlen($newchar_name) > $maxLength)
$errors['name'] = 'Name is too long. Max. lenght <b>'.$maxLength.'</b> letters.';
else if(strlen($newchar_name) < $minLength)
$errors['name'] = 'Name is too short. Min. lenght <b>'.$minLength.'</b> letters.';
else {
if(!admin() && !Validator::newCharacterName($newchar_name)) {
$errors['name'] = Validator::getLastError();
}
$exist = new OTS_Player();
$exist->find($newchar_name);
if($exist->isLoaded()) {
$errors['name'] = 'Character with this name already exist.';
}
}
if(empty($newchar_sex) && $newchar_sex != "0")
$errors[] = 'Please select the sex for your character!';
if(count($config['character_samples']) > 1)
{
if(!isset($newchar_vocation))
$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))
$errors[] = 'Please select a town for your character.';
}
else {
$newchar_town = $config['character_towns'][0];
}
if(empty($errors)) {
if(!isset($config['genders'][$newchar_sex]))
$errors[] = 'Sex is invalid.';
if(!in_array($newchar_town, $config['character_towns']))
$errors[] = 'Please select valid town.';
if(count($config['character_samples']) > 1)
{
$newchar_vocation_check = false;
foreach($config['character_samples'] as $char_vocation_key => $sample_char)
if($newchar_vocation == $char_vocation_key)
$newchar_vocation_check = true;
if(!$newchar_vocation_check)
$errors[] = 'Unknown vocation. Please fill in form again.';
}
else
$newchar_vocation = 0;
}
if(empty($errors))
{
$number_of_players_on_account = $account_logged->getPlayersList()->count();
if($number_of_players_on_account >= $config['characters_per_account'])
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.$config['characters_per_account'].')</b>!';
}
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())
$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: <b>'.$char_to_copy_name.'</b> doesn\'t exist.';
}
if(empty($errors))
{
if($newchar_sex == "0")
$char_to_copy->setLookType(136);
$player = new OTS_Player();
$player->setName($newchar_name);
$player->setAccount($account_logged);
//$player->setGroupId($char_to_copy->getGroup()->getId());
$player->setGroupId(1);
$player->setSex($newchar_sex);
$player->setVocation($char_to_copy->getVocation());
if($db->hasColumn('players', 'promotion'))
$player->setPromotion($char_to_copy->getPromotion());
if($db->hasColumn('players', 'direction'))
$player->setDirection($char_to_copy->getDirection());
$player->setConditions($char_to_copy->getConditions());
$rank = $char_to_copy->getRank();
if($rank->isLoaded()) {
$player->setRank($char_to_copy->getRank());
}
if($db->hasColumn('players', 'lookaddons'))
$player->setLookAddons($char_to_copy->getLookAddons());
$player->setTownId($newchar_town);
$player->setExperience($char_to_copy->getExperience());
$player->setLevel($char_to_copy->getLevel());
$player->setMagLevel($char_to_copy->getMagLevel());
$player->setHealth($char_to_copy->getHealth());
$player->setHealthMax($char_to_copy->getHealthMax());
$player->setMana($char_to_copy->getMana());
$player->setManaMax($char_to_copy->getManaMax());
$player->setManaSpent($char_to_copy->getManaSpent());
$player->setSoul($char_to_copy->getSoul());
for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++)
$player->setSkill($skill, 10);
$player->setLookBody($char_to_copy->getLookBody());
$player->setLookFeet($char_to_copy->getLookFeet());
$player->setLookHead($char_to_copy->getLookHead());
$player->setLookLegs($char_to_copy->getLookLegs());
$player->setLookType($char_to_copy->getLookType());
$player->setCap($char_to_copy->getCap());
$player->setBalance(0);
$player->setPosX(0);
$player->setPosY(0);
$player->setPosZ(0);
if($db->hasColumn('players', 'stamina')) {
$player->setStamina($char_to_copy->getStamina());
}
if($db->hasColumn('players', 'loss_experience')) {
$player->setLossExperience($char_to_copy->getLossExperience());
$player->setLossMana($char_to_copy->getLossMana());
$player->setLossSkills($char_to_copy->getLossSkills());
}
if($db->hasColumn('players', 'loss_items')) {
$player->setLossItems($char_to_copy->getLossItems());
$player->setLossContainers($char_to_copy->getLossContainers());
}
$player->save();
$player->setCustomField("created", time());
$newchar_created = true;
$account_logged->logAction('Created character <b>' . $player->getName() . '</b>.');
unset($player);
$player = new OTS_Player();
$player->find($newchar_name);
if($player->isLoaded()) {
if($db->hasTable('player_skills')) {
for($i=0; $i<7; $i++) {
$skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $i);
if($skillExists->rowCount() <= 0) {
$db->query('INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('.$player->getId().', '.$i.', 10, 0)');
}
}
}
$loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId()."");
foreach($loaded_items_to_copy as $save_item)
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
$twig->display('success.html.twig', array(
'title' => 'Character Created',
'description' => 'The character <b>' . $newchar_name . '</b> has been created.<br/>
Please select the outfit when you log in for the first time.<br/><br/>
<b>See you on ' . $config['lua']['serverName'] . '!</b>'
));
}
else
{
error("Error. Can't create character. Probably problem with database. Please try again later or contact with admin.");
return;
}
}
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $account_logged, $errors);
}
if(count($errors) > 0) {
$twig->display('error_box.html.twig', array('errors' => $errors));
}
if(!$newchar_created) {
if(!$character_created) {
$twig->display('account.create_character.html.twig', array(
'name' => $newchar_name,
'sex' => $newchar_sex,
'vocation' => $newchar_vocation,
'town' => $newchar_town,
'name' => $character_name,
'sex' => $character_sex,
'vocation' => $character_vocation,
'town' => $character_town,
'save' => $save,
'errors' => $errors
));
}
?>
}

View File

@ -20,6 +20,16 @@ if($logged)
return;
}
if(config('account_create_character_create')) {
require_once LIBS . 'CreateCharacter.php';
$createCharacter = new CreateCharacter();
}
$account_type = 'number';
if(USE_ACCOUNT_NAME) {
$account_type = 'name';
}
$errors = array();
$save = isset($_POST['save']) && $_POST['save'] == 1;
if($save)
@ -27,8 +37,9 @@ if($save)
if(USE_ACCOUNT_NAME) {
$account_name = $_POST['account'];
}
else
else {
$account_id = $_POST['account'];
}
$email = $_POST['email'];
$password = $_POST['password'];
@ -86,33 +97,39 @@ if($save)
$errors['password'] = 'Password may not be the same as account name.';
}
if(empty($errors))
if($config['account_mail_unique'])
{
if($config['account_mail_unique'])
{
$test_email_account = new OTS_Account();
$test_email_account->findByEMail($email);
if($test_email_account->isLoaded())
$errors['email'] = 'Account with this e-mail address already exist.';
}
$account_db = new OTS_Account();
if(USE_ACCOUNT_NAME)
$account_db->find($account_name);
else
$account_db->load($account_id);
if($account_db->isLoaded()) {
if(USE_ACCOUNT_NAME)
$errors['account'] = 'Account with this name already exist.';
else
$errors['account'] = 'Account with this id already exist.';
}
$test_email_account = new OTS_Account();
$test_email_account->findByEMail($email);
if($test_email_account->isLoaded())
$errors['email'] = 'Account with this e-mail address already exist.';
}
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] != 'true')
$account_db = new OTS_Account();
if(USE_ACCOUNT_NAME)
$account_db->find($account_name);
else
$account_db->load($account_id);
if($account_db->isLoaded()) {
if(USE_ACCOUNT_NAME)
$errors['account'] = 'Account with this name already exist.';
else
$errors['account'] = 'Account with this id already exist.';
}
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] !== 'true')
$errors['accept_rules'] = 'You have to agree to the ' . $config['lua']['serverName'] . ' Rules in order to create an account!';
if(config('account_create_character_create')) {
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null;
$character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null;
$character_vocation = isset($_POST['vocation']) ? (int)$_POST['vocation'] : null;
$character_town = isset($_POST['town']) ? (int)$_POST['town'] : null;
$createCharacter->check($character_name, $character_sex, $character_vocation, $character_town, $errors);
}
if(empty($errors))
{
$new_account = new OTS_Account();
@ -171,8 +188,13 @@ if($save)
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html))
{
$twig->display('account.created.verify.html.twig', array(
'account' => $tmp_account
echo 'Your account has been created.<br/><br/>';
$twig->display('success.html.twig', array(
'title' => 'Account Created',
'description' => 'Your account ' . $account_type . ' is <b>' . $tmp_account . '</b><br/>You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '.
Please keep your account ' . $account_type . ' and password in a safe place and
never give your account ' . $account_type . ' or password to anybody.',
'custom_buttons' => config('account_create_character_create') ? '' : null
));
}
else
@ -192,8 +214,26 @@ if($save)
header('Location: ' . getLink('account/manage'));
}
$twig->display('account.created.html.twig', array(
'account' => $tmp_account
echo 'Your account';
if(config('account_create_character_create')) {
echo ' and character have';
}
else {
echo ' has';
}
echo ' been created.';
if(!config('account_create_character_create')) {
echo ' Now you can login and create your first character.';
}
echo ' See you in Tibia!<br/><br/>';
$twig->display('success.html.twig', array(
'title' => 'Account Created',
'description' => 'Your account ' . $account_type . ' is <b>' . $tmp_account . '</b><br/>You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '.
Please keep your account ' . $account_type . ' and password in a safe place and
never give your account ' . $account_type . ' or password to anybody.',
'custom_buttons' => config('account_create_character_create') ? '' : null
));
if($config['mail_enabled'] && $config['account_welcome_mail'])
@ -209,6 +249,14 @@ if($save)
log_append('error.log', '[createaccount.php] An error occorred while sending email: ' . $mailer->ErrorInfo . '. Error: ' . print_r(error_get_last(), true));
}
}
if(config('account_create_character_create')) {
// character creation
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
if (!$character_created) {
error('There was an error creating your character. Please create your character later in account management page.');
}
}
}
return;
@ -244,7 +292,8 @@ if($config['account_country']) {
}
$twig->display('account.create.js.html.twig');
$twig->display('account.create.html.twig', array(
$params = array(
'account' => isset($_POST['account']) ? $_POST['account'] : '',
'email' => isset($_POST['email']) ? $_POST['email'] : '',
'countries' => isset($countries) ? $countries : null,
@ -253,5 +302,15 @@ $twig->display('account.create.html.twig', array(
'country' => isset($country) ? $country : null,
'errors' => $errors,
'save' => $save
));
?>
);
if($save && config('account_create_character_create')) {
$params = array_merge($params, array(
'name' => $character_name,
'sex' => $character_sex,
'vocation' => $character_vocation,
'town' => $character_town
));
}
$twig->display('account.create.html.twig', $params);

View File

@ -73,4 +73,5 @@ To change a name of character select player and choose a new name.<br/>
</table>
</td>
</tr>
</table>
</table>
<script type="text/javascript" src="tools/check_name.js"></script>

View File

@ -3,7 +3,7 @@ All you have to do to create your new account is to enter an account {% if const
Also you have to agree to the terms presented below. If you have done so, your account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %} will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
<form action="{{ getLink('account/create') }}" method="post" id="createaccount">
<div class="TableContainer" >
<table class="Table1" cellpadding="0" cellspacing="0" >
<table class="Table5" cellpadding="0" cellspacing="0" >
<div class="CaptionContainer" >
<div class="CaptionInnerContainer" >
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);" /></span>
@ -22,94 +22,250 @@ Also you have to agree to the terms presented below. If you have done so, your a
<div class="InnerTableContainer" >
<table style="width:100%;" >
<tr>
<td class="LabelV" >
<span{% if errors.account[0] is defined %} class="red"{% endif %}>Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}:</span>
</td>
<td>
<input type="text" name="account" id="account_input" size="30" maxlength="{% if constant('USE_ACCOUNT_NAME') %}30{% else %}10{% endif %}" value="{{ account }}" autofocus/>
<img id="account_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" style="display: none;" />
<div class="TableShadowContainerRightTop"> <div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div></div>
<div class="TableContentAndRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rm.gif);">
<div class="TableContentContainer">
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
<tbody>
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.account is defined %} class="red"{% endif %}>Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}:</span>
</td>
<td>
<input type="text" name="account" id="account_input" size="30" maxlength="{% if constant('USE_ACCOUNT_NAME') %}30{% else %}10{% endif %}" value="{{ account }}" autofocus/>
<img id="account_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="account_error" class="FormFieldError">{% if errors.account is defined %}{{ errors.account }}{% endif %}</span></td></tr>
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.email is defined %} class="red"{% endif %}>Email Address:</span>
</td>
<td>
<input type="text" name="email" id="email" size="30" maxlength="50" value="{{ email }}" />
<img id="email_indicator" src="images/global/general/{% if not save or errors.email is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td></tr>
{% if config.account_country %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.country[0] is defined %} class="red"{% endif %}>Country:</span>
</td>
<td>
<select name="country" id="account_country">
{% for code, country_ in countries %}
<option value="{{ code }}"{% if(country is defined and country == code) or (country is null and country_recognized == code) %}selected{% endif %}>{{ country_ }}</option>
{% endfor %}
</select>
<img src="" id="account_country_img"/>
</td>
</tr>
{% if errors.country is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.country }}</span></td></tr>
{% endif %}
{% endif %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.password is defined %} class="red"{% endif %}>Password:</span>
</td>
<td>
<input type="password" name="password" id="password" value="" size="30" maxlength="50" />
<img id="password_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="password_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.password is defined %} class="red"{% endif %}>Repeat password:</span>
</td>
<td>
<input type="password" name="password2" id="password2" value="" size="30" maxlength="50" />
<img id="password2_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="password2_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
{% if config.recaptcha_enabled %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.verification[0] is defined %} class="red"{% endif %}>Verification:</span>
</td>
<td>
<div class="g-recaptcha" data-sitekey="{{ config.recaptcha_site_key }}" data-theme="{{ config.recaptcha_theme }}"></div>
</td>
</tr>
{% if errors.verification is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.verification }}</span></td></tr>
{% endif %}
{% endif %}
</tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div> </div></div>
</td>
</tr>
<tr><td></td><td><span id="account_error" class="FormFieldError">{% if errors.account is defined %}{{ errors.account }}{% endif %}</span></td></tr>
{% if (not config.mail_enabled or not config.account_mail_verify) and config.account_create_character_create %}
<tr>
<td class="LabelV" >
<span{% if errors.email[0] is defined %} class="red"{% endif %}>Email Address:</span>
</td>
<td style="width:100%;" >
<input type="text" name="email" id="email" size="30" maxlength="50" value="{{ email }}" />
<img id="email_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td></tr>
{% if config.account_country %}
<tr>
<td class="LabelV" >
<span{% if errors.country[0] is defined %} class="red"{% endif %}>Country:</span>
</td>
<td>
<select name="country" id="account_country">
{% for code, country_ in countries %}
<option value="{{ code }}"{% if(country is defined and country == code) or (country is null and country_recognized == code) %}selected{% endif %}>{{ country_ }}</option>
{% endfor %}
</select>
<img src="" id="account_country_img"/>
</td>
</tr>
{% if errors.country is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.country }}</span></td></tr>
{% endif %}
{% endif %}
<tr>
<td class="LabelV" >
<span{% if errors.password[0] is defined %} class="red"{% endif %}>Password:</span>
</td>
<td>
<input type="password" name="password" id="password" value="" size="30" maxlength="50" />
<img id="password_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="password_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
<tr>
<td class="LabelV" >
<span{% if errors.password[0] is defined %} class="red"{% endif %}>Repeat password:</span>
</td>
<td>
<input type="password" name="password2" id="password2" value="" size="30" maxlength="50" />
<img id="password2_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="password2_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
{% if config.recaptcha_enabled %}
<tr>
<td class="LabelV" >
<span{% if errors.verification[0] is defined %} class="red"{% endif %}>Verification:</span>
</td>
<td>
<div class="g-recaptcha" data-sitekey="{{ config.recaptcha_site_key }}" data-theme="{{ config.recaptcha_theme }}"></div>
</td>
</tr>
{% if errors.verification is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.verification }}</span></td></tr>
{% endif %}
{% endif %}
<tr>
<td><br/></td>
</tr>
<tr>
<td colspan="2" ><b>Please select all of the following check boxes:</b></td>
</tr>
<tr>
<td colspan="2" >
<span><input type="checkbox" id="accept_rules" name="accept_rules" value="true"{% if accept_rules %}checked{% endif %}/> <label for="accept_rules">I agree to the <a href="?subtopic=rules" target="_blank">{{ config.lua.serverName }} Rules</a>.</label></span>
</td>
</tr>
{% if errors.accept_rules is defined %}
<tr>
<td colspan="2">
<span class="FormFieldError">{{ errors.accept_rules }}</span>
<div class="TableShadowContainerRightTop">
<div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div>
</div>
<div class="TableContentAndRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rm.gif);">
<div class="TableContentContainer">
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
<tbody>
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.name is defined %} class="red"{% endif %}>Character Name:</span>
</td>
<td>
<input id="character_name" name="name" size="{{ config.character_name_max_length }}" maxlength="{{ config.character_name_max_length }}" value="{{ name }}"/>
<img id="character_indicator" src="images/global/general/{% if not save or errors.name is defined %}n{% endif %}ok.gif" style="display: none;" />
<br>
</td>
</tr>
<tr>
<td></td>
<td>
<span id="character_error" class="FormFieldError">{% if errors.name is defined %}{{ errors.name }}{% endif %}</span>
</td>
</tr>
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.sex is defined %} class="red"{% endif %}>Sex:</span>
</td>
<td>
<table width="100%">
<tbody>
<tr>
<td>
{% set i = 0 %}
{% for id, gender in config.genders|reverse(true) %}
{% set i = i + 1 %}
<span style="margin-right:15px;" class="OptionContainer">
<input type="radio" name="sex" id="sex{{ i }}" value="{{ id }}"{% if sex is not null and sex == id %} checked="checked"{% endif %}>
<label for="sex{{ i }}">{{ gender|lower }}</label>
</span>
{% endfor %}
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td></td>
<td>
<span id="sex_error" class="FormFieldError">{% if errors.sex is defined %}{{ errors.sex }}{% endif %}</span>
</td>
</tr>
{% if config.character_samples|length > 1 %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.vocation is defined %} class="red"{% endif %}>Vocation:</span>
</td>
<td>
<table width="100%" >
<tbody>
<tr>
<td>
{% for key, sample_char in config.character_samples %}
<span style="margin-right:15px;" class="OptionContainer">
<input type="radio" name="vocation" id="vocation{{ key }}" value="{{ key }}"
{% if vocation is not null and vocation == key %} checked="checked"{% endif %}>
<label for="vocation{{ key }}">{{ config['vocations'][key] }}</label>
</span>
{% endfor %}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td></td>
<td>
<span id="vocation_error" class="FormFieldError">{% if errors.vocation is defined %}{{ errors.vocation }}{% endif %}</span>
</td>
</tr>
{% endif %}
{% if config.character_towns|length > 1 %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.town is defined %} class="red"{% endif %}>Select your city:</span>
</td>
<td>
<table width="100%" >
<tbody>
<tr>
<td>
{% for town_id in config.character_towns %}
<span style="margin-right:15px;" class="OptionContainer">
<input type="radio" name="town" id="town{{ town_id }}" value="{{ town_id }}"
{% if town is not null and town == town_id %} checked="checked"{% endif %}>
<label for="town{{ town_id }}">{{ config.towns[town_id] }}</label>
</span>
{% endfor %}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);">
<div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div>
<div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div>
</div>
</div>
</td>
</tr>
{% endif %}
<tr>
<td>
<div class="TableShadowContainerRightTop">
<div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div>
</div>
<div class="TableContentAndRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rm.gif);">
<div class="TableContentContainer">
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
<tbody>
<tr>
<td colspan="2" ><b>Please select the following check box:</b></td>
</tr>
<tr>
<td colspan="2" >
<span><input type="checkbox" id="accept_rules" name="accept_rules" value="true"{% if accept_rules %}checked{% endif %}/> <label for="accept_rules">I agree to the <a href="?subtopic=rules" target="_blank">{{ config.lua.serverName }} Rules</a>.</label></span>
</td>
</tr>
{% if errors.accept_rules is defined %}
<tr>
<td colspan="2">
<span class="FormFieldError">{{ errors.accept_rules }}</span>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div>
</div>
</div>
</td>
</tr>
</table>
</div>
</td>
@ -131,4 +287,5 @@ Also you have to agree to the terms presented below. If you have done so, your a
</td>
</tr>
</table>
</form>
</form>
<script type="text/javascript" src="tools/check_name.js"></script>

View File

@ -144,4 +144,5 @@ In any case the name must not violate the naming conventions stated in the <a hr
</table>
</td>
</tr>
</table>
</table>
<script type="text/javascript" src="tools/check_name.js"></script>

View File

@ -1,25 +0,0 @@
Your account has been created. Now you can login and create your first character. See you in Tibia!<br/><br/>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td bgcolor="{{ config.vdarkborder }}" class="white"><b>Account Created</b></td>
</tr>
<tr>
<td bgcolor="{{ config.darkborder }}">
<table border="0" cellpadding="1">
<tr>
<td>
{% if constant('USE_ACCOUNT_NAME') %}
{% set account_type = 'name' %}
{% else %}
{% set account_type = 'number' %}
{% endif %}
<br/>Your account {{ account_type }} is <b>{{ account }}</b><br/>You will need the account {{ account_type }} and your password to play on {{ config.lua.serverName }}.
Please keep your account {{ account_type }} and password in a safe place and
never give your account {{ account_type }} or password to anybody.<br/><br/>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/><br/>

View File

@ -1,27 +0,0 @@
Your account has been created.<br/><br/>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td bgcolor="{{ config.vdarkborder }}" class="white"><b>Account Created</b></td>
</tr>
<tr>
<td bgcolor="{{ config.darkborder }}">
<table border="0" cellpadding="1">
<tr>
<td>
{% if constant('USE_ACCOUNT_NAME') %}
{% set account_type = 'name' %}
{% else %}
{% set account_type = 'number' %}
{% endif %}
<br/>Your account {{ account_type }} is <b>{{ account }}</b>.
You will need the account {{ account_type }} and your password to play on {{ config.lua.serverName }}.
Please keep your account {{ account_type }} and password in a safe place and
never give your account {{ account_type }} or password to anybody.<br/><br/>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/><br/>