From 57c254709871e9f9cf9f12dc40feb99753a998f1 Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Tue, 6 Jun 2017 23:32:50 +0200 Subject: [PATCH] added same printing to spells more elegant way of showing message on reload creatures and spells --- system/pages/creatures.php | 4 ++-- system/pages/spells.php | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/system/pages/creatures.php b/system/pages/creatures.php index b54bdab6..108e0c93 100644 --- a/system/pages/creatures.php +++ b/system/pages/creatures.php @@ -137,10 +137,10 @@ if(isset($_POST['reload_monsters']) && $canEdit) 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, ".$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."
"; + success("Added: ".$name."
"); } catch(PDOException $error) { - echo 'Error while adding monster (' . $name . '): ' . $error->getMessage(); + warning('Error while adding monster (' . $name . '): ' . $error->getMessage()); } $names_added[] = $name; diff --git a/system/pages/spells.php b/system/pages/spells.php index 141498f9..62238378 100644 --- a/system/pages/spells.php +++ b/system/pages/spells.php @@ -68,8 +68,13 @@ if(isset($_POST['reload_spells']) && $canEdit) } $type = 2; $count = $spell->getConjureCount(); - try { $db->query("INSERT INTO myaac_spells (spell, name, words, type, mana, level, maglevel, soul, premium, vocations, conjure_count, hidden) VALUES ('".$spell_txt."', '".$name."', '".$spell_txt."', '".$type."', '".$mana."', '".$lvl."', '".$mlvl."', '".$soul."', '".$pacc."', '".$vocations_to_db."', '".$count."', '".$hide_spell."')"); } catch(PDOException $error) {} - echo "Added: ".$name."
"; + try { + $db->query("INSERT INTO myaac_spells (spell, name, words, type, mana, level, maglevel, soul, premium, vocations, conjure_count, hidden) VALUES ('".$spell_txt."', '".$name."', '".$spell_txt."', '".$type."', '".$mana."', '".$lvl."', '".$mlvl."', '".$soul."', '".$pacc."', '".$vocations_to_db."', '".$count."', '".$hide_spell."')"); + success("Added: ".$name."
"); + } + catch(PDOException $error) { + warning('Error while adding spell (' . $name . '): ' . $error->getMessage()); + } } //add instant spells @@ -118,8 +123,13 @@ if(isset($_POST['reload_spells']) && $canEdit) } $type = 1; $count = 0; - try { $db->query("INSERT INTO myaac_spells (spell, name, words, type, mana, level, maglevel, soul, premium, vocations, conjure_count, hidden) VALUES ('".$spell_txt."', '".$name."', '".$spell_txt."', '".$type."', '".$mana."', '".$lvl."', '".$mlvl."', '".$soul."', '".$pacc."', '".$vocations_to_db."', '".$count."', '".$hide_spell."')"); } catch(PDOException $error) {} - echo "Added: ".$name."
"; + try { + $db->query("INSERT INTO myaac_spells (spell, name, words, type, mana, level, maglevel, soul, premium, vocations, conjure_count, hidden) VALUES (".$db->quote($spell_txt).", ".$db->quote($name).", ".$db->quote($spell_txt).", '".$type."', '".$mana."', '".$lvl."', '".$mlvl."', '".$soul."', '".$pacc."', '".$vocations_to_db."', '".$count."', '".$hide_spell."')"); + success("Added: ".$name."
"); + } + catch(PDOException $error) { + warning('Error while adding spell (' . $name . '): ' . $error->getMessage()); + } } }