$numrows = $db->num_rows($result); if ($numrows == 0) { echo 'Unfortunately you do not have any Nether creatures right now."</i><br><br>'; } else { echo '"</i><br><br> <form method="POST" action="index.php?page=travel&action=submitscholarname"> '; tBegin(); $array = array(); while ($row = $db->fetch_array($result)) { $creature = new Creature($row); $row["skill"] = $creature->data["sortskill"]; $array[] = $row; } gSortCreatures($array); foreach ($array as $row) { $creature = new Creature($row); $url = array("<input type='checkbox' name='summons[", "#id", "]'> ", "#creaturename"); $creature->echoCreature($url); } echo ' </table> <br><br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20%"> </td> <td width="60%"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> ';
} else { $time = time(); $sql = "SELECT {$gdCreatureSelect} FROM (summons AS s, creatures AS c, races AS r) LEFT JOIN accitems AS ai ON s.item = ai.id LEFT JOIN items AS i ON ai.item = i.id LEFT JOIN battlelimits AS bl ON bl.summon = s.id AND bl.type = '0' AND bl.battle = '{$bid}' WHERE s.creature = c.id AND c.race = r.id AND s.dead = '0' AND bl.id IS NULL AND (((s.type = '0' OR s.type = '1') AND s.account = '{$acc['id']}') OR (s.type = '6' AND s.target = '{$acc['id']}' AND s.hidden > '{$time}'))"; } $result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows == 0) { echo 'You don\'t have any creatures available.<br>'; } else { unset($defended, $creatures); while ($row = $db->fetch_array($result)) { $creature = new creature($row); $creatures[count($creatures)] = $row; $creatures[count($creatures) - 1]["skill"] = $creature->data["sortskill"]; } gSortCreatures($creatures); tBegin(); $counter = 0; for ($m = 0; $m < count($creatures); $m++) { $row = $creatures[$m]; $counter++; $creature = new creature($row); $url = array("{$counter}", ". ", "#creaturename"); $creature->echoCreature($url); } echo '</table>'; } } ?> </td>
tBegin("Defending Creatures (total: {$numrows})"); if ($showcreatures != 1) { echo '<a href="index.php?page=kingdom&action=buildingdefense&hid=', $hid, '&showcreatures=1">Show creatures in defense.</a><br>'; } else { if ($numrows == 0) { echo 'There are no creatures defending this building right now.<br>'; } else { tBegin(); } unset($array); while ($row = $db->fetch_array($result)) { $creature = new creature($row); $array[count($array)] = $row; $array[count($array) - 1]["skill"] = $creature->data["sortskill"]; } gSortCreatures($array, TRUE); for ($m = 0; $m < count($array); $m++) { $row = $array[$m]; $creature = new creature($row); if (($row["aid"] == $acc["id"] || $acc["leadertype"] >= 1 && is_null($acc[x])) && !$underattack) { $url = array("#creaturename", " (<a href=\"index.php?page=playerinfo&action=viewinfo&aid=", "#aid", "\">", "#aname", "</a>, <a href=\"index.php?page=kingdom&action=removecreaturehatchery&sid=", "#id", "\">remove</a>)"); } else { $url = array("#creaturename", " (<a href=\"index.php?page=playerinfo&action=viewinfo&aid=", "#aid", "\">", "#aname", "</a>)"); } $creature->echoCreature($url); } if ($numrows != 0) { echo '</table>'; } } tEnd();
} // select defenders $time = time(); $sql = "SELECT {$gdCreatureSelect}, bl.id AS blid FROM (summons AS s, creatures AS c, races AS r) LEFT JOIN accitems AS ai ON s.item = ai.id LEFT JOIN items AS i ON ai.item = i.id LEFT JOIN battlelimits AS bl ON bl.summon = s.id AND bl.type = '0' AND bl.battle = '{$bid}' WHERE s.creature = c.id AND c.race = r.id AND s.dead = '0' AND (((s.type = '0' OR s.type = '1') AND s.account = '{$acc['id']}') OR (s.type = '6' AND s.target = '{$acc['id']}' AND s.hidden > '{$time}'))"; $result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows != 0 && $action == "submitdefend") { unset($creatures); while ($row = $db->fetch_array($result)) { if ($creaturelist[$row["id"]]) { $creatures[$creaturelist[$row["id"]]] = $row; } } } if ($attackers) { gSortCreatures($attackers, $acc["id"] == $targetid); $defenders = array(); $creatures_Itherian = new ItherianList(); for ($m = 0; $m < count($attackers); $m++) { $row = $attackers[$m]; $check = $summon[$row["id"]]; if ($check) { if ($creatures[$check]) { for ($p = 0; $p < count($attackers); $p++) { if ($attackers[$p]["defender"] == $check) { echo 'You have entered an invalid creature number.<br>'; $no = 1; $already = TRUE; } } $attackers[$m]["defender"] = $check;