$result = $db->query($sql); $date = date("Y-m-d H:i:s"); $sql = "INSERT INTO donatelogs (account, target, amount, date, type) VALUES ('{$acc['id']}', '{$aid}', '" . count($gems) . "', '{$date}', 'gems')"; $result = $db->query($sql); } elseif ($gem) { $sql = "UPDATE gems SET target = '{$aid}' WHERE id = '{$gem}'"; $result = $db->query($sql); $sql = "SELECT count(*) FROM gems WHERE owner = 'mage' AND target = '{$acc['id']}'"; $result = $db->query($sql); $total = $db->result($result, 0); $date = date("Y-m-d H:i:s"); $sql = "INSERT INTO donatelogs (account, target, amount, date, type) VALUES ('{$acc['id']}', '{$aid}', '1', '{$date}', 'gems')"; $result = $db->query($sql); } for ($m = 0; $m < count($gems); $m++) { $text .= addslashes(gEchoGem($gems[$m])) . "<br>"; } foreach ($donateothers as $key => $other) { $data = explode("-", $key); $otype = $data[0]; $oid = $data[1]; switch ($otype) { // Itherian item case 1: $sql = "UPDATE Itherian SET account = '{$aid}' WHERE id = '{$oid}'"; $result = $db->query($sql); // get amount of sacs $sql = "SELECT count(*) FROM Itheriansacs WHERE Itherian = '{$oid}' AND used = 'no'"; $result = $db->query($sql); $sacs = $db->result($result, 0); $text .= gEchoItherian($other, $sacs) . "<br>";
tBegin("Gem Depot ({$addon})"); echo ' <a href="index.php?page=kingdom&action=insertgemdepot">Insert gems in depot.</a><br><br> <a href="index.php?page=kingdom&action=gemdepotinhabitants">Kingdom inhabitants list.</a><br><br> '; if ($numrows == 0) { echo 'No gems selected.<br>'; } elseif ($acc["leadertype"] >= 1) { echo '<form method="POST" action="index.php?page=kingdom&action=removegemdepot" name="gemform">'; } while ($row = $db->fetch_array($result)) { if ($acc["leadertype"] >= 1) { echo '<input type="checkbox" name="gems[', $row["id"], ']">'; } echo gEchoGem($row), '<br>'; } if ($numrows != 0 && $acc["leadertype"] >= 1) { echo ' <script language="JavaScript"> fields = ', $numrows, '; function fillin (result) { for (m = 0; m < fields; m++) { document.gemform.elements[m].checked = result; } } </script> <br><br>
$text = '<table width="100%" border="0" cellspacing="0" cellpadding="0">'; sColumn("new"); $sql = "SELECT a.id, a.name, count(*) AS aantal FROM {$db_previousage_accounts} AS a, ignores AS i WHERE a.status != '2' AND i.target = a.id GROUP BY a.id ORDER BY aantal DESC, a.id DESC LIMIT 0,{$gdMaxStatLines}"; $result = $db->query($sql); unset($array); while ($row = $db->fetch_array($result)) { $array[count($array)]["name"] = $row["name"]; $array[count($array) - 1]["value"] = $row["aantal"]; } sEntry("Most ignored magi", $array); sColumn("next"); $sql = "SELECT s.name AS signname, g.sign, g.level AS glevel, g.quality, g.type AS gtype, count(*) AS aantal FROM gems AS g, signs AS s WHERE g.sign = s.id GROUP BY g.sign, g.level, g.quality, g.type ORDER BY aantal DESC LIMIT 0,{$gdMaxStatLines}"; $result = $db->query($sql); unset($array); while ($row = $db->fetch_array($result)) { $array[count($array)]["name"] = gEchoGem($row); $array[count($array) - 1]["value"] = $row["aantal"]; } sEntry("Most common gems", $array); sColumn("end"); sColumn("new"); $sql = "SELECT a.name, c.name AS cname FROM {$db_previousage_accounts} AS a, summons AS s, creatures AS c WHERE s.creature = c.id AND s.account = a.id AND a.status = '0' AND a.id != '1' ORDER BY s.id ASC LIMIT 0,{$gdMaxStatLines}"; $result = $db->query($sql); unset($array); while ($row = $db->fetch_array($result)) { $array[count($array)]["name"] = $row["name"]; $array[count($array) - 1]["value"] = $row["cname"]; } sEntry("Oldest living creatures", $array); sColumn("next"); $sql = "SELECT name FROM {$db_previousage_accounts} WHERE status != '2' " . Exclude("") . " ORDER BY id ASC LIMIT 0,{$gdMaxStatLines}";
$sql = "INSERT INTO `bsgemlog` (`gemowner` , `newowner` , `stolen` , `gemsign` , `gemlevel` , `gemquality` , `time`)\r\n\t\t\t\t\t\t\t\t\tVALUES ('{$target['id']}', '{$account['id']}', '{$arcanelost}', '{$target['sign']}', '{$gem['glevel']}', '{$gem['quality']}', NOW( ));"; $result = $db->query($sql); // output $accountarcanetext = '<br>You managed to steal ' . $arcanelost . '% from the arcane chamber of your opponent and convert it into a ' . gEchoGem($gem) . '.'; $targetarcanetext = '<br>Your opponent managed to steal ' . $arcanelost . '% from your arcane chamber and convert it into a ' . gEchoGem($gem) . '.'; // cancel all battles $sql = "SELECT id, accountreport, targetreport, account FROM battles WHERE target = '{$target['id']}' AND resource = 'arcane' AND status = '1' AND id != '{$bid}'"; $nresult = $db->query($sql); $nnumrows = $db->num_rows($nresult); $arcaneremaining = $target["arcanechamber"] - $arcanelost; if ($nnumrows <= 0) { if ($arcaneremaining > 0) { $signid = getRandomGemSign(); $arcanelostreal = ', arcanechamber = 0, sign = \'' . $signid . '\', arcanerise = \'1\''; $gem["glevel"] = ceil($target["level"] * (1 - $multiplier)); $targetarcanetext .= '<br>The remaning ' . $arcaneremaining . '% from your arcane chamber was converted into a ' . gEchoGem($gem) . '.'; $sql = "INSERT INTO gems (owner, target, sign, level, quality) VALUES ('mage', '{$target['id']}', '{$target['sign']}', '{$gem['glevel']}', '{$gem['quality']}')"; $result = $db->query($sql); $sql = "INSERT INTO `bsgemlog` (`gemowner` , `newowner` , `stolen` , `gemsign` , `gemlevel` , `gemquality` , `time`)\r\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('{$target['id']}', '{$account['id']}', '{$arcanelost}', '{$target['sign']}', '{$gem['glevel']}', '{$gem['quality']}', NOW( ));"; $result = $db->query($sql); } else { $signid = getRandomGemSign(); $arcanelostreal = ', arcanechamber = 0, sign = \'' . $signid . '\', arcanerise = \'1\''; } } elseif ($arcaneremaining <= 99) { $signid = getRandomGemSign(); $arcanelostreal = ', arcanechamber = 0, sign = \'' . $signid . '\', arcanerise = \'1\''; while ($otherbattle = $db->fetch_array($nresult)) { $otherbattle["accountreport"] .= "\r\n\t\t\t\t\t\t\t\t\t<br><u>Conclusion</u><br><br>\r\n\t\t\t\t\t\t\t\t\tThe battle was cancelled because someone else has already managed to steal enough power from the arcane chamber to drop it below 100%, therefore making your battle useless.\r\n\t\t\t\t\t\t\t\t\t"; $otherbattle["targetreport"] .= "\r\n\t\t\t\t\t\t\t\t\t<br><u>Conclusion</u><br><br>\r\n\t\t\t\t\t\t\t\t\tThe battle was cancelled because there was not enough power left to steal in the arcane chamber.\r\n\t\t\t\t\t\t\t\t\t"; $text = "\r\n\t\t\t\t\t\t\t\t\tSomeone else stole enough energy from <a href=\"index.php?page=playerinfo&action=viewinfo&aid={$target['id']}\">{$target['name']}</a>'s chamber to drop it below 100%. Because there was not enough power left to steal, your battle was cancelled.<br>\r\n\t\t\t\t\t\t\t\t\t<a href=\"index.php?page=battles&action=battlereport&bid={$otherbattle['id']}\">Read the report.</a><br>\r\n\t\t\t\t\t\t\t\t\t";
$result = $db->query($sql); $xp = $db->result($result, 0); $kingdomlevel = gCalcLvl($xp, $gdKingdomXpVar, $gdKingdomStartXp); if ($kingdomlevel < $gdGemSpells[$eid]["level"]) { echo 'Your level is too low.<br>'; $no = 1; } if ($no == 0) { echo 'You are about to cast ', $gdGemSpells[$eid]["name"], ' on the following gems:<br><br>'; $totalcost = 0; $basecost = round(gdWorkerIncome * gdWorkersPerLevel * gdArcaneLevelTime * gdGemSpellMultiplier); for ($m = 0; $m < count($gems); $m++) { $row = $gems[$m]; $creature = new creature($row); $cost = round($row["glevel"] * $basecost * $gdGemSpells[$eid]["multiplier"]); echo gEchoGem($row), ' (', $cost, ' resources)<br>'; $totalcost += $cost; } echo '<br><br>Total spell cost: ', $totalcost, ' kingdom resources.<br>'; $sql = "SELECT resources FROM kingdoms WHERE id = '{$acc['kingdom']}'"; $result = $db->query($sql); $resources = $db->result($result, 0); if ($resources < $totalcost) { echo 'Your kingdom doesn\'t have enough resources to cast that spell.<br>'; } else { fTitle("index.php?page=kingdom&action=submitenchantgems&eid={$eid}"); for ($m = 0; $m < count($gems); $m++) { echo '<input type="hidden" name="gem[', $gems[$m]["gid"], ']" value="on">'; } fEnd("Enchant Gems"); }
if ($numrows == 0) { echo 'Unfortunately, you do not have any gems.<br>'; } else { echo 'Select a gem from the list to give it to him.<br><br>'; } $array = array(); while ($row = $db->fetch_array($result)) { $raritymultiplier = gGetRarityMultiplier($row["signtype"], $row["rarity"]) * $gdGemTypeMultiplier[$row["signtype"]]; $row["power"] = round($row["glevel"] * gdRudolfPowerMultiplier * $gdGemQuality[$row["quality"]]["value"] * $raritymultiplier); $array[] = $row; } $array = gSortArray($array, "power", "DESC"); foreach ($array as $row) { $raritymultiplier = gGetRarityMultiplier($row["signtype"], $row["rarity"]) * $gdGemTypeMultiplier[$row["signtype"]]; $resources = round($row["glevel"] * gdRudolfResourceMultiplier * $gdGemQuality[$row["quality"]]["value"] * $raritymultiplier); echo '<a href="index.php?page=travel&action=rudolf&gid=', $row["gid"], '">', gEchoGem($row), ' (gain ', $row["power"], ' power, pay ', $resources, ' brimstone, ', $resources, ' crystal, ', $resources, ' essence and ', $resources, ' granite).</a><br>'; } } if ($encounter == 2) { echo ' You encounter ', $gdEncounters[$encounter][0], '!!!<br> Run, run, run!<br> '; $sql = "UPDATE accounts SET x = '1337', y = '1337' WHERE id = '{$acc['id']}'"; $result = $db->query($sql); $acc["x"] = 1337; $acc["y"] = 1337; } if ($encounter == 3) { echo ' You encounter a ', $gdEncounters[$encounter][0], '.<br>
</td> <td width="3%"> </td> </tr> </table> '; tEnd(); } } if ($action == "rudolf" || $action == "gembox") { $sql = "SELECT g.id, s.name AS signname, g.level AS glevel, g.type AS gtype, g.quality, s.type AS signtype FROM gems AS g, signs AS s WHERE g.owner = 'mage' AND g.target = '{$acc['id']}' AND g.id = '{$gid}' AND g.sign = s.id"; $result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows == 1) { $row = $db->fetch_array($result); echo '<a href="index.php?page=travel&action=encounter&gid=', $gid, '">Are you sure?</a> (', gEchoGem($row), ' selected)<br>'; } else { echo 'You selected an invalid gem.<br>'; } } if ($action == "submitnumber") { $no = 0; if (!gCheckInt($number) || $acc["travelcounter"] > 0) { echo 'Invalid number.<br>'; $no = 2; } else { if ($acc["travelcounterkey"] != $number && $acc["travelcounterkey"] != 0 || $formtype != "submitnumber") { $no = 1; } } if ($acc["travelcounterkey"] == "") {
$title2 = $gdGenders[$row["gender"]]["a"]; } echo ' ', $title, ' aligned towards the ', $row["description"], ' ', $row["signname"], ' sign.<br> ', $title2, ' arcane chamber is currently at ', $row["arcanechamber"], '%'; if (!$quality) { echo ', which is not enough to produce a gem.<br>'; } else { if ($quality["name"] == "") { $quality["name"] = "normal"; } echo ', which is enough to produce a ', strtolower($quality["name"]), ' gem.<br>'; } if ($acc["id"] == $aid && $quality) { $row = array("signname" => $row["signname"], "glevel" => $acc["level"], "gtype" => NULL, "quality" => $quality["index"]); echo '<a href="index.php?page=playerinfo&action=producegem&aid=', $acc["id"], '">Produce a ', gEchoGem($row), '.</a><br>'; } $sql = "UPDATE accounts SET travelcounter = travelcounter - 8 WHERE id = '{$acc['id']}'"; $result = $db->query($sql); } } if ($action == "producegem") { $no = 0; $signid = getRandomGemSign(); $sql = "LOCK TABLES accounts WRITE, gems WRITE, bsgemlog WRITE, signs READ"; $result = $db->query($sql); $sql = "UPDATE accounts SET travelcounter = travelcounter - 8 WHERE id = '{$acc['id']}'"; $result = $db->query($sql); if ($acc["travelcounter"] <= 0) { $action = "mathdwarf"; $no = 1;