示例#1
0
function include_build2_text()
{
    global $build_cost, $local_goods, $max_build, $building_count, $wood_cost, $building_output, $building_variables, $local_build, $barren, $output_building_percent, $building_percent, $buildings_due, $current, $sub_current1, $sub_current2, $sub_current3, $userid, $local_pop;
    include_once 'inc/functions/build.php';
    mysql_grab($userid, 'local', 'goods', 'build', 'stats', 'pop', 'army', 'user');
    build_cost();
    building_names();
    general_build();
    build_buildings();
    echo '<div class="center">' . "<br /><a href=main.php?cat=game&page=build>Return To Construction</a></div>";
}
示例#2
0
function include_raze_build2_text()
{
    global $local_goods, $local_army, $local_build, $barren, $userid, $local_pop, $collapse, $local_stats, $unit_var, $unit_names, $gold_unit, $army_due, $max_train, $raze, $connection, $build_cost, $local_goods, $max_build, $building_count, $building_output, $building_variables, $local_build, $barren, $output_building_percent, $building_percent, $buildings_due, $current, $sub_current1, $sub_current2, $sub_current3, $userid, $local_pop;
    include_once 'inc/functions/build.php';
    mysql_grab($userid, 'local', 'goods', 'build', 'stats', 'pop', 'army', 'user');
    build_cost();
    building_names();
    general_build();
    echo '<div id="textMedium">' . '<h2>' . "Demolision Report" . '</h2>';
    $yes = 'no';
    for ($i = 1; $i <= $building_count; $i++) {
        $current = $building_variables[$i];
        $collapse[$current] = floor($collapse[$current]);
        if ($collapse[$current] <= 0) {
            $collapse[$current] = 0;
        }
        if ($collapse[$current] >= "1") {
            $yes = "yes";
            if ($collapse[$current] > $local_build[$current]) {
                echo "<p>Wait... You do  not own {$collapse[$current]} acres of {$building_output[$i]}, so how can you demolish them?<br><br>";
                echo "<a href= main.php?cat=game&page=raze_build>Try Again</a></p></div>";
                include_game_down();
                exit;
            }
            echo "<p>{$collapse[$current]} {$building_output[$i]}</p>";
            $new['build'] = $local_build[$current] - $collapse[$current];
            $update['build'] = "UPDATE build SET {$current} ='{$new['build']}' WHERE id= {$userid}";
            $update['build'] = mysql_query($update['build'], $connection);
        }
    }
    if ($yes == "yes") {
        echo "<p>Have been demolished. Such a waste of crowns and logs...</p>";
    }
    if ($yes != "yes") {
        echo "<p>Sorry, what did you order demolished?</p>";
    }
    echo "<p><a href= main.php?cat=game&page=raze_build>Demolish More</a> :: ";
    echo "<a href=main.php?cat=game&page=build>Return To Construction</a></p>";
    echo "</div>";
}
示例#3
0
function include_uberdev_text()
{
    global $building_count, $building_output, $building_variables;
    if ($_SERVER['SERVER_NAME'] != DEV_SERVER_NAME) {
        echo "EVIL!!!! HOW DID YOU GET HERE?!";
        include_game_down();
        exit;
    }
    $objSrcUser =& $GLOBALS['objSrcUser'];
    $userid = $objSrcUser->get_userid();
    // if stuff is posted, do that first
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if (!array_empty($_POST['building'])) {
            var_dump($_POST['building']);
            //debug
            foreach ($_POST['building'] as $strToBuild => $strNumber) {
                if ($strNumber == '') {
                    continue;
                }
                if (get_magic_quotes_gpc()) {
                    $strToBuild = stripslashes($strToBuild);
                    $strNumber = stripslashes($strNumber);
                }
                $strToBuild = mysql_real_escape_string($strToBuild);
                $strNumber = mysql_real_escape_string($strNumber);
                //print("<br />" . "UPDATE build SET $strToBuild = $strNumber WHERE id = $userid" . "<br />"); //debug
                var_dump(mysql_query("UPDATE build SET {$strToBuild} = {$strNumber} WHERE id = {$userid}"));
                echo '<br />' . mysql_error();
            }
        }
        if (!array_empty($_POST['population'])) {
            var_dump($_POST['population']);
            //debug
            foreach ($_POST['population'] as $strToTrain => $strNumber) {
                if ($strNumber == '') {
                    continue;
                }
                if (get_magic_quotes_gpc()) {
                    $strToTrain = stripslashes($strToTrain);
                    $strNumber = stripslashes($strNumber);
                }
                $strToTrain = mysql_real_escape_string($strToTrain);
                $strNumber = mysql_real_escape_string($strNumber);
                if ($strToTrain == "citizen") {
                    $objSrcUser->set_pop(CITIZENS, $strNumber);
                    print "<br />true";
                } else {
                    //print("<br />" . "UPDATE army SET $strToTrain = $strNumber WHERE id = $userid" . "<br />"); //debug
                    var_dump(mysql_query("UPDATE army SET {$strToTrain} = {$strNumber} WHERE id = {$userid}"));
                    echo '<br />' . mysql_error();
                }
            }
        }
        if (!empty($_POST['SQL'])) {
            $strSQL = $_POST['SQL'];
            if (get_magic_quotes_gpc()) {
                $strSQL = stripslashes($strSQL);
            }
            var_dump($strSQL);
            //debug
            $res = mysql_query($strSQL);
            if (!$res) {
                echo '<br />' . mysql_error();
            } elseif ($res === true) {
                echo '<br />Success! ' . mysql_affected_rows() . ' rows updated.';
            } else {
                $rows = mysql_num_rows($res);
                echo "{$rows} rows returned<br />";
                if ($rows) {
                    echo "<table class='medium'><tr class='subheader'>";
                    $line = mysql_fetch_assoc($res);
                    foreach (array_keys($line) as $label) {
                        echo "<th>{$label}</th>";
                    }
                    echo "</tr>";
                    do {
                        echo "<tr class='data'>";
                        foreach ($line as $item) {
                            echo '<td>' . $item . '</td>';
                        }
                        echo '</tr>';
                    } while ($line = mysql_fetch_assoc($res));
                    echo '</table>';
                }
            }
        }
    }
    //now for the actual form
    ?>
