mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-02 12:19:20 +02:00
nothing important, just early exit & fixes
Fix creature display
This commit is contained in:
parent
34fa672c0f
commit
bb699ffef2
@ -10,9 +10,10 @@
|
|||||||
* @link https://my-aac.org
|
* @link https://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = "Creatures";
|
$title = 'Creatures';
|
||||||
|
|
||||||
if (empty($_REQUEST['creature'])) {
|
if (empty($_REQUEST['name'])) {
|
||||||
|
// display list of monsters
|
||||||
$preview = config('creatures_images_preview');
|
$preview = config('creatures_images_preview');
|
||||||
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc')->fetchAll();
|
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc')->fetchAll();
|
||||||
|
|
||||||
@ -28,13 +29,16 @@ if (empty($_REQUEST['creature'])) {
|
|||||||
'preview' => $preview
|
'preview' => $preview
|
||||||
));
|
));
|
||||||
|
|
||||||
} else {
|
return;
|
||||||
$creature_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['creature']))));
|
}
|
||||||
$prep = $db->prepare('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 AND `name` = ? LIMIT 1;');
|
|
||||||
$prep->execute([$creature_name]);
|
|
||||||
$creature = $prep->fetch();
|
|
||||||
|
|
||||||
if (isset($creature['name'])) {
|
// display monster
|
||||||
|
$creature_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['name']))));
|
||||||
|
$prep = $db->prepare('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 AND `name` = ? LIMIT 1;');
|
||||||
|
$prep->execute([$creature_name]);
|
||||||
|
$creature = $prep->fetch();
|
||||||
|
|
||||||
|
if (isset($creature['name'])) {
|
||||||
function sort_by_chance($a, $b)
|
function sort_by_chance($a, $b)
|
||||||
{
|
{
|
||||||
if ($a['chance'] == $b['chance']) {
|
if ($a['chance'] == $b['chance']) {
|
||||||
@ -71,12 +75,9 @@ if (empty($_REQUEST['creature'])) {
|
|||||||
'creature' => $creature,
|
'creature' => $creature,
|
||||||
));
|
));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "Creature with name <b>" . $creature_name . "</b> doesn't exist.";
|
echo "Creature with name <b>" . $creature_name . "</b> doesn't exist.";
|
||||||
}
|
|
||||||
|
|
||||||
//back button
|
|
||||||
$twig->display('creatures.back_button.html.twig');
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
|
// back button
|
||||||
|
$twig->display('creatures.back_button.html.twig');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user