2024-10-04 18:43:22 -05:00
|
|
|
<section>
|
2024-10-23 17:39:48 -05:00
|
|
|
<h1>Characters <span class="badge"><?= count($chars) . '/' . user()->char_slots ?></span></h1>
|
2024-10-04 18:43:22 -05:00
|
|
|
<?php
|
|
|
|
if (($f = flash('alert_character_list_1')) !== false) echo c_alert($f[0], $f[1]);
|
|
|
|
|
2024-10-05 14:23:32 -05:00
|
|
|
if (count($chars) > 0):
|
|
|
|
?>
|
2024-10-04 18:43:22 -05:00
|
|
|
<form action="/characters" method="post">
|
|
|
|
<input type="hidden" name="csrf" value="<?= csrf() ?>">
|
|
|
|
|
2024-10-05 14:23:32 -05:00
|
|
|
<div class="my-2 character-select">
|
2024-10-24 18:23:55 -05:00
|
|
|
<?php foreach ($chars as $i => $c) echo c_char_select_box($i, $c); ?>
|
2024-10-04 18:43:22 -05:00
|
|
|
|
2024-10-05 14:23:32 -05:00
|
|
|
<div class="mt-4 buttons">
|
|
|
|
<button type="submit" class="ui button primary" name="action" value="select">Select</button>
|
|
|
|
<button type="submit" class="ui button danger" name="action" value="delete">Delete</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-10-04 18:43:22 -05:00
|
|
|
</form>
|
|
|
|
<?php else: ?>
|
|
|
|
<!-- Should never see this particular message. If you have, there's a bug. -->
|
|
|
|
<p>You have no characters.</p>
|
|
|
|
<?php endif; ?>
|
|
|
|
</section>
|
|
|
|
|
2024-10-23 17:39:48 -05:00
|
|
|
<?php if (user()->char_slots > count($chars)): ?>
|
2024-10-04 18:43:22 -05:00
|
|
|
<section>
|
|
|
|
<h2>Create a new character</h2>
|
2024-10-23 17:39:48 -05:00
|
|
|
<?php $num_slots_left = user()->char_slots - count($chars); ?>
|
2024-10-04 18:43:22 -05:00
|
|
|
<p>You have <b><?= $num_slots_left ?> <?= $num_slots_left === 1 ? 'slot' : 'slots' ?></b> left.</p>
|
|
|
|
<form action="/character/create" method="post">
|
|
|
|
<input type="hidden" name="csrf" value="<?= csrf() ?>">
|
|
|
|
|
|
|
|
<div class="my-4">
|
2024-10-05 14:23:32 -05:00
|
|
|
<?= c_form_errors('create-character') ?>
|
|
|
|
<?= c_form_field('text', 'n', 'Character Name', formId: 'create-character') ?>
|
2024-10-04 18:43:22 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<button type="submit" class="ui button secondary">Create</button>
|
|
|
|
</form>
|
|
|
|
</section>
|
2024-10-05 14:23:32 -05:00
|
|
|
<?php endif; ?>
|