$inhabitants--; $sql = "UPDATE accounts SET leadertype = '0', kingdom = '{$row['id']}', brimstone = '{$acc['brimstone']}', crystal = '{$acc['crystal']}', essence = '{$acc['essence']}', granite = '{$acc['granite']}', gems_in = '0', gems_out = '0' WHERE id = '{$acc['id']}'"; $result = $db->query($sql); $sql = "UPDATE summons SET type = '0' WhERE type = '6' AND account = '{$acc['id']}'"; $result = $db->query($sql); $sql = "UPDATE summons SET type = '0' WHERE type = '6' AND target = '{$acc['id']}'"; $result = $db->query($sql); $sql = "DELETE FROM invitations WHERE account = '{$acc['id']}' AND kingdom = '{$row['id']}'"; $result = $db->query($sql); if (!$gdSpecialKingdoms[$acc["kingdom"]]) { $text = "\r\n\t\t\t\t<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> left our kingdom.<br>\r\n\t\t\t\t"; gNews(1, 1, "{$acc['name']} leaves kingdom", $text, $acc["kingdom"]); } $text = "\r\n\t\t\t<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> accepted the kingdom invitation and joined our kingdom!<br>\r\n\t\t\t"; gNews(1, 1, "Invitation Accepted", $text, $kingdom); $curses = gRemoveCurses($acc["id"]); $time = time(); $sql = "INSERT INTO kingdomhistory (account, type, leaves, joins, time) VALUES ('{$acc['id']}', 'invite', '{$leaves}', '{$joins}', '{$time}')"; $result = $db->query($sql); $output .= "\r\n\t\t\tYou accepted the kingdom invitation!<br>\r\n\t\t\tYou lost {$cost} brimstone, {$cost} crystal, {$cost} essence and {$cost} granite because of the teleportation spell.\r\n\t\t\t{$curses}\r\n\t\t\t"; } } if ($action == "submitdonate") { $no = 0; if (!$aid || $aid == $acc["id"]) { $output .= 'Invalid data.<br>'; $no = 1; } else { $sql = "SELECT a.id, a.name, a.kingdom, k.x, k.y, a.xp, a.status, a.brimstone, a.crystal, a.essence, a.granite FROM accounts AS a, kingdoms AS k WHERE a.id = '{$aid}' AND a.kingdom = k.id"; $result = $db->query($sql); $numrows = $db->num_rows($result);
$no = 1; } $sql = "SELECT count(*) FROM kdbattles WHERE (kingdom = '{$acc['kingdom']}' AND (status = '0' OR status = '1')) OR (target = '{$acc['kingdom']}' AND status = '1')"; $result = $db->query($sql); $numrows = $db->result($result, 0); if ($numrows != 0) { echo 'You have to finish all the incoming and outgoing kingdom battles first.<br>'; $no = 1; } } } if ($no == 0) { $kdid = $gdStartingKingdomId; $sql = "UPDATE accounts SET kingdom = '{$kdid}', leadertype = '0', gems_in = '0', gems_out = '0' WHERE id = '{$aid}'"; $result = $db->query($sql); $curses = gRemoveCurses($aid); $sql = "UPDATE summons SET type = '0' WhERE type = '6' AND account = '{$aid}'"; $result = $db->query($sql); $sql = "UPDATE summons SET type = '0' WHERE type = '6' AND target = '{$aid}'"; $result = $db->query($sql); $text = "\r\n\t\t\t<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> removed you from his kingdom.<br>\r\n\t\t\tHe teleported you back to the central meeting point of Rodia.<br>\r\n\t\t\t{$curses}\r\n\t\t\t"; $time = time(); $sql = "INSERT INTO kingdomhistory (account, type, leaves, joins, time) VALUES ('{$aid}', 'remove', '{$leaves}', '{$gdStartingKingdomName}', '{$time}')"; $result = $db->query($sql); gNews(0, 1, "Kingdom Removal", $text, $aid); $text = "\r\n\t\t\t<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> kicked <a href=\"index.php?page=playerinfo&action=viewinfo&aid={$target['id']}\">{$target['name']}</a> out of the kingdom.<br>\r\n\t\t\t"; gNews(1, 1, "{$target['name']} leaves kingdom", $text, $acc["kingdom"]); echo 'Mage successfully removed.<br>'; } } if ($action == "donate") {