added id field on monsters, so you can delete in phpmyadmin

fixed adding some creatures with ' and "
This commit is contained in:
slawkens1 2017-06-06 23:19:15 +02:00
parent f393e525a6
commit 4fa32e79ce
5 changed files with 16 additions and 5 deletions

View File

@ -28,7 +28,7 @@ session_start();
define('MYAAC', true);
define('MYAAC_VERSION', '0.2.3');
define('DATABASE_VERSION', 3);
define('DATABASE_VERSION', 4);
define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true));
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : 'LINUX');

View File

@ -116,6 +116,7 @@ CREATE TABLE `myaac_hooks`
) ENGINE = MyISAM;
CREATE TABLE `myaac_monsters` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hide_creature` tinyint(1) NOT NULL default '0',
`name` varchar(255) NOT NULL,
`mana` int(11) NOT NULL,
@ -129,7 +130,8 @@ CREATE TABLE `myaac_monsters` (
`convinceable` tinyint(1) NOT NULL,
`race` varchar(255) NOT NULL,
`gfx_name` varchar(255) NOT NULL,
`file_path` varchar(255) NOT NULL
`file_path` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = MyISAM;
CREATE TABLE `myaac_movies`

3
system/migrations/4.php Normal file
View File

@ -0,0 +1,3 @@
<?php
$db->query("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `id` int(11) NOT NULL AUTO_INCREMENT primary key FIRST;");
?>

View File

@ -505,7 +505,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
if($mostdmg)
{
$mostdmg = ($death['mostdamage_is_player']) ? getPlayerLink($death['mostdamage_by']) : $death['mostdamage_by'];
$dead_add_content .= '<br>and by ' . $mostdmg;
$dead_add_content .= ' and by ' . $mostdmg;
if ($death['mostdamage_unjustified']) {
$dead_add_content .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";

View File

@ -135,10 +135,16 @@ if(isset($_POST['reload_monsters']) && $canEdit)
$flags['convinceable'] = '0';
if(!in_array($name, $names_added)) {
try { $db->query("INSERT INTO myaac_monsters (hide_creature, name, mana, exp, health, speed_lvl, use_haste, voices, immunities, summonable, convinceable, race, gfx_name, file_path) VALUES (0, '".$name."', '".$mana."', '".$exp."', '".$health."', '".$speed_lvl."', '".$use_haste."', '".$voices_string."', '".$immunities_string."', '".$flags['summonable']."', '".$flags['convinceable']."', '".$race."', '".$gfx_name."', '" . $allmonsters->currentFile() . "')"); } catch(PDOException $error) {}
$names_added[] = $name;
try {
$db->query("INSERT INTO myaac_monsters (hide_creature, name, mana, exp, health, speed_lvl, use_haste, voices, immunities, summonable, convinceable, race, gfx_name, file_path) VALUES (0, ".$db->quote($name).", '".$mana."', '".$exp."', '".$health."', '".$speed_lvl."', '".$use_haste."', ".$db->quote($voices_string).", ".$db->quote($immunities_string).", '".$flags['summonable']."', '".$flags['convinceable']."', '".$race."', ".$db->quote($gfx_name).", " . $db->quote($allmonsters->currentFile()) . ")");
echo "Added: ".$name."<br/>";
}
catch(PDOException $error) {
echo 'Error while adding monster (' . $name . '): ' . $error->getMessage();
}
$names_added[] = $name;
}
}
}