finish new version of admin panel
This commit is contained in:
parent
2074a09663
commit
abe827eabd
|
@ -83,6 +83,15 @@ table {
|
|||
}
|
||||
}
|
||||
|
||||
.table-wrapper {
|
||||
width: 100%; /* Ensure the wrapper takes 100% of the parent's width */
|
||||
max-height: 300px; /* Set the desired height limit */
|
||||
overflow-x: auto; /* Enable horizontal scrolling if the table overflows */
|
||||
overflow-y: auto; /* Enable vertical scrolling if needed */
|
||||
display: block; /* Ensure block-level behavior */
|
||||
-webkit-overflow-scrolling: touch; /* Smooth scrolling on touch devices */
|
||||
}
|
||||
|
||||
a {
|
||||
color: #015df7;
|
||||
text-decoration: none;
|
||||
|
|
|
@ -56,7 +56,7 @@ function index(): string
|
|||
redirect('/fight');
|
||||
}
|
||||
|
||||
return Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,10 +23,7 @@ function move() {
|
|||
|
||||
// Validate direction
|
||||
$form = validate($_POST, ['direction' => ['in:north,west,east,south']]);
|
||||
if (!$form['valid']) {
|
||||
$errors = ul_from_validate_errors($form['errors']);
|
||||
return \Render\content($errors);
|
||||
}
|
||||
if (!$form['valid']) return ul_from_validate_errors($form['errors']);
|
||||
|
||||
// Current game state
|
||||
$game_size = env('game_size');
|
||||
|
|
|
@ -120,15 +120,15 @@ function fight()
|
|||
// Spell action
|
||||
if (isset($_POST["spell"])) {
|
||||
$pickedspell = $_POST["userspell"];
|
||||
if ($pickedspell == 0) return \Render\content('You must select a spell first. Please go back and try again.');
|
||||
if ($pickedspell == 0) return 'You must select a spell first. Please go back and try again.';
|
||||
|
||||
$newspellrow = get_spell($pickedspell);
|
||||
$spell = in_array($pickedspell, explode(',', user()->spells));
|
||||
|
||||
if (!$spell) return \Render\content('You have not yet learned this spell. Please go back and try again.');
|
||||
if (!$spell) return 'You have not yet learned this spell. Please go back and try again.';
|
||||
|
||||
if (user()->currentmp < $newspellrow["mp"]) {
|
||||
return \Render\content('You do not have enough Magic Points to cast this spell. Please go back and try again.');
|
||||
return 'You do not have enough Magic Points to cast this spell. Please go back and try again.';
|
||||
}
|
||||
|
||||
// Spell type handling (similar to original function)
|
||||
|
@ -177,7 +177,7 @@ function fight()
|
|||
|
||||
// Finalize page and display it
|
||||
$page = render('fight', ['page' => $page]);
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
function victory()
|
||||
|
@ -251,7 +251,7 @@ function victory()
|
|||
user()->save();
|
||||
|
||||
page_title($title);
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
function drop()
|
||||
|
@ -263,10 +263,7 @@ function drop()
|
|||
if (isset($_POST["submit"])) {
|
||||
$slot = $_POST["slot"];
|
||||
|
||||
if ($slot == 0) {
|
||||
$page = 'Please go back and select an inventory slot to continue.';
|
||||
return \Render\content($page);
|
||||
}
|
||||
if ($slot === 0) return 'Please go back and select an inventory slot to continue.';
|
||||
|
||||
$slotstr = 'slot'.$slot.'id';
|
||||
if (user()->$slotstr != 0) {
|
||||
|
@ -321,8 +318,7 @@ function drop()
|
|||
}
|
||||
|
||||
user()->save();
|
||||
$page = 'The item has been equipped. You can now continue <a href="/" hx-get="/" hx-target="#middle">exploring</a>.';
|
||||
return \Render\content($page);
|
||||
return 'The item has been equipped. You can now continue <a href="/" hx-get="/" hx-target="#middle">exploring</a>.';
|
||||
}
|
||||
|
||||
$attributearray = array("maxhp"=>"Max HP",
|
||||
|
@ -352,19 +348,18 @@ function drop()
|
|||
$page .= "<form action=\"/drop\" method=\"post\"><select name=\"slot\"><option value=\"0\">Choose One</option><option value=\"1\">Slot 1: ".user()->slot1name."</option><option value=\"2\">Slot 2: ".user()->slot2name."</option><option value=\"3\">Slot 3: ".user()->slot3name."</option></select> <input type=\"submit\" name=\"submit\" value=\"Submit\" /></form>";
|
||||
$page .= "You may also choose to just continue <a href=\"/\" hx-get=\"/\" hx-target=\"#middle\">exploring</a> and give up this item.";
|
||||
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
||||
function dead()
|
||||
{
|
||||
$page = <<<HTML
|
||||
return <<<HTML
|
||||
<b>You have died.</b><br><br>
|
||||
As a consequence, you've lost half of your gold. However, you have been given back a portion of your hit points
|
||||
to continue your journey.<br><br>
|
||||
You may now continue back to <a href="/" hx-get="/" hx-target="#middle">town</a>, and we hope you fair better next time.
|
||||
HTML;
|
||||
return \Render\content($page);
|
||||
}
|
||||
|
||||
function handleMonsterTurn(&$userrow, $monsterrow)
|
||||
|
|
|
@ -56,7 +56,7 @@ function donothing($start = 0)
|
|||
$page .= '</table></td></tr></table>';
|
||||
|
||||
page_title('Forum');
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
function showthread($id, $start)
|
||||
|
@ -72,7 +72,7 @@ function showthread($id, $start)
|
|||
$page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br><form action=\"/forum/reply\" method=\"post\" hx-post=\"/forum/reply\" hx-target=\"#middle\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$title["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
||||
|
||||
page_title('Forum: '.$title['title']);
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
function reply()
|
||||
|
@ -110,7 +110,6 @@ function newthread()
|
|||
redirect('/forum/thread/'.db()->lastInsertRowID().'/0');
|
||||
}
|
||||
|
||||
$page = "<table width=\"100%\"><tr><td><b>Make A New Post:</b><br><br/ ><form action=\"/forum/new\" method=\"post\" hx-post=\"/forum/new\" hx-target=\"#middle\">Title:<br><input type=\"text\" name=\"title\" size=\"50\" maxlength=\"50\" /><br><br>Message:<br><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
||||
page_title('Form: New Thread');
|
||||
return \Render\content($page);
|
||||
return "<table width=\"100%\"><tr><td><b>Make A New Post:</b><br><br/ ><form action=\"/forum/new\" method=\"post\" hx-post=\"/forum/new\" hx-target=\"#middle\">Title:<br><input type=\"text\" name=\"title\" size=\"50\" maxlength=\"50\" /><br><br>Message:<br><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br><br><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>";
|
||||
}
|
||||
|
|
|
@ -30,5 +30,5 @@ function healspells(int $id): string
|
|||
}
|
||||
|
||||
page_title('Casting '.$spell['name']);
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ function inn()
|
|||
}
|
||||
|
||||
page_title($town['name'] . ' Inn');
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,7 +156,7 @@ function shop()
|
|||
HTML;
|
||||
|
||||
page_title($town['name'] . ' Shop');
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,8 +186,7 @@ function buy(int $id)
|
|||
];
|
||||
|
||||
if (!isset($type_mapping[$item["type"]])) { // should never happen
|
||||
$page = 'Error! Invalid item type...<br>'.var_dump($item);
|
||||
return \Render\content($page, '');
|
||||
return 'Error! Invalid item type...<br>'.var_dump($item);
|
||||
}
|
||||
|
||||
// Retrieve current equipped item or create a default
|
||||
|
@ -271,7 +270,7 @@ function buy(int $id)
|
|||
}
|
||||
|
||||
page_title('Buying '.$item['name']);
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -317,7 +316,7 @@ function maps()
|
|||
HTML;
|
||||
|
||||
page_title('Maps');
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
function buy_map(int $id): string
|
||||
|
@ -352,7 +351,7 @@ function buy_map(int $id): string
|
|||
}
|
||||
|
||||
page_title('Buying '.$town['name'].' Map');
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -398,5 +397,5 @@ function travelto(int $id, bool $use_points = true): string
|
|||
}
|
||||
|
||||
page_title('Travelling to '.$town['name']);
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ function login()
|
|||
}
|
||||
|
||||
page_title('Login');
|
||||
return \Render\content(render('login'));
|
||||
return render('login');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,7 +98,7 @@ function register()
|
|||
}
|
||||
|
||||
page_title('Register');
|
||||
return \Render\content($page);
|
||||
return $page;
|
||||
}
|
||||
|
||||
function verify()
|
||||
|
@ -113,10 +113,10 @@ function verify()
|
|||
|
||||
db()->query("UPDATE users SET verify='g2g' WHERE username=?;", [$u]);
|
||||
|
||||
return \Render\content("Your account was verified successfully.<br><br>You may now continue to the <a href=\"/login\">Login Page</a> and start playing the game.<br><br>Thanks for playing!");
|
||||
return "Your account was verified successfully.<br><br>You may now continue to the <a href=\"/login\">Login Page</a> and start playing the game.<br><br>Thanks for playing!";
|
||||
}
|
||||
|
||||
return \Render\content(render('verify'));
|
||||
return render('verify');
|
||||
}
|
||||
|
||||
function lostpassword()
|
||||
|
@ -132,13 +132,13 @@ function lostpassword()
|
|||
db()->query('UPDATE users SET password=? WHERE email=?;', [$hashed, $e]);
|
||||
|
||||
if (sendpassemail($e, $newpass)) {
|
||||
return \Render\content("Your new password was emailed to the address you provided.<br><br>Once you receive it, you may <a href=\"/login\">Log In</a> and continue playing.<br><br>Thank you.");
|
||||
return "Your new password was emailed to the address you provided.<br><br>Once you receive it, you may <a href=\"/login\">Log In</a> and continue playing.<br><br>Thank you.";
|
||||
} else {
|
||||
return \Render\content("There was an error sending your new password.<br><br>Please check with the game administrator for more information.<br><br>We apologize for the inconvience.");
|
||||
return "There was an error sending your new password.<br><br>Please check with the game administrator for more information.<br><br>We apologize for the inconvience.";
|
||||
}
|
||||
}
|
||||
|
||||
return \Render\content(render('lostpassword'));
|
||||
return render('lostpassword');
|
||||
}
|
||||
|
||||
function changepassword()
|
||||
|
@ -170,7 +170,7 @@ function changepassword()
|
|||
|
||||
$auth->logout();
|
||||
|
||||
return \Render\content("Your password was changed successfully.<br><br>You have been logged out of the game to avoid errors.<br><br>Please <a href=\"/login\">log back in</a> to continue playing.");
|
||||
return "Your password was changed successfully.<br><br>You have been logged out of the game to avoid errors.<br><br>Please <a href=\"/login\">log back in</a> to continue playing.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,10 +187,10 @@ function settings()
|
|||
user()->save();
|
||||
|
||||
$alert = '<div class="alert">Settings updated</div>';
|
||||
return \Render\content($alert . render('settings'));
|
||||
return $alert . render('settings');
|
||||
}
|
||||
|
||||
return \Render\content(render('settings'));
|
||||
return render('settings');
|
||||
}
|
||||
|
||||
function sendpassemail($emailaddress, $password)
|
||||
|
|
|
@ -63,6 +63,11 @@ if (!file_exists('../.installed') && $uri[0] !== 'install') { // need to install
|
|||
redirect('/');
|
||||
}
|
||||
|
||||
// Update default page layout based on root endpoint
|
||||
page_layout('layouts/primary');
|
||||
if ($uri[0] === 'admin') page_layout('layouts/admin');
|
||||
if ($uri[0] === 'help') page_layout('layouts/help');
|
||||
|
||||
user()->update_online_time();
|
||||
} else {
|
||||
$auth->logout();
|
||||
|
|
37
src/lib.php
37
src/lib.php
|
@ -311,7 +311,7 @@ function validate(array $input_data, array $rules): array
|
|||
break;
|
||||
|
||||
case 'int':
|
||||
if (!filter_var($value, FILTER_VALIDATE_INT)) {
|
||||
if (filter_var($value, FILTER_VALIDATE_INT) === false) {
|
||||
$errors[$field][] = "{$field_name} must be an integer.";
|
||||
}
|
||||
break;
|
||||
|
@ -514,22 +514,33 @@ function page_title(string $new_title = ''): string
|
|||
*/
|
||||
function render_response(array $uri, string $content): string
|
||||
{
|
||||
if (!is_htmx() || $uri[0] === 'babblebox') return $content;
|
||||
if ($uri[0] === 'babblebox') return $content;
|
||||
|
||||
header('HX-Push-Url: '.$_SERVER['REQUEST_URI']);
|
||||
if (is_htmx()) {
|
||||
header('HX-Push-Url: '.$_SERVER['REQUEST_URI']);
|
||||
|
||||
$content .= '<title>'.page_title().'</title>';
|
||||
$content .= '<title>'.page_title().'</title>';
|
||||
|
||||
$content .= Render\debug_db_info();
|
||||
$content .= Render\debug_db_info();
|
||||
|
||||
if (env('debug', false)) {
|
||||
$content .= Render\debug_query_log();
|
||||
if (env('debug', false)) {
|
||||
$content .= Render\debug_query_log();
|
||||
}
|
||||
|
||||
if ($GLOBALS['state']['user-state-changed'] ?? false) {
|
||||
$content .= Render\right_nav();
|
||||
$content .= Render\left_nav();
|
||||
}
|
||||
}
|
||||
|
||||
if ($GLOBALS['state']['user-state-changed'] ?? false) {
|
||||
$content .= Render\right_nav();
|
||||
$content .= Render\left_nav();
|
||||
}
|
||||
|
||||
return $content;
|
||||
return Render\content($content, page_layout());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get/set page layout through GLOBALS state.
|
||||
*/
|
||||
function page_layout(string $layout = ''): string
|
||||
{
|
||||
if ($layout === '') return $GLOBALS['state']['page-layout'] ?? 'layouts/primary';
|
||||
return $GLOBALS['state']['page-layout'] = $layout;
|
||||
}
|
||||
|
|
33
templates/admin/edit_level.php
Normal file
33
templates/admin/edit_level.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<h2>Edit Level <?= $level['id'] ?></h2>
|
||||
Experience values for each level should be the cumulative total amount of experience up to this point. All other values should be only the new amount to add this level.<br><br>
|
||||
|
||||
<form action="/admin/levels" method="post" hx-post="/admin/levels" hx-target="#main">
|
||||
<input type="hidden" name="save" value="true">
|
||||
<input type="hidden" name="level" value="<?= $level['id'] ?>">
|
||||
<table>
|
||||
<colgroup><col><col></colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ID:</td>
|
||||
<td><?= $level['id'] ?></td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan="2"></td></tr>
|
||||
|
||||
<?php foreach ([1, 2, 3] as $n): ?>
|
||||
<?php $class_name = env("class_{$n}_name"); ?>
|
||||
<tr><td><?= $class_name ?> EXP</td> <td><input type="number" name="<?= $n ?>_exp" value="<?= $level["{$n}_exp"] ?>"></td></tr>
|
||||
<tr><td><?= $class_name ?> HP</td> <td><input type="number" name="<?= $n ?>_hp" value="<?= $level["{$n}_hp"] ?>"></td></tr>
|
||||
<tr><td><?= $class_name ?> MP</td> <td><input type="number" name="<?= $n ?>_mp" value="<?= $level["{$n}_mp"] ?>"></td></tr>
|
||||
<tr><td><?= $class_name ?> TP</td> <td><input type="number" name="<?= $n ?>_tp" value="<?= $level["{$n}_tp"] ?>"></td></tr>
|
||||
<tr><td><?= $class_name ?> Strength</td> <td><input type="number" name="<?= $n ?>_strength" value="<?= $level["{$n}_strength"] ?>"></td></tr>
|
||||
<tr><td><?= $class_name ?> Dexterity</td><td><input type="number" name="<?= $n ?>_dexterity" value="<?= $level["{$n}_dexterity"] ?>"></td></tr>
|
||||
<tr><td><?= $class_name ?> Spells</td> <td><input type="number" name="<?= $n ?>_spells" value="<?= $level["{$n}_spells"] ?>"></td></tr>
|
||||
<?= $n !== 3 ? '<tr><td colspan="2"></td></tr>' : '' ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
<button type="reset">Reset</button>
|
||||
</form>
|
74
templates/admin/edit_monster.php
Normal file
74
templates/admin/edit_monster.php
Normal file
|
@ -0,0 +1,74 @@
|
|||
<h2>Edit <?= $monster['name'] ?></h2>
|
||||
|
||||
<form action="/admin/monsters/<?= $monster['id'] ?>"
|
||||
method="post"
|
||||
hx-post="/admin/monsters/<?= $monster['id'] ?>"
|
||||
hx-target="#main">
|
||||
<table>
|
||||
<colgroup><col><col></colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td><?= $monster['id'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td><input type="text" name="name" value="<?= $monster['name'] ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Max HP</td>
|
||||
<td><input type="number" name="maxhp" value="<?= $monster['maxhp'] ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Max Damage</td>
|
||||
<td>
|
||||
<input type="number" name="maxdam" value="<?= $monster['maxdam'] ?>"><br>
|
||||
<span class="small">Compares to player's attack power.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Armor</td>
|
||||
<td>
|
||||
<input type="number" name="armor" value="<?= $monster['armor'] ?>"><br>
|
||||
<span class="small">Compares to player's defense power.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Monster Level</td>
|
||||
<td>
|
||||
<input type="number" name="level" value="<?= $monster['level'] ?>"><br>
|
||||
<span class="small">Determines spawn location and item drops.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Max EXP</td>
|
||||
<td>
|
||||
<input type="number" name="maxexp" value="<?= $monster['maxexp'] ?>"><br>
|
||||
<span class="small">Max experience gained from defeating monster.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Max Gold</td>
|
||||
<td>
|
||||
<input type="number" name="maxgold" value="<?= $monster['maxgold'] ?>"><br>
|
||||
<span class="small">Max gold gained from defeating monster.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Immunity</td>
|
||||
<td>
|
||||
<select name="immune">
|
||||
<option value="0" <?= $monster['immune'] == 0 ? 'selected' : '' ?>>None</option>
|
||||
<option value="1" <?= $monster['immune'] == 1 ? 'selected' : '' ?>>Hurt Spells</option>
|
||||
<option value="2" <?= $monster['immune'] == 2 ? 'selected' : '' ?>>Hurt & Sleep Spells</option>
|
||||
</select>
|
||||
<br>
|
||||
<span class="small">Some monsters may not be hurt by certain spells.</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
<button type="reset">Reset</button>
|
||||
</form>
|
56
templates/admin/edit_spell.php
Normal file
56
templates/admin/edit_spell.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<h2>Edit <?= $spell['name'] ?></h2>
|
||||
|
||||
<form action="/admin/spells/<?= $spell['id'] ?>" method="post", hx-post="/admin/spells/<?= $spell['id'] ?>" hx-target="#main">
|
||||
<table>
|
||||
<colgroup><col><col></colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td><?= $spell['id'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td><input type="text" name="name" value="<?= $spell['name'] ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MP</td>
|
||||
<td>
|
||||
<input type="number" name="mp" value="<?= $spell['mp'] ?>">
|
||||
<br>
|
||||
<span class="small">MP required to cast spell.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Attribute</td>
|
||||
<td>
|
||||
<input type="number" name="attribute" value="<?= $spell['attribute'] ?>">
|
||||
<br>
|
||||
<span class="small">Numeric value of the spell's effect. Ties with type, below.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type</td>
|
||||
<td>
|
||||
<select name="type">
|
||||
<option value="1" <?= $spell['type'] == 1 ? 'selected' : '' ?>>Heal</option>
|
||||
<option value="2" <?= $spell['type'] == 2 ? 'selected' : '' ?>>Hurt</option>
|
||||
<option value="3" <?= $spell['type'] == 3 ? 'selected' : '' ?>>Sleep</option>
|
||||
<option value="4" <?= $spell['type'] == 4 ? 'selected' : '' ?>>Uber Attack</option>
|
||||
<option value="5" <?= $spell['type'] == 5 ? 'selected' : '' ?>>Uber Defense</option>
|
||||
</select>
|
||||
<br>
|
||||
<span class="small">
|
||||
- Heal gives player back [attribute] hit points.<br>
|
||||
- Hurt deals [attribute] damage to monster.<br>
|
||||
- Sleep keeps monster from attacking ([attribute] is monster's chance out of 15 to stay asleep each turn).<br>
|
||||
- Uber Attack increases total attack damage by [attribute] percent.<br>
|
||||
- Uber Defense increases total defense from attack by [attribute] percent.
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
<button type="reset">Reset</button>
|
||||
</form>
|
58
templates/admin/edit_town.php
Normal file
58
templates/admin/edit_town.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<h2>Edit <?= $town['name'] ?></h2>
|
||||
<form action="/admin/towns/<?= $town['id'] ?>" method="post" hx-post="/admin/towns/<?= $town['id'] ?>" hx-target="#main">
|
||||
<table>
|
||||
<colgroup><col><col></colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ID</td> <td><?= $town['id'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td><input type="text" name="name" value="<?= $town['name'] ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Latitude</td>
|
||||
<td>
|
||||
<input type="number" name="latitude" value="<?= $town['latitude'] ?>"><br>
|
||||
<span class="small">Positive or negative integer.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Longitude</td>
|
||||
<td>
|
||||
<input type="number" name="longitude" value="<?= $town['longitude'] ?>" /><br>
|
||||
<span class="small">Positive or negative integer.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Inn Price</td>
|
||||
<td><input type="number" name="innprice" value="<?= $town['innprice'] ?>"> gold</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Map Price</td>
|
||||
<td>
|
||||
<input type="number" name="mapprice" value="<?= $town['mapprice'] ?>"> gold<br>
|
||||
<span class="small">How much it costs to buy the map to this town.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Travel Points</td>
|
||||
<td>
|
||||
<input type="number" name="travelpoints" value="<?= $town['travelpoints'] ?>"><br>
|
||||
<span class="small">How many TP are consumed when travelling to this town.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Items List</td>
|
||||
<td>
|
||||
<input type="text" name="itemslist" value="<?= $town['itemslist'] ?>"><br>
|
||||
<span class="small">Comma-separated list of item ID numbers available for purchase at this town.
|
||||
(Example: <span class="highlight">1,2,3,6,9,10,13,20</span>)</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
<button type="reset">Reset</button>
|
||||
</form>
|
89
templates/admin/edit_user.php
Normal file
89
templates/admin/edit_user.php
Normal file
|
@ -0,0 +1,89 @@
|
|||
<h2>Edit <?= $user['username'] ?></h2>
|
||||
<form action="/admin/users/<?= $user['id'] ?>" method="post" hx-post="/admin/users/<?= $user['id'] ?>" hx-target="#main">
|
||||
<table>
|
||||
<colgroup><col><col></colgroup>
|
||||
<tbody>
|
||||
<tr><td>ID</td><td><?= $user['id'] ?></td></tr>
|
||||
<tr><td>Username</td><td><input type="text" name="username" value="<?= $user['username'] ?>"></td></tr>
|
||||
<tr><td>Email</td><td><input type="text" name="email" value="<?= $user['email'] ?>"></td></tr>
|
||||
<tr><td>Register Date</td><td><?= pretty_date($user['regdate']) ?></td></tr>
|
||||
<tr><td>Last Online</td><td><?= pretty_date($user['onlinetime']) ?></td></tr>
|
||||
<tr><td>Auth Level</td><td>
|
||||
<select name="authlevel">
|
||||
<option value="0" <?= $user['authlevel'] == 0 ? 'selected' : '' ?>>User</option>
|
||||
<option value="1" <?= $user['authlevel'] == 1 ? 'selected' : '' ?>>Admin</option>
|
||||
<option value="2" <?= $user['authlevel'] == 2 ? 'selected' : '' ?>>Blocked</option>
|
||||
</select><br>
|
||||
<span class="small">Set to "Blocked" to temporarily (or permanently) ban a user.</span>
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="2"></td></tr>
|
||||
|
||||
<tr><td>Latitude</td><td><input type="number" name="latitude" value="<?= $user['latitude'] ?>" /></td></tr>
|
||||
<tr><td>Longitude</td><td><input type="number" name="longitude" value="<?= $user['longitude'] ?>" /></td></tr>
|
||||
<tr><td>Character Class</td><td>
|
||||
<select name="charclass">
|
||||
<option value="1" <?= $user['charclass'] == 1 ? 'selected' : '' ?>><?= env('class_1_name') ?></option>
|
||||
<option value="2" <?= $user['charclass'] == 2 ? 'selected' : '' ?>><?= env('class_2_name') ?></option>
|
||||
<option value="3" <?= $user['charclass'] == 3 ? 'selected' : '' ?>><?= env('class_3_name') ?></option>
|
||||
</select>
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="2"></td></tr>
|
||||
|
||||
<tr><td>Current Action</td><td><input type="text" name="currentaction" value="<?= $user['currentaction'] ?>" /></td></tr>
|
||||
<tr><td>Current Fight</td><td><input type="number" name="currentfight" value="<?= $user['currentfight'] ?>" /></td></tr>
|
||||
<tr><td>Current Monster</td><td><input type="number" name="currentmonster" value="<?= $user['currentmonster'] ?>" /></td></tr>
|
||||
<tr><td>Current Monster HP</td><td><input type="number" name="currentmonsterhp" value="<?= $user['currentmonsterhp'] ?>" /></td></tr>
|
||||
<tr><td>Current Monster Sleep</td><td><input type="number" name="currentmonsterimmune" value="<?= $user['currentmonsterimmune'] ?>" /></td></tr>
|
||||
<tr><td>Current Monster Immune</td><td><input type="number" name="currentmonstersleep" value="<?= $user['currentmonstersleep'] ?>" /></td></tr>
|
||||
<tr><td>Current Uber Damage</td><td><input type="number" name="currentuberdamage" value="<?= $user['currentuberdamage'] ?>" /></td></tr>
|
||||
<tr><td>Current Uber Defense</td><td><input type="number" name="currentuberdefense" value="<?= $user['currentuberdefense'] ?>" /></td></tr>
|
||||
|
||||
<tr><td colspan="2"></td></tr>
|
||||
|
||||
<tr><td>Current HP</td><td><input type="number" name="currenthp" value="<?= $user['currenthp'] ?>" /></td></tr>
|
||||
<tr><td>Current MP</td><td><input type="number" name="currentmp" value="<?= $user['currentmp'] ?>" /></td></tr>
|
||||
<tr><td>Current TP</td><td><input type="number" name="currenttp" value="<?= $user['currenttp'] ?>" /></td></tr>
|
||||
<tr><td>Max HP</td><td><input type="number" name="maxhp" value="<?= $user['maxhp'] ?>" /></td></tr>
|
||||
<tr><td>Max MP</td><td><input type="number" name="maxmp" value="<?= $user['maxmp'] ?>" /></td></tr>
|
||||
<tr><td>Max TP</td><td><input type="number" name="maxtp" value="<?= $user['maxtp'] ?>" /></td></tr>
|
||||
|
||||
<tr><td colspan="2"></td></tr>
|
||||
|
||||
<tr><td>Level</td><td><input type="number" name="level" value="<?= $user['level'] ?>" /></td></tr>
|
||||
<tr><td>Gold</td><td><input type="number" name="gold" value="<?= $user['gold'] ?>" /></td></tr>
|
||||
<tr><td>Experience</td><td><input type="number" name="experience" value="<?= $user['experience'] ?>" /></td></tr>
|
||||
<tr><td>Gold Bonus</td><td><input type="number" name="goldbonus" value="<?= $user['goldbonus'] ?>" /></td></tr>
|
||||
<tr><td>EXP Bonus</td><td><input type="number" name="expbonus" value="<?= $user['expbonus'] ?>" /></td></tr>
|
||||
<tr><td>Strength</td><td><input type="number" name="strength" value="<?= $user['strength'] ?>" /></td></tr>
|
||||
<tr><td>Dexterity</td><td><input type="number" name="dexterity" value="<?= $user['dexterity'] ?>" /></td></tr>
|
||||
<tr><td>Attack Power</td><td><input type="number" name="attackpower" value="<?= $user['attackpower'] ?>" /></td></tr>
|
||||
<tr><td>Defense Power</td><td><input type="number" name="defensepower" value="<?= $user['defensepower'] ?>" /></td></tr>
|
||||
|
||||
<tr><td colspan="2"></td></tr>
|
||||
|
||||
<tr><td>Weapon ID</td><td><input type="number" name="weaponid" value="<?= $user['weaponid'] ?>"></td></tr>
|
||||
<tr><td>Armor ID</td><td><input type="number" name="armorid" value="<?= $user['armorid'] ?>"></td></tr>
|
||||
<tr><td>Shield ID</td><td><input type="number" name="shieldid" value="<?= $user['shieldid'] ?>"></td></tr>
|
||||
<tr><td>Slot 1 ID</td><td><input type="number" name="slot1id" value="<?= $user['slot1id'] ?>"></td></tr>
|
||||
<tr><td>Slot 2 ID</td><td><input type="number" name="slot2id" value="<?= $user['slot2id'] ?>"></td></tr>
|
||||
<tr><td>Slot 3 ID</td><td><input type="number" name="slot3id" value="<?= $user['slot3id'] ?>"></td></tr>
|
||||
<tr><td>Weapon Name</td><td><input type="text" name="weaponname" value="<?= $user['weaponname'] ?>"></td></tr>
|
||||
<tr><td>Armor Name</td><td><input type="text" name="armorname" value="<?= $user['armorname'] ?>"></td></tr>
|
||||
<tr><td>Shield Name</td><td><input type="text" name="shieldname" value="<?= $user['shieldname'] ?>"></td></tr>
|
||||
<tr><td>Slot 1 Name</td><td><input type="text" name="slot1name" value="<?= $user['slot1name'] ?>"></td></tr>
|
||||
<tr><td>Slot 2 Name</td><td><input type="text" name="slot2name" value="<?= $user['slot2name'] ?>"></td></tr>
|
||||
<tr><td>Slot 3 Name</td><td><input type="text" name="slot3name" value="<?= $user['slot3name'] ?>"></td></tr>
|
||||
|
||||
<tr><td colspan="2"></td></tr>
|
||||
|
||||
<tr><td>Drop Code</td><td><input type="number" name="dropcode" value="<?= $user['dropcode'] ?>"></td></tr>
|
||||
<tr><td>Spells</td><td><input type="text" name="spells" value="<?= $user['spells'] ?>"></td></tr>
|
||||
<tr><td>Towns</td><td><input type="text" name="towns" value="<?= $user['towns'] ?>"></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
<button type="reset">Reset</button>
|
||||
</form>
|
|
@ -28,7 +28,7 @@
|
|||
<a href="/admin/drops" hx-get="/admin/drops" hx-target="#main">Edit Drops</a><br>
|
||||
<a href="/admin/towns" hx-get="/admin/towns" hx-target="#main">Edit Towns</a><br>
|
||||
<a href="/admin/monsters" hx-get="/admin/monsters" hx-target="#main">Edit Monsters</a><br>
|
||||
<a href="/admin/level" hx-get="/admin/level" hx-target="#main">Edit Levels</a><br>
|
||||
<a href="/admin/levels" hx-get="/admin/levels" hx-target="#main">Edit Levels</a><br>
|
||||
<a href="/admin/spells" hx-get="/admin/spells" hx-target="#main">Edit Spells</a><br>
|
||||
</nav>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user