* @author Slawkens * @copyright 2019 MyAAC * @link https://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); $title = "Creatures"; ?> hasErrors()) error('There were some problems loading your monsters.xml file. Please check system/logs/error.log for more info.'); } else { error(Creatures::getLastError()); } } if ($canEdit) { ?>
query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 ORDER BY name asc'); echo ''; foreach ($monsters as $monster) { echo ''; } echo '
NameHealthExperience Summonable ManaConvinceable ManaRace
' . $monster['name'] . ' ' . $monster['health'] . ' ' . $monster['exp'] . ' ' . ($monster['summonable'] ? $monster['mana'] : "---") . ' ' . ($monster['convinceable'] ? $monster['mana'] : "---") . ' ' . ucwords($monster['race']) . '
'; } else { $monster_name = stripslashes(trim(ucwords($_REQUEST['creature']))); $monster = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 AND `name` = ' . $db->quote($monster_name) . ';')->fetch(); if (isset($monster['name'])) { $title = $monster['name'] . " - Creatures"; echo '

' . $monster['name'] . '

'; echo ''; $loot = json_decode($monster['loot'], true); if ($loot) { echo '
'; $number_of_rows = 0; echo ''; $number_of_rows++; echo ''; $number_of_rows++; echo ''; $number_of_rows++; if ($monster['summonable'] == 1) echo ''; else { echo ''; } $number_of_rows++; if ($monster['convinceable'] == 1) echo ''; else echo ''; echo '
Health: ' . $monster['health'] . '
Experience: ' . $monster['exp'] . '
Speed like: ' . $monster['speed_lvl'] . ' level'; $number_of_rows++; if ($monster['use_haste']) echo ' (Can use haste)'; echo '
Summon: ' . $monster['mana'] . ' mana
Summon: Impossible
Convince: ' . $monster['mana'] . ' mana
Convince: Impossible
'; $monster['gfx_name'] = trim(strtolower($monster['name'])) . ".gif"; if (!file_exists('images/monsters/' . $monster['gfx_name'])) { $gfx_name = str_replace(" ", "", $monster['gfx_name']); if (file_exists('images/monsters/' . $gfx_name)) echo ''; else echo ''; } else echo ''; echo '
'; $immunities = json_decode($monster['immunities'], true); if (count($immunities) > 0) { $number_of_rows++; echo ''; } $voices = json_decode($monster['voices'], true); if (count($voices) > 0) { foreach ($voices as &$voice) { $voice = '"' . $voice . '"'; } $number_of_rows++; echo ''; } echo '
Immunities: ' . implode(', ', $immunities) . '
Voices: ' . implode(', ', $voices) . '
'; function sort_by_chance($a, $b) { if ($a['chance'] == $b['chance']) { return 0; } return ($a['chance'] > $b['chance']) ? -1 : 1; } usort($loot, 'sort_by_chance'); $i = 0; foreach ($loot as $item) { $name = getItemNameById($item['id']); $tooltip = $name . '
Chance: ' . round($item['chance'] / 1000, 2) . '%
Max count: ' . $item['count']; echo ' ' . $name . ''; $i++; } echo '
'; } echo ''; echo ''; } else { echo "Monster with name " . $monster_name . " doesn't exist."; } //back button $twig->display('creatures.back_button.html.twig'); } ?>