Esempio n. 1
0
        echo '
			You enter the small door and end up in a workshop stashed with equipment and materials. Suddenly a Nether comes running from behind one of the piles of junk and starts talking to you.<br><br>
			
			"<i>I am a Nether Builder. I can make you a hatchery to hatch finished Nether eggs in.
			';
        if ($acc["leadertype"] >= 1) {
            echo 'If you give me enough resources, I will make a hatchery for your kingdom.';
        } else {
            echo 'If one of your leaders gives me enough resources, I will make a hatchery for your kingdom.';
        }
        echo '"</i><br><br>';
        if ($acc["leadertype"] >= 1) {
            $sql = "SELECT SUM(xp) AS totalxp FROM accounts WHERE kingdom = '{$acc['kingdom']}' AND status != '2' GROUP BY kingdom";
            $result = $db->query($sql);
            $totalxp = $db->result($result, 0);
            $kdlevel = gCalcLvl($totalxp, $gdKingdomXpVar, $gdKingdomStartXp);
            $maxhatcheries = floor($kdlevel / gdNetherBuildingLevel);
            $sql = "SELECT * FROM hatcheries WHERE kingdom = '{$acc['kingdom']}'";
            $result = $db->query($sql);
            $numrows = $db->num_rows($result);
            if ($numrows >= $maxhatcheries) {
                echo '
					"<i>I\'m sorry, but there\'s no place left in your kingdom to build a new hatchery.<br>
					You can still upgrade an old one though.</i>"<br>
					';
            }
            $array = array();
            while ($row = $db->fetch_array($result)) {
                $array[$row["hatchery"]][$row["class"]] = $row["type"];
            }
            $printarray = array();
Esempio n. 2
0
    $numrows = $db->num_rows($result);
    tBegin("Inhabitants ({$numrows})");
    echo '
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td width="33%" align="left" valign="top">
		';
    $time = time() - $gdOnlineTime;
    for ($m = 0; $m < $numrows; $m++) {
        $row = $db->fetch_array($result);
        if ($row["leadertype"] != 0) {
            $type = " (" . $gdLeaderTypes[$row["leadertype"]]["name"][$row["gender"]] . ", ";
        } else {
            $type = " (";
        }
        $type .= "L" . gCalcLvl($row["xp"], $gdXpVar, $gdStartXp) . ", " . $gdClass[$row["class"] - 1]["name"] . ")";
        if ($row["time"] > $time) {
            $color = '<font class="top">';
        } else {
            $color = '<font class="head">';
        }
        echo '<a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["id"], '">', $color, '', $row["name"], '</font></a>', $type, '<br>';
        if (round($numrows / 3 * 1) == $m || round($numrows / 3 * 2) == $m) {
            echo '
				</td>
				<td width="33%" align="left" valign="top">
				';
        }
    }
    echo '
		</tr>
Esempio n. 3
0
     echo 'You are not a leader or not at home.<br>';
     $no = 1;
 }
 if (!$mage) {
     echo 'Invalid data.<br>';
     $no = 1;
 } else {
     $sql = "SELECT id, kingdom, gender, name, forest, death, air, earth, xp FROM accounts WHERE name = '{$mage}'";
     $result = $db->query($sql);
     $numrows = $db->num_rows($result);
     if ($numrows != 1) {
         echo 'That mage doesn\'t exit.<br>';
         $no = 1;
     } else {
         $row = $db->fetch_array($result);
         $row["level"] = gCalcLvl($row["xp"], $gdXpVar, $gdStartXp);
         $accid = $row["id"];
         if ($row["kingdom"] != $acc["kingdom"]) {
             $sql = "SELECT * FROM relations WHERE ((kingdom = '{$acc['kingdom']}' AND target = '{$row['kingdom']}') OR (kingdom = '{$row['kingdom']}' AND target = '{$acc['kingdom']}')) AND type = '2'";
             $result = $db->query($sql);
             $numrows = $db->num_rows($result);
             if ($numrows != 1) {
                 echo 'That mage lives in a kingdom that is not allied to you.<br>';
                 $no = 1;
             }
         }
         $sql = "SELECT {$gdTravelChallengeCreatureSelect} FROM creatures AS c, races AS r WHERE c.id = '{$egg['creature']}' AND c.race = r.id";
         $result = $db->query($sql);
         $crow = $db->fetch_array($result);
         $creature = new Creature($crow);
         $accskill = $row[strtolower($gdClass[$crow["class"] - 1]["name"])];
Esempio n. 4
0
 function creature1($array, $special = FALSE)
 {
     global $acc, $gdClass;
     $this->data = $array;
     // real creature
     if ($this->data["creaturename"] != "") {
         // special creature (amulet)
         if ($special == "amulet") {
             $this->amulet = TRUE;
         }
         // basic steal var
         $this->data["stealmultiplier"] = 1;
         // > 140% base defense check
         if ($this->data["forest"] > 140) {
             $this->data["forestspecial"] = TRUE;
         }
         if ($this->data["death"] > 140) {
             $this->data["deathspecial"] = TRUE;
         }
         if ($this->data["air"] > 140) {
             $this->data["airspecial"] = TRUE;
         }
         if ($this->data["earth"] > 140) {
             $this->data["earthspecial"] = TRUE;
         }
         // set standard race display
         $this->data["racedisplay"] = $this->data["racename"];
         // apply creature mods
         $this->applyMods();
         // maximum level check
         $maxxp = gCalcXp(gdMaxCreatureLevel + $this->data["bonuslevels"], gdCreatureXpVar, gdCreatureStartXp);
         if ($this->data["xp"] >= $maxxp) {
             $this->data["xp"] = $maxxp - 1;
         }
         // level calculation
         $this->data["level"] = gCalcLvl($this->data["xp"], gdCreatureXpVar, gdCreatureStartXp);
         $this->data["nextlevelxp"] = gCalcXp($this->data["level"], gdCreatureXpVar, gdCreatureStartXp);
         // level bonus calculation
         $this->data["levelbonus"] = 1 + gdCreatureNextLevelBonus * ($this->data["level"] - 1);
         $this->data["damage"] = round($this->data["damage"] * $this->data["levelbonus"]);
         $this->data["maxhealth"] = round($this->data["maxhealth"] * $this->data["levelbonus"]);
         // skill calculation + defense slot skill fix
         //if ($this->data["status"] == 1 && $this->data["hidden"] != 0) {	$this->data[strtolower($gdClass[$this->data["hidden"]-1]["name"])] -= gdDefenseSlotAdvantage; }
         $this->data["skill"] = round(($this->data["damage"] * 2 + (2 / 30 * (($this->data["forest"] + $this->data["death"] + $this->data["air"] + $this->data["earth"]) / 40 * $this->data["maxhealth"]) + 2 / 3 * $this->data["maxhealth"])) * (1 - $this->data["skillbonus"] / 100));
         //if ($this->data["status"] == 1 && $this->data["hidden"] != 0) {	$this->data[strtolower($gdClass[$this->data["hidden"]-1]["name"])] += gdDefenseSlotAdvantage; }
         $this->data["sortskill"] = round($this->data["skill"] / (1 - $this->data["skillbonus"] / 100));
         // steal multiplier bonus
         $this->data["stealmultiplier"] *= gGetCreatureExponent($this->data["skill"]);
         // defense slot bonus
         if ($this->data["status"] == 1 && $this->data["hidden"] != 0) {
             $this->data["base_" . strtolower($gdClass[$this->data["hidden"] - 1]["name"])] = $this->data[strtolower($gdClass[$this->data["hidden"] - 1]["name"])];
             $this->data[strtolower($gdClass[$this->data["hidden"] - 1]["name"])] += gdDefenseSlotAdvantage;
             $this->alters[strtolower($gdClass[$this->data["hidden"] - 1]["name"])] += gdDefenseSlotAdvantage;
         }
         // check for defenses > 140
         $this->limitDefenses();
         // set creature type display
         $this->SetCreatureType();
         // level req calculation
         $this->CalculateLevel();
         // creature status correction
         if ($this->data["dead"] == 1) {
             $this->data["status"] = 5;
         }
         if ($this->data["status"] == "") {
             $this->data["status"] = 0;
         }
         // resource calculation
         $this->calculateResources();
         // xp correction if maximum level is reached
         if ($this->data["xp"] == $maxxp - 1) {
             $this->data["xp"]++;
         }
         // Surathli's Blessing curse
         if ($this->data["curse"] == 5) {
             $this->data["stealmultiplier"] += 3;
         }
         // set class display
         $this->setClassDisplay();
     }
     // item
     if ($this->data["itemname"] != "") {
         $this->addAbility();
     }
 }
Esempio n. 5
0
 if ($battle["resource"] == "powerbalance" || $battle["resource"] == "power") {
     $mult = "steal3";
 } elseif ($battle["resource"] == "essence" || $battle["resource"] == "granite" || $battle["resource"] == "arcane") {
     $mult = "steal2";
 } else {
     $mult = "steal1";
 }
 // fetch player data
 $sql = "SELECT * FROM accounts WHERE id = '{$targetid}'";
 $result = $db->query($sql);
 $target = $db->fetch_array($result);
 $target["level"] = gCalcLvl($target["xp"], $gdXpVar, $gdStartXp);
 $sql = "SELECT * FROM accounts WHERE id = '{$accountid}'";
 $result = $db->query($sql);
 $account = $db->fetch_array($result);
 $account["level"] = gCalcLvl($account["xp"], $gdXpVar, $gdStartXp);
 // set attacker/defender arrays
 $attackers_array = array("id" => $accountid, "Itherian" => $attackers_Itherian, "level" => $account["level"]);
 $creatures_array = array("id" => $targetid, "Itherian" => $creatures_Itherian, "level" => $target["level"]);
 for ($m = 0; $m < count($attackers); $m++) {
     $attacker = new Creature($attackers[$m]);
     if ($battle["resource"] == "arcane") {
         $attacker->data[$mult] = 100;
     }
     if (!$attacker->data["defender"]) {
         // raid
         // execute items
         $attacker->addItherian($attackers_Itherian);
         $attacker->execAbility("prebattle", gDummyCreature(), $attackers);
         $resources += round($attacker->data["skill"] * $gdRaidResourcesStolen);
         $attackername = $attacker->data["creaturename"];
Esempio n. 6
0
    $sql = "SELECT count(*) FROM kdbattles WHERE target = '{$acc['kingdom']}' AND status = '1' AND building = '0'";
    $result = $db->query($sql);
    $numrows = $db->result($result, 0);
    if ($numrows != 0) {
        echo '

			You can\'t spend resources while your treasure room is under attack.<br>

			Finish the kingdom battles first.<br>

			';
    } else {
        $sql = "SELECT SUM(xp) AS xp FROM accounts WHERE kingdom = '{$acc['kingdom']}' AND status != '2'";
        $result = $db->query($sql);
        $xp = $db->result($result, 0);
        $kingdomlevel = gCalcLvl($xp, $gdKingdomXpVar, $gdKingdomStartXp);
        $found = FALSE;
        for ($m = 0; $m < count($gdGemSpells); $m++) {
            if ($gdGemSpells[$m]["level"] <= $kingdomlevel) {
                $found = TRUE;
                $type = $gdGemSpells[$m]["type"];
                // xp
                if ($type == "xp") {
                    $description = "Enchanted creature will gain more xp than usual.";
                }
                // damage
                if ($type == "damage") {
                    $description = "Enchanted creature will do additional damage.";
                }
                // more levels
                if ($type == "levels") {
Esempio n. 7
0
                 $no = 1;
             }
         }
         if ($numrows == 0) {
             $output .= 'You have to select at least one shard.<br>';
             $no = 1;
         }
         if ($numrows > $proficiency["shards"] && $gdCurses[$curse["curse"]]["type"] == "curse") {
             $output .= "You can only select {$proficiency['shards']} shards.";
             $no = 1;
         }
         if ($total != $numrows) {
             $output .= 'You have selected an invalid shard.<br>';
             $no = 1;
         }
         $level = gCalcLvl($xp, $gdXpVar, $gdStartXp);
         $leveldif = abs($acc["level"] - $level);
         if ($leveldif > $gdCurseDropTimeLevelDif) {
             $leveldif = $gdCurseDropTimeLevelDif;
         }
         $timedif = round($gdCurseDropTimeMaximum - ($gdCurseDropTimeMaximum - $gdCurseDropTimeMinimum) / $gdCurseDropTimeLevelDif * $leveldif);
         if ($level < $gdCurseLevelMin) {
             $output .= 'That player is not yet level ' . $gdCurseLevelMin . '.<br>';
             $no = 1;
         }
     }
 }
 if ($gdSpecialKingdoms[$acc["kingdom"]]) {
     $output .= 'You can\'t cast curses when you live in a starter kingdom.<br>';
     $no = 1;
 }
Esempio n. 8
0
<?php

topic("Buildings");
if ($acc["owner"]) {
    include_once "admin/abuildings.php";
}
if (!$action) {
    // indelen van buildings
    $level = gCalcLvl($acc["xp"], $gdXpVar, $gdStartXp);
    $id = $acc["id"];
    $sql = "SELECT ab.id AS abid, b.id AS id, b.name AS name, b.type AS type, b.granite AS granite, b.level AS level, b.root AS root, b.value FROM (buildings AS b) LEFT JOIN accbuildings AS ab ON b.id = ab.building AND ab.account = '{$id}' WHERE b.level <= '{$level}' AND (b.class = '0' OR b.class = '{$acc['class']}') ORDER BY b.name ASC";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    while ($row = $db->fetch_array($result)) {
        // not-built buildings
        if ($row["abid"] == "") {
            $newbuildings[count($newbuildings)] = $row;
        } else {
            $allbuildings[count($allbuildings)] = $row;
            // race buildings
            if ($row["type"] == 0) {
                $racebuildings[count($racebuildings)] = $row;
            }
            // item buildings
            if ($row["type"] == 1) {
                $itembuildings[count($itembuildings)] = $row;
            }
            // creature max buildings
            if ($row["type"] == 2) {
                $cmaxbuildings[count($cmaxbuildings)] = $row;
            }