Example #1
0
		This is where warlords organise kingdom battles and the creatures of all the mages gather before they set off to an opposing kingdom.<br><br>
		';
    tBegin("Incoming and Outgoing Kingdom Battles");
    $display = $gdDisplayBattles + 1;
    $sql = "SELECT kdb.id, kdb.time, k.name, k.id AS kid, kdb.kingdom FROM kdbattles AS kdb, kingdoms AS k WHERE kdb.target = '{$acc['kingdom']}' AND kdb.kingdom = k.id AND kdb.status = '1' ORDER BY kdb.time DESC";
    $result = $db->query($sql);
    $array = array();
    while ($row = $db->fetch_array($result)) {
        $array[] = $row;
    }
    $sql = "SELECT kdb.id, kdb.time, k.name, k.id AS kid, kdb.kingdom FROM kdbattles AS kdb, kingdoms AS k WHERE kdb.kingdom = '{$acc['kingdom']}' AND kdb.target = k.id AND kdb.status = '1' ORDER BY kdb.time DESC";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        $array[] = $row;
    }
    $array = gSortArray($array, "time", "DESC");
    for ($m = 0; $m < count($array); $m++) {
        $row = $array[$m];
        if ($row["time"] + $gdKingdomBattlesTime - time() < 0) {
            $display = "none";
        } else {
            $timeleft = gCalcTimeDif($row["time"] + $gdKingdomBattlesTime, time());
            $display = "{$timeleft['days']} days, {$timeleft['hours']} hrs, {$timeleft['minutes']} mins";
        }
        if ($row["kingdom"] == $acc["kingdom"]) {
            echo 'Outgoing kingdom battle vs <a href="index.php?page=kingdominfo&action=viewinfo&kid=', $row["kid"], '">', $row["name"], '</a>. <a href="index.php?page=kingdom&action=kdbattleinfo&kdbid=', $row["id"], '">Battle info.</a> Time left: ', $display, '.<br>';
        } elseif ($row["kingdom"] != $acc["kingdom"]) {
            echo 'Incoming kingdom battle vs <a href="index.php?page=kingdominfo&action=viewinfo&kid=', $row["kid"], '">', $row["name"], '</a>. <a href="index.php?page=kingdom&action=kdbattleinfo&kdbid=', $row["id"], '">Battle info.</a> Time left: ', $display, '.<br>';
        }
    }
    if (count($array) == 0) {
function gSortCreatures(&$array, $enemies = FALSE)
{
    global $acc;
    $sort = array();
    $sort[] = gGetCreatureOrder($acc["creatureorder"], $enemies);
    $sort[] = gGetCreatureOrder($acc["creatureorder2"], $enemies);
    $array = gSortArray($array, $sort[0][0], $sort[0][1], $sort[1][0], $sort[1][1], "id", "ASC");
}
Example #3
0
    while ($row = $db->fetch_array($result)) {
        if ($gdSpecialBooks[$row["library"]][$row["bid"]]) {
            $row["display"] = '<a href="index.php?page=items&action=readbook&blid=' . $row["id"] . '">' . $gdSpecialBooks[$row["library"]][$row["bid"]]["name"] . '</a><br>';
            $row["order"] = $gdSpecialBooks[$row["library"]][$row["bid"]]["name"];
            $array[] = $row;
        }
    }
    $sql = "SELECT id, type, amount FROM packages WHERE account = '{$acc['id']}' ORDER BY type ASC, amount ASC";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        $row["display"] = "{$row['type']} package: gives {$row['amount']} {$row['type']} (<a href=\"index.php?page=items&action=usepackage&pid={$row['id']}\">use</a>)<br>";
        $row["order"] = $row["type"] . $row["amount"];
        $array[] = $row;
    }
    // display
    $array = gSortArray($array, "order", "ASC");
    if (count($array) > 0) {
        foreach ($array as $special) {
            echo $special["display"];
        }
    }
    tEnd();
}
if ($action == "Itherian") {
    $sql = "SELECT i.*, it.id AS itid, it.bonus FROM Itherian AS it, items AS i WHERE it.account = '{$acc['id']}' AND it.item = i.id ORDER BY i.name ASC, it.id ASC";
    $nresult = $db->query($sql);
    $numrows = $db->num_rows($nresult);
    tBegin("Unbound Itherian items ({$numrows})");
    echo 'In case of 2 identical Itherian items the oldest one is on top.<br><br>';
    if ($numrows == 0) {
        echo 'You don\'t have any unbound Itherian items.<br>';
Example #4
0
    while ($row = $db->fetch_array($result)) {
        $row["name"] = $row["creaturename"];
        $amulets[] = $row;
        $total += $row["amount"];
    }
    if ($acc["amuletdisplay"] == 1) {
        $sql = "SELECT i.abilityname, i.id, i.name AS name, i.name AS itemname, i.class, i.value1, i.value2, i.race, r.name AS racename, 1 AS amtype, am.special, am.specialrace, am.specialracename, i.level AS itemlevel, i.type, count(*) AS amount, am.mods, am.target AS amtarget FROM (amulets AS am, items AS i) LEFT JOIN races AS r ON i.race = r.id WHERE am.account = '{$acc['id']}' AND am.type = '1' AND am.target = i.id GROUP BY am.target, am.specialrace, am.special, am.mods";
    } else {
        $sql = "SELECT i.abilityname, am.id AS amid, i.id, i.name AS name, i.name AS itemname, i.class, i.value1, i.value2, i.race, r.name AS racename, am.type AS amtype, am.special, am.specialrace, am.specialracename, am.mods, i.level AS itemlevel, i.type, 1 AS amount FROM (amulets AS am, items AS i) LEFT JOIN races AS r ON i.race = r.id WHERE am.account = '{$acc['id']}' AND am.type = '1' AND am.target = i.id";
    }
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        $amulets[] = $row;
        $total += $row["amount"];
    }
    $amulets = gSortArray($amulets, "name", "ASC");
    topic("Amulets", TRUE, TRUE, 0, " (" . $total . ")");
    if (count($amulets) == 0) {
        echo '
			You don\'t have any amulets right now.<br>
			You can summon them by casting spells in your spellbook.<br>
			';
    }
    for ($m = 0; $m < count($amulets); $m++) {
        $row = $amulets[$m];
        // compact display mode
        $count = "";
        $multiple = "";
        $use = "";
        if ($acc["amuletdisplay"] == 1) {
            $count = $row["amount"] . " ";
Example #5
0
    }
    if ($removeall) {
        echo '<br><a href="index.php?page=spellbook&action=removecurses">Remove all enemy curses with no time or no shards left.</a><br>';
    }
    tEnd();
}
if ($action == "yourcurses") {
    $sql = "SELECT cu.curse, cu.proficiency, cu.creature, c.name AS creaturename FROM (curses AS cu) LEFT JOIN creatures AS c ON cu.creature != '0' AND cu.creature = c.id WHERE cu.account = '{$acc['id']}'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows == 0) {
        echo 'You don\'t have any curses yet.<br>';
    }
    $array = array();
    while ($row = $db->fetch_array($result)) {
        $curse = $gdCurses[$row["curse"]];
        $row["cursename"] = "{$row['creaturename']} {$curse['name']} " . $gdCurseProficiency[$row["proficiency"]]["name"];
        $array[] = $row;
    }
    $array = gSortArray($array, "cursename", "ASC");
    foreach ($array as $row) {
        $curse = $gdCurses[$row["curse"]];
        echo $row["cursename"], ': ', $curse["description"], ' (';
        if ($curse["type"] == "curse") {
            echo $gdCurseProficiency[$row["proficiency"]]["chance"], '% chance of successful casting, ', $gdCurseProficiency[$row["proficiency"]]["shards"], ' shards maximum, ', $curse["pb"], '% power balance lost upon casting';
        } elseif ($curse["type"] == "dispell") {
            echo $gdDispellProficiency[$row["proficiency"]]["chance"], '% chance of successful casting, ', $curse["pb"], '% power balance lost upon casting';
        }
        echo ')<br><br>';
    }
}
				';
        $sql = "SELECT g.id AS gid, g.level AS glevel, g.type AS gtype, g.quality, s.name AS signname, s.rarity, s.type AS signtype FROM gems AS g, signs AS s WHERE g.owner = 'mage' AND g.target = '{$acc['id']}' AND g.sign = s.id";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        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;
Example #7
0
         if ($m < count($children) - 1) {
             echo ', ';
         }
     }
 }
 tEnd();
 // ***********************
 // *	Creature Buildings	*
 // ***********************
 tBegin("Race Buildings");
 if (count($racebuildings) == 0) {
     echo 'You don\'t have any race buildings yet.';
 } else {
     $rooted = gRootArray($racebuildings);
     $children = gGetChildrenArray($rooted);
     $children = gSortArray($children, "name", "ASC");
     for ($m = 0; $m < count($children); $m++) {
         echo $children[$m]["name"];
         if ($m < count($children) - 1) {
             echo ', ';
         }
     }
 }
 tEnd();
 // ****************************
 // *	Creature Max Buildings	*
 // ****************************
 tBegin("Creature Maximum Buildings");
 if (count($cmaxbuildings) == 0) {
     echo 'You don\'t have any creature maximum buildings yet.';
 } else {