document.location=\"index.php\";"; } print "
\n"; $query = "SELECT $spawn_entry_table.chance,$npc_types_table.name,$npc_types_table.id FROM $spawn_entry_table,$npc_types_table WHERE $spawn_entry_table.spawngroupID=$id AND $spawn_entry_table.npcID=$npc_types_table.id ORDER BY $npc_types_table.name ASC "; $result = db_mysql_query($query) or message_die('spawngroup.php', 'MYSQL_QUERY', $query, mysqli_error()); print "NPCs composing that spawngroup :"; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) { print "
  • " . $row["name"] . " (" . $row["chance"] . "%)"; } } print "
  • "; print "NPCs spawning around that spawngroup :
    (Max range : $spawngroup_around_range)
      "; $myrange = $spawngroup_around_range * $spawngroup_around_range; // precalculate, saves some mysql time $query = "SELECT $spawn_entry_table.chance,$spawn2_table.x AS x, $spawn2_table.y AS y, $spawn2_table.z AS z, $npc_types_table.name,$npc_types_table.id, $spawn_group_table.id AS sgid,$spawn_group_table.name AS sgname FROM $spawn_entry_table,$npc_types_table,$spawn_group_table,$spawn2_table WHERE $spawn2_table.zone='" . $spawn["spawnzone"] . "' AND $spawn2_table.spawngroupID=$spawn_group_table.id AND $spawn2_table.spawngroupID=$spawn_entry_table.spawngroupID AND $spawn_entry_table.npcID=$npc_types_table.id AND(($x-$spawn2_table.x)*($x-$spawn2_table.x))+(($y-$spawn2_table.y)*($y-$spawn2_table.y))<$myrange AND (abs(z-$spawn2_table.z)<20) AND $spawn_group_table.id!=$id ORDER BY sgid ASC, $npc_types_table.name ASC "; $result = db_mysql_query($query) or message_die('spawngroup.php', 'MYSQL_QUERY', $query, mysqli_error()); $sg = 0; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) { if ($sg != $row["sgid"]) { $sg = $row["sgid"]; print "
  • " . $row["sgname"] . ", range="; print floor(sqrt(($x - $row["x"]) * ($x - $row["x"]) + ($y - $row["y"]) * ($y - $row["y"]))); print " (" . floor($row["y"]) . "," . floor($row["x"]) . "," . floor($row["z"]) . ")
  • "; ?>