$result = $db->query($sql); $king = $db->fetch_array($result); $sql = "SELECT SUM(xp) AS totalxp FROM accounts WHERE kingdom = '{$kd['id']}' AND status != '2' GROUP BY kingdom"; $result = $db->query($sql); $totalxp = $db->result($result, 0); if ($kd["faction"] != 0) { $sql = "SELECT name FROM factions WHERE id = '{$kd['faction']}'"; $result = $db->query($sql); $factionname = $db->result($result, 0); } else { $factionname = "no faction"; } $kdlevel = gCalcLvl($totalxp, $gdKingdomXpVar, $gdKingdomStartXp); $nextlevelxp = gCalcXp($kdlevel, $gdKingdomXpVar, $gdKingdomStartXp); $togo = $nextlevelxp - $totalxp; $previous = gCalcXp($kdlevel - 1, $gdKingdomXpVar, $gdKingdomStartXp); $percent = round(($totalxp - $previous) * 100 / ($nextlevelxp - $previous)); $xpbar = '<table border="0" cellspacing="0" cellpadding="0"><tr>'; for ($m = 0; $m < 50; $m++) { if ($m < $percent / 2) { $xpbar .= '<td width="1" class="alert">'; } else { $xpbar .= '<td width="1" class="head">'; } $xpbar .= '|</td>'; } $xpbar .= '</tr></table>'; echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="49%">
$acc["private"] = stripslashes($private); unset($action); } } if ($action == "raiseskill") { $availablepoints = gGetSkillPointsLeft(); $raise = $gdClass[$class]["value"] == $acc["class"] ? 2 : 1; echo 'How many skill points do you want to spend on your ', strtolower($gdClass[$class]["name"]), ' skill? (maximum ', $availablepoints, ', skill raises by ', $raise, ' for every point spent)<br><br><br>'; fTitle("index.php?page=character&action=raise&class={$class}"); fText("Skill points:", "amount", "0", 5); fEnd("Raise skill"); } if (!$action) { tBegin("Character Development"); $togo = $acc["nextlevelxp"] - $acc["xp"]; $previous = gCalcXp($acc["level"] - 1, $gdXpVar, $gdStartXp); $percent = round(($acc["xp"] - $previous) * 100 / ($acc["nextlevelxp"] - $previous)); $xpbar = '<table border="0" cellspacing="0" cellpadding="0"><tr>'; for ($m = 0; $m < 50; $m++) { if ($m < $percent / 2) { $xpbar .= '<td width="1" class="alert">'; } else { $xpbar .= '<td width="1" class="head">'; } $xpbar .= '|</td>'; } $xpbar .= '</tr></table>'; echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="49%">
if ($acc["status"] == 1 || $acc["status"] == 2 && $page != "rules") { $page = "options"; } // include functions and gamedata include_once "functions/gamefunctions.php"; include_once "gamedata.php"; include_once "functions/tags.php"; include_once "functions/indexfunctions.php"; include_once "functions/tablefunctions.php"; include_once "functions/battlefunctions.php"; include_once "functions/shrinefunctions.php"; include_once "functions/Itherian.php"; include_once "functions/creature.php"; // calculate level $acc["level"] = gCalcLvl($acc["xp"], $gdXpVar, $gdStartXp); $acc["nextlevelxp"] = gCalcXp($acc["level"], $gdXpVar, $gdStartXp); // admin if (in_array($acc["id"], $admins)) { $acc["admin"] = TRUE; } else { $acc["admin"] = FALSE; } $db->admin($acc["admin"]); // owner if (in_array($acc["id"], $owners)) { $acc["owner"] = TRUE; } else { $acc["owner"] = FALSE; } // check for incoming battles $sql = "SELECT count(*) FROM battles WHERE target = '{$acc['id']}' AND status = '1'";
for ($p = 0; $p < count($array); $p++) { list($key, $value) = explode(":", $array[$p]); $attackers[$m][$key] = $value; } } } unset($amounts); $where = ""; for ($m = 1; $m <= count($attackers); $m++) { $row = $attackers[$m]; if ($where != "") { $where .= " OR "; } $where .= "c.id = '{$row['id']}'"; $groupdata[$row["id"]]["amount"] = $row["amount"]; $groupdata[$row["id"]]["xp"] = gCalcXp($row["level"], gdCreatureXpVar, gdCreatureStartXp); } } } if ($no == 1) { die("Invalid data."); } else { if (!$type) { $sql = "SELECT {$gdChallengeCreatureSelect}, cc.id, cc.xp FROM (challengecreatures AS cc, creatures AS c, races AS r) LEFT JOIN items AS i ON cc.item = i.id WHERE cc.challenge = '{$challenge['id']}' AND cc.creature = c.id AND c.race = r.id ORDER BY c.name ASC, cc.id ASC"; $result = $db->query($sql); $numrows = $db->num_rows($result); if ($numrows == 0) { die("No attacking creatures!"); } else { unset($array); while ($row = $db->fetch_array($result)) {
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(); } }
for ($p = 0; $p < count($array); $p++) { list($key, $value) = explode(":", $array[$p]); $attackers[$m][$key] = $value; } } } unset($amounts); $where = ""; for ($m = 1; $m <= count($attackers); $m++) { $row = $attackers[$m]; if ($where != "") { $where .= " OR "; } $where .= "c.id = '{$row['id']}'"; $amounts[$row["id"]] = $row["amount"]; $creaturexp[$row["id"]] = gCalcXp($row["level"], gdCreatureXpVar, gdCreatureStartXp); } $ox = 0; $oy = 0; $sql = "SELECT {$gdTravelChallengeCreatureSelect} FROM creatures AS c, races AS r WHERE ({$where}) AND c.race = r.id"; $result = $db->query($sql); $attackers = array(); $attackertypes = array(); while ($row = $db->fetch_array($result)) { $row["xp"] = $creaturexp[$row["cid"]]; $creature = new creature($row); $row["skill"] = $creature->data["sortskill"]; $baselevel = ceil($creature->data["baselevel"] / $creature->data["levelbonus"]); $attackertypes[] = array("amount" => $amounts[$row["cid"]], "level" => $baselevel); for ($m = 0; $m < $amounts[$row["cid"]]; $m++) { $attackers[] = $row;
if ($pick == 1) { $sql = "UPDATE misc SET value = '" . gdNetherShopVacationTime . "' WHERE name = '{$shop}'"; $result = $db->query($sql); } else { // switch open/closed $pick = rand(1, gdNetherShopOpenChance); if ($pick == 1) { $sql = "UPDATE misc SET value = 1 - VALUE WHERE name = '{$shop}'"; $result = $db->query($sql); } } } else { $sql = "UPDATE misc SET value = value - 1 WHERE name = '{$shop}'"; $result = $db->query($sql); } } // get arcane chamber chance for raising the chamber $chance = round(100 / (12 * gdArcaneLevelTime), 5); $xp = gCalcXp(gdArcaneLevelMin - 1, $gdXpVar, $gdStartXp) + 1; $maxcharge = 0; foreach ($gdArcaneCharges as $val => $qual) { if ($val > $maxcharge) { $maxcharge = $val; } } // update arcane chambers $sql = "UPDATE accounts SET arcanechamber = arcanechamber + IF(RAND() < {$chance}, 1, 0) WHERE xp > {$xp} AND arcanechamber < {$maxcharge} AND status = '0' AND arcanerise = '1'"; $result = $db->query($sql); $woot_datum = date("Y-m-d H:i:s"); echo "{$woot_datum}: w00t!\n"; }