Exemplo n.º 1
0
                case 3:
                    $sql = "UPDATE packages SET account = '{$aid}' WHERE id = '{$oid}'";
                    $result = $db->query($sql);
                    $text .= "{$other['type']} package: gives {$other['amount']} {$other['type']}<br>";
                    $amount = 3;
            }
            $date = date("Y-m-d H:i:s");
            $sql = "INSERT INTO donatelogs (account, target, amount, date, type) VALUES ('{$acc['id']}', '{$aid}', '{$amount}', '{$date}', 'other')";
            $result = $db->query($sql);
        }
        $output .= "Donation successful!<br>";
        $targettext = "<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> donated the following things to you:<br><br>" . $text;
        $accounttext = "You donated the following things to <a href=\"index.php?page=playerinfo&action=viewinfo&aid={$targetid}\">{$targetname}</a>:<br><br>" . $text;
        if ($note) {
            $targettext .= "<br><br>Note: " . addslashes(gTags($note));
            $accounttext .= "<br><br>Note: " . addslashes(gTags($note));
        }
        $sql = "SELECT x, y FROM kingdoms WHERE id = '{$acc['kingdom']}'";
        $results = $db->query($sql);
        $resultrow = $db->fetch_array($results);
        gNews(0, 0, "donation from {$acc['name']} ({$resultrow['x']},{$resultrow['y']})", $targettext, $aid);
        gNews(0, 0, "donation to {$targetname}", $accounttext, $acc["id"]);
    }
}
if ($action == "submitsendcreature") {
    $no = 0;
    if (!$sid || !$aid) {
        $output .= 'Invalid data.<br>';
        $no = 1;
    } else {
        $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 WHERE s.account = '{$acc['id']}' AND s.creature = c.id AND c.race = r.id AND s.id = '{$sid}' AND s.type = '0'";
Exemplo n.º 2
0
		', $display, '
		';
    tEnd();
    tBegin("Skill Tree");
    if ($acc["level"] < gdSkillLevelMin) {
        echo 'You can learn special skills when you are level ', gdSkillLevelMin, '.<br>';
    } else {
        echo '<a href="index.php?page=character&action=skills">View your skill tree.</a><br>';
    }
    echo '<a href="index.php?page=character&action=tree">View the complete skill tree.</a><br>';
    tEnd();
    tBegin("Private Notes (<a href=\"index.php?page=character&action=changeprivate\">change</a>)");
    echo gTags($acc["private"]);
    tEnd();
    tBegin("Personal Info (<a href=\"index.php?page=character&action=changeinfo\">change</a>)");
    echo gTags($acc["info"]);
    tEnd();
    tBegin("Kingdom History");
    echo '<a href="index.php?page=playerinfo&action=kingdomhistory&aid=', $acc["id"], '">View your kingdom history.</a><br>';
    tEnd();
    tBegin("Income");
    $sum = 0;
    $types = array("Brimstone", "Crystal", "Essence", "Granite");
    $shorttypes = array("b", "c", "e", "g");
    for ($m = 0; $m < 4; $m++) {
        $type = $shorttypes[$m] . "_workers";
        // calculate worker bonus
        $bonusval = 1;
        foreach ($gdWorkerBonus as $val => $bonus) {
            if ($acc[$type] >= $val) {
                $bonusval = $bonus;
Exemplo n.º 3
0
			<td width="100">
			', $xpbar, '
			</td>
			</tr>
			</table>
			</td>
			<td width="1%">
			</td>
			</tr>
			</table>
			';
    }
    tEnd();
    if ($kd["type"] == 0) {
        tBegin("Kingdom Message");
        echo gTags($kd["message"]);
        if ($acc["leadertype"] == 2) {
            echo '<br><br><a href="index.php?page=kingdom&action=editmessage">Edit kingdom message.</a>';
        }
        tEnd();
    }
    if ($kd["type"] == 1) {
        $addon = "AND status != '2'";
    } else {
        $addon = "";
    }
    if ($acc["onlineinhabitants"] == 1) {
        $time = time() - $gdOnlineTime;
        $addon .= " AND time > '{$time}'";
    }
    $sql = "SELECT name, id, leadertype, time, xp, class, gender FROM accounts WHERE kingdom = '{$acc['kingdom']}' {$addon} ORDER BY leadertype DESC, name ASC";
Exemplo n.º 4
0
        echo '<br><br>Only logged in players can post comments.<br>';
    }
}
if (!$action) {
    $sql = "SELECT a.name AS aname, a.email AS aemail, an.topic, an.text, an.time, an.id FROM accounts AS a, announcements AS an WHERE an.account = a.id AND an.parent = '0' ORDER BY an.time DESC LIMIT 0,15";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        $date = date("Y-m-d @ H:i", $row["time"]);
        tBegin('
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td width="50%">
			' . $row["topic"] . ' ' . $addon . '
			</td>
			<td width="20%" align="center">
			by <a href="mailto:' . $row["aemail"] . '">' . $row["aname"] . '</a>
			</td>
			<td width="30%" align="center">
			' . $date . '
			</td>
			</tr>
			</table>
			');
        echo gTags($row["text"], TRUE);
        $newsql = "SELECT count(*) FROM announcements WHERE parent = '{$row['id']}'";
        $newresult = $db->query($newsql);
        $comments = $db->result($newresult, 0);
        echo '<div align="right"><a href="indexnl.php?page=nl_announcements&action=comments&anid=', $row[id], '">', $comments, ' comments</a></div>';
        tEnd();
    }
}
Exemplo n.º 5
0
    } else {
        $row = $db->fetch_array($result);
        if (!$gdSpecialBooks[$row["library"]][$row["bid"]]) {
            echo 'You can\'t understand the language in the book.<br>';
            $no = 1;
        }
    }
    if ($no == 0) {
        $sql = "SELECT text FROM misctext WHERE name = '" . addslashes($gdSpecialBooks[$row["library"]][$row["bid"]]["name"]) . "'";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        if ($numrows != 1) {
            $output .= 'You can\'t understand the language in the book.<br>';
        } else {
            $text = $db->result($result, 0);
            echo gTags(stripslashes($text), TRUE, TRUE);
        }
    }
}
if ($action == "enchant") {
    echo '
		You can enchant this item with a special ability by adding resources to the item and naming a race.
		You can only enchant your items with enchantments you have already learned in your skill tree.<br>
		The rate of success of an enchantment is determined by the resources you use and the enchantment you are trying to cast.
		For example, brimstone will work better with improved offense than crystal.
		You can fail and lose all the resources involved, but you cannot lose the item itself.<br>
		';
    if (!isset($aiid) && $amid == 0) {
        $amid = gGetAmuletId($type, $target, $special, $specialrace);
    }
    if (isset($aiid)) {
Exemplo n.º 6
0
					</table>
					';
                tEnd();
                tBegin('Race: ' . $row["racename"]);
                echo '
					<table width="100%" cellspacing="0" cellpadding="1">
					<tr>
					<td align="left" width="30%" valign="top">
					Forest Defense: ', $row["forest"], '%<br>
					Death Defense: ', $row["death"], '%
					</td>
					<td align="left" width="40%" valign="top">
					Air Defense: ', $row["air"], '%<br>
					Earth Defense: ', $row["earth"], '%
					</td>
					</tr>
					</table>
					';
                tEnd();
            }
            if ($row["description"] != "") {
                tBegin("Race Description");
                echo gTags(stripslashes($row["description"]));
                tEnd();
            }
        }
    }
}
?>
			
			
Exemplo n.º 7
0
        if ($offset == 0 && $p == 0) {
            $row = $topicrow;
        } else {
            $row = $db->fetch_array($result);
        }
        if (($offset != 0 || $p != 0) && $leader == 1) {
            $delete = "<a href=\"index.php?page=kingdom&action=deletereply&replyid={$row['id']}&type={$type}&offset={$offset}\">delete</a> - ";
        } else {
            $delete = "";
        }
        if ($leader == 1 && $acc["kingdom"] != $row["kingdom"]) {
            $delete = "<a href=\"index.php?page=kingdom&action=ban&aid={$row['aid']}\">ban</a> - " . $delete;
        }
        $level = gCalcLvl($row["xp"], $gdXpVar, $gdStartXp);
        $class = $gdClass[$row["class"] - 1]["name"];
        $text = gTags($row["text"]);
        if ($row["edittime"] != 0) {
            $edited = "Last edited " . date("Y-m-d @ H:i", $row["edittime"]) . ", posted on " . date("Y-m-d @ H:i", $row["ptime"]) . ".";
        } else {
            $edited = "Posted on " . date("Y-m-d @ H:i", $row["ptime"]) . ".";
        }
        echo '
			<table width="100%" border="0" cellspacing="0" cellpadding="3" class="titleline">
			<tr height="3">
			<td></td>
			</tr>
			<tr>
			<td align="left" valign="top" width="20%" style="border-top-width: 0; border-left-width: 1; border-right-width: 1; border-bottom-width: 1;">
			<b><font size="2"><a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["aid"], '">', $row["name"], '</a></font><br>
			';
        if (!in_array($row["aid"], $gdSecretMages)) {
Exemplo n.º 8
0
				Its coordinates are (', $row["x"], ',', $row["y"], ').<br>
				It has ', $row["resources"], ' resources.
				';
            if (is_null($acc["x"]) && $acc["kingdom"] == $row["id"] || !is_null($acc["x"]) && $acc["x"] == $row["x"] && $acc["y"] == $row["y"]) {
                echo ' (<a href="index.php?page=kingdominfo&action=donate&kid=', $row["id"], '">donate</a>)';
            } elseif ($acc["attacked"]) {
                echo '<br>You can\'t donate to a kingdom while you\'re under attack.<br>';
            } else {
                echo '<br>You have to be at the location of the kingdom in order to donate something.<br>';
            }
            echo '<br>';
        }
        tEnd();
        if ($row["type"] == 0) {
            tBegin("Kingdom Message");
            echo gTags($row["message"]);
            tEnd();
        }
        if ($acc["onlineinhabitants"] == 1) {
            $time = time() - $gdOnlineTime;
            $addon2 = " AND time > '{$time}'";
        } else {
            $addon2 = "";
        }
        if ($row["type"] == 1) {
            $addon = "AND a.status != '2'";
        } else {
            $addon = "";
        }
        $sql = "SELECT a.name, a.id, a.leadertype, a.time, a.gender, a.class, a.xp FROM accounts AS a WHERE a.kingdom = '{$row['id']}' {$addon} {$addon2} ORDER BY a.leadertype DESC, a.name ASC";
        $result = $db->query($sql);
