本文整理汇总了PHP中ResourceUpdate::CalcResource方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceUpdate::CalcResource方法的具体用法?PHP ResourceUpdate::CalcResource怎么用?PHP ResourceUpdate::CalcResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceUpdate
的用法示例。
在下文中一共展示了ResourceUpdate::CalcResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
protected function __construct()
{
if (!AJAX_REQUEST) {
$this->setWindow('full');
if (!$this->disableEcoSystem) {
$this->ecoObj = new ResourceUpdate();
$this->ecoObj->CalcResource();
}
$this->initTemplate();
} else {
$this->setWindow('ajax');
}
}
示例2: show
function show()
{
global $LNG, $USER, $PLANET, $resource, $reslist;
if ($USER['planet_sort'] == 0) {
$Order = "id ";
} elseif ($USER['planet_sort'] == 1) {
$Order = "galaxy, system, planet, planet_type ";
} elseif ($USER['planet_sort'] == 2) {
$Order = "name ";
}
$Order .= $USER['planet_sort_order'] == 1 ? "DESC" : "ASC";
$PlanetsRAW = $GLOBALS['DATABASE']->query("SELECT * FROM " . PLANETS . " WHERE id_owner = '" . $USER['id'] . "' AND destruyed = '0' AND planet_type != '4' ORDER BY " . $Order . ";");
$elementALL = array(212, 202, 203, 204, 205, 229, 209, 206, 207, 217, 215, 213, 211, 219, 225, 226, 214, 216, 230, 227, 228, 222, 218, 221, 208, 210, 220, 223);
$elementALLBis = array(401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 416, 417, 418, 419, 420, 421, 422, 502, 503);
$elementAllTris = array(1, 2, 3, 4, 5, 6, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 41, 42, 43, 44, 48);
foreach ($elementAllTris as $Element) {
$elementListallTris[$Element] = array('id' => $Element);
}
foreach ($elementALL as $Element) {
$elementListall[$Element] = array('id' => $Element);
}
foreach ($elementALLBis as $Element) {
$elementListallBis[$Element] = array('id' => $Element);
}
$planetList = array();
$PlanetRess = new ResourceUpdate();
while ($PLANETA = $GLOBALS['DATABASE']->fetch_array($PlanetsRAW)) {
list($USER, $PLANETA) = $PlanetRess->CalcResource($USER, $PLANETA, true);
$planetList[] = array('id' => $PLANETA['id'], 'name' => $PLANETA['name'], 'image' => $PLANETA['image'], 'galaxy' => $PLANETA['galaxy'], 'system' => $PLANETA['system'], 'planet' => $PLANETA['planet'], 'type' => $PLANETA['planet_type'], 'metal_percent' => round($PLANETA['metal'] * 100 / $PLANETA['metal_max']), 'cystal_percent' => round($PLANETA['crystal'] * 100 / $PLANETA['crystal_max']), 'deut_percent' => round($PLANETA['deuterium'] * 100 / $PLANETA['deuterium_max']), 'metal_mine' => $PLANETA['metal_mine'], 'crystal_mine' => $PLANETA['crystal_mine'], 'deuterium_sintetizer' => $PLANETA['deuterium_sintetizer'], 'solar_plant' => $PLANETA['solar_plant'], 'searcher' => $PLANETA['searcher'], 'fusion_plant' => $PLANETA['fusion_plant'], 'robot_factory' => $PLANETA['robot_factory'], 'nano_factory' => $PLANETA['nano_factory'], 'hangar' => $PLANETA['hangar'], 'metal_store' => $PLANETA['metal_store'], 'crystal_store' => $PLANETA['crystal_store'], 'deuterium_store' => $PLANETA['deuterium_store'], 'laboratory' => $PLANETA['laboratory'], 'terraformer' => $PLANETA['terraformer'], 'university' => $PLANETA['university'], 'ally_deposit' => $PLANETA['ally_deposit'], 'silo' => $PLANETA['silo'], 'mondbasis' => $PLANETA['mondbasis'], 'phalanx' => $PLANETA['phalanx'], 'sprungtor' => $PLANETA['sprungtor'], 'collider' => $PLANETA['collider'], 'solar_satelit' => pretty_number($PLANETA['solar_satelit']), 'small_ship_cargo' => pretty_number($PLANETA['small_ship_cargo']), 'big_ship_cargo' => pretty_number($PLANETA['big_ship_cargo']), 'light_hunter' => pretty_number($PLANETA['light_hunter']), 'heavy_hunter' => pretty_number($PLANETA['heavy_hunter']), 'M7' => pretty_number($PLANETA['M7']), 'recycler' => pretty_number($PLANETA['recycler']), 'crusher' => pretty_number($PLANETA['crusher']), 'battle_ship' => pretty_number($PLANETA['battle_ship']), 'ev_transporter' => pretty_number($PLANETA['ev_transporter']), 'battleship' => pretty_number($PLANETA['battleship']), 'destructor' => pretty_number($PLANETA['destructor']), 'bomber_ship' => pretty_number($PLANETA['bomber_ship']), 'М19' => pretty_number($PLANETA['М19']), 'giga_recykler' => pretty_number($PLANETA['giga_recykler']), 'galleon' => pretty_number($PLANETA['galleon']), 'destroyer' => pretty_number($PLANETA['destroyer']), 'dearth_star' => pretty_number($PLANETA['dearth_star']), 'lune_noir' => pretty_number($PLANETA['lune_noir']), 'M32' => pretty_number($PLANETA['M32']), 'frigate' => pretty_number($PLANETA['frigate']), 'black_wanderer' => pretty_number($PLANETA['black_wanderer']), 'flying_death' => pretty_number($PLANETA['flying_death']), 'star_crasher' => pretty_number($PLANETA['star_crasher']), 'bs_class_oneil' => pretty_number($PLANETA['bs_class_oneil']), 'colonizer' => pretty_number($PLANETA['colonizer']), 'spy_sonde' => pretty_number($PLANETA['spy_sonde']), 'dm_ship' => pretty_number($PLANETA['dm_ship']), 'Scrappy' => pretty_number($PLANETA['Scrappy']), 'misil_launcher' => pretty_number($PLANETA['misil_launcher']), 'small_laser' => pretty_number($PLANETA['small_laser']), 'big_laser' => pretty_number($PLANETA['big_laser']), 'gauss_canyon' => pretty_number($PLANETA['gauss_canyon']), 'ionic_canyon' => pretty_number($PLANETA['ionic_canyon']), 'buster_canyon' => pretty_number($PLANETA['buster_canyon']), 'small_protection_shield' => pretty_number($PLANETA['small_protection_shield']), 'big_protection_shield' => pretty_number($PLANETA['big_protection_shield']), 'planet_protector' => pretty_number($PLANETA['planet_protector']), 'graviton_canyon' => pretty_number($PLANETA['graviton_canyon']), 'orbital_station' => pretty_number($PLANETA['orbital_station']), 'lepton_gun' => pretty_number($PLANETA['lepton_gun']), 'proton_gun' => pretty_number($PLANETA['proton_gun']), 'canyon' => pretty_number($PLANETA['canyon']), 'hydrogen_gun' => pretty_number($PLANETA['hydrogen_gun']), 'dora_gun' => pretty_number($PLANETA['dora_gun']), 'photon_cannon' => pretty_number($PLANETA['photon_cannon']), 'particle_emitter' => pretty_number($PLANETA['particle_emitter']), 'slim_mehador' => pretty_number($PLANETA['slim_mehador']), 'iron_mehador' => pretty_number($PLANETA['iron_mehador']), 'grand_mehador' => pretty_number($PLANETA['grand_mehador']), 'interceptor_misil' => pretty_number($PLANETA['interceptor_misil']), 'interplanetary_misil' => pretty_number($PLANETA['interplanetary_misil']), 'current' => $PLANETA['field_current'], 'max' => CalculateMaxPlanetFields($PLANETA), 'energy_used' => $PLANETA['energy'] + $PLANETA['energy_used'], 'resource901' => pretty_number($PLANETA['metal']), 'resource902' => pretty_number($PLANETA['crystal']), 'resource903' => pretty_number($PLANETA['deuterium']), 'resource911' => pretty_number($PLANETA['energy']));
}
$this->tplObj->loadscript("empire.js");
$this->tplObj->assign_vars(array('planetList' => $planetList, 'elementListall' => $elementListall, 'elementListallBis' => $elementListallBis, 'elementListallTris' => $elementListallTris));
$this->display('page.empire.default.tpl');
}
示例3: __construct
public function __construct()
{
global $CONF, $dpath, $LNG, $db, $USER, $PLANET;
$mode = request_var('mode', '');
$msg = request_var('msg', '', true);
$ctype = request_var('chat_type', '');
$MessageID = request_var('id', 0);
switch ($mode) {
case "delete":
$this->DelMeassageFromChat($MessageID);
break;
case "send":
$this->SetMeassageInChat($ctype, $msg);
break;
case "call":
$this->GetMessages($ctype);
break;
default:
$template = new template();
$template->execscript("showMessage();setInterval(showMessage, 10000);");
$template->loadscript("chat.js");
if (empty($ctype)) {
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
} else {
$template->isPopup(true);
}
$template->assign_vars(array('ctype' => $ctype, 'chat_send' => $LNG['chat_send'], 'chat_disc' => $LNG['chat_disc'], 'chat_message' => $LNG['chat_message'], 'chat_bbcode' => $LNG['chat_bbcode'], 'chat_fontcolor' => $LNG['chat_fontcolor'], 'chat_color_white' => $LNG['chat_color_white'], 'chat_color_blue' => $LNG['chat_color_blue'], 'chat_color_yellow' => $LNG['chat_color_yellow'], 'chat_color_green' => $LNG['chat_color_green'], 'chat_color_pink' => $LNG['chat_color_pink'], 'chat_color_red' => $LNG['chat_color_red'], 'chat_color_orange' => $LNG['chat_color_orange'], 'chat_notext' => $LNG['chat_notext'], 'chat_request_url' => $LNG['chat_request_url'], 'chat_request_url_desc' => $LNG['chat_request_url_desc']));
$template->show("chat_overview.tpl");
break;
}
}
示例4: ShowFleetTraderPage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (Fork/2Moons)
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.3 (2011-01-21)
* @link http://code.google.com/p/2moons/
* Please do not remove the credits
*/
function ShowFleetTraderPage()
{
global $USER, $PLANET, $LNG, $CONF, $pricelist, $resource;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$CONF['trade_allowed_ships'] = explode(',', $CONF['trade_allowed_ships']);
$ID = request_var('id', 0);
if (!empty($ID) && in_array($ID, $CONF['trade_allowed_ships'])) {
$Count = max(min(request_var('count', '0'), $PLANET[$resource[$ID]]), 0);
$PLANET['metal'] = bcadd($PLANET['metal'], bcmul($Count, bcmul($pricelist[$ID]['metal'], (double) (1 - $CONF['trade_charge']))));
$PLANET['crystal'] = bcadd($PLANET['crystal'], bcmul($Count, bcmul($pricelist[$ID]['crystal'], (double) (1 - $CONF['trade_charge']))));
$PLANET['deuterium'] = bcadd($PLANET['deuterium'], bcmul($Count, bcmul($pricelist[$ID]['deuterium'], (double) (1 - $CONF['trade_charge']))));
$PLANET['norio'] = bcadd($PLANET['norio'], bcmul($Count, bcmul($pricelist[$ID]['norio'], (double) (1 - $CONF['trade_charge']))));
$USER['darkmatter'] = bcadd($USER['darkmatter'], bcmul($Count, bcmul($pricelist[$ID]['darkmatter'], (double) (1 - $CONF['trade_charge']))));
$PlanetRess->Builded[$ID] = bcadd(bcmul('-1', $Count), $PlanetRess->Builded[$ID]);
}
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript('fleettrader.js');
$template->execscript('updateVars();');
$Cost = array();
foreach ($CONF['trade_allowed_ships'] as $ID) {
$Cost[$ID] = array($PLANET[$resource[$ID]], $pricelist[$ID]['metal'], $pricelist[$ID]['crystal'], $pricelist[$ID]['deuterium'], $pricelist[$ID]['darkmatter'], $pricelist[$ID]['norio']);
}
$template->assign_vars(array('tech' => $LNG['tech'], 'ft_head' => $LNG['ft_head'], 'ft_count' => $LNG['ft_count'], 'ft_max' => $LNG['ft_max'], 'ft_total' => $LNG['ft_total'], 'ft_charge' => $LNG['ft_charge'], 'ft_absenden' => $LNG['ft_absenden'], 'trade_allowed_ships' => $CONF['trade_allowed_ships'], 'CostInfos' => json_encode($Cost), 'Charge' => $CONF['trade_charge']));
$template->show("fleettrader_overview.tpl");
}
示例5: ShowRecordsPage
function ShowRecordsPage()
{
global $USER, $PLANET, $LNG, $resource, $db, $CONF, $UNI;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$Records = new records();
$RecordsArray = $Records->GetRecords($UNI);
foreach ($RecordsArray as $ElementID => $ElementIDArray) {
if ($ElementID >= 1 && $ElementID <= 39 || $ElementID == 44) {
$Builds[$LNG['tech'][$ElementID]] = array('winner' => $ElementIDArray['maxlvl'] != 0 ? $ElementIDArray['username'] : $LNG['rec_rien'], 'count' => $ElementIDArray['maxlvl'] != 0 ? pretty_number($ElementIDArray['maxlvl']) : $LNG['rec_rien']);
} elseif ($ElementID >= 41 && $ElementID <= 99 && $ElementID != 44) {
$MoonsBuilds[$LNG['tech'][$ElementID]] = array('winner' => $ElementIDArray['maxlvl'] != 0 ? $ElementIDArray['username'] : $LNG['rec_rien'], 'count' => $ElementIDArray['maxlvl'] != 0 ? pretty_number($ElementIDArray['maxlvl']) : $LNG['rec_rien']);
} elseif ($ElementID >= 101 && $ElementID <= 199) {
$Techno[$LNG['tech'][$ElementID]] = array('winner' => $ElementIDArray['maxlvl'] != 0 ? $ElementIDArray['username'] : $LNG['rec_rien'], 'count' => $ElementIDArray['maxlvl'] != 0 ? pretty_number($ElementIDArray['maxlvl']) : $LNG['rec_rien']);
} elseif ($ElementID >= 201 && $ElementID <= 399) {
$Fleet[$LNG['tech'][$ElementID]] = array('winner' => $ElementIDArray['maxlvl'] != 0 ? $ElementIDArray['username'] : $LNG['rec_rien'], 'count' => $ElementIDArray['maxlvl'] != 0 ? pretty_number($ElementIDArray['maxlvl']) : $LNG['rec_rien']);
} elseif ($ElementID >= 401 && $ElementID <= 599) {
$Defense[$LNG['tech'][$ElementID]] = array('winner' => $ElementIDArray['maxlvl'] != 0 ? $ElementIDArray['username'] : $LNG['rec_rien'], 'count' => $ElementIDArray['maxlvl'] != 0 ? pretty_number($ElementIDArray['maxlvl']) : $LNG['rec_rien']);
}
}
$Records = array($LNG['rec_build'] => $Builds, $LNG['rec_specb'] => $MoonsBuilds, $LNG['rec_techn'] => $Techno, $LNG['rec_fleet'] => $Fleet, $LNG['rec_defes'] => $Defense);
$template->assign_vars(array('Records' => $Records, 'update' => sprintf($LNG['rec_last_update_on'], date(TDFORMAT, $CONF['stat_last_update'])), 'level' => $LNG['rec_level'], 'player' => $LNG['rec_playe']));
$template->show("records_overview.tpl");
}
示例6: ShowTechTreePage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (Fork/2Moons)
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.3 (2011-01-21)
* @link http://code.google.com/p/2moons/
* Please do not remove the credits
*/
function ShowTechTreePage()
{
global $resource, $requeriments, $LNG, $reslist, $USER, $PLANET;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$RequeriList = array();
foreach ($LNG['tech'] as $Element => $ElementName) {
if (in_array($Element, $reslist['dmfunc'])) {
continue;
}
if (!isset($resource[$Element])) {
$TechTreeList[] = $ElementName;
} else {
$RequeriList = array();
if (isset($requeriments[$Element])) {
foreach ($requeriments[$Element] as $RegID => $RedCount) {
$RequeriList[$Element][] = array('id' => $RegID, 'count' => $RedCount, 'own' => isset($PLANET[$resource[$RegID]]) ? $PLANET[$resource[$RegID]] : $USER[$resource[$RegID]]);
}
}
$TechTreeList[] = array('id' => $Element, 'name' => $ElementName, 'need' => $RequeriList);
}
}
$template->assign_vars(array('TechTreeList' => $TechTreeList, 'tt_requirements' => $LNG['tt_requirements'], 'LNG' => $LNG['tech'], 'tt_lvl' => $LNG['tt_lvl']));
$template->show("techtree_overview.tpl");
}
示例7: ShowTopKB
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (Fork/2Moons)
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.3 (2011-01-21)
* @link http://code.google.com/p/2moons/
* Please do not remove the credits
*/
function ShowTopKB()
{
global $USER, $PLANET, $LNG, $UNI, $db, $LANG;
$mode = request_var('mode', '');
$template = new template();
switch ($mode) {
case "showkb":
$template->isPopup(true);
$LANG->includeLang(array('FLEET'));
$ReportID = request_var('rid', '');
if (file_exists(ROOT_PATH . 'raports/topkb_' . $ReportID . '.php')) {
require_once ROOT_PATH . 'raports/topkb_' . $ReportID . '.php';
$RaportRAW = $db->uniquequery("SELECT `angreifer`, `defender` FROM " . TOPKB . " WHERE `rid` = '" . $db->sql_escape($ReportID) . "';");
}
foreach ($LNG['tech_rc'] as $id => $s_name) {
$ship[] = "[ship[" . $id . "]]";
$shipname[] = $s_name;
}
$template->assign_vars(array('attacker' => $RaportRAW['angreifer'], 'defender' => $RaportRAW['defender'], 'report' => $raport));
$template->show("topkb_report.tpl");
break;
default:
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$top = $db->query("SELECT * FROM " . TOPKB . " WHERE `universe` = '" . $UNI . "' ORDER BY gesamtunits DESC LIMIT 100;");
while ($data = $db->fetch_array($top)) {
$TopKBList[] = array('result' => $data['fleetresult'], 'time' => date(TDFORMAT, $data['time']), 'units' => pretty_number($data['gesamtunits']), 'rid' => $data['rid'], 'attacker' => $data['angreifer'], 'defender' => $data['defender'], 'result' => $data['fleetresult']);
}
$db->free_result($top);
$template->assign_vars(array('tkb_units' => $LNG['tkb_units'], 'tkb_datum' => $LNG['tkb_datum'], 'tkb_owners' => $LNG['tkb_owners'], 'tkb_platz' => $LNG['tkb_platz'], 'tkb_top' => $LNG['tkb_top'], 'tkb_gratz' => $LNG['tkb_gratz'], 'tkb_legende' => $LNG['tkb_legende'], 'tkb_gewinner' => $LNG['tkb_gewinner'], 'tkb_verlierer' => $LNG['tkb_verlierer'], 'TopKBList' => $TopKBList));
$template->show("topkb_overview.tpl");
break;
}
}
示例8: ShowCreditsPage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
*
* Please do not remove the credits
*/
function ShowCreditsPage()
{
global $USER, $PLANET, $LNG, $LANG;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->show("creditos_overview.tpl");
}
示例9: show
function show()
{
global $USER, $PLANET, $LNG, $LANG, $CONF, $UNI;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDb();
$this->tplObj->assign_vars(array());
$this->display('page.planetjump.default.tpl');
}
示例10: show
function show()
{
global $USER, $PLANET, $resource, $reslist;
$db = Database::get();
switch ($USER['planet_sort']) {
case 2:
$orderBy = 'name';
break;
case 1:
$orderBy = 'galaxy, system, planet, planet_type';
break;
default:
$orderBy = 'id';
break;
}
$orderBy .= ' ' . ($USER['planet_sort_order'] == 1) ? 'DESC' : 'ASC';
$sql = "SELECT * FROM %%PLANETS%% WHERE id != :planetID AND id_owner = :userID AND destruyed = '0' ORDER BY :order;";
$PlanetsRAW = $db->select($sql, array(':planetID' => $PLANET['id'], ':userID' => $USER['id'], ':order' => $orderBy));
$PLANETS = array($PLANET);
$PlanetRess = new ResourceUpdate();
foreach ($PlanetsRAW as $CPLANET) {
list($USER, $CPLANET) = $PlanetRess->CalcResource($USER, $CPLANET, true);
$PLANETS[] = $CPLANET;
unset($CPLANET);
}
$planetList = array();
foreach ($PLANETS as $Planet) {
$planetList['name'][$Planet['id']] = $Planet['name'];
$planetList['image'][$Planet['id']] = $Planet['image'];
$planetList['coords'][$Planet['id']]['galaxy'] = $Planet['galaxy'];
$planetList['coords'][$Planet['id']]['system'] = $Planet['system'];
$planetList['coords'][$Planet['id']]['planet'] = $Planet['planet'];
$planetList['field'][$Planet['id']]['current'] = $Planet['field_current'];
$planetList['field'][$Planet['id']]['max'] = CalculateMaxPlanetFields($Planet);
$planetList['energy_used'][$Planet['id']] = $Planet['energy'] + $Planet['energy_used'];
$planetList['resource'][901][$Planet['id']] = $Planet['metal'];
$planetList['resource'][902][$Planet['id']] = $Planet['crystal'];
$planetList['resource'][903][$Planet['id']] = $Planet['deuterium'];
$planetList['resource'][911][$Planet['id']] = $Planet['energy'];
foreach ($reslist['build'] as $elementID) {
$planetList['build'][$elementID][$Planet['id']] = $Planet[$resource[$elementID]];
}
foreach ($reslist['fleet'] as $elementID) {
$planetList['fleet'][$elementID][$Planet['id']] = $Planet[$resource[$elementID]];
}
foreach ($reslist['defense'] as $elementID) {
$planetList['defense'][$elementID][$Planet['id']] = $Planet[$resource[$elementID]];
}
}
foreach ($reslist['tech'] as $elementID) {
$planetList['tech'][$elementID] = $USER[$resource[$elementID]];
}
$this->assign(array('colspan' => count($PLANETS) + 2, 'planetList' => $planetList));
$this->display('page.empire.default.tpl');
}
示例11: ShowChangelogPage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (Fork/2Moons)
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.3 (2011-01-21)
* @link http://code.google.com/p/2moons/
* Please do not remove the credits
*/
function ShowChangelogPage()
{
global $USER, $PLANET, $LNG, $LANG;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$LANG->includeLang(array('CHANGELOG'));
$template->assign_vars(array('ChangelogList' => array_map('makebr', $LNG['changelog']), 'Version' => $LNG['Version'], 'Description' => $LNG['Description']));
$template->show("changelog_overview.tpl");
}
示例12: ShowFAQPage
/**
* 2Moons
* Copyright (C) 2011 Slaver
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (Fork/2Moons)
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.3 (2011-01-21)
* @link http://code.google.com/p/2moons/
*/
function ShowFAQPage()
{
global $USER, $PLANET, $LNG, $LANG;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$LANG->includeLang(array('FAQ'));
$template->assign_vars(array('FAQList' => $LNG['faq'], 'faq_overview' => $LNG['faq_overview']));
$template->show("faq_overview.tpl");
}
示例13: ShowSearchPage
function ShowSearchPage()
{
global $USER, $PLANET, $dpath, $LNG, $db;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$type = request_var('type', '');
$searchtext = request_var('searchtext', '');
switch ($type) {
case 'playername':
$search = $db->query("SELECT a.id, a.username, a.ally_id, a.ally_name, a.galaxy, a.system, a.planet, b.name, c.total_rank FROM " . USERS . " as a LEFT JOIN " . PLANETS . " as b ON b.id = a.id_planet LEFT JOIN " . STATPOINTS . " as c ON c.stat_type = 1 AND c.id_owner = a.id WHERE a.username LIKE '%" . $db->sql_escape($searchtext, true) . "%' LIMIT 25;");
while ($s = $db->fetch_array($search)) {
$SearchResult[] = array('planetname' => $s['name'], 'username' => $s['username'], 'userid' => $s['id'], 'allyname' => $s['ally_name'], 'allyid' => $s['ally_id'], 'galaxy' => $s['galaxy'], 'system' => $s['system'], 'planet' => $s['planet'], 'rank' => $s['total_rank']);
}
$db->free_result($search);
break;
case 'planetname':
$search = $db->query("SELECT a.name, a.galaxy, a.planet, a.system, b.ally_name, b.id, b.ally_id, b.username, c.total_rank FROM " . PLANETS . " as a LEFT JOIN " . USERS . " as b ON b.id = a.id_owner LEFT JOIN " . STATPOINTS . " as c ON c.stat_type = 1 AND c.id_owner = b.id WHERE a.name LIKE '%" . $db->sql_escape($searchtext, true) . "%' LIMIT 25;");
while ($s = $db->fetch_array($search)) {
$SearchResult[] = array('planetname' => $s['name'], 'username' => $s['username'], 'userid' => $s['id'], 'allyname' => $s['ally_name'], 'allyid' => $s['ally_id'], 'galaxy' => $s['galaxy'], 'system' => $s['system'], 'planet' => $s['planet'], 'rank' => $s['total_rank']);
}
$db->free_result($search);
break;
case "allytag":
$search = $db->query("SELECT a.ally_name, a.ally_tag, a.ally_members, b.total_points FROM " . ALLIANCE . " as a, " . STATPOINTS . " as b WHERE b.stat_type = 1 AND b.id_owner = a.id AND a.ally_tag LIKE '%" . $db->sql_escape($searchtext, true) . "%' LIMIT 25;");
while ($s = $db->fetch_array($search)) {
$SearchResult[] = array('allypoints' => pretty_number($s['total_points']), 'allytag' => $s['ally_tag'], 'allymembers' => $s['ally_members'], 'allyname' => $s['ally_name']);
}
$db->free_result($search);
break;
case "allyname":
$search = $db->query("SELECT a.ally_name, a.ally_tag, a.ally_members, b.total_points FROM " . ALLIANCE . " as a, " . STATPOINTS . " as b WHERE b.stat_type = 1 AND b.id_owner = a.id AND a.ally_name LIKE '%" . $db->sql_escape($searchtext, true) . "%' LIMIT 25;");
while ($s = $db->fetch_array($search)) {
$SearchResult[] = array('allypoints' => pretty_number($s['total_points']), 'allytag' => $s['ally_tag'], 'allymembers' => $s['ally_members'], 'allyname' => $s['ally_name']);
}
$db->free_result($search);
break;
}
$SeachTypes = array("playername" => $LNG['sh_player_name'], "planetname" => $LNG['sh_planet_name'], "allytag" => $LNG['sh_alliance_tag'], "allyname" => $LNG['sh_alliance_name']);
$template->assign_vars(array('SearchResult' => $SearchResult, 'SeachTypes' => $SeachTypes, 'SeachInput' => $searchtext, 'SeachType' => $type, 'sh_search' => $LNG['sh_search'], 'sh_search_in_the_universe' => $LNG['sh_search_in_the_universe'], 'sh_buddy_request' => $LNG['sh_buddy_request'], 'sh_write_message' => $LNG['sh_write_message'], 'sh_name' => $LNG['sh_name'], 'sh_alliance' => $LNG['sh_alliance'], 'sh_planet' => $LNG['sh_planet'], 'sh_coords' => $LNG['sh_coords'], 'sh_position' => $LNG['sh_position'], 'sh_tag' => $LNG['sh_tag'], 'sh_members' => $LNG['sh_members'], 'sh_points' => $LNG['sh_points']));
$template->show("search_body.tpl");
}
示例14: ShowFAQPage
function ShowFAQPage()
{
global $USER, $PLANET, $LNG;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
includeLang('FAQ');
$template->assign_vars(array('FAQList' => $LNG['faq'], 'faq_overview' => $LNG['faq_overview']));
$template->show("faq_overview.tpl");
}
示例15: ShowBannedPage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (Fork/2Moons)
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.3 (2011-01-21)
* @link http://code.google.com/p/2moons/
* Please do not remove the credits
*/
function ShowBannedPage()
{
global $USER, $PLANET, $LNG, $db;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$query = $db->query("SELECT * FROM " . BANNED . " ORDER BY `id`;");
$PrangerList = array();
while ($u = $db->fetch_array($query)) {
$PrangerList[] = array('player' => $u['who'], 'theme' => $u['theme'], 'from' => date(TDFORMAT, $u['time']), 'to' => date(TDFORMAT, $u['longer']), 'admin' => $u['author'], 'mail' => $u['email'], 'info' => sprintf($LNG['bn_writemail'], $u['author']));
}
$db->free_result($query);
$template->assign_vars(array('PrangerList' => $PrangerList, 'bn_no_players_banned' => $LNG['bn_no_players_banned'], 'bn_exists' => $LNG['bn_exists'], 'bn_players_banned' => $LNG['bn_players_banned'], 'bn_players_banned_list' => $LNG['bn_players_banned_list'], 'bn_player' => $LNG['bn_player'], 'bn_reason' => $LNG['bn_reason'], 'bn_from' => $LNG['bn_from'], 'bn_until' => $LNG['bn_until'], 'bn_by' => $LNG['bn_by']));
$template->show("banned_overview.tpl");
}