示例#1
0
     } else {
         $enchantdata = $db->fetch_array($result);
         $itemlevel = $enchantdata["level"];
         if ($itemlevel > 9000) {
             $itemlevel -= 9000;
         }
     }
     $sql = "SELECT s.id FROM accskills AS acs, skills AS s WHERE acs.account = '{$acc['id']}' AND acs.skill = s.id AND s.code = '{$enchantment}' AND s.tree = 'enchantments'";
     $result = $db->query($sql);
     $numrows = $db->num_rows($result);
     if ($numrows != 1) {
         $output .= 'Invalid enchantment.<br>';
         $no = 1;
     }
 }
 if (!gCheckInt($brimstone) || !gCheckInt($crystal) || !gCheckInt($essence) || !gCheckInt($granite)) {
     $output .= 'You have entered an invalid resource amount.<br>';
     $no = 1;
 }
 if ($brimstone > $acc["brimstone"] || $crystal > $acc["crystal"] || $essence > $acc["essence"] || $granite > $acc["granite"]) {
     $output .= 'You don\'t have enough resources.<br>';
     $no = 1;
 }
 if (!$race) {
     $output .= 'Invalid race.<br>';
     $no = 1;
 } else {
     $sql = "SELECT id, name FROM races WHERE name = '{$race}'";
     $result = $db->query($sql);
     $numrows = $db->num_rows($result);
     if ($numrows != 1) {
示例#2
0
			
			' . gGetOrbDescription($orb) . '<br>
			';
        $sql = "UPDATE accounts SET resused = resused + ({$gdCreditCost['2']} * 100000) WHERE id='{$acc['id']}'";
        $result = $db->query($sql);
    }
}
if ($action == "aidnethers") {
    $no = 0;
    if ($scholarperc >= 100 && $creatorperc >= 100 && $builderperc >= 100) {
        echo 'There are no unbuild buildings left.<br>';
    } elseif (!$brimstone && !$crystal && !$essence && !$granite) {
        echo 'Invalid resources.<br>';
        $no = 1;
    } else {
        if ($brimstone && !gCheckInt($brimstone) || $crystal && !gCheckInt($crystal) || $essence && !gCheckInt($essence) || $granite && !gCheckInt($granite)) {
            echo 'Invalid resources.<br>';
            $no = 1;
        }
        $total = $brimstone + $crystal + $essence + $granite;
    }
    if ($acc["attacked"]) {
        echo 'You can\'t donate resources while you are under attack.<br>';
        $no = 1;
    }
    if ($no == 0) {
        $sql = "SELECT brimstone, crystal, essence, granite FROM accounts WHERE id = '{$acc['id']}'";
        $result = $db->query($sql);
        $row = $db->fetch_array($result);
        if ($brimstone > $row[brimstone] || $crystal > $row[crystal] || $essence > $row[essence] || $granite > $row[granite]) {
            echo 'You don\'t have enough resources to donate that amount.<br>';
示例#3
0
            $sql = "UPDATE castcurses SET time = time + '{$cursetimebonus}' WHERE {$where}";
            $result = $db->query($sql);
        }
        $output .= 'You have successfully left vacation mode!<br><br>';
    }
}
if ($action == "submitpreferences") {
    if ($friends == "on") {
        $friends = 1;
    } else {
        $friends = 0;
    }
    if (!gCheckInt($creatureorder) || $creatureorder < 0 || $creatureorder > 3) {
        $creatureorder = 0;
    }
    if (!gCheckInt($creatureorder2) || $creatureorder2 < 0 || $creatureorder2 > 3) {
        $creatureorder2 = 0;
    }
    if ($creaturedisplay == "on") {
        $creaturedisplay = 1;
    } else {
        $creaturedisplay = 0;
    }
    if ($amuletdisplay == "on") {
        $amuletdisplay = 1;
    } else {
        $amuletdisplay = 0;
    }
    if ($itemdisplay == "on") {
        $itemdisplay = 1;
    } elseif ($acc["creaturedisplay"] == 1) {
示例#4
0
					
					You are standing back in the crater. All your power is gone, there is no way you can ever get back into that maze. You hear Aetar\'s voice in your head - he\'s asking if you\'re ready to come back. You agree, and minutes later you\'re standing back in Surathli\'s tower.<br><br>
					
					"I see you have failed. A pity. Maybe you should consider working together with other kingdoms before trying again. Do mind though that the treasures held within this maze are very valuable, so don\'t share the information you gathered with everyone."<br><br>
					
					Disappointed you leave Surathli\'s tower and hurry back to your castle.<br>
					<a href="index.php">click here</a> to proceed.<br>
					';
            }
        }
    }
}
if ($status == 2) {
    if ($action == "push") {
        $no = 0;
        if (!$times || !gCheckInt($times)) {
            echo 'You can\'t push that button ', $times, ' times.<br>';
            $no = 1;
            unset($action);
        }
        if ($no == 0) {
            if ($times == 5) {
                $sql = "UPDATE mazestatus SET status = '3' WHERE account = '{$acc['id']}'";
                $result = $db->query($sql);
                echo '
					You push the button ', $times, ' times.<br>
					The wall slides open and reveals another corridor.<br>
					The low sound of your breath is resounding on the narrow walls of the ways 
					in the maze and you have been walking for several hours through this 
					monotone area. Your hands touch the humid surface of the black stoned walls 
					and your fingers form a trail of wet lines along your chosen path. Sweat 
示例#5
0
 function getDefense($classname)
 {
     if (!gCheckInt($this->data[strtolower($classname)])) {
         return 0;
     } else {
         return $this->data[strtolower($classname)];
     }
 }
示例#6
0
<?php

if ($action == "raise") {
    $no = 0;
    if (!$class) {
        $class = 0;
    }
    if (!gCheckInt($amount) || !$amount || $amount == 0) {
        $output .= 'Invalid amount.<br>';
        $no = 1;
    }
    if (!in_array($class, array(0, 1, 2, 3))) {
        $output .= 'Invalid class.<br>';
        $no = 1;
    }
    if ($no == 0) {
        $classname = strtolower($gdClass[$class]["name"]);
        $sql = "LOCK TABLES accounts WRITE, challenges WRITE, challengelogs WRITE";
        $result = $db->query($sql);
        $sql = "SELECT {$classname} FROM accounts WHERE id = '{$acc['id']}'";
        $result = $db->query($sql);
        $skill = $db->result($result, 0);
        // update $acc for gGetSkillPointsLeft
        $acc[$classname] = $skill;
        // calculate points left
        $availablepoints = gGetSkillPointsLeft();
        $raise = $gdClass[$class]["value"] == $acc["class"] ? 2 : 1;
        // points left check
        if ($availablepoints < $amount) {
            $output .= 'You can\'t spend that much points.<br>';
            $no = 1;
示例#7
0
        $result = $db->query($sql);
        $output .= 'Defense slot successfully upgraded!<br>';
        unset($action);
    }
}
if ($action == "submitcreateslot") {
    $no = 0;
    if ($acc["attacked"]) {
        $output .= 'You can\'t create a defense slot while you are under attack.<br>';
        $no = 1;
    }
    if (!$class) {
        echo 'Invalid data.<br>';
        $no = 1;
    }
    if ($level != round($level) || $level <= 0 || !gCheckInt($level)) {
        $output .= 'Invalid level!<br>';
        $no = 1;
    } else {
        $cost = $level * $gdDefenseSlotCost * $gdDefenseSlotMultiplier;
        if ($cost > $acc["granite"]) {
            $output .= 'You don\'t have enough resources to build a slot of that level!<br>';
            $no = 1;
        }
        if (!in_array($class, array(1, 2, 3, 4))) {
            echo 'Invalid class.<br>';
            $no = 1;
        }
    }
    if ($no == 0) {
        $sql = "LOCK TABLES slots WRITE, accounts WRITE";
示例#8
0
                 $creature = new Creature($creatures[$check]);
                 if ($creature->data["itemtype"] == 5) {
                     $creatures_Itherian->addItherian($creature->data["abilityname"], $creature->data["value1"], $creature->data["castcurse"] != 0 && $creature->data["curse"] == 12);
                 }
             } else {
                 if (!$already) {
                     echo 'You have entered an invalid creature number.<br>';
                     $no = 1;
                     $already = TRUE;
                 }
             }
         }
     }
 }
 if ($action == "submitdefend") {
     if (!gCheckInt($number) || $acc["travelcounterkey"] != $number) {
         echo 'Invalid security number entered! Please use the back-button of your browser and try again.<br>';
         $no = 1;
         gAddBugError();
     }
 }
 if ($no == 0) {
     $accountxp = 0;
     $targetxp = 0;
     $resources = 0;
     $stealmultiplier = 0;
     // remove travel counter if it is not a raid
     if ($action != "raid") {
         $travelcountertext = ", travelcounterkey = '', travelcountercorrects = travelcountercorrects + 1";
     } else {
         $travelcountertext = "";
示例#9
0
    }
}
if ($action == "rudolf" || $action == "gembox") {
    $sql = "SELECT g.id, s.name AS signname, g.level AS glevel, g.type AS gtype, g.quality, s.type AS signtype FROM gems AS g, signs AS s WHERE g.owner = 'mage' AND g.target = '{$acc['id']}' AND g.id = '{$gid}' AND g.sign = s.id";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows == 1) {
        $row = $db->fetch_array($result);
        echo '<a href="index.php?page=travel&action=encounter&gid=', $gid, '">Are you sure?</a> (', gEchoGem($row), ' selected)<br>';
    } else {
        echo 'You selected an invalid gem.<br>';
    }
}
if ($action == "submitnumber") {
    $no = 0;
    if (!gCheckInt($number) || $acc["travelcounter"] > 0) {
        echo 'Invalid number.<br>';
        $no = 2;
    } else {
        if ($acc["travelcounterkey"] != $number && $acc["travelcounterkey"] != 0 || $formtype != "submitnumber") {
            $no = 1;
        }
    }
    if ($acc["travelcounterkey"] == "") {
        echo 'The Dwarf is not paying attention right now... but if you click <a href="index.php?page=travel">here</a>, he will get back to you...<br>';
        $no = 2;
    }
    if ($no == 0) {
        $counter = rand(gdTravelCounter - gdTravelCounterDeviance, gdTravelCounter + gdTravelCounterDeviance);
        $sql = "UPDATE accounts SET travelcounter = '{$counter}', travelcounterkey = '0', travelcountercorrects = travelcountercorrects + 1 WHERE id = '{$acc['id']}'";
        $result = $db->query($sql);
示例#10
0
    fEnd("Edit");
}
if ($action == "submiteditviolation") {
    $no = 0;
    $sql = "SELECT * FROM violations WHERE id = '{$vid}'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
        echo 'Invalid vid.<br>';
        $no = 1;
    }
    if (!$subject || !$text || !$days) {
        echo 'Invalid data.<br>';
        $no = 1;
    }
    if (!gCheckInt($days)) {
        echo 'You have to enter a valid amount of days.<br>';
        $no = 1;
    }
    if ($no == 0) {
        $sql = "UPDATE violations SET subject = '{$subject}', text = '{$text}', days = '{$days}' WHERE id = '{$vid}'";
        $result = $db->query($sql);
        echo 'Violation changed!<br>';
        $action = "banlist";
    }
}
if ($action == "violationlogs") {
    // get all currently banned users
    $sql = "SELECT a.id, a.name, MAX(vl.date) AS md FROM violationlogs AS vl, accounts AS a WHERE vl.account = a.id GROUP BY vl.account ORDER BY a.name ASC";
    $nresult = $db->query($sql);
    while ($row = $db->fetch_array($nresult)) {
示例#11
0
     $no = 1;
 } else {
     $row = $db->fetch_array($result);
     $creature = new creature($row);
     // base cost per level, depends on income etc
     $basecost = round(gdWorkerIncome * gdWorkersPerLevel * gdArcaneLevelTime * gdGemSpellMultiplier);
     // cost based on creature level and spell multiplier (= positive effect on gem spell)
     if ($creature->data["baselevel"] == 0) {
         $creature->data["baselevel"] = 1;
     }
     $cost = round($basecost * $creature->data["baselevel"] * $gdGemSpells[$gemspell]["multiplier"] * gdGemSpellKDBCostMultiplier);
     // minimum/maximum investment
     $mincost = $cost;
     $maxcost = round($cost * gdGemSpellKDBMaxLevelBonusCostIncrease);
     // invalid resource amount
     if (!gCheckInt($resources) || $resources < $mincost || $resources > $maxcost) {
         echo 'Invalid amount of resources selected! (', $mincost, '-', $maxcost, ' allowed)<br>';
         $no = 1;
     }
 }
 $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);
 if ($gdGemSpells[$gemspell]["level"] > $kingdomlevel || $gemspell < 0 || $gemspell >= count($gdGemSpells)) {
     echo 'Invalid gem spell.<br>';
     $no = 1;
 }
 if ($acc["leadertype"] < 1) {
     echo 'You have to be a warlord to cast a gem spell on a wave.<br>';
     $no = 1;
示例#12
0
		</ul>
		';
    /*
    
    <li>The end-of-age statistics can be found <a href="indexnll.php?action=statistics">here</a>!<br><br></li>
    */
}
if ($action == "statistics") {
    $age = 8;
    $sql = "SELECT MAX(page) FROM statistics WHERE age = '{$age}'";
    $result = $db->query($sql);
    $maxpage = $db->result($result, 0);
    if (!$pagenumber) {
        $pagenumber = 1;
    }
    if (!gCheckInt($pagenumber) || $pagenumber < 1 || $pagenumber > $maxpage) {
        echo 'Invalid page.<br>';
    } else {
        $sql = "SELECT text FROM statistics WHERE age = '{$age}' AND page = '{$pagenumber}'";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        if ($numrows != 1) {
            echo 'Invalid data.<br>';
        } else {
            echo '<br><center>';
            for ($i = 1; $i <= $maxpage; $i++) {
                echo '<a href="indexnll.php?action=statistics&pagenumber=', $i, '">page ', $i, '</a>';
                if ($i != $maxpage) {
                    echo ', ';
                }
            }
示例#13
0
 // get level
 $skill = $acc["level"];
 // calculate power investment bonus multiplier
 $neutral = round($skill * gdPowerspellCostMultiplier);
 $max = round($skill * gdPowerspellCostMultiplier * gdMaximumPowerspellInvestment);
 $min = round($skill * gdPowerspellCostMultiplier * gdMinimumPowerspellInvestment);
 if ($power < $min) {
     $output .= "You have to invest more power.<br>";
     $no = 1;
 }
 if ($power > $max) {
     $output .= "You have to invest less power.<br>";
     $no = 1;
 }
 if (in_array($acc["id"], $admins)) {
     if (!gCheckInt($aantal)) {
         $aantal = 1;
     }
 } else {
     $aantal = 1;
 }
 if ($no == 0) {
     for ($x = 1; $x <= $aantal; $x++) {
         $sql = "INSERT INTO powerlogs (account, power) VALUES ('{$acc['id']}', '{$power}')";
         $result = $db->query($sql);
         if ($power < $neutral) {
             $powermod = 1 - (1 - gdMinimumPowerspellBonus) * ($neutral - $power) / ($neutral - $min);
         } else {
             $powermod = 1 + (gdMaximumPowerspellBonus - 1) * ($power - $neutral) / ($max - $neutral);
         }
         // skill cap
示例#14
0
 $no = 0;
 if ($brimstone && !gCheckInt($brimstone) || $crystal && !gCheckInt($crystal) || $essence && !gCheckInt($essence) || $granite && !gCheckInt($granite)) {
     echo 'Invalid resources.<br>';
     $no = 1;
 } else {
     if ($brimstone + $crystal + $essence + $granite != $betamount) {
         $output .= 'The total amount of wagered resources must be exactly ' . $betamount . '.<br>';
         $output .= 'You are of course always allowed to sponsor more by donating it directly to the Lotto account.<br>';
         $no = 1;
     }
 }
 if (!gCheckInt($homescore) || !gCheckInt($awayscore)) {
     $output .= 'Both scores obviously have to be a number.<br>';
     $no = 1;
 }
 if (!gCheckInt($minute)) {
     $output .= 'The minute of the first goal or card has to be a number.<br>';
     $no = 1;
 }
 if ($homescore == 0 && $awayscore != 0 && $firstscore == 'H' || $homescore != 0 && $awayscore == 0 && $firstscore == 'A') {
     $output .= 'The first team scoring actually has to score a goal. The first yellow card is only used as a decider in case you predict a 0-0 result.<br>';
     $no = 1;
 }
 $sql = "SELECT * FROM gamblebets WHERE gid='{$currentgame}' AND aid='{$acc['id']}'";
 $result = $db->query($sql);
 $numrows = $db->num_rows($result);
 if ($numrows != 0) {
     echo 'You already placed a bet on this game.';
     $no = 1;
 }
 $sql = "SELECT until FROM gamblegames WHERE id='{$currentgame}'";
示例#15
0
            $numrows = $db->result($result, 0);
            if ($numrows > 0) {
                echo 'That player is under attack at the moment.<br>';
                $no = 1;
            }
        }
    }
    if ($no == 0) {
        $creature = new Creature($row);
        $cost = ceil($creature->data["skill"] * $gdAlliedDefenseCostMultiplier);
        echo 'Sending this creature to <a href="index.php?page=playerinfo&action=viewinfo&aid=', $account["id"], '">', $account["name"], '</a> will cost you ', $cost, ' power. <a href="index.php?page=playerinfo&action=submitsendcreature&aid=', $aid, '&sid=', $sid, '">Continue?</a><br>';
    }
}
if ($action == "submitnumber") {
    $no = 0;
    if (!$number || !gCheckInt($number)) {
        echo 'Invalid number.<br>';
        $no = 2;
        $action = "arcanechamber";
    } elseif ($acc["travelcounter"] > 0) {
        echo 'Apparently the dwarf doesn\'t need you at the moment.<br>';
        $no = 2;
        $action = "arcanechamber";
    } else {
        if ($acc["travelcounterkey"] != $number && $acc["travelcounterkey"] != 0 || $formtype != "submitnumber") {
            $no = 1;
            $action = "arcanechamber";
        }
    }
    if ($acc["travelcounterkey"] == 0) {
        echo 'The Dwarf is not paying attention right now... but if you click <a href="index.php?page=playerinfo&action=arcanechamber&aid=', $aid, '">here</a>, he will get back to you...<br>';