Exemplo n.º 9
0
        }
    }
    if ($no == 0) {
        $sql = "UPDATE reports SET admin = '{$aid}' WHERE id = '{$rid}'";
        $result = $db->query($sql);
        echo 'Report forwarded to ', $name, '.<br><br>';
        $action = "reports";
    }
}
if ($action == "reports") {
    tBegin("My Reports");
    $sql = "SELECT r.*, a.name, a.id AS aid FROM reports AS r, accounts AS a WHERE r.admin = '{$acc['id']}' AND r.processed = 'no' AND r.reporter = a.id ORDER BY r.date ASC";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        tBegin(ucfirst($row["type"]) . ' report by <a href="index.php?page=playerinfo&action=viewinfo&aid=' . $row["aid"] . '">' . $row["name"] . '</a> on ' . $row["date"]);
        echo gTags(stripslashes($row["text"]));
        echo '<br><br>';
        echo '
			<a href="index.php?page=admin&action=reportprocessed&rid=', $row["id"], '">Flag as processed.</a>
			<a href="index.php?page=admin&action=removereport&rid=', $row["id"], '">Remove from my reports.</a>
			<a href="index.php?page=admin&action=editreport&rid=', $row["id"], '">Edit report.</a>
			<a href="index.php?page=admin&action=forwardreport&rid=', $row["id"], '">Forward report.</a>
			';
        tEnd();
    }
    tEnd();
    tBegin("Pending Reports");
    $sql = "SELECT r.*, a.name, a2.name AS adminname FROM (reports AS r, accounts AS a) LEFT JOIN accounts AS a2 ON r.admin = a2.id WHERE r.admin != '{$acc['id']}' AND r.processed = 'no' AND r.reporter = a.id ORDER BY (r.admin = 1) ASC, r.date ASC";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        if ($row["admin"] == 0) {
Exemplo n.º 10
0
                $sql = "SELECT text FROM misctext WHERE name = '" . addslashes($book[name]) . "'";
                $result = $db->query($sql);
                $numrows = $db->num_rows($result);
                if ($numrows != 1) {
                    $output .= 'You can\'t understand the language in the book.<br>';
                } else {
                    $text = $db->result($result, 0);
                    $sql = "SELECT id FROM booklogs WHERE account = '{$acc['id']}' AND library = '{$library}' AND bid = '{$bid}'";
                    $result = $db->query($sql);
                    $numrows = $db->num_rows($result);
                    if ($numrows == 0) {
                        $sql = "INSERT INTO booklogs (account, library, bid) VALUES ('{$acc['id']}', '{$library}', '{$bid}')";
                        $result = $db->query($sql);
                        $output .= 'You buy the book. You can always read it again in the items section.<br><br><br>';
                    }
                    $output .= gTags(stripslashes($text), TRUE, TRUE);
                }
                break;
        }
    }
}
// target = creature check
if ($action == "submitnewcurse") {
    if (!isset($curse)) {
        $output .= 'Invalid data.<br>';
        $no = 1;
    } else {
        if ($gdCurses[$curse]["target"] == "creature" && !$creature) {
            $action = "newcurse";
        }
    }
Exemplo n.º 11
0
    fCheckbox("Send mail to every inhabitant", "mail");
    fEnd("Post");
}
if ($action == "submitnewmessage") {
    $no = 0;
    if ($acc["leadertype"] < 1) {
        echo 'Invalid leader.<br>';
        $no = 1;
    }
    if (!trim($text) || !trim($topic)) {
        echo 'You have to fill in all the fields.<br>';
        $no = 1;
    }
    if ($no == 0) {
        $topic = addslashes($topic);
        gNews(1, 8, htmlspecialchars($topic), addslashes("<a href=\"index.php?page=playerinfo&action=viewinfo&aid={$acc['id']}\">{$acc['name']}</a> posted the following news:<br><br>" . gTags($text)), $acc["kingdom"]);
        if ($mail == "on") {
            $sql = "SELECT id FROM accounts WHERE kingdom = '{$acc['kingdom']}' AND id != '{$acc['id']}'";
            $nresult = $db->query($sql);
            $time = time();
            $text = "{$acc['name']} posted the following news:\n\n" . $text;
            while ($row = $db->fetch_array($nresult)) {
                $sql = "INSERT INTO mails (subject, text, sender, receiver, time, senderstatus) VALUES ('Kingdom Message: " . $topic . "', '{$text}', '{$acc['id']}', '{$row['id']}',  '{$time}', '1')";
                $result = $db->query($sql);
            }
        }
        echo 'News message succesfully posted.<br>';
        if ($mail == "on") {
            echo 'Mails sent.<br>';
        }
    }
Exemplo n.º 12
0
                echo '
					<a href="index.php?page=playerinfo&action=invite&aid=', $row["id"], '">Invite ', $row["name"], ' to your kingdom.</a><br>
					<a href="index.php?page=playerinfo&action=cancelinvite&aid=', $row["id"], '">Cancel all invitations towards ', $row["name"], '.</a>
					';
            }
            if ($row["kingdom"] == $acc["kingdom"]) {
                echo '<a href="index.php?page=playerinfo&action=remove&aid=', $row["id"], '">Remove ', $row["name"], ' from kingdom.</a>';
            }
            tEnd();
        }
        tBegin("Kingdom History");
        echo '<a href="index.php?page=playerinfo&action=kingdomhistory&aid=', $row["id"], '">View this player\'s kingdom history.</a><br>';
        tEnd();
        if ($acc["personalinfodisplay"] != 0) {
            tBegin("Personal Info");
            echo gTags($row["info"]);
            tEnd();
        }
    }
}
if ($action == "kingdomhistory") {
    $no = 0;
    if (!$aid) {
        echo 'Invalid data.<br>';
        $no = 1;
    } else {
        $sql = "SELECT name, gender FROM accounts WHERE id = '{$aid}'";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        if ($numrows != 1) {
            echo 'Invalid aid.<br>';
Exemplo n.º 13
0
            echo '<a href="index.php?page=kingdom&action=unstore&mid=', $row["id"], '">delete</a>';
        }
        if ($row["stored"] == 0 && $row["receiver"] == $acc["id"]) {
            echo ', <a href="index.php?page=kingdom&action=store&mid=', $row["id"], '">store</a>';
        }
        echo ', <a href="index.php?page=kingdom&action=newmail&target=', $row["name"], '&text=', $row["id"], '">reply</a>';
        echo ')
			</td>
			<td width="35%" align="right">
			<a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["aid"], '">', $row["name"], '</a><br>
			', $date, '
			</td>
			</tr>
			<tr>
			<td colspan="2">
			', gTags($row["text"]), '
			</td>
			</tr>
			</table>
			
			';
        // convert to report
        if ($acc["admin"]) {
            echo '<br><br>';
            tBegin("Convert to report");
            fTitle("index.php?page=report&action=submit&reporter={$row['aid']}");
            fHidden("description", htmlspecialchars(stripslashes($row["subject"])) . "<br><br>" . addslashes($row["text"]));
            fRadio("Type:", "type", array(array("name" => "Question", "value" => "question"), array("name" => "Bug/Advice Report", "value" => "bug"), array("name" => "Abuse Report", "value" => "abuse")));
            fEnd("Convert");
            tEnd();
        }