0){ output("Creature deleted`n`n"); }else{ output("Creature not deleted: %s", db_error(LINK)); } $op=""; httpset('op', ""); } if ($op=="" || $op=="search"){ $level = httpget("level"); if (!$level) $level = 1; $q = httppost("q"); if ($q) { $where = "creaturename LIKE '%$q%' OR creatureweapon LIKE '%$q%' OR creaturelose LIKE '%$q%' OR createdby LIKE '%$q%'"; } else { $where = "creaturelevel='$level'"; } $sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE $where ORDER BY creaturelevel,creaturename"; $result = db_query($sql); // Search form $search = translate_inline("Search"); rawoutput("
"); output("Search by field: "); rawoutput(""); rawoutput(""); rawoutput("
"); rawoutput("",true); addnav("","creatures.php?op=search"); addnav("Levels"); $sql1 = "SELECT count(creatureid) AS n,creaturelevel FROM " . db_prefix("creatures") . " group by creaturelevel order by creaturelevel"; $result1 = db_query($sql1); while ($row = db_fetch_assoc($result1)) { addnav(array("Level %s: (%s creatures)", $row['creaturelevel'], $row['n']), "creatures.php?level={$row['creaturelevel']}"); } // There is no reason to allow players to add creatures to level 17 and 18. // Players aren't supposed to stay at level 15 at all. if ($level <= 16) { addnav("Edit"); addnav("Add a creature","creatures.php?op=add&level=$level"); } $opshead = translate_inline("Ops"); $idhead = translate_inline("ID"); $name = translate_inline("Name"); $lev = translate_inline("Level"); $weapon = translate_inline("Weapon"); $winmsg = translate_inline("Win"); $diemsg = translate_inline("Die"); $author = translate_inline("Author"); $edit = translate_inline("Edit"); $confirm = translate_inline("Are you sure you wish to delete this creature?"); $del = translate_inline("Del"); rawoutput(""); rawoutput(""); rawoutput(""); addnav("","creatures.php"); $number=db_num_rows($result); for ($i=0;$i<$number;$i++){ $row = db_fetch_assoc($result); rawoutput("", true); rawoutput(""); } rawoutput("
$opshead$idhead$name$lev$weapon$winmsg$diemsg$author
[ "); output_notl("%s", $edit); rawoutput(" | "); output_notl("%s", $del); rawoutput(" ]"); addnav("","creatures.php?op=edit&creatureid={$row['creatureid']}"); addnav("","creatures.php?op=del&creatureid={$row['creatureid']}&level={$row['creaturelevel']}"); output_notl("%s", $row['creatureid']); rawoutput(""); output_notl("%s", $row['creaturename']); rawoutput(""); output_notl("%s", $row['creaturelevel']); rawoutput(""); output_notl("%s", $row['creatureweapon']); rawoutput(""); output_notl("%s", $row['creaturewin']); rawoutput(""); output_notl("%s", $row['creaturelose']); rawoutput(""); output_notl("%s", $row['createdby']); rawoutput("
"); }else{ $level = httpget('level'); if (!$level) $level = 1; if ($op=="edit" || $op=="add"){ require_once("lib/showform.php"); addnav("Edit"); addnav("Creature properties", "creatures.php?op=edit&creatureid=$id"); addnav("Add"); addnav("Add Another Creature", "creatures.php?op=add&level=$level"); module_editor_navs("prefs-creatures", "creatures.php?op=edit&subop=module&creatureid=$id&module="); if ($subop == "module") { $module = httpget("module"); rawoutput("
"); module_objpref_edit("creatures", $module, $id); rawoutput("
"); addnav("", "creatures.php?op=save&subop=module&creatureid=$id&module=$module"); } else { if ($op=="edit" && $id!=""){ $sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creatureid=$id"; $result = db_query($sql); if (db_num_rows($result)<>1){ output("`4Error`0, that creature was not found!"); }else{ $row = db_fetch_assoc($result); } $level = $row['creaturelevel']; } else { $row = array("creatureid"=>0,"creaturelevel"=>$level); } $form = array( "Creature Properties,title", "creatureid"=>"Creature id,hidden", "creaturename"=>"Creature Name", "creatureweapon"=>"Weapon", "creaturewin"=>"Win Message (Displayed when the creature kills the player)", "creaturelose"=>"Death Message (Displayed when the creature is killed by the player)", // 18 to make a non-forest available monster // (ie, graveyard only)_ "creaturelevel"=>"Level,range,1,18,1", "forest"=>"Creature is in forest?,bool", "graveyard"=>"Creature is in graveyard?,bool", ); if ($session['user']['superuser'] & SU_MEGAUSER || $session['user']['superuser'] & SU_RAW_SQL) { $form["creatureaiscript"] = "Creature's A.I.,textarearesizeable"; } rawoutput("
"); showform($form, $row); rawoutput("
"); addnav("","creatures.php?op=save"); } }else{ $module = httpget("module"); rawoutput("
"); module_objpref_edit("creatures", $module, $id); rawoutput("
"); addnav("", "creatures.php?op=save&subop=module&creatureid=$id&module=$module"); } addnav("Navigation"); addnav("Return to the creature editor","creatures.php?level=$level"); } page_footer(); ?>