} } } } // boss killed if ($bosskilled) { $text = "\r\n\t\t\t\t\t\t\tAs the whole Surathil community stands united in this battle, <a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> is the one to give the fatal blow to the Easter Pigeon. With a huge flash of light, blinding everyone, the creature falls down. Everyone in Rodia can feel the earth trembling from the immense blow and a huge dust cloud covers the scene. When the dust is cleared, everyone on the battlefield can see <a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> standing victoriously on the lifeless body of the pigeon, shouting that the reign of pigeon terror is now over.<br><br>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tTonight a party in honor of this hero shall be thrown. We shall feast on barbecued pigeon meat and beer!<br>\r\n\t\t\t\t\t\t\t"; gNews(2, 0, "the fall of the Easter Pigeon", addslashes($text)); echo ' As the whole Surathil community stands united in this battle, you are the one to give the fatal blow to the Easter Pigeon. With a huge flash of light, blinding everyone, the creature falls down. Everyone in Rodia can feel the earth trembling from the immense blow and a huge dust cloud covers the scene. When the dust is cleared, everyone on the battlefield can see you standing victoriously on the lifeless body of the pigeon, shouting that the reign of pigeon terror is now over.<br><br> Tonight a party in honor of you shall be thrown. We shall feast on barbecued pigeon meat and beer!<br> '; } else { echo 'You send your creature to attack the pigeon.<br><br>'; echo gParseReport($longreport); if ($left > 0) { echo '<br>The pigeon survived the battle, but is severely weakened: it only has ', $left, ' health left.<br>'; } else { echo '<br>You managed to slay the mighty pigeon! This brings us one step closer to the Easter Pigeon.<br>'; } } } } if ($action == "battleinfo") { $sql = "SELECT count(*) AS aantal, hidden FROM summons WHERE type = '8' AND target = '{$nest['id']}' GROUP BY hidden ORDER BY hidden ASC"; $result = $db->query($sql); unset($waves); while ($row = $db->fetch_array($result)) { $waves[$row["hidden"]] = $row["aantal"]; }
if ($battleresult["failed"]) { $failed = TRUE; } // end of battle } if ($failed) { echo 'You failed to kill all your opponents.<br><br>'; echo gParseReport(stripslashes($defreport)); } else { $sql = "INSERT INTO challengelogs (account, challenge) VALUES ('{$acc['id']}', '{$chid}')"; $result = $db->query($sql); echo ' You killed all your opponents!<br> You successfully complete the challenge!<br><br> '; echo gParseReport(stripslashes($defreport)); } } } if ($action == "challenge") { $no = 0; if (!$chid) { echo 'Invalid data.<br>'; $no = 1; } else { $sql = "SELECT * FROM challenges WHERE id = '{$chid}'"; $result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows != 1) { echo 'Invalid chid.<br>'; $no = 1;
// log query $sql = "INSERT INTO battlelogs (battleid, attackerid, defenderid, date) VALUES ('{$bid}', '{$accountid}', '{$targetid}', '" . date("Y-m-d H:i:s") . "')"; $result = $db->query($sql); // battle query $time = time(); $sql = "UPDATE battles SET status = '3', accountreport = '" . addslashes($attreport) . "', targetreport = '" . addslashes($defreport) . "', time = '{$time}' WHERE id = '{$bid}'"; $result = $db->query($sql); if (!$result) { $bla = addslashes($sql); mail($PhantomMail, "EMERGENCY BUG", $bla); } // update summon status $sql = "UPDATE summons SET type = NULL WHERE type = '4' AND target = '{$bid}'"; $result = $db->query($sql); // delete battle limits $sql = "DELETE FROM battlelimits WHERE battle = '{$battle['id']}' AND type = '0'"; $result = $db->query($sql); if ($action == "submitdefend") { echo 'Battle fought! (<a href="index.php?page=battles&action=attack&target=', $accountid, '">counter attack</a>)<br><br>'; echo gParseReport(stripslashes($defreport)); $text = "\r\n\t\t\t\t\t<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$target['id']}\">{$target['name']}</a> defended our attacking creatures.<br>\r\n\t\t\t\t\t<a href=\"index.php?page=battles&action=battlereport&bid={$battle['id']}\">Read the report.</a><br>\r\n\t\t\t\t\t"; gNews(0, 2, "battle report vs {$target['name']}", $text, $accountid); } else { echo 'Raid successful!<br><br>'; echo gParseReport(stripslashes($attreport)); $text = "\r\n\t\t\t\t\t<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$account['id']}\">{$account['name']}</a> attacked us but we didn\\'t defend in time so " . strtolower($gdGenders[$account["gender"]]["s"]) . " raided our castle.<br>\r\n\t\t\t\t\t<a href=\"index.php?page=battles&action=battlereport&bid={$battle['id']}\">Read the report.</a><br>\r\n\t\t\t\t\t"; gNews(0, 2, "battle report vs {$account['name']}", $text, $targetid); } } } }
echo 'Invalid data.<br>'; $no = 1; } else { $sql = "SELECT b.*, a.name, a.id AS aid FROM battles AS b, accounts AS a WHERE b.id = '{$bid}' AND b.status = '3' AND ((b.account = '{$acc['id']}' AND b.target = a.id) OR (b.target = '{$acc['id']}' AND b.account = a.id))"; $result = $db->query($sql); $numrows = $db->num_rows($result); } if ($numrows != 1) { echo 'Invalid bid.<br>'; $no = 1; } if ($no == 0) { $row = $db->fetch_array($result); tBegin("General Information"); if ($row["account"] == $acc["id"]) { echo 'We attacked <a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["aid"], '">', $row["name"], '</a>.<br>'; } else { echo 'We were attacked by <a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["aid"], '">', $row["name"], '</a>.<br>'; } $date = date("Y-m-d H:i:s", $row["time"]); echo 'Date of battle: ', $date, '.<br>'; tEnd(); tBegin("Report"); if ($row["account"] == $acc["id"]) { echo gParseReport(stripslashes($row["accountreport"])); } else { echo gParseReport(stripslashes($row["targetreport"])); } tEnd(); } }
} } } $output .= "You found a " . $gem["description"] . " " . gEchoGem($gem) . ".<br>"; $sql = "INSERT INTO gems (owner, target, sign, quality, level) VALUES ('mage', '{$acc['id']}', '{$gem['signid']}', '{$gem['quality']}', '{$gem['glevel']}')"; $result = $db->query($sql); } } $output .= "<br><br>"; $acc["brimstone"] += $gained["brimstone"]; $acc["crystal"] += $gained["crystal"]; $acc["essence"] += $gained["essence"]; $acc["granite"] += $gained["granite"]; $sql = "UPDATE accounts SET brimstone = brimstone + '{$gained['brimstone']}', crystal = crystal + '{$gained['crystal']}', essence = essence + '{$gained['essence']}', granite = granite + '{$gained['granite']}' WHERE id = '{$acc['id']}'"; $result = $db->query($sql); $output .= gParseReport(stripslashes($defreport)); } $output .= '<br><br><a href="index.php?page=travel">Back to map.</a><br>'; } else { unset($action); } } topic("Travel"); if ($nametag) { echo '<a name="', $nametag, '">'; } if ($action == "challenge") { $no = 0; if (isset($tcid)) { die("yeah right."); $no = 1;
} tBegin("{$display} Wave {$counter} Report" . $addon); echo gParseReport($row["report"]); tEnd(); } } else { $sql = "SELECT {$select} AS report, a.id, a.name FROM (kdreports AS r) LEFT JOIN accounts AS a ON r.account = a.id WHERE r.kdbattle = '{$kdbid}' AND r.wave = '{$wave}'"; $result = $db->query($sql); $report = $db->fetch_array($result); if ($row["id"] != "") { $addon = " (defended by <a href=\"index.php?page=playerinfo&action=viewinfo&aid={$row['id']}\">{$row['name']}</a>)"; } else { $addon = ""; } tBegin("{$display} Wave {$wave} Report" . $addon); echo gParseReport($report["report"]); tEnd(); } } // outgoing kingdom battle if ($kdb["status"] == 1 && $kdb["kingdom"] == $acc["kingdom"]) { $sql = "SELECT count(*) AS aantal, hidden FROM summons WHERE type = '2' AND target = '{$kdb['id']}' GROUP BY hidden ORDER BY hidden ASC"; $result = $db->query($sql); unset($waves); while ($row = $db->fetch_array($result)) { $waves[$row["hidden"]] = $row["aantal"]; } $wavekeys = array_keys($waves); if (!$wave) { $wave = $wavekeys[0]; }
gNews(2, 0, "Guardian defeated", $text); } else { $id = $attacker->data["id"]; $sql = "DELETE FROM summons WHERE id = '{$id}'"; $result = $db->query($sql); if ($attacker->data["castcurse"] != 0) { $cid = $attacker->data["castcurse"]; $sql = "DELETE FROM castcurses WHERE id = '{$cid}'"; $result = $db->query($sql); $sql = "DELETE FROM accshards WHERE castcurse != '0' AND castcurse = '{$cid}'"; $result = $db->query($sql); } } } } echo 'You send all the creatures of your faction to the Guardian.<br><br>'; echo gParseReport($report); if ($defender->data["maxhealth"] == 0) { $sql = "UPDATE guardians SET dead = '1', oldhealth = '0', faction = '{$faction}' WHERE id = '{$guardian}'"; $result = $db->query($sql); $sql = "UPDATE summons SET type = '0' WHERE type = '7' AND target = '{$guardian}'"; $result = $db->query($sql); echo '<br><br>You succesfully defeat the Guardian and take its heart!<br>'; } else { $sql = "UPDATE guardians SET oldhealth = '" . $defender->data["maxhealth"] . "' WHERE id = '{$guardian}'"; $result = $db->query($sql); echo '<br><br>Unfortunately, you fail to destroy the Guardian.<br>'; } echo 'All creatures that died are permanently lost, for their essence has been absorbed by the Core.<br>'; } }