diff --git a/anmelden.php b/anmelden.php index cdab60af..d56f1100 100644 --- a/anmelden.php +++ b/anmelden.php @@ -4,7 +4,7 @@ ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Filename : anmelden.php ## -## Type : In Game Registration Page ## +## Type : In Game Registration Page (3 step wizard) ## ## --------------------------------------------------------------------------- ## ## Developed by : Dzoki ## ## Refactored by : Shadow ## @@ -31,6 +31,131 @@ include('GameEngine/Account.php'); AccessLogger::logRequest(); $invited=(isset($_GET['uid'])) ? filter_var($_GET['uid'], FILTER_SANITIZE_NUMBER_INT):$form->getError('invt'); + +/* + * --------------------------------------------------------------------------- + * Registration wizard data + * --------------------------------------------------------------------------- + * Every label below can be overridden from the language files: if a constant + * with the given name exists it wins, otherwise the English fallback is used. + * No changes are required in lang/*.php for the page to work. + */ +if (!function_exists('regText')) { + function regText($constant, $fallback) { + return defined($constant) ? constant($constant) : $fallback; + } +} + +/* id => tribe definition. The order of this array is the order of the cards. */ +$regTribes = array( + 3 => array( /* Gauls */ + 'name' => TRIBE3, + 'flag' => true, + 'best' => true, + 'lines' => array( + regText('TRIBE3_L1', 'Low time requirements'), + regText('TRIBE3_L2', 'Loot protection and good defense'), + regText('TRIBE3_L3', 'Excellent, fast cavalry'), + regText('TRIBE3_L4', 'Well suited to new players'), + ), + ), + 1 => array( /* Romans */ + 'name' => TRIBE1, + 'flag' => true, + 'best' => false, + 'lines' => array( + regText('TRIBE1_L1', 'Moderate time requirements'), + regText('TRIBE1_L2', 'Can develop villages the fastest'), + regText('TRIBE1_L3', 'Very strong but expensive troops'), + regText('TRIBE1_L4', 'Hard to play for new players'), + ), + ), + 2 => array( /* Teutons */ + 'name' => TRIBE2, + 'flag' => true, + 'best' => false, + 'lines' => array( + regText('TRIBE2_L1', 'High time requirements'), + regText('TRIBE2_L2', 'Good at looting in early game'), + regText('TRIBE2_L3', 'Strong, cheap infantry'), + regText('TRIBE2_L4', 'For aggressive players'), + ), + ), + 7 => array( /* Egyptians */ + 'name' => defined('TRIBE7') ? TRIBE7 : 'Egyptians', + 'flag' => (defined('NEW_FUNCTION_TRIBE_EGIPTEANS') && NEW_FUNCTION_TRIBE_EGIPTEANS), + 'best' => false, + 'lines' => array( + regText('TRIBE7_L1', 'Low time requirements'), + regText('TRIBE7_L2', 'More resources available'), + regText('TRIBE7_L3', 'Excellent defensive units'), + regText('TRIBE7_L4', 'Well suited to new players'), + ), + ), + 6 => array( /* Huns */ + 'name' => defined('TRIBE6') ? TRIBE6 : 'Huns', + 'flag' => (defined('NEW_FUNCTION_TRIBE_HUNS') && NEW_FUNCTION_TRIBE_HUNS), + 'best' => false, + 'lines' => array( + regText('TRIBE6_L1', 'High time requirements'), + regText('TRIBE6_L2', 'Impressively strong cavalry'), + regText('TRIBE6_L3', 'Reliant on others for protection'), + regText('TRIBE6_L4', 'Not recommended for new players!'), + ), + ), + 8 => array( /* Spartans */ + 'name' => defined('TRIBE8') ? TRIBE8 : 'Spartans', + 'flag' => (defined('NEW_FUNCTION_TRIBE_SPARTANS') && NEW_FUNCTION_TRIBE_SPARTANS), + 'best' => false, + 'lines' => array( + regText('TRIBE8_L1', 'Moderate time requirements'), + regText('TRIBE8_L2', 'Efficient crop consumption'), + regText('TRIBE8_L3', 'Easier recovery from battles'), + regText('TRIBE8_L4', 'Recommended for active new players'), + ), + ), + 9 => array( /* Vikings */ + 'name' => defined('TRIBE9') ? TRIBE9 : 'Vikings', + 'flag' => (defined('NEW_FUNCTION_TRIBE_VIKINGS') && NEW_FUNCTION_TRIBE_VIKINGS), + 'best' => false, + 'lines' => array( + regText('TRIBE9_L1', 'High time requirements'), + regText('TRIBE9_L2', 'Fearless raiders, strong offense'), + regText('TRIBE9_L3', 'Weak defense in the early game'), + regText('TRIBE9_L4', 'Not recommended for new players!'), + ), + ), +); + +/* Drop every tribe that is disabled by the install feature flags. */ +foreach ($regTribes as $tribeId => $tribeData) { + if (!$tribeData['flag']) { + unset($regTribes[$tribeId]); + } +} + +/* Starting positions: 0 = random, 1 = NW (-|+), 2 = NE (+|+), 3 = SW (-|-), 4 = SE (+|-) */ +$regQuadrants = array( + 0 => array('name' => RANDOM, 'coords' => ''), + 1 => array('name' => NW, 'coords' => '(-|+)'), + 2 => array('name' => NE, 'coords' => '(+|+)'), + 3 => array('name' => SW, 'coords' => '(-|-)'), + 4 => array('name' => SE, 'coords' => '(+|-)'), +); + +/* Values coming back from a failed POST (Account::Signup redirects here). */ +$regErrors = ($form->returnErrors() > 0); +$regTribe = (int) $form->getValue('vid'); +if (!isset($regTribes[$regTribe])) { + reset($regTribes); + $regTribe = (int) key($regTribes); // first card = Gauls (the recommended tribe) +} +$regQuad = (int) $form->getValue('kid'); +if (!isset($regQuadrants[$regQuad])) { + $regQuad = 0; +} +/* When the server rejected the form we jump straight back to the recap step. */ +$regStep = $regErrors ? 3 : 1; ?> @@ -49,6 +174,116 @@ $invited=(isset($_GET['uid'])) ? filter_var($_GET['uid'], FILTER_SANITIZE_NUMBER + +
@@ -63,92 +298,104 @@ if(REG_OPEN == true){ ?>

![]() |
- ![]() |
- |
|---|---|---|
| - | - | - |
| - | - | - |
| - | - | - |
| - | - | - |
| - | - | - |
| - | - | - |
| - | - | - |
- getRadio('agb',1); ?>/>
++ getRadio('agb',1); ?>/> +
-- Register -
- + + « + - + + + + + + + + +