Example #1
0
function get_construction_table(&$objUser)
{
    include_once 'inc/functions/build.php';
    $arrVars = getBuildingVariables($objUser->get_stat(RACE));
    $arrBuilds = $objUser->get_builds();
    $iBarren = $objUser->get_barren();
    $iTotal = $arrBuilds[LAND] - $iBarren;
    $strTd = '';
    for ($i = 1; $i <= 4; $i++) {
        $current = LAND . '_t' . $i;
        $strTd .= '<td';
        if ($arrBuilds[$current] > 0) {
            $strTd .= ' class="incoming"';
        }
        $strTd .= '>' . $arrBuilds[$current] . '</td>';
    }
    // Incoming Acres Table
    $strTable1 = "<table class=\"medium\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"7\">" . "Incoming Acres" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th width=\"30%\">" . "Type" . "</th>" . "<td width=\"20%\" colspan=\"2\">" . "Ready" . "</td>" . "<td>" . "In 1" . "</td>" . "<td>" . "In 2" . "</td>" . "<td>" . "In 3" . "</td>" . "<td>" . "In 4" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Barren Land:" . "</th>" . "<td>" . $iBarren . "</td>" . "<td>" . "(" . getBuildInPercent($objUser, $iBarren, 'yes') . "%)" . "</td>" . $strTd . "</tr>" . "</table><br />";
    // Under Construction Table (+ explore table)
    $strTable2 = $strTable1 . "<table class=\"medium\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"7\">" . "Under Construction" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th width=\"30%\">" . "Type" . "</th>" . "<td width=\"20%\" colspan=\"2\">" . "Constructed" . "</td>" . "<td>" . "In 1" . "</td>" . "<td>" . "In 2" . "</td>" . "<td>" . "In 3" . "</td>" . "<td>" . "In 4" . "</td>" . "</tr>";
    for ($i = 1; $i <= count($arrVars['variables']); $i++) {
        $current = $arrVars['variables'][$i];
        $strTable2 .= "<tr class=\"data\">" . "<th>" . $arrVars['output'][$i] . ":" . "</th>" . "<td>" . number_format($arrBuilds[$current]) . "</td>" . "<td>" . "(" . getBuildInPercent($objUser, $arrBuilds[$current], 'yes') . "%)" . "</td>";
        for ($j = 1; $j <= 4; $j++) {
            $current2 = $current . '_t' . $j;
            $strTable2 .= '<td';
            if ($arrBuilds[$current2] > 0) {
                $strTable2 .= ' class="incoming"';
            }
            $strTable2 .= '>' . $arrBuilds[$current2] . '</td>';
        }
        $strTable2 .= "</tr>";
    }
    $strTable2 .= "<tr class=\"data\">" . "<th class=\"bsup\">" . "Constructed Land:" . "</th>" . "<td class=\"bsup\">" . $iTotal . "</td>" . "<td class=\"bsup\">" . "(" . getBuildInPercent($objUser, $iTotal, 'yes') . "%)" . "</td>" . "<td class=\"bsup\" colspan=\"4\">" . "&nbsp;" . "</td>" . "</tr>" . "</table>";
    return $strTable2;
}
Example #2
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>
<?

}