Esempio n. 1
0
		The further away from the central meeting point, the more expensive the spot.<br>
		';
    $coords = gFindCoords($kingdoms);
    fTitle("index.php?page=kingdom&action=submitchoosecoordinates&name={$name}&type=choosecoordinates");
    fText("X-coordinate:", "x", $coords[x], 5);
    fText("Y-coordinate:", "y", $coords[y], 5);
    fEnd("Create");
}
if ($action == "submitchoosecoordinates") {
    unset($kingdoms);
    $sql = "SELECT x, y FROM kingdoms";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        $kingdoms[$row["x"]][$row["y"]] = TRUE;
    }
    if (!($coords = gFindCoords($kingdoms, "choose", array("x" => $x, "y" => $y)))) {
        echo 'Invalid coordinates chosen! (', $x, ',', $y, ')<br>';
    } else {
        echo '
			Are you sure you want to create a kingdom at (', $coords["x"], ',', $coords["y"], ')?<br>
			This will cost you an additional ', $coords["cost"], ' brimstone, crystal, essence and granite.<br>
			<a href="index.php?page=kingdom&action=createkingdom&name=', $name, '&x=', $coords[x], '&y=', $coords[y], '">Create kingdom.</a><br>
			';
    }
}
if ($action == "submiteditmessage") {
    $no = 0;
    if ($acc["leadertype"] != 2) {
        echo 'You are not a king.<br>';
        $no = 1;
    }
Esempio n. 2
0
 if ($numrows != 0) {
     $output .= 'There is already a kingdom with that name.<br>';
     $no = 1;
 } else {
     unset($kingdoms);
     $sql = "SELECT x, y FROM kingdoms";
     $result = $db->query($sql);
     while ($row = $db->fetch_array($result)) {
         $kingdoms[$row["x"]][$row["y"]] = TRUE;
     }
     if ($coordinates != "choose") {
         if (isset($x)) {
             $coords = gFindCoords($kingdoms, "choose", array("x" => $x, "y" => $y));
             $cost += $coords["cost"];
         } else {
             $coords = gFindCoords($kingdoms);
         }
         if (!$coords) {
             $output .= 'Kingdom maximum reached!<br>';
             $no = 1;
         }
     }
 }
 if ($acc["brimstone"] < $cost || $acc["crystal"] < $cost || $acc["essence"] < $cost || $acc["granite"] < $cost) {
     $output .= 'You don\'t have enough resources to create a new kingdom.<br>';
     $no = 1;
 }
 $sql = "SELECT count(*) FROM accounts WHERE kingdom = '{$acc['kingdom']}'";
 $result = $db->query($sql);
 $inhabitants = $db->result($result, 0);
 if ($acc["leadertype"] == 2 && $inhabitants > 1) {