<form action="<? echo $_SERVER['REQUEST_URI']; ?>" method="post">
    <table class="medium">
        <tr class="header">
            <th>Data</th>
            <th class="right">Value</th>
        </tr>
<?php 
    $objUser =& $GLOBALS["objSrcUser"];
    $arrSrcStats = $objUser->get_stats();
    $level = $arrSrcStats['level'];
    if ($level >= 5) {
        ?>
        <tr class="subheader">
            <th>raw SQL</th>
        </tr>
        <tr class="data">
            <th>SQL</th>
            <td><input type="text" name="SQL" size="50" /></td>
        </tr>
<?php 
    }
    ?>
        <tr class="subheader">
            <th>Buildings</th>
        </tr>
        <tr class="data">
            <th>Total acres</th>
            <td><input type="text" name="building[land]" /></td>
        </tr>

<?php 
    include_once "inc/functions/build.php";
    $arrBuild = $objSrcUser->get_builds();
    $arrStat = $objSrcUser->get_stats();
    //mysql_grab($userid, 'local', 'goods', 'build', 'pop');
    build_cost();
    building_names();
    //general_build();
    for ($i = 1; $i <= $building_count; $i++) {
        echo "<tr class=\"data\">" . "<th>{$building_output[$i]}</th>" . "<td><input type=\"text\" name=\"building[{$building_variables[$i]}]\" /></td>" . "</tr>";
    }
    ?>
        <tr class="subheader">
            <th>Population</th>
        </tr>
<?php 
    $objRace = clsRace::getRace($objSrcUser->get_stat(RACE));
    $arrUnitVar = $objRace->getUnitVariables();
    $arrUnitNames = $objRace->getUnitNames();
    for ($i = 1; $i < 7; $i++) {
        echo "<tr class=\"data\">" . "<th>{$arrUnitNames[$i]}</th>" . "<td><input type=\"text\" name=\"population[{$arrUnitVar[$i]}]\" /></td>" . "</tr>";
    }
    ?>
    </table>
    <input type="submit" value="do crazy stuff" />
