コード例 #1
0
ファイル: tribe.php プロジェクト: BrorHolm/Orkfia-2008
function get_tribe_table(&$objUser)
{
    global $arrStats;
    include_once 'inc/functions/military.php';
    include_once 'inc/functions/races.php';
    include_once 'inc/functions/magic.php';
    include_once 'inc/functions/population.php';
    $arrBuild = $objUser->get_builds();
    $iAcres = $arrBuild[LAND];
    $iBarren = $objUser->get_barren();
    $arrStats = $objUser->get_stats();
    $arrGoods = $objUser->get_goods();
    $arrPopulation = getPopulation($objUser);
    $arrArmys = $objUser->get_armys();
    $iMageLevel = get_mage_level($objUser);
    $userid = $objUser->get_userid();
    $iStrength = $objUser->get_strength();
    $iRulerAge = getRulerAge($objUser);
    //     $iSpells        = getActiveSpells($objUser);
    $arrUnitVars = getUnitVariables($arrStats[RACE]);
    $arrUnitNames = $arrUnitVars['output'];
    $total_defence = getArmyDefence($objUser);
    $total_defence = $total_defence['raw'];
    $suicidal_offence = getArmyOffence($objUser);
    $suicidal_offence = $suicidal_offence['raw'];
    $offencePerAcre = ceil($suicidal_offence / $iAcres);
    $defencePerAcre = ceil($total_defence / $iAcres);
    $iMilitaryUnits = $arrArmys[UNIT1] + $arrArmys[UNIT2] + $arrArmys[UNIT3] + $arrArmys[UNIT4];
    //==========================================================================
    // Stop people from avoiding the tribe page so they dont get updated
    //==========================================================================
    include_once 'inc/functions/update_ranking.php';
    doUpdateRankings($objUser, 'yes');
    $strServerTime = date("H:i:s");
    $res = "<table class=\"medium\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"5\">" . stripslashes($arrStats['tribe']) . " (#" . $arrStats['kingdom'] . ")" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th width=\"120px\">" . "Type" . "</th>" . "<td width=\"165px\">" . "Info" . "</td>" . "<td width=\"30px\">" . "&nbsp;" . "</td>" . "<th width=\"120px\">" . "Type" . "</th>" . "<td width=\"165px\">" . "Info" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Ruler Age:" . "</th>" . "<td>" . $iRulerAge . " Years" . "</td>" . "<td>" . "&nbsp;" . "</td>" . "<th>" . "Fame:" . "</th>" . "<td>" . number_format($arrStats['fame']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Race:" . "</th>" . "<td>" . $arrStats['race'] . "</td>" . "<td>" . "&nbsp;" . "</td>" . "<th>" . "Strength:" . "</th>" . "<td>" . number_format($iStrength) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . $arrUnitNames[1] . "s:" . "</th>" . "<td>" . number_format($arrPopulation['citizens']) . "</td>" . "<td>" . "&nbsp;" . "</td>" . "<th>" . "Military Units:" . "</th>" . "<td>" . number_format($iMilitaryUnits) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Mage Level:" . "</th>" . "<td>" . $iMageLevel . "</td>" . "<td>" . "&nbsp;" . "</td>";
    if ($arrStats[RACE] == 'Templar') {
        $res .= "<th>" . "Mystics:" . "</th>";
    } else {
        $res .= "<th>" . "Thieves:" . "</th>";
    }
    $res .= "<td>" . number_format($arrArmys['unit5']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Raw Offence:" . "</th>" . "<td>" . $offencePerAcre . " OPA</td>" . "<td>" . "&nbsp;" . "</td>" . "<th>" . "Raw Defence:" . "</th>" . "<td>" . $defencePerAcre . " DPA</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Barren Land:" . "</th>" . "<td>" . number_format($iBarren) . "</td>" . "<td>" . "&nbsp;" . "</td>" . "<th>" . "Land:" . "</th>" . "<td>" . number_format($iAcres) . "</td>" . "</tr>" . "</table>" . '<div class="center" style="font-size: 0.8em">' . 'Server Time: ' . $strServerTime . '</div>';
    return $res;
}
コード例 #2
0
ファイル: advisors.inc.php プロジェクト: BrorHolm/Orkfia-2008
function get_offence_table(&$objUser)
{
    include_once 'inc/functions/military.php';
    $arrArmyOffence = getArmyOffence($objUser);
    $offence = "<table class=\"small\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Offence" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th>" . "Type" . "</th>" . "<td>" . "Power" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Offence:" . "</th>" . "<td>" . number_format($arrArmyOffence['raw']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Weaponries Bonus:" . "</th>" . "<td>" . number_format($arrArmyOffence['building_bonus']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Research Bonus:" . "</th>" . "<td>" . number_format($arrArmyOffence['research_bonus']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Spell Bonuses:" . "</th>" . "<td>" . number_format($arrArmyOffence['spell_bonus']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Fame Bonus:" . "</th>" . "<td>" . number_format($arrArmyOffence['fame_bonus']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "After Mod Offence:" . "</th>" . "<td>" . number_format($arrArmyOffence['total']) . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th class=\"bsup\">" . "Offence Sent Out:" . "</th>" . "<td class=\"bsup\">" . number_format($arrArmyOffence['total_out']) . "</td>" . "</tr>" . "</table>";
    return $offence;
}
コード例 #3
0
ファイル: population.php プロジェクト: BrorHolm/Orkfia-2008
function getMilitaryUpkeep(&$objUser)
{
    $arrArmy = $objUser->get_armys();
    //     $upkeep  = ($arrArmy[UNIT1] * 0.1)
    //              + ($arrArmy[UNIT2] * 0.3)
    //              + ($arrArmy[UNIT3] * 0.3)
    //              + ($arrArmy[UNIT4] * 0.7)
    //              + ($arrArmy[UNIT5] * 0.2)
    //              + ($arrArmy[UNIT6] * 0.2);
    //     New formula:
    //     ( Raw off + Raw def ) / 30 + (number of basics, specs and elites) / 10 + thieves / 4
    include_once 'inc/functions/military.php';
    $arrArmyOffence = getArmyOffence($objUser);
    $arrArmyDefence = getArmyDefence($objUser);
    $raw_off = $arrArmyOffence['raw'];
    $raw_def = $arrArmyDefence['raw'];
    $upkeep = ($raw_off + $raw_def) / 30 + ($arrArmy[UNIT1] + $arrArmy[UNIT2] + $arrArmy[UNIT3] + $arrArmy[UNIT4]) / 10 + ($arrArmy[UNIT5] + $arrArmy[UNIT6]) / 4;
    if ($objUser->get_stat(RACE) == 'Dragon') {
        $upkeep = round($upkeep * 0.33);
    }
    return $upkeep;
}