コード例 #1
0
ファイル: ahelp.php プロジェクト: KristofMols/castlequest2
        $no = 1;
    }
    if ($no == 0) {
        $sql = "DELETE FROM faq WHERE id = '{$fid}'";
        $result = $db->query($sql);
        echo 'FAQ question deleted.';
    }
}
if ($action == "changefaq") {
    $sql = "SELECT * FROM faq WHERE id = '{$fid}'";
    $result = $db->query($sql);
    $row = $db->fetch_array($result);
    fTitle("index.php?page=help&action=submitchangefaq&fid=" . $row["id"]);
    fText("Question:", "question", $row["question"]);
    fTextarea("Answer:", "answer", $row["answer"]);
    fText("Importance:", "importance", $row["importance"], 5);
    fEnd("Change");
}
if ($action == "submitchangefaq") {
    $no = 0;
    if (!$question || !$answer || !$fid) {
        echo 'Data is incomplete.';
        $no = 1;
    }
    if (!$importance) {
        $importance = 0;
    }
    $sql = "SELECT * FROM faq WHERE id = '{$fid}'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
コード例 #2
0
ファイル: Maze.php プロジェクト: KristofMols/castlequest2
if ($status == 3) {
    if (!$action) {
        echo '
			You face an immense wall. Your eyes try to grasp where it ends, 
			but in neither of the directions you can see and ending. Curious you touch 
			the wall and feel that it\'s made out of the same smooth black stone as the 
			narrow walls you were walking before. You walk a whole time alongside it, 
			until your reach small holes in the wall. You can\'t see inside them, because 
			it\'s darker as hell inside these hallways. You figure you can crawl through 
			one of these small tunnels to the other side of that wall.<br>
			You find about 10 holes right next to each other.<br><br>
			
			Which one will you enter?
			';
        fTitle("index.php?page=Maze&action=enter");
        fText("Entrance:", "entrance");
        fEnd("Enter");
    }
    if ($action == "enter") {
        if ($entrance == 5) {
            $sql = "UPDATE mazestatus SET status = '4' WHERE account = '{$acc['id']}'";
            $result = $db->query($sql);
            echo '
				You enter the dark passage. Before you know it, you have passed underneath the huge wall. You are standing in a gigantic hall.<br><br>
				
				As you wander through the Great Room, as you\'ve come to call it, you suddenly see, in the distance, a great structure. Running towards it, your anxiety grows, because you feel power emerging from that place, you can feel the greatness that once was.
				When you\'ve almost reached the structure, you gasp in awe at the colossal building in front of you, made entirely out of a low pulsing and gleaming material which emits a strange scent, one you\'ve never smelled before. When you\'re standing a few yards away from it, you realize this is some sort of tomb. A tomb that no man could build, for it seems entirely made out of one piece. Looking up at it, you see no end and circling the grave looks nearly impossible, because in the distance there is nothing to be seen but the giant wall.
				Surrounding the huge block of stone, there are little rooms. When you enter a few of those, you can see walls full of strange glowing symbols, huge ornaments with a frightening look, but nothing you can use. Several other rooms are completely empty, creating the feeling that this fascinating tomb is not yet finished - as if the creators were interupted in the middle of their work.<br><br>
				
				You feel lost in an eternal space.<br><br>
				
コード例 #3
0
    if (strlen($info) > gdMaxPrivateLength) {
        echo 'That text is too long.<br>';
    } else {
        $sql = "UPDATE accounts SET private = '{$private}' WHERE id = '{$acc['id']}'";
        $result = $db->query($sql);
        echo 'Private notes successfully changed!<br>';
        $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>';
コード例 #4
0
    $numrows = $db->num_rows($result);
    while ($row = $db->fetch_array($result)) {
        echo $row["name"], ': <a href="index.php?page=creatures&action=useitemconfig&icid=', $row["id"], '">use</a>, <a href="index.php?page=creatures&action=modifyitemconfig&icid=', $row["id"], '">modify</a>, <a href="index.php?page=creatures&action=renameitemconfig&icid=', $row["id"], '">rename</a>, <a href="index.php?page=creatures&action=deleteitemconfig&icid=', $row["id"], '">delete</a><br>';
    }
    if ($numrows < gdMaxItemConfigs) {
        echo '<br><a href="index.php?page=creatures&action=newitemconfig">Create a new item configuration.</a><br>';
    } else {
        echo '<br>You can only have ', gdMaxItemConfigs, ' item configurations.<br>';
    }
}
if ($action == "renameitemconfig") {
    $sql = "SELECT name FROM itemconfig WHERE id = '{$icid}'";
    $result = $db->query($sql);
    $name = $db->result($result, 0);
    fTitle("index.php?page=creatures&action=submitrenameitemconfig&icid={$icid}");
    fText("Name:", "name", $name);
    fEnd("Rename");
}
if ($action == "removeitemconfigset") {
    $no = 0;
    $sql = "SELECT count(*) FROM itemconfig WHERE account = '{$acc['id']}' AND id = '{$icid}'";
    $result = $db->query($sql);
    $numrows = $db->result($result, 0);
    if ($numrows != 1) {
        echo 'Invalid icid.<br>';
        $no = 1;
    } else {
        $sql = "SELECT count(*) FROM itemconfigset WHERE creature = '{$sid}' AND config = '{$icid}'";
        $result = $db->query($sql);
        $numrows = $db->result($result, 0);
        if ($numrows != 1) {
コード例 #5
0
ファイル: library.php プロジェクト: KristofMols/castlequest2
<?php

topic("{$library} curseshop");
if ($action == "newcurse") {
    echo '
		Please enter the name of the creature you want to be able to curse.<br>
		This choice is irreversible.
		';
    fTitle("index.php?page=library&action=submitnewcurse&curse={$curse}");
    fText("Creature:", "creature");
    fEnd("Learn Curse");
}
if (!$action) {
    echo '
		Welcome to my shop.<br>
		Some of the items here are too powerful for unexperienced magi, I really can\'t offer you those.<br>
		';
    if ($acc["level"] >= $gdCurseLevelMin) {
        // get curses already learned
        $sql = "SELECT s.code, s.id FROM skills AS s, accskills AS acs WHERE acs.account = '{$acc['id']}' AND acs.skill = s.id AND s.tree = 'curses'";
        $result = $db->query($sql);
        // settings
        $learnedCurses = array();
        $topProficiency = 0;
        $cursesActivated = false;
        while ($row = $db->fetch_array($result)) {
            // curses activated
            if ($row["code"] == gdsCurses) {
                $cursesActivated = TRUE;
            } elseif ($row["code"] == gdsExpert && $topProficiency < 1) {
                $topProficiency = 1;
コード例 #6
0
<?php

topic("Creature And Item Database");
if (!$action) {
    echo '
		Enter the name of a creature or item in the field below to get information about that spell.
		You can only get information about the spells that are somewhat in your reach.
		Only creatures and items that have a usage level lower than your own will be available here.
		<br><br>
		';
    fTitle("index.php?page=spellinfo&action=viewinfo");
    fText("Spell Name:", "name");
    fEnd("Search");
}
if ($action == "viewinfo") {
    $no = 1;
    if ($type && $sid) {
        if ($type == "creature") {
            $sql = "SELECT count(*) FROM creatures WHERE id = '{$sid}'";
            $result = $db->query($sql);
            $numrows = $db->result($result, 0);
            if ($numrows == 1) {
                $no = 0;
            }
        }
        if ($type == "item") {
            $sql = "SELECT count(*) FROM items WHERE id = '{$sid}'";
            $result = $db->query($sql);
            $numrows = $db->result($result, 0);
            if ($numrows == 1) {
                $no = 0;
コード例 #7
0
<?php

topic("Report Abuse");
if (!$action) {
    fTitle("index.php?page=reportabuse&action=submitabuse");
    fText("Account name of abuser:"******"name");
    fTextArea("Abuse Description:", "description");
    fEnd("Submit");
    echo '
		You can report anything abusive you encounter here.<br>
		Typical abuse can be the use of offensive language or a player with more than one account.<br>
		';
}
if ($action == "submitabuse") {
    $no = 0;
    if (!$description) {
        echo 'You have to enter a description and an account name.<br>';
        $no = 1;
    }
    $sql = "SELECT id, name FROM accounts WHERE name = '{$name}'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
        echo 'You have to enter a valid account name.<br>';
        $no = 1;
    } else {
        $row = $db->fetch_array($result);
        $name = "{$row['name']} (" . $cq2url . "index.php?page=playerinfo&action=viewinfo&aid={$row['id']}";
    }
    if ($no == 0) {
        $date = date("Y-m-d @ H:i");
コード例 #8
0
ファイル: battles.php プロジェクト: KristofMols/castlequest2
        if ($offset < 0) {
            $offset = 0;
        }
        echo '<a href="index.php?page=battles&outgoingreportoffset=', $offset, '">previous</a>';
    }
    if ($outgoingreportoffset != 0 && $counter > $gdDisplayBattles) {
        echo '<br>';
    }
    if ($counter > $gdDisplayBattles) {
        $offset = $outgoingreportoffset + $gdDisplayBattles;
        echo '<a href="index.php?page=battles&outgoingreportoffset=', $offset, '">next</a>';
    }
    tEnd();
    tBegin("Attack");
    fTitle("index.php?page=battles&action=attack");
    fText("Target:", "targetname");
    fEnd("Attack");
    tEnd();
}
if ($action == "battleinfo") {
    $no = 0;
    $sql = "SELECT b.*, a.name AS aname, a.id AS aid, a.gender AS agender, k.id AS kid, k.name AS kname FROM battles AS b, accounts AS a, kingdoms AS k WHERE b.id = '{$bid}' AND b.account = '{$acc['id']}' AND b.status = '1' AND b.target = a.id AND a.kingdom = k.id";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
        echo 'Invalid data.<br>';
        $no = 1;
    }
    if ($no == 0) {
        $row = $db->fetch_array($result);
        tBegin("Status");
コード例 #9
0
ファイル: kd_pub.php プロジェクト: KristofMols/castlequest2
         $addon = "";
     } else {
         if ($row["timelimit"] == 0) {
             $addon = " for unlimited time";
         } else {
             $dif = gCalcTimeDif($row["timelimit"], $row["time"]);
             $addon = " for {$dif['days']} days";
         }
         $addon .= ", <a href=\"index.php?page=kingdom&action=changebandays&aid={$row['aid']}\">change</a>";
     }
     echo '<a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["aid"], '">', $row["name"], '</a> by <a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["banner"], '">', $row["bannername"], '</a> (since ', $date, '', $addon, ') - <a href="index.php?page=kingdom&action=unban&pbid=', $row["id"], '">unban</a><br>';
 }
 tEnd();
 tBegin("Ban Account");
 fTitle("index.php?page=kingdom&action=ban");
 fText("Name:", "name");
 fEnd("Ban");
 tEnd();
 if (in_array($acc["id"], $moderators)) {
     tBegin("Violations");
     $sql = "SELECT id, subject, days FROM violations ORDER BY subject ASC";
     $result = $db->query($sql);
     while ($row = $db->fetch_array($result)) {
         echo $row["subject"], ' (', $row["days"], '): <a href="index.php?page=kingdom&action=editviolation&vid=', $row["id"], '">edit</a>, <a href="index.php?page=kingdom&action=deleteviolation&vid=', $row["id"], '">delete</a><br>';
     }
     echo '<br><a href="index.php?page=kingdom&action=addviolation">Add violation.</a><br>';
     tEnd();
     tBegin("Violation Logs");
     echo '<a href="index.php?page=kingdom&action=violationlogs">View logs.</a>';
     tEnd();
 }
コード例 #10
0
        // 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);
        echo '
			You are going to cast a ', $gdGemSpells[$gemspell]["name"], ' wave enchant on the ', $creature->data["creaturename"], ' creatures in the wave.<br>
			The quality of the spell depends on the amount of ', $creature->data["creaturename"], ' creatures in your kingdom and on the amount of resources you use for it.<br>
			The more resources you use, the higher your chance of casting a better spell.<br>
			You can invest between ', $mincost, ' and ', $maxcost, ' resources in this spell.<br>
			';
        fTitle("index.php?page=kingdom&action=submitcastenchantment&kdbid={$kdbid}&wave={$wave}&cid=" . $creature->data["cid"] . "&gemspell={$gemspell}");
        fText("Kingdom Resources:", "resources", "0");
        fEnd("Cast Enchantment");
    }
}
if ($action == "submitcastenchantment") {
    $no = 0;
    // get kingdom battle
    $sql = "SELECT * FROM kdbattles WHERE id = '{$kdbid}' AND (kingdom = '{$acc['kingdom']}' OR target = '{$acc['kingdom']}') AND building != '0'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
        echo 'Invalid kingdom battle.<br>';
        $no = 1;
    } else {
        $kdbattle = $db->fetch_array($result);
        // we are the attackers -> we can only cast an enchantment during battle setup, and on any wave
コード例 #11
0
ファイル: admin.php プロジェクト: KristofMols/castlequest2
if ($action == "submiteditreport") {
    $sql = "SELECT r.*, a.name FROM reports AS r, accounts AS a WHERE r.id = '{$rid}' AND r.reporter = a.id";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
        echo 'Invalid report id.<br>';
    } else {
        $sql = "UPDATE reports SET text = '" . addslashes($text) . "' WHERE id = '{$rid}'";
        $result = $db->query($sql);
        echo 'Report modified!<br><br>';
        $action = "reports";
    }
}
if ($action == "forwardreport") {
    fTitle("index.php?page=admin&action=submitforwardreport&rid={$rid}");
    fText("Admin name:", "name");
    fEnd("Forward");
}
if ($action == "submitforwardreport") {
    $no = 0;
    $sql = "SELECT r.* FROM reports AS r WHERE r.id = '{$rid}'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
        echo 'Invalid report id.<br>';
        $no = 1;
    }
    $sql = "SELECT id FROM accounts WHERE name = '{$name}'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
コード例 #12
0
        }
    }
    echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="right">';
    if ($offset != 0) {
        $prevoffset = $offset - $gdPostMax;
        if ($prevoffset < 0) {
            $prevoffset = 0;
        }
        if ($filter) {
            echo '<a href="index.php?page=news&offset=', $prevoffset, '&filter=', $filter, '">previous page</a>';
        } else {
            echo '<a href="index.php?page=news&offset=', $prevoffset, '">previous page</a>';
        }
    }
    if ($offset != 0 && $more == TRUE) {
        echo ' - ';
    }
    if ($more == TRUE) {
        $nextoffset = $offset + $gdPostMax;
        if ($filter) {
            echo '<a href="index.php?page=news&offset=', $nextoffset, '&filter=', $filter, '">next page</a>';
        } else {
            echo '<a href="index.php?page=news&offset=', $nextoffset, '">next page</a>';
        }
    }
    echo '</td></tr></table>';
    fTitle("index.php?page=news");
    fText("Filter:", "filter", 0, 30);
    //		echo $filter;
    fEnd("Filter");
}
コード例 #13
0
ファイル: lotto.php プロジェクト: KristofMols/castlequest2
    }
} else {
    if ($hometeam && $awayteam) {
        $array = array(array("value" => "H", "name" => $hometeam), array("value" => "A", "name" => $awayteam));
        echo 'We are currently trying to predict the result of the game between ' . $hometeam . ' and ' . $awayteam . '.<p>
			
			You have to bet ' . $betamount . ' resources, and you\'re only allowed to wager once on each game.<br>
			In the form below you can enter the score, who scores first and in which minute this will happen.<br>
			If you predict a 0-0 result, enter which team will get a yellow card first and again in which minute this will happen.<br>
			For more information and rules, check the <a href=index.php?page=help&topic=Football%20gambling>help</a>.<p><br>';
        fTitle("index.php?page=lotto&action=gamble");
        fText("Brimstone:", "brimstone", "0");
        fText("Crystal:", "crystal", "0");
        fText("Essence:", "essence", "0");
        fText("Granite:", "granite", "0");
        echo '<tr><td><br><td></tr>';
        fText($hometeam . " score:", "homescore", "0");
        fText($awayteam . " score:", "awayscore", "0");
        echo '<tr><td><br><td></tr>';
        fRadio("First goal or yellow card:", "firstscore", $array);
        fText("In which minute?", "minute", "0");
        echo '<tr><td><br><td></tr>';
        fEnd("Place bet");
    } else {
        echo 'There is currently no game to bet on.';
    }
}
?>


コード例 #14
0
ファイル: speed.php プロジェクト: KristofMols/castlequest2
<?php

include_once "../data.php";
include_once "../functions/gamefunctions.php";
include_once "../functions/tablefunctions.php";
$db = new database();
$db->connect($db_server, $db_login, $db_password);
$db->select_db($db_database);
if (!$action) {
    fTitle("speed.php");
    fText("Action:", "action");
    fTextarea("Add:", "text");
    fEnd("Add");
}
if ($action == "orbs") {
    $lines = explode("\n", $text);
    $counter = 0;
    // create buildings
    foreach ($lines as $line) {
        $values = explode("\t", $line);
        foreach ($values as $key => $value) {
            $values[$key] = trim($value);
        }
        $sql = "\r\n\t\t\tINSERT INTO orbs (color, cost, min_gems, max_gems, min_uses, max_uses, rarity_mod, rarity_description) \r\n\t\t\tVALUES ('{$values['0']}', '{$values['1']}', '{$values['2']}', '{$values['3']}', '{$values['4']}', '{$values['5']}', '" . str_replace(",", ".", $values[6]) . "', '{$values['7']}')\r\n\t\t\t";
        $result = $db->query($sql);
        $counter++;
    }
    echo "{$counter} added.";
}
if ($action == "signs") {
    $lines = explode("\n", $text);
コード例 #15
0
ファイル: tshirt.php プロジェクト: KristofMols/castlequest2
        $result = $db->query($sql);
        while ($row = $db->fetch_array($result)) {
            $left[$row["type"]] = $max[$row["type"]] - $row["aantal"];
        }
        while (list($key, $value) = each($max)) {
            if (!isset($left[$key])) {
                $left[$key] = $value;
            }
        }
        fTitle("index.php?page=tshirt&action=order");
        $array = array(array("name" => "Large (" . $left["L"] . " left)", "value" => "L"), array("name" => "Extra Large (" . $left["XL"] . " left)", "value" => "XL"), array("name" => "Extra Extra Large (" . $left["XXL"] . " left)", "value" => "XXL"));
        fRadio("T-shirt size:", "type", $array, 0);
        fText("Real name:", "realname");
        fText("Street + number:", "street");
        fText("Postcode:", "postcode");
        fText("Town:", "town");
        fEnd("Order");
    }
}
if ($action == "order") {
    if (!in_array($type, array("L", "XL", "XXL"))) {
        echo 'Invalid t-shirt size.<br>';
        $no = 1;
    } else {
        $sql = "SELECT count(*) FROM tshirt WHERE account = '{$acc['id']}'";
        $result = $db->query($sql);
        $numrows = $db->result($result, 0);
        if ($numrows != 0) {
            echo 'You have already ordered a t-shirt.<br>';
            $no = 1;
            $action = "output";
コード例 #16
0
    $result = $db->query($sql);
    $array[0] = array("name" => "No Root", "value" => 0);
    $m = 1;
    while ($newrow = $db->fetch_array($result)) {
        $array[$m]["name"] = $newrow["name"];
        $array[$m]["value"] = $newrow["id"];
        if ($row["root"] == $newrow["id"]) {
            $default = $m;
        }
        $m++;
    }
    if ($row["root"] == "") {
        $default = 0;
    }
    fSelect("Root:", "root", $array, $default);
    fText("Value:", "value", $row["value"]);
    fEnd("Change");
}
if ($action == "submitchangebuilding") {
    $no = 0;
    if (!$name || !$granite || !$level || !$bid) {
        echo 'Data is incomplete.';
        $no = 1;
    }
    if (!$type) {
        $type = 0;
    }
    if (!$value) {
        $value = 0;
    }
    $sql = "SELECT id FROM buildings WHERE name = '{$name}'";
コード例 #17
0
ファイル: items.php プロジェクト: KristofMols/castlequest2
        $i++;
    }
    if ($numrows == 0) {
        echo 'You haven\'t learned any enchantments yet.<br>';
    } else {
        if (isset($aiid)) {
            fTitle("index.php?page=items&action=submitenchant&aiid={$aiid}");
        } else {
            fTitle("index.php?page=items&action=submitenchant&amid={$amid}");
        }
        fSelect("Enchantment:", "enchantment", $array, $default);
        fText("Brimstone:", "brimstone", $brimstone > 0 ? "{$brimstone}" : "0");
        fText("Crystal:", "crystal", $crystal > 0 ? "{$crystal}" : "0");
        fText("Essence:", "essence", $essence > 0 ? "{$essence}" : "0");
        fText("Granite:", "granite", $granite > 0 ? "{$granite}" : "0");
        fText("Creature race:", "race", $crace > 0 ? "{$crace}" : "");
        fEnd("Add resources");
    }
}
if ($action == "usepackage") {
    $no = 0;
    if ($acc["attacked"]) {
        echo 'You can\'t use a package while under attack.<br>';
        $no = 1;
    }
    $sql = "LOCK TABLES packages WRITE, accounts WRITE";
    $result = $db->query($sql);
    $sql = "SELECT type, amount FROM packages WHERE id = '{$pid}' AND account = '{$acc['id']}'";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
コード例 #18
0
            case 6:
                $resource = "essence";
                break;
            case 7:
                $resource = "granite";
                break;
        }
        $maxres = round($acc[$resource] * gdGamblingDwarfMax);
        echo '
				You encounter ', $gdEncounters[$encounter][0], '.<br>
				He offers you a ', $resource, ' gambling challenge.<br>
				You can gain a lot of ', $resource, ' and you can lose a lot, but you can never lose more than you invest.<br>
				You can gamble for at most ', $maxres, ' ', $resource, ' in one game.<br>
				';
        fTitle("index.php?page=travel&action=encounter");
        fText("{$resource} to invest:", "amount", "", 5);
        fEnd("Gamble");
    }
    if ($encounter == 8) {
        echo '
				You encounter ', $gdEncounters[$encounter][0], '.<br>
				He is an unusually powerful dwarf.<br>
				If you give him a gem and some additional resources, he will give you some of his power.<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>';
コード例 #19
0
<?php

if ($action == "summoncreatures") {
    $sql = "SELECT name FROM creatures WHERE id = '{$cid}'";
    $result = $db->query($sql);
    $name = $db->result($result, 0);
    echo 'How many ', $name, ' amulets do you want to summon?<br><br><br>';
    fTitle("index.php?page=spellbook&action=submitsummoncreatures&cid={$cid}");
    fText("Amount:", "amount", 1, 5);
    fEnd("Summon Amulets");
}
if ($action == "race" || $action == "race_as") {
    $no = 0;
    if (!$rid) {
        echo 'Invalid data.<br>';
        $no = 1;
    } else {
        $sql = "SELECT class FROM races WHERE id = '{$rid}'";
        $result = $db->query($sql);
        $class = $db->result($result, 0);
        $value = $acc[strtolower($gdClass[$class - 1]["name"])];
        $core = "ROUND(((( c.damage * 2) + (2/30*(( r.forest + r.death + r.air + r.earth )/40* c.health ) + 2/3* c.health )) * (1 - (c.skillbonus / 100))), 0)";
        $maincheck = "({$core} /100* (100 - {$gdSkillDifference}))";
        $check = "(ROUND({$maincheck}) <= {$value})";
        $end = "ORDER BY {$core} ASC";
        $sql = "SELECT {$gdTravelChallengeCreatureSelect}, b.name AS buildingname FROM (creatures AS c, races AS r) LEFT JOIN accbuildings AS ab ON c.building = ab.building AND ab.account = '{$acc['id']}' LEFT JOIN buildings AS b ON b.id = c.building WHERE c.race = r.id AND r.id = '{$rid}' AND (c.building = '0' OR ab.building = c.building) AND c.type = '0' AND ({$check}) {$end}";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        if ($numrows == 0) {
            echo 'Invalid race.';
            $no = 1;
コード例 #20
0
ファイル: random.php プロジェクト: KristofMols/castlequest2
<?php

include_once "functions/tablefunctions.php";
if (!$action) {
    fTitle("random.php?action=generate");
    fText("Amount of numbers to generate:", "amount", "1");
    fText("Min value to generate:", "min", "1");
    fText("Max value to generate:", "max", "100");
    fText("Lower or equal than:", "lower", "50");
    fEnd("Generate");
}
if ($action == "generate") {
    // generate results
    $results = array_fill($min, $max - $min + 1, 0);
    for ($i = 0; $i < $amount; $i++) {
        $pick = rand($min, $max);
        $results[$pick]++;
    }
    // print all results
    echo '<table width="55" border="0" cellspacing="0" cellpadding="0">';
    $total = 0;
    for ($i = $min; $i <= $max; $i++) {
        echo '
			<tr><td width="25" align="right">
			', $i, '
			</td><td width="5"></td><td width="25">
			</td><td width="25" align="left">
			', $results[$i], '
			</td></tr>
			';
        if ($i <= $lower) {
コード例 #21
0
ファイル: kingdom.php プロジェクト: KristofMols/castlequest2
			}
			</script>
			
			<br><br>
			
			<a href="javascript:void(0);" onclick="fillin(true); return false;">Select all</a> / <a href="javascript:void(0);" onclick="fillin(false); return false;">Unselect all</a><br><br>
			
			<input type="submit" name="submit" class="input" value="Take Selected">
			</form>
			';
    }
    echo '<br><br>';
    fTitle("index.php?page=kingdom&action=gemtemple");
    fText("Sign:", "signname", $creaturename);
    fText("Minimum Level:", "minlevel", $minlevel, 5);
    fText("Maximum Level:", "maxlevel", $maxlevel, 5);
    unset($array, $default);
    $array[0] = array("name" => "Don't Filter", "value" => "NO");
    if ($genchantment == "NO" || !isset($genchantment)) {
        $default = 0;
    }
    $array[1] = array("name" => "No Enchantment", "value" => "NULL");
    $array[2] = array("name" => "Any Enchantment", "value" => "ANY");
    if ($genchantment == "NULL") {
        $default = 1;
    }
    if ($genchantment == "ANY") {
        $default = 2;
    }
    for ($m = 0; $m < count($gdGemSpells); $m++) {
        $array[] = array("name" => $gdGemSpells[$m]["name"], "value" => $m);
コード例 #22
0
// ******************
if ($action == "mathdwarf") {
    tBegin("Mathematics Dwarf");
    $cache = md5(uniqid(rand()));
    echo '
		While giving orders to your minions you suddenly notice a strange little guy messing around with your creatures and counting their toes, tails and teeth, amongst other things.<br>
		
		<i>"I really need a duplicate of a rare number I discovered here...<br>
		Please, can you copy it for me?"</i><br><br>
		
		<img src="travelcounter.php?cache=', $cache, '"><br><br>
		
		Just refresh the page if you\'re not sure about the number.<br><br>
		';
    fTitle("index.php?page=playerinfo&action=submitnumber&aid={$aid}");
    fText("Copy:", "number", "", 5);
    echo '<input type="hidden" name="formtype" value="submitnumber">';
    fEnd("Give Number");
    tEnd();
}
if ($action == "attack") {
    $no = 0;
    if ($targetname) {
        $sql = "SELECT id FROM accounts WHERE name = '" . trim($targetname) . "'";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        if ($numrows != 1) {
            echo 'That mage doesn\'t exist.<br>';
            $no = 1;
        } else {
            $target = $db->result($result, 0);
コード例 #23
0
          echo '
          Registration is disabled until the next age starts.<br>
          ';
      }*/
}
if ($action == "reactivate") {
    include_once "functions/gamefunctions.php";
    echo '
		Normally, you should have received a mail with a reactivation code for your account.
		But some people didn\'t receive it because their e-mail account was invalid or they exceeded their maximum storage amount.
		These people can now receive their reactivation code by entering their old username and password below.
		If you don\'t know the username or password anymore and the activation e-mail hasn\'t arrived by now, your account will be lost and you will have to register again when the game goes up.<br><br>
		';
    fTitle("indexnl.php?page=nl_newaccount&action=reactivate2");
    fText("Login name:", "name");
    fText("Password:"******"password", "", 20, TRUE);
    fEnd("Get reactivation key");
}
if ($action == "reactivate2") {
    include_once "functions/gamefunctions.php";
    $sql = "SELECT activatekey FROM reactivation WHERE name = '{$name}' AND password = PASSWORD('{$password}')";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows != 1) {
        echo 'Invalid login name or password.<br>';
        $no = 1;
    } else {
        $key = $db->result($result, 0);
        echo 'Click on the following url to activate your account:<br><br>';
        $url = $cq2url . "indexnl.php?page=nl_newaccount&key=" . $key;
        echo '<a href="', $url, '">', $url, '</a><br>';
コード例 #24
0
                }
                if ($status == 3) {
                    if ($relrow["kingdom"] == $acc["kingdom"]) {
                        echo '<a href="index.php?page=kingdominfo&action=changerelation&kid=', $row["id"], '&reltype=0">Cancel the alliance offer.</a><br>';
                    } else {
                        echo '<a href="index.php?page=kingdominfo&action=changerelation&kid=', $row["id"], '&reltype=2">Accept the alliance offer.</a><br>';
                        echo '<a href="index.php?page=kingdominfo&action=changerelation&kid=', $row["id"], '&reltype=0">Decline the alliance offer.</a><br>';
                    }
                }
                if ($status == 4) {
                    if ($relrow["kingdom"] == $acc["kingdom"]) {
                        echo '<a href="index.php?page=kingdominfo&action=changerelation&kid=', $row["id"], '&reltype=1">Cancel the peace treaty offer.</a><br>';
                    } else {
                        echo '<a href="index.php?page=kingdominfo&action=changerelation&kid=', $row["id"], '&reltype=0">Accept the peace treaty offer.</a><br>';
                        echo '<a href="index.php?page=kingdominfo&action=changerelation&kid=', $row["id"], '&reltype=1">Decline the peace treaty offer.</a><br>';
                    }
                }
            }
        }
        tEnd();
    }
}
if ($action == "donate") {
    echo 'Please select how much resources you want to donate to that kingdom.<br><br>';
    fTitle("index.php?page=kingdominfo&action=submitdonate&kid={$kid}");
    fText("Brimstone:", "brimstone", "0");
    fText("Crystal:", "crystal", "0");
    fText("Essence:", "essence", "0");
    fText("Granite:", "granite", "0");
    fEnd("Donate");
}
コード例 #25
0
ファイル: nl_home.php プロジェクト: KristofMols/castlequest2
}
if ($action == "submitactivation") {
    $no = 0;
    if (!$name) {
        echo 'Invalid data.<br>';
        $no = 1;
    } else {
        $sql = "SELECT id, email, session_id FROM {$db_register_accounts} WHERE name = '{$name}' AND status = '98'";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        if ($numrows != 1) {
            echo 'Invalid login name.<br>';
            $no = 1;
        } else {
            $row = $db->fetch_array($result);
        }
    }
    if ($no == 0) {
        $url = $cq2url . "indexnl.php?page=nl_finish&action=activate&sessionid=" . $row["session_id"];
        mail($row["email"], "Castle Quest 2 Registration", "Hello!\r\n\r\nYour registration to Castle Quest 2 has been successfully processed.\r\n\r\nTo activate your account, please click on the url below or copy & paste it into your browser.\r\n\r\n{$url}\r\n\r\nEnjoy your stay in our universe!\r\n\r\n\r\nKind regards,\r\nthe CQ2 team.\r\n{$cq2url}\r\n", $mailheaders);
        echo '
			A new activation mail has been dispatched.<br>
			';
    }
}
if ($action == "setpassword") {
    fTitle("indexnl.php?page=nl_home&action=submitsetpassword&passwordkey={$passwordkey}");
    fText("New Password:"******"password", "", 20, TRUE);
    fText("Repeat Password:"******"password2", "", 20, TRUE);
    fEnd("Change Password");
}
コード例 #26
0
    if ($gdSpecialKingdoms[$acc["kingdom"]]) {
        $output .= 'You can\'t cast curses when you live in Stonehenge because you need a Shard Vault to hold your active shards.<br>';
        $no = 1;
    } else {
        echo '
			To cast a curse on the creature of an opponent, you first have to cast the Reveal spell to get the creature list from an opponent.<br>
			Enter the name of the mage you want to Reveal below.
			If you want to curse a mage instead of a creature, go to \'Other Players\'.<br><br>
			
			<a href="index.php?page=spellbook&action=yourcurses">View a list of all the curses you have learned so far.</a><br>
			';
    }
    tEnd();
    tBegin("Reveal");
    fTitle("index.php?page=spellbook&action=reveal");
    fText("Reveal Mage:", "name");
    fEnd("Reveal");
    $sql = "SELECT a.name, a.id FROM reveals AS r, accounts AS a WHERE r.account = '{$acc['id']}' AND r.target = a.id ORDER BY a.name ASC";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows == 0) {
        echo 'You don\'t have any active Reveal spells right now.<br>';
    } else {
        while ($row = $db->fetch_array($result)) {
            echo '<a href="index.php?page=playerinfo&action=viewinfo&aid=', $row["id"], '">', $row["name"], '</a>: <a href="index.php?page=playerinfo&action=creaturelist&aid=', $row["id"], '">creature list</a><br>';
        }
    }
    tEnd();
    tBegin("Active Curses");
    echo '<a href="index.php?page=spellbook&action=activecurses">Click here</a> to view a complete list of all the active curses that have anything to do with you.<br>';
    tEnd();
コード例 #27
0
                } else {
                    $url = array("#creaturename", " (<a href=\"index.php?page=playerinfo&action=viewinfo&aid=", "#aid", "\">", "#aname", "</a>)");
                }
                $creature->echoCreature($url);
            }
            if ($numrows != 0) {
                echo '</table>';
            }
        }
        tEnd();
    }
}
if ($action == "donateegg") {
    echo 'Please enter the name of a kingdom.<br><br>';
    fTitle("index.php?page=kingdom&action=submitdonateegg&eid={$eid}");
    fText("Kingdom:", "kingdom");
    fEnd("Donate Egg");
}
if ($action == "submitdonateegg") {
    $no = 0;
    if (!$eid || !$kingdom) {
        echo 'Invalid data.<br>';
        $no = 1;
    } else {
        $sql = "SELECT creature, descriptor FROM eggs WHERE kingdom = '{$acc['kingdom']}' AND id = '{$eid}' AND hatchery = '0'";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        if ($numrows != 1) {
            echo 'Invalid eid.<br>';
            $no = 1;
        } else {
コード例 #28
0
ファイル: options.php プロジェクト: KristofMols/castlequest2
        tBegin("Image Pack");
        echo '
			The image pack allows you to store all the image files on your hard disk so that you don\'t have to receive them from the server anymore.
			We strongly advise every active player to download and use it, because it allows you to load pages much faster and it lowers the traffic to and from the server.<br><br>
			
			To download the image pack, click <a href="docs/imagepack_2003-11-04.zip">here</a> (last updated: 2003-11-04).<br>
			Unzip the page in a folder of your choice and enter the full path to the image directory below (for example: c:\\cq2).
			If you don\'t want to use the pack anymore, just fill in an empty path and the images will be loaded from the server again.<br><br>
			
			<i>Important notice for Mozilla/Firefox users:</i><br>
			Firefox doesn\'t support local javascript loading by default. Because of this, the image pack will not function correctly when using these browsers. To fix this problem, follow <a href="index.php?page=options&action=firefoxinstructions">these instructions</a>.<br><br>
			
			If you enter an invalid path, everything will look ugly. To fix this, you have to enter a correct or empty path below.<br><br>
			';
        fTitle("index.php?page=options&action=changeimagepath");
        fText("Image path:", "imagepath", $acc["imagepath"]);
        echo '<tr height="5"><td></td></tr>';
        fCheckbox("get stylesheet from server (required for some browsers, leave checked if you're not sure)", "stylesheet", $acc["stylesheet"]);
        echo '<tr height="5"><td></td></tr>';
        fEnd("Change Path");
        tEnd();
    }
}
if ($action == "firefoxinstructions") {
    echo '
		Enter about:config in the url bar of firefox. A list of configuration entries should be loaded. Don\'t change anything.<br><br>
		
		Right click somewhere in the window, choose \'new\' and \'string\' (the first option). Then enter the following key in the input box: \'capability.policy.policynames\'. Press ok, and enter the following string in the next input box, as the value of the key: \'localfilelinks\'. Press ok again. It doesn\'t matter if the new key doesn\'t appear in the list.<br><br>
		
		Repeat the previous steps for these other two key and value pairs:<br>
		\'capability.policy.localfilelinks.sites\' = \'', $cq2url, '\'<br>
コード例 #29
0
ファイル: Aether.php プロジェクト: KristofMols/castlequest2
        echo '
			</table>
			<br><br>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td width="20%">
			</td>
			<td width="60%">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			';
        fText("Brimstone:", "brimstone", "0");
        fText("Crystal:", "crystal", "0");
        fText("Essence:", "essence", "0");
        fText("Granite:", "granite", "0");
        fRadio("Name setting:", "namesetting", array(array("name" => "scholar picks name", "value" => "scholar"), array("name" => "you pick name", "value" => "you")), 1);
        fText("New name:", "name");
        fEnd("Rename Nether");
    }
}
if ($action == "scholarorb" && $scholarperc >= 100) {
    echo '
		"<i>I sell magical orbs containing the spirit of a dead Nether Creature. They\'re the basic resource for a powerful spell that will improve fresh Nether eggs and will improve the quality of new Itherian items.<br>
		Use these spells together with enchanted gems to enhance your Nether creature. If you want to improve your Itherian item, you\'ll have to sacrifice some creatures as well.<br> 
		Orbs have a different color, depending on what kind of creature the trapped spirit used to be. They have different properties and some are more valuable than others. Even orbs from the same color can have serious differences in quality, so buying an orb is always a bit of a gamble.<br><br>
		';
    echo 'I have the following orbs in stock for you.</i>"<br><br>';
    $sql = "SELECT * FROM orbs WHERE cost>0 ORDER BY cost ASC, rarity_mod ASC";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        echo '
			<a href="index.php?page=travel&action=submitscholarorb&oid=', $row["id"], '">', $row["color"], ' Orb</a>: ', $row["cost"], ' kingdom resources.<br>
コード例 #30
0
<?php

if ($action == "newmessage") {
    fTitle("index.php?page=kingdom&action=submitnewmessage");
    fText("Topic:", "topic");
    fTextarea("Text:", "text");
    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);
            }