</form>
<?php 
}
示例#4
0
function include_raze_build_text()
{
    global  $Host, $build_cost, $local_goods, $max_build, $building_count,
            $building_output, $building_variables, $local_build, $barren,
            $output_building_percent, $building_percent, $buildings_due,
            $current, $sub_current1, $sub_current2, $sub_current3, $userid,
            $local_pop;

    include_once('inc/functions/build.php');
    mysql_grab($userid, 'local', 'goods', 'build', 'pop');
    build_cost();
    building_names();
    general_build();

    $advisorLinks =
        '<div class="tableLinkBig">' .
            '<a href="main.php?cat=game&amp;page=advisors&amp;show=build">Tribe Architect</a>' .
            ' :: ' .
            '<a href="main.php?cat=game&amp;page=build">Construction</a>' .
        '</div>';
    echo $advisorLinks;

    ECHO "<form action=\"main.php?cat=game&amp;page=raze_build2\" method=\"post\">";
    ECHO "<table class=\"big\" cellpadding=0 cellspacing=0>";
        ECHO "<tr class=\"header\"><th colspan=\"9\">";
        ECHO "Demolish Buildings";
        ECHO "</th></tr>";

        ECHO "<tr class=\"subheader\">";
            ECHO "<th>Type</th>";
            ECHO "<th class=\"right\">Owned</th>";
            ECHO "<th class=\"right\">Collapse</th>";
            ECHO "<th>&nbsp;</th>";
            ECHO "<th>Type</th>";
            ECHO "<th class=\"right\">Owned</th>";
            ECHO "<th class=\"right\">Collapse</th>";
        ECHO "</tr>";

    for ($i = 1; $i <= $building_count; $i++)
    {
        $current = $building_variables[$i];
        $i2 = $i + 1;
        $current2 = $building_variables[$i2];

        ECHO "<tr class=\"data\">";
            ECHO "<th width=\"20%\">$building_output[$i]</th>";
            ECHO "<td width=\"12%\" class=\"right\">";
            IF ($buildings_due[$building_variables[$i]] > 0) {
                ECHO "<span style=\"font-size: 0.8em;\">(".$buildings_due[$building_variables[$i]].")</span> ";
            }
            ECHO "<b>$local_build[$current]</b></td>";
            ECHO "<td width=\"13%\" class=\"right\"><input size=5 name=\"collapse[$current]\"></td>";
            ECHO "<td>&nbsp;</td>";
            ECHO "<th width=\"20%\">$building_output[$i2]</th>";
            ECHO "<td width=\"12%\" class=\"right\">";
            IF ($buildings_due[$building_variables[$i2]] > 0) {
                ECHO "<span style=\"font-size: 0.8em;\">(".$buildings_due[$building_variables[$i2]].")</span> ";
            }
            ECHO "<b>$local_build[$current2]</b></td>";
            ECHO "<td width=\"13%\" class=\"right\"><input size=5 name=\"collapse[$current2]\"></td>";
        ECHO "</tr>";
        $i = $i +1;
    }
    ECHO "</table>";
    ECHO '<div class="center" style="font-size: 0.8em;">' . "Total <strong>$local_build[land]</strong> acres.</div>";
    ECHO '<div class="center">' . '<input type="submit" value="Demolish Buildings"></div>';

    ECHO "</form>";
}
示例#5
0
function include_build_text()
{
    global  $Host, $build_cost, $local_goods, $max_build,
            $local_build,
            $wood_cost, $output_building_percent, $building_percent,
            $buildings_due, $current, $sub_current1, $sub_current2,
            $sub_current3, $userid, $local_pop;

    $objSrcUser = &$GLOBALS["objSrcUser"];

    include_once('inc/functions/build.php');
//     mysql_grab($userid, 'local', 'goods', 'build', 'pop'); 1 1 down...
    $local_goods = $objSrcUser->get_goods();
    $local_build = $objSrcUser->get_builds();
    $local_pop = $objSrcUser->get_pops();
    build_cost();
    building_names();
    general_build();

    // New object oriented code

    $arrBuildingVariables = getBuildingVariables($objSrcUser->get_stat(RACE));

    $arrBuildVar     = $arrBuildingVariables['variables'];
    $arrBuildOutput  = $arrBuildingVariables['output'];
    $arrBuildTooltip = $arrBuildingVariables['tooltips'];
    $iBuildings      = count($arrBuildVar);
    $iBarren         = $objSrcUser->get_barren();

    //==========================================================================
    // Stop people from avoiding the tribe page so they dont get updated
    //==========================================================================
    include_once('inc/functions/update_ranking.php');
    doUpdateRankings($objSrcUser);

    $arrSrcStats = $objSrcUser->get_stats();
    $arrBuild = $objSrcUser->get_builds();

    echo $topLinks =
        '<div class="center">' .
            '<b>Construction</b> | ' .
            '<a href="main.php?cat=game&amp;page=army">Military Training</a> | ' .
            '<a href="main.php?cat=game&amp;page=explore">Exploration</a>' .
        '</div>';

    $advisorText =
        '<div id="textBig">' .
        '<p>' .
            "<b>Your tribe architect</b> greets you: <br />" .
            "To let your civilization grow and prosper, you must build your land. " .
            "How you build your land is completely up to you, " .
            "but some buildings are necessary for your people to survive." .
        "</p>" .
        "<p>" .
            "It will cost you <b>" . number_format($build_cost) . " crowns</b>" .
            " and <b>" . number_format($wood_cost) . " logs</b> to build on " .
            "<b>1 barren acre</b>." .
        '</p>' .
        '<p align="center">' .
            "You have <b><span class=\"indicator\">$iBarren</span> barren " .
            "acre(s)</b> and you can afford to " .
            "build on <b class=\"indicator\">$max_build</b>" .
            " of them." .
        "</p>" .
        "</div>";
    echo $advisorText;

    $advisorLinks =
        '<br />' .
        '<div class="tableLinkBig">' .
            '<a href="main.php?cat=game&amp;page=advisors&amp;show=build">Tribe Architect</a>' .
            ' :: ' .
            '<a href="main.php?cat=game&amp;page=raze_build">Demolish Buildings</a>' .
        '</div>';
    echo $advisorLinks;

    $buildTable =
        '<form id="center" action="main.php?cat=game&amp;page=build2" method="post" style="margin-top: 0pt;">' .
        '<table class="big" cellpadding="0" cellspacing="0">' .
            '<tr class="header">' .
                '<th colspan="9">' .'Order Construction' . '</th>' .
            '</tr>' .
            '<tr class="subheader">' .
                '<th>' . 'Type' . '</th>' .
                '<th class="right">' . 'Owned' . '</th>' .
                '<th class="right">' . '%' . '</th>' .
                '<th class="right">' . 'Build' . '</th>' .
                '<th class="right">' . '&nbsp;' . '</th>' .
                '<th>' . 'Type' . '</th>' .
                '<th class="right">' . 'Owned' . '</th>' .
                '<th class="right">' . '%' . '</th>' .
                '<th class="right">' . 'Build' . '</th>' .
            '</tr>';

    for ($i = 1; $i <= $iBuildings; $i++)
    {
        $current = $arrBuildVar[$i];
        $i2 = $i + 1;
        $current2 = $arrBuildVar[$i2];

        $buildTable .=
            '<tr class="data">' .
                '<th width="20%"><label for="' . $i . '" title="' . $arrBuildTooltip[$i] . '">' . $arrBuildOutput[$i] . '</label></th>' .
                '<td width="12%">';

        if ($buildings_due[$arrBuildVar[$i]] > 0)
        {
            $buildTable .=
                '<span style="font-size: 0.8em;">(' .
                $buildings_due[$arrBuildVar[$i]] .
                ')</span>';
        }

        $buildTable .=
                ' <strong>' . $local_build[$current] . '</strong></td>' .
                '<td width="7%">' .
                getBuildInPercent($objSrcUser, $local_build[$current], 'yes') .
                "</td>" .
                "<td width=\"7%\"><input id=\"$i\" size=\"3\" maxlength=\"4\" name=\"built[$current]\" /></td>" .
                "<td>&nbsp;</td>" .
                '<th width=\"20%\"><label for="' . $i2 . '" title="' . $arrBuildTooltip[$i2] . '">' . $arrBuildOutput[$i2] . '</label></th>' .
                "<td width=\"12%\" class=\"right\">";

        if ($buildings_due[$arrBuildVar[$i2]] > 0)
        {
            $buildTable .=
                '<span style="font-size: 0.8em;">(' .
                $buildings_due[$arrBuildVar[$i2]] . ")</span>";
        }

        $buildTable .=
                "<strong> $local_build[$current2]</strong>" . "</td>" .
                "<td width=\"7%\" class=\"right\">" .
                getBuildInPercent($objSrcUser, $local_build[$current2], 'yes') .
                "</td>" .
                "<td width=\"7%\" class=\"right\">" .
                "<input id=\"$i2\" size=\"3\" maxlength=\"4\" name=\"built[$current2]\" />" . "</td>" .
            "</tr>";
        $i++;
    }

    $buildTable .=
        "</table>";
    echo $buildTable;

?>
        <span style="font-size: 0.8em;">Total <b><?=$local_build[LAND]; ?></b> acres.</span>
        <br /><br />
        <input type="submit" value="Order Construction" />
    </form>
<?

}