Ejemplo n.º 1
0
function include_explore_text()
{
    $objSrcUser =& $GLOBALS["objSrcUser"];
    $objSrcRace = $objSrcUser->get_race();
    $arrUnitNames = $objSrcRace->getUnitNames();
    include_once 'inc/functions/explore.php';
    $iMaxAcres = getMaxExplore($objSrcUser);
    $arrExploreCost = getExploreCosts($objSrcUser);
    //==========================================================================
    // Stop people from avoiding the tribe page so they dont get updated
    //==========================================================================
    include_once 'inc/functions/update_ranking.php';
    doUpdateRankings($objSrcUser);
    echo $topLinks = '<div class="center">' . '<a href="main.php?cat=game&amp;page=build">Construction</a> | ' . '<a href="main.php?cat=game&amp;page=army">Military Training</a> | ' . "<strong>Exploration</strong>" . '</div>';
    $advisorText = '<div id="textBig">' . '<p>' . '<img src="' . HOST_PICS . 'explorers.gif" style="float: left; margin-right: 10px;" alt="Explorers" />' . "<strong>The tribe architect</strong> greets you: <br />" . "Attacking other tribes is not the only way to settle new " . "acres and expand your tribe. Exploring is another, more friendly, " . "way to grow. However, exploring isn't free and will require crowns, " . strtolower($arrUnitNames[2]) . "s and " . strtolower($arrUnitNames[1]) . "s. " . "To lower the costs you may consider ordering additional markets to be constructed." . '</p>' . '<p>' . "Sending out a team to settle <strong>1 acre</strong> costs <strong>" . number_format($arrExploreCost['crowns']) . " crowns</strong>, <strong>" . $arrExploreCost['basics'] . " " . strtolower($arrUnitNames[2]) . "s</strong> and " . "<strong>" . $arrExploreCost['citizens'] . " " . strtolower($arrUnitNames[1]) . "s." . "</strong>" . '</p>';
    if ($objSrcRace->getRaceName() == 'Nazgul') {
        $advisorText = '<div id="textMedium">' . '<p>' . 'Your proud Nazgul army will not lower itself to explore for acres.' . '</p>';
    }
    $advisorText .= '</div>';
    echo $advisorText;
    // Classic Exception
    $strTip = 'Tip: You may be able to afford more, but you can only explore a ' . 'total of no more than 25% of your current land.';
    if ($_SERVER['SERVER_NAME'] == DINAH_SERVER_NAME && $objSrcUser->get_user_info(HOURS) < PROTECTION_HOURS) {
        $strTip = 'Tip: You may explore at most 1000 acres while in protection.';
    }
    if ($objSrcRace->getRaceName() != 'Nazgul') {
        // Advisor Link
        echo $advisorLink = '<br /><div class="tableLinkMedium">' . '<a href="main.php?cat=game&amp;page=advisors&amp;show=build">Tribe Architect</a> ' . ':: <a href="main.php?cat=game&amp;page=market">Market</a>' . '</div>';
        echo $strAdvisorText = '<div id="textMedium" style="margin-top: 0;">' . '<h3>Prepare Expedition</h3>' . '<p>' . 'Currently you can explore <strong><span class="indicator">' . number_format($iMaxAcres) . '</span> acres</strong>.' . '</p>' . '<form id="center" action="main.php?cat=game&amp;page=explore2" method="post" style="margin-top: 0pt";>' . '<label>Explore Acres: ' . '<input name="explored_acres" value="' . $iMaxAcres . '" size="5" maxlength="4" />' . '</label> ' . '<input type="submit" value="Send Expedition" />' . '</form>' . '<p>' . $strTip . '</p>' . '</div>';
    }
}
Ejemplo n.º 2
0
function include_explore2_text()
{
    global $Host;
    $objSrcUser =& $GLOBALS["objSrcUser"];
    $explored_acres = intval($_POST['explored_acres']);
    include_once 'inc/functions/explore.php';
    $iMaxAcres = getMaxExplore($objSrcUser);
    $arrExploreCost = getExploreCosts($objSrcUser);
    $money_used = $explored_acres * $arrExploreCost['crowns'];
    $used_citizens = $explored_acres * $arrExploreCost['citizens'];
    $used_basics = $explored_acres * $arrExploreCost['basics'];
    include_once 'inc/functions/races.php';
    $arrUnitVars = getUnitVariables($objSrcUser->get_stat(RACE));
    $arrUnitNames = $arrUnitVars['output'];
    $strRace = $objSrcUser->get_stat(RACE);
    if ($strRace == 'Nazgul') {
        echo $strDiv = '<div id="textMedium"><p>' . "Your proud nazgul military will not lower itself to exploring for land." . '</p></div>';
        include_game_down();
        exit;
    }
    if ($explored_acres < 1) {
        echo $strDiv = '<div id="textMedium"><p>' . "You tried to explore 0 acres." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>';
        include_game_down();
        exit;
    }
    $iCitz = $objSrcUser->get_pop(CITIZENS);
    $iNewCitz = $iCitz - $used_citizens;
    if ($iNewCitz < 800) {
        echo $strDiv = '<div id="textMedium"><p>' . "Exploring this many acres would result in less than 800 citizens " . "remaining on your lands. Your citizens refuse to venture forth." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>';
        include_game_down();
        exit;
    }
    $arrSpells = $objSrcUser->get_spells();
    if ($arrSpells[STUNTED_GROWTH] > 0) {
        echo $strDiv = '<div id="textMedium"><p>' . "Bewitched by your enemies, your exploration team do not dare " . "prospecting new lands for yet another " . $arrSpells[STUNTED_GROWTH] . " months." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>';
        include_game_down();
        exit;
    }
    $iMaxExplore = getMaxExplore($objSrcUser);
    if ($explored_acres > $iMaxExplore) {
        echo $strDiv = '<div id="textMedium"><p>' . "You tried to explore {$explored_acres} acres, however you can " . "only explore {$iMaxExplore} acres. " . "<br /><br />" . "You can send expeditions out to explore a maximum of 25% of " . "your current acres plus incoming." . '<br /><br />' . '<a href="main.php?cat=game&page=explore">' . "Try Again ?" . "</a>" . '</p></div>';
        include_game_down();
        exit;
    } else {
        if (doExplore($objSrcUser, $explored_acres)) {
            // Return HTML Output
            $plural = 's';
            if ($explored_acres == 1) {
                $plural = '';
            }
            echo $strDiv = '<div id="textMedium">' . '<h2>' . 'Explore Report' . '</h2>' . '<p>' . "Congratulations, you have explored " . "<b>" . number_format($explored_acres) . " acre{$plural}</b>." . '</p><p>' . "This expedition cost you <b>" . number_format($money_used) . " crowns</b> and required <b>" . number_format($used_citizens) . " " . strtolower($arrUnitNames[1]) . "s</b> and <b>" . number_format($used_basics) . " " . strtolower($arrUnitNames[2]) . "s</b> to send off." . '</p><p align="center">' . '<img src="' . $Host . 'explorers_medium.gif" width="375" />' . '</p><p>' . "Your new land will be ready for construction in <b>4 months</b>." . '</p><p>' . '<a href="main.php?cat=game&amp;page=explore">Continue</a>' . "</p></div>";
        } else {
            echo '<div class="center">' . "Your explore seem to have failed, please check your tribe " . "for any eventual errors caused by this, and report these " . "together with your tribe name and alliance # to an admin." . "<br />Thank you, and sorry for any inconvenience caused by " . "this.";
            echo "<br><br><a href=main.php?cat=game&amp;page=explore>Return to Exploration</a></div";
        }
    }
}
Ejemplo n.º 3
0
function doExplore(&$objUser, $iAmount)
{
    $arrExploreCost = getExploreCosts($objUser);
    $money_used = $iAmount * $arrExploreCost['crowns'];
    $used_citizens = $iAmount * $arrExploreCost['citizens'];
    $used_basics = $iAmount * $arrExploreCost['basics'];
    // Update Land
    $iOldL = $objUser->get_build(LAND_T4);
    $iNewL = max(0, $iOldL + $iAmount);
    $objUser->set_build(LAND_T4, $iNewL);
    // Update Money
    $iOldM = $objUser->get_good(MONEY);
    $iNewM = max(0, $iOldM - $money_used);
    $objUser->set_good(MONEY, $iNewM);
    // Update Citizens
    $iOldC = $objUser->get_pop(CITIZENS);
    $iNewC = max(0, $iOldC - $used_citizens);
    $objUser->set_pop(CITIZENS, $iNewC);
    // Update Basics
    $iOldB = $objUser->get_army(UNIT1);
    $iNewB = max(0, $iOldB - $used_basics);
    $objUser->set_army(UNIT1, $iNewB);
    return TRUE;
}