Creatures and monsters are now reloaded in Admin Panel

This commit is contained in:
slawkens 2020-10-27 07:33:21 +01:00
parent 41e24ca535
commit 9fe419cfe7
3 changed files with 3 additions and 39 deletions

View File

@ -23,26 +23,6 @@ $title = "Creatures";
</script>
<?php
$canEdit = hasFlag(FLAG_CONTENT_MONSTERS) || admin();
if (isset($_POST['reload_monsters']) && $canEdit) {
require LIBS . 'creatures.php';
if (Creatures::loadFromXML(true)) {
if (Creatures::getMonstersList()->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) {
?>
<form method="post" action="<?php echo getLink('creatures'); ?>">
<input type="hidden" name="reload_monsters" value="yes"/>
<input type="submit" value="(admin) Reload monsters"/>
</form>
<?php
}
if (empty($_REQUEST['creature'])) {
//send query to database
$monsters = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 ORDER BY name asc');
@ -170,4 +150,4 @@ if (empty($_REQUEST['creature'])) {
</script>
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>

View File

@ -11,15 +11,6 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Spells';
$canEdit = hasFlag(FLAG_CONTENT_SPELLS) || admin();
if(isset($_POST['reload_spells']) && $canEdit)
{
require LIBS . 'spells.php';
if(!Spells::loadFromXML(true)) {
error(Spells::getLastError());
}
}
if(isset($_REQUEST['vocation_id'])) {
$vocation_id = $_REQUEST['vocation_id'];
if($vocation_id == 'all') {
@ -90,4 +81,4 @@ $twig->display('spells.html.twig', array(
} );
</script>
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>

View File

@ -32,13 +32,6 @@
}
</style>
{% if canEdit %}
<form method="post" action="{{ getLink('spells') }}">
<input type="hidden" name="reload_spells" value="yes"/>
<input type="submit" value="(admin) Reload spells"/>
</form>
{% endif %}
<form action="{{ getLink('spells') }}" method="post">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
@ -198,4 +191,4 @@
</table>
</section>
</div>
</div>
</div>