createcharacter.php

main 80 lines · 2.4 KB Raw
Alex Alex Commit Initial commit 01/10/2026 09:20
1<?php
2/**
3 * Create character.
4 *
5 * Prepared by createcharacter.php:
6 * $formState 'success' | 'errors' | 'form'
7 * $errors array of messages, when $formState is 'errors'
8 *
9 * The character creation happens in createcharacter.php, never here.
10 */
11?>
12<div class="znx-acct">
13
14<div class="znx-acct-head"><?= t('createchar.title') ?></div>
15
16<?php if ($formState === 'success'): ?>
17
18 <div class="znx-acct-info znx-editchar-notice znx-editchar-notice--ok"><?= t('createchar.success') ?></div>
19
20<?php else: ?>
21
22 <?php if ($formState === 'errors'): ?>
23 <div class="znx-acct-info znx-editchar-notice znx-editchar-notice--error"><?= output_errors($errors) ?></div>
24 <?php endif; ?>
25
26 <form action="" method="post" class="znx-editchar-box">
27 <div class="znx-settings-field">
28 <label><?= t('createchar.name') ?></label>
29 <input type="text" name="name" class="znx-acct-select">
30 </div>
31 <div class="znx-settings-field">
32 <!-- Available vocations to select from when creating character -->
33 <label><?= t('createchar.vocation') ?></label>
34 <select name="selected_vocation" class="znx-acct-select">
35 <?php foreach ($config['available_vocations'] as $id) { ?>
36 <option value="<?php echo $id; ?>"><?php echo vocation_id_to_name($id); ?></option>
37 <?php } ?>
38 </select>
39 </div>
40 <div class="znx-settings-field">
41 <!-- Available genders to select from when creating character -->
42 <label><?= t('createchar.gender') ?></label>
43 <select name="selected_gender" class="znx-acct-select">
44 <option value="1"><?= t('createchar.male') ?></option>
45 <option value="0"><?= t('createchar.female') ?></option>
46 </select>
47 </div>
48 <?php
49 $available_towns = $config['available_towns'];
50 if (count($available_towns) > 1):
51 ?>
52 <div class="znx-settings-field">
53 <!-- Available towns to select from when creating character -->
54 <label><?= t('createchar.town') ?></label>
55 <select name="selected_town" class="znx-acct-select">
56 <?php
57 foreach ($available_towns as $tid):
58 ?>
59 <option value="<?php echo $tid; ?>"><?php echo town_id_to_name($tid); ?></option>
60 <?php
61 endforeach;
62 ?>
63 </select>
64 </div>
65 <?php
66 else:
67 ?>
68 <input type="hidden" name="selected_town" value="<?php echo end($available_towns); ?>">
69 <?php
70 endif;
71
72 /* Form file */
73 Token::create();
74 ?>
75 <button type="submit" class="znx-acct-btn"><?= t('createchar.title') ?></button>
76 </form>
77<?php endif; ?>
78
79</div><!-- .znx-acct -->
80
Top