当前位置: 首页>>代码示例>>PHP>>正文


PHP template::page_leftmenu方法代码示例

本文整理汇总了PHP中template::page_leftmenu方法的典型用法代码示例。如果您正苦于以下问题:PHP template::page_leftmenu方法的具体用法?PHP template::page_leftmenu怎么用?PHP template::page_leftmenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在template的用法示例。


在下文中一共展示了template::page_leftmenu方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ShowRecordsPage

function ShowRecordsPage()
{
    global $USER, $PLANET, $LNG, $resource, $db, $CONF;
    require_once ROOT_PATH . "cache/CacheRecords.php";
    $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();
    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("d. M Y, H:i:s", $CONF['stat_last_update'])), 'level' => $LNG['rec_level'], 'player' => $LNG['rec_playe']));
    $template->show("records_overview.tpl");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:30,代码来源:ShowRecordsPage.php

示例2: ShowTechTreePage

function ShowTechTreePage()
{
    global $resource, $requeriments, $LNG, $reslist, $USER, $PLANET;
    $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();
    $RequeriList = array();
    foreach ($LNG['tech'] as $Element => $ElementName) {
        if (in_array($Element, $reslist['dmfunc'])) {
            continue;
        }
        if (!isset($resource[$Element])) {
            $TechTreeList[] = $ElementName;
        } else {
            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");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:ShowTechTreePage.php

示例3: __construct

 public function __construct()
 {
     global $USER, $PLANET, $dpath, $resource, $LNG, $db, $reslist;
     $template = new template();
     $template->page_header();
     $template->page_topnav();
     $template->page_leftmenu();
     $template->page_planetmenu();
     $template->page_footer();
     $template->loadscript('galaxy.js');
     $maxfleet = $db->num_rows($db->query("SELECT fleet_id FROM " . FLEETS . " WHERE `fleet_owner` = '" . $USER['id'] . "' AND `fleet_mission` != 10;"));
     $mode = request_var('mode', 0);
     $galaxyLeft = request_var('galaxyLeft', '');
     $galaxyRight = request_var('galaxyRight', '');
     $systemLeft = request_var('systemLeft', '');
     $systemRight = request_var('systemRight', '');
     $galaxy = min(max(abs(request_var('galaxy', $PLANET['galaxy'])), 1), MAX_GALAXY_IN_WORLD);
     $system = min(max(abs(request_var('system', $PLANET['system'])), 1), MAX_SYSTEM_IN_GALAXY);
     $planet = min(max(abs(request_var('planet', $PLANET['planet'])), 1), MAX_PLANET_IN_SYSTEM);
     $current = request_var('current', 0);
     if ($mode == 1) {
         if (!empty($galaxyLeft)) {
             $galaxy = max($galaxy - 1, 1);
         } elseif (!empty($galaxyRight)) {
             $galaxy = min($galaxy + 1, MAX_GALAXY_IN_WORLD);
         }
         if (!empty($systemLeft)) {
             $system = max($system - 1, 1);
         } elseif (!empty($systemRight)) {
             $system = min($system + 1, MAX_SYSTEM_IN_GALAXY);
         }
     }
     if (!($galaxy == $PLANET['galaxy'] && $system == $PLANET['system']) && $mode != 0) {
         if ($PLANET['deuterium'] < 10) {
             $template->message($LNG['gl_no_deuterium_to_view_galaxy'], "game.php?page=galaxy&mode=0", 2);
             exit;
         } else {
             $PLANET['deuterium'] -= 10;
         }
     }
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     $PlanetRess->SavePlanetToDB();
     unset($reslist['defense'][array_search(502, $reslist['defense'])]);
     $MissleSelector[0] = $LNG['gl_all_defenses'];
     foreach ($reslist['defense'] as $Element) {
         $MissleSelector[$Element] = $LNG['tech'][$Element];
     }
     $Result = $this->ShowGalaxyRows($galaxy, $system);
     $template->assign_vars(array('GalaxyRows' => $Result['Result'], 'planetcount' => sprintf($LNG['gl_populed_planets'], $Result['planetcount']), 'mode' => $mode, 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'current' => $current, 'currentmip' => pretty_number($PLANET[$resource[503]]), 'maxfleetcount' => $maxfleet, 'fleetmax' => $USER['computer_tech'] + 1 + $USER['rpg_commandant'] * COMMANDANT, 'grecyclers' => pretty_number($PLANET[$resource[219]]), 'recyclers' => pretty_number($PLANET[$resource[209]]), 'spyprobes' => pretty_number($PLANET[$resource[210]]), 'missile_count' => sprintf($LNG['gl_missil_to_launch'], $PLANET[$resource[503]]), 'spio_anz' => $USER['spio_anz'], 'settings_fleetactions' => $USER['settings_fleetactions'], 'current_galaxy' => $PLANET['galaxy'], 'current_system' => $PLANET['system'], 'current_planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type'], 'MissleSelector' => $MissleSelector, 'gl_solar_system' => $LNG['gl_solar_system'], 'gl_galaxy' => $LNG['gl_galaxy'], 'gl_missil_launch_action' => $LNG['gl_missil_launch_action'], 'gl_objective' => $LNG['gl_objective'], 'gl_missil_launch' => $LNG['gl_missil_launch'], 'gl_pos' => $LNG['gl_pos'], 'gl_planet' => $LNG['gl_planet'], 'gl_alliance' => $LNG['gl_alliance'], 'gl_actions' => $LNG['gl_actions'], 'gl_name_activity' => $LNG['gl_name_activity'], 'gl_player_estate' => $LNG['gl_player_estate'], 'gl_debris' => $LNG['gl_debris'], 'gl_moon' => $LNG['gl_moon'], 'gl_show' => $LNG['gl_show'], 'gl_out_space' => $LNG['gl_out_space'], 'gl_legend' => $LNG['gl_legend'], 'gl_strong_player' => $LNG['gl_strong_player'], 'gl_s' => $LNG['gl_s'], 'gl_week_player' => $LNG['gl_week_player'], 'gl_w' => $LNG['gl_w'], 'gl_vacation' => $LNG['gl_vacation'], 'gl_v' => $LNG['gl_v'], 'gl_banned' => $LNG['gl_banned'], 'gl_b' => $LNG['gl_b'], 'gl_inactive_seven' => $LNG['gl_inactive_seven'], 'gl_i' => $LNG['gl_i'], 'gl_inactive_twentyeight' => $LNG['gl_inactive_twentyeight'], 'gl_I' => $LNG['gl_I'], 'gl_avaible_grecyclers' => $LNG['gl_avaible_grecyclers'], 'gl_avaible_recyclers' => $LNG['gl_avaible_recyclers'], 'gl_avaible_spyprobes' => $LNG['gl_avaible_spyprobes'], 'gl_fleets' => $LNG['gl_fleets'], 'gl_avaible_missiles' => $LNG['gl_avaible_missiles'], 'gl_moon' => $LNG['gl_moon'], 'gl_diameter' => $LNG['gl_diameter'], 'gl_features' => $LNG['gl_features'], 'gl_temperature' => $LNG['gl_temperature'], 'gl_actions' => $LNG['gl_actions'], 'gl_debris_field' => $LNG['gl_debris_field'], 'gl_resources' => $LNG['gl_resources'], 'gl_collect' => $LNG['gl_collect'], 'gl_with' => $LNG['gl_with'], 'gl_alliance_page' => $LNG['gl_alliance_page'], 'gl_see_on_stats' => $LNG['gl_see_on_stats'], 'gl_alliance_web_page' => $LNG['gl_alliance_web_page'], 'gl_spy' => $LNG['gl_spy'], 'gl_buddy_request' => $LNG['gl_buddy_request'], 'gl_missile_attack' => $LNG['gl_missile_attack'], 'gl_player' => $LNG['gl_player'], 'gl_playercard' => $LNG['gl_playercard'], 'gl_phalanx' => $LNG['gl_phalanx'], 'gl_points' => $LNG['gl_points'], 'gl_ajax_status_ok' => $LNG['gl_ajax_status_ok'], 'gl_ajax_status_fail' => $LNG['gl_ajax_status_fail'], 'write_message' => $LNG['write_message']));
     $template->show('galaxy_overview.tpl');
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:52,代码来源:class.ShowGalaxyPage.php

示例4: ShowTopKB

function ShowTopKB()
{
    global $USER, $PLANET, $LNG, $db;
    $mode = request_var('mode', '');
    $template = new template();
    switch ($mode) {
        case "showkb":
            $template->page_header();
            $template->page_footer();
            includeLang('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) . "';");
            } else {
                $RaportRAW = $db->uniquequery("SELECT * FROM " . TOPKB . " WHERE `rid` = '" . $db->sql_escape($ReportID) . "';");
                $raport = stripslashes($RaportRAW['raport']);
                foreach ($LNG['tech_rc'] as $id => $s_name) {
                    $str_replace1 = array("[ship[" . $id . "]]");
                    $str_replace2 = array($s_name);
                    $raport = str_replace($str_replace1, $str_replace2, $raport);
                }
            }
            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();
            $template->page_header();
            $template->page_topnav();
            $template->page_leftmenu();
            $template->page_planetmenu();
            $template->page_footer();
            $top = $db->query("SELECT * FROM " . TOPKB . " ORDER BY gesamtunits DESC LIMIT 100;");
            while ($data = $db->fetch_array($top)) {
                $TopKBList[] = array('result' => $data['fleetresult'], 'time' => date("D d M H:i:s", $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;
    }
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:49,代码来源:ShowTopKB.php

示例5: 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");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:48,代码来源:ShowSearchPage.php

示例6: 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");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:16,代码来源:ShowFAQ.php

示例7: ShowChangelogPage

function ShowChangelogPage()
{
    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('CHANGELOG');
    $template->assign_vars(array('ChangelogList' => array_map('makebr', $LNG['changelog']), 'Version' => $LNG['Version'], 'Description' => $LNG['Description']));
    $template->show("changelog_overview.tpl");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:16,代码来源:ShowChangelogPage.php

示例8: ShowImperiumPage

function ShowImperiumPage()
{
    global $LNG, $USER, $PLANET, $resource, $reslist, $db;
    $PlanetRess = new ResourceUpdate();
    $PlanetRess->CalcResource();
    $PlanetRess->SavePlanetToDB();
    $template = new template();
    $template->loadscript("trader.js");
    $template->page_topnav();
    $template->page_header();
    $template->page_leftmenu();
    $template->page_planetmenu();
    $template->page_footer();
    $SQLArray = array_merge($reslist['build'], $reslist['fleet'], $reslist['defense']);
    $Query = "";
    foreach ($SQLArray as $id => $gid) {
        $Query .= ",`" . $resource[$gid] . "`";
    }
    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 = $db->query("\r\n\tSELECT `id`,`name`,`galaxy`,`system`,`planet`,`planet_type`,\r\n\t`image`,`field_current`,`field_max`,`metal`,`crystal`,`deuterium`,\r\n\t`energy_used`,`energy_max` " . $Query . " FROM " . PLANETS . " WHERE `id_owner` = '" . $USER['id'] . "' AND `destruyed` = '0' ORDER BY " . $Order . ";");
    while ($Planet = $db->fetch_array($PlanetsRAW)) {
        $InfoList = array('id' => $Planet['id'], 'name' => $Planet['name'], 'image' => $Planet['image'], 'galaxy' => $Planet['galaxy'], 'system' => $Planet['system'], 'planet' => $Planet['planet'], 'field_current' => $Planet['field_current'], 'field_max' => CalculateMaxPlanetFields($Planet), 'metal' => pretty_number($Planet['metal']), 'crystal' => pretty_number($Planet['crystal']), 'deuterium' => pretty_number($Planet['deuterium']), 'energy_used' => pretty_number($Planet['energy_max'] + $Planet['energy_used']), 'energy_max' => pretty_number($Planet['energy_max']));
        foreach ($reslist['build'] as $gid) {
            $BuildsList[$gid] = pretty_number($Planet[$resource[$gid]]);
        }
        foreach ($reslist['fleet'] as $gid) {
            $FleetsList[$gid] = pretty_number($Planet[$resource[$gid]]);
        }
        foreach ($reslist['defense'] as $gid) {
            $DefensesList[$gid] = pretty_number($Planet[$resource[$gid]]);
        }
        $PlanetsList[] = array('InfoList' => $InfoList, 'BuildsList' => $BuildsList, 'FleetsList' => $FleetsList, 'DefensesList' => $DefensesList);
    }
    foreach ($reslist['tech'] as $gid) {
        $ResearchList[$gid] = pretty_number($USER[$resource[$gid]]);
    }
    $template->assign_vars(array('colspan' => count($PlanetsList) + 1, 'PlanetsList' => $PlanetsList, 'ResearchList' => $ResearchList, 'iv_imperium_title' => $LNG['iv_imperium_title'], 'iv_planet' => $LNG['iv_planet'], 'iv_name' => $LNG['iv_name'], 'iv_coords' => $LNG['iv_coords'], 'iv_fields' => $LNG['iv_fields'], 'iv_resources' => $LNG['iv_resources'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'Energy' => $LNG['Energy'], 'iv_buildings' => $LNG['iv_buildings'], 'iv_technology' => $LNG['iv_technology'], 'iv_ships' => $LNG['iv_ships'], 'iv_defenses' => $LNG['iv_defenses'], 'tech' => $LNG['tech'], 'build' => $reslist['build'], 'fleet' => $reslist['fleet'], 'defense' => $reslist['defense'], 'research' => $reslist['tech']));
    $template->show("empire_overview.tpl");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:46,代码来源:ShowImperiumPage.php

示例9: __construct

 public function __construct()
 {
     global $USER, $PLANET, $resource, $reslist, $LNG, $db, $ExtraDM;
     $action = request_var('action', '');
     $Offi = request_var('offi', 0);
     $Extra = request_var('extra', 0);
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     if ($action == "send" && $USER['urlaubs_modus'] == 0) {
         if (!empty($Offi) && !CheckModule(8)) {
             $this->UpdateOfficier($Offi);
         } elseif (!empty($Extra) && !CheckModule(18)) {
             $this->UpdateExtra($Extra);
         }
     }
     $PlanetRess->SavePlanetToDB();
     $template = new template();
     $template->loadscript('officier.js');
     $template->page_header();
     $template->page_topnav();
     $template->page_leftmenu();
     $template->page_planetmenu();
     $template->page_footer();
     if (!CheckModule(8)) {
         foreach ($reslist['dmfunc'] as $Element) {
             if ($USER[$resource[$Element]] > TIMESTAMP) {
                 $template->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
             }
             $ExtraDMList[] = array('id' => $Element, 'active' => $USER[$resource[$Element]] - TIMESTAMP, 'price' => pretty_number($ExtraDM[$Element]['darkmatter']), 'isok' => $USER['darkmatter'] - $ExtraDM[$Element]['darkmatter'] >= 0 ? true : false, 'time' => pretty_time($ExtraDM[$Element]['time'] * 3600), 'name' => $LNG['tech'][$Element], 'desc' => sprintf($LNG['res']['descriptions'][$Element], $ExtraDM[$Element]['add'] * 100));
         }
     }
     if (!CheckModule(18)) {
         foreach ($reslist['officier'] as $Element) {
             if (($Result = $this->IsOfficierAccessible($Element)) === 0) {
                 continue;
             }
             $OfficierList[] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'name' => $LNG['tech'][$Element], 'desc' => $LNG['res']['descriptions'][$Element], 'Result' => $Result);
         }
     }
     $template->assign_vars(array('ExtraDMList' => $ExtraDMList, 'OfficierList' => $OfficierList, 'user_darkmatter' => floor($USER['darkmatter'] / DM_PRO_OFFICIER_LEVEL), 'of_max_lvl' => $LNG['of_max_lvl'], 'of_recruit' => $LNG['of_recruit'], 'of_darkmatter' => sprintf($LNG['of_points_per_thousand_darkmatter'], DM_PRO_OFFICIER_LEVEL, $LNG['Darkmatter']), 'of_available_points' => $LNG['of_available_points'], 'alv_points' => $LNG['alv_points'], 'of_lvl' => $LNG['of_lvl'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_still' => $LNG['of_still'], 'of_active' => $LNG['of_active'], 'of_update' => $LNG['of_update'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['Darkmatter'])));
     $template->show("officier_overview.tpl");
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:42,代码来源:class.ShowOfficierPage.php

示例10: ShowBannedPage

function ShowBannedPage()
{
    global $USER, $PLANET, $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();
    $query = $db->query("SELECT * FROM " . BANNED . " ORDER BY `id`;");
    while ($u = $db->fetch_array($query)) {
        $PrangerList[] = array('player' => $u['who'], 'theme' => $u['theme'], 'from' => date("d. M Y H:i:s", $u['time']), 'to' => date("d. M Y H:i:s", $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");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:20,代码来源:ShowBannedPage.php

示例11: __construct

 public function __construct()
 {
     global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $db, $pricelist;
     include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.' . PHP_EXT;
     include_once ROOT_PATH . 'includes/functions/GetElementPrice.' . PHP_EXT;
     $template = new template();
     $template->page_header();
     $template->page_topnav();
     $template->page_leftmenu();
     $template->page_planetmenu();
     $template->page_footer();
     if ($PLANET[$resource[31]] == 0) {
         $template->message($LNG['bd_lab_required']);
         exit;
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET) ? true : false;
     $PLANET[$resource[31] . '_inter'] = $this->CheckAndGetLabLevel($USER, $PLANET);
     $TheCommand = request_var('cmd', '');
     $Element = request_var('tech', 0);
     $PlanetRess = new ResourceUpdate();
     if ($USER['urlaubs_modus'] == 0 && !empty($TheCommand) && $bContinue) {
         switch ($TheCommand) {
             case 'cancel':
                 if (empty($USER['b_tech'])) {
                     break;
                 }
                 $costs = GetBuildingPrice($USER, $PLANET, $USER['b_tech_id']);
                 if ($PLANET['id'] == $USER['b_tech_planet']) {
                     $PLANET['metal'] += $costs['metal'];
                     $PLANET['crystal'] += $costs['crystal'];
                     $PLANET['deuterium'] += $costs['deuterium'];
                 } else {
                     $db->query("UPDATE " . PLANETS . " SET `metal` = `metal` + '" . $costs['metal'] . "', `crystal` = `crystal` + '" . $costs['crystal'] . "', `deuterium` = `deuterium` + '" . $costs['deuterium'] . "' WHERE `id` = '" . $USER['b_tech_planet'] . "';");
                 }
                 $USER['darkmatter'] += $costs['darkmatter'];
                 $USER['b_tech_id'] = 0;
                 $USER['b_tech'] = 0;
                 $USER['b_tech_planet'] = 0;
                 break;
             case 'search':
                 if (!empty($USER['b_tech']) || empty($Element) || !in_array($Element, $reslist['tech']) || $USER[$resource[$Element]] >= $pricelist[$Element]['max'] || !IsTechnologieAccessible($USER, $PLANET, $Element) || !IsElementBuyable($USER, $PLANET, $Element)) {
                     break;
                 }
                 $costs = GetBuildingPrice($USER, $PLANET, $Element);
                 $PLANET['metal'] -= $costs['metal'];
                 $PLANET['crystal'] -= $costs['crystal'];
                 $PLANET['deuterium'] -= $costs['deuterium'];
                 $USER['darkmatter'] -= $costs['darkmatter'];
                 $USER['b_tech_id'] = $Element;
                 $USER['b_tech'] = TIMESTAMP + GetBuildingTime($USER, $PLANET, $Element);
                 $USER['b_tech_planet'] = $PLANET['id'];
                 break;
         }
     }
     $PlanetRess->CalcResource();
     $PlanetRess->SavePlanetToDB();
     $ScriptInfo = array();
     foreach ($reslist['tech'] as $ID => $Element) {
         if (IsTechnologieAccessible($USER, $PLANET, $Element)) {
             $CanBeDone = IsElementBuyable($USER, $PLANET, $Element);
             if (isset($pricelist[$Element]['max']) && $USER[$resource[$Element]] >= $pricelist[$Element]['max']) {
                 $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_maxlevel'] . "</font>";
             } elseif ($USER['b_tech_id'] == 0) {
                 $LevelToDo = 1 + $USER[$resource[$Element]];
                 if ($CanBeDone && $this->CheckLabSettingsInQueue($PLANET)) {
                     $TechnoLink = "<a href=\"game.php?page=buildings&amp;mode=research&amp;cmd=search&amp;tech=" . $Element . "\"><font color=\"#00FF00\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font></a>";
                 } else {
                     $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>";
                 }
             } else {
                 if ($USER['b_tech_id'] == $Element) {
                     if ($USER['b_tech_planet'] == $PLANET['id']) {
                         $template->loadscript('research.js');
                         $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => '', 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
                     } else {
                         $THEPLANET = $db->uniquequery("SELECT `name` FROM " . PLANETS . " WHERE `id` = '" . $USER['b_tech_planet'] . "';");
                         $template->loadscript('research.js');
                         $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => $LNG['bd_on'] . '<br>' . $THEPLANET['name'], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
                     }
                     $TechnoLink = '<div id="research"></div>';
                 } else {
                     $TechnoLink = '<center>-</center>';
                 }
             }
             $ResearchList[] = array('id' => $Element, 'maxinfo' => isset($pricelist[$Element]['max']) && $pricelist[$Element]['max'] != 255 ? sprintf($LNG['bd_max_lvl'], $pricelist[$Element]['max']) : '', 'name' => $LNG['tech'][$Element], 'descr' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'restprice' => $this->GetRestPrice($Element), 'elvl' => $Element == 106 ? $USER['rpg_espion'] * ESPION . " (" . $LNG['tech'][610] . ")" : ($Element == 108 ? $USER['rpg_commandant'] * COMMANDANT . " (" . $LNG['tech'][611] . ")" : false), 'lvl' => $USER[$resource[$Element]], 'link' => $TechnoLink);
         }
     }
     $template->assign_vars(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'ScriptInfo' => json_encode($ScriptInfo), 'bd_building_lab' => $LNG['bd_building_lab'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_lvl' => $LNG['bd_lvl'], 'fgf_time' => $LNG['fgf_time']));
     $template->show('buildings_research.tpl');
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:90,代码来源:class.ShowResearchPage.php

示例12: ShowResourcesPage

function ShowResourcesPage()
{
    global $LNG, $ProdGrid, $resource, $reslist, $CONF, $db, $ExtraDM, $USER, $PLANET;
    if ($PLANET['planet_type'] == 3 || $USER['urlaubs_modus'] == 1) {
        $CONF['metal_basic_income'] = 0;
        $CONF['crystal_basic_income'] = 0;
        $CONF['deuterium_basic_income'] = 0;
    }
    $SubQry = "";
    if ($_POST && $USER['urlaubs_modus'] == 0) {
        foreach ($_POST as $Field => $Value) {
            $FieldName = $Field . "_porcent";
            if (isset($PLANET[$FieldName]) && in_array($Value, $reslist['procent'])) {
                $Value = $Value / 10;
                $PLANET[$FieldName] = $Value;
                $SubQry .= ", `" . $FieldName . "` = '" . $Value . "'";
            }
        }
        if (isset($SubQry)) {
            $QryUpdatePlanet = "UPDATE " . PLANETS . " SET ";
            $QryUpdatePlanet .= "`id` = '" . $PLANET['id'] . "' ";
            $QryUpdatePlanet .= $SubQry;
            $QryUpdatePlanet .= "WHERE ";
            $QryUpdatePlanet .= "`id` = '" . $PLANET['id'] . "';";
            $db->query($QryUpdatePlanet);
        }
        redirectTo("game.php?page=resources");
        exit;
    }
    $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();
    if ($PLANET['energy_max'] == 0 && $PLANET['energy_used'] > 0) {
        $post_porcent = 0;
    } elseif ($PLANET['energy_max'] > 0 && abs($PLANET['energy_used']) > $PLANET['energy_max']) {
        $post_porcent = floor($PLANET['energy_max'] / ($PLANET['energy_used'] * -1) * 100);
    } elseif ($PLANET['energy_max'] == 0 && abs($PLANET['energy_used']) > $PLANET['energy_max']) {
        $post_porcent = 0;
    } else {
        $post_porcent = 100;
    }
    if ($post_porcent > 100) {
        $post_porcent = 100;
    }
    $BuildTemp = $PLANET['temp_max'];
    $BuildEnergy = $USER[$resource[113]];
    $metal = array();
    $crystal = array();
    $deuterium = array();
    $deu_en = array();
    $energy = array();
    $energy_en = array();
    foreach ($reslist['prod'] as $ProdID) {
        if ($PLANET[$resource[$ProdID]] > 0 && isset($ProdGrid[$ProdID])) {
            $BuildLevelFactor = $PLANET[$resource[$ProdID] . "_porcent"];
            $BuildLevel = $PLANET[$resource[$ProdID]];
            $metal[$ProdID] = floor(eval($ProdGrid[$ProdID]['formule']['metal']) * (0.01 * $post_porcent) * $CONF['resource_multiplier']);
            $crystal[$ProdID] = floor(eval($ProdGrid[$ProdID]['formule']['crystal']) * (0.01 * $post_porcent) * $CONF['resource_multiplier']);
            if ($ProdID < 4) {
                $deuterium[$ProdID] = floor(eval($ProdGrid[$ProdID]['formule']['deuterium']) * (0.01 * $post_porcent) * $CONF['resource_multiplier']);
                $energy[$ProdID] = floor(eval($ProdGrid[$ProdID]['formule']['energy']) * $CONF['resource_multiplier']);
            } else {
                if ($ProdID == 12 && $PLANET['deuterium'] == 0) {
                    continue;
                }
                $deu_en[$ProdID] = floor(eval($ProdGrid[$ProdID]['formule']['deuterium']) * $CONF['resource_multiplier']);
                $energy_en[$ProdID] = floor(eval($ProdGrid[$ProdID]['formule']['energy']) * $CONF['resource_multiplier']);
            }
            $thisdeu = isset($deuterium[$ProdID]) ? $deuterium[$ProdID] : $deu_en[$ProdID];
            $thisenergy = isset($energy[$ProdID]) ? $energy[$ProdID] : $energy_en[$ProdID];
            $CurrPlanetList[] = array('name' => $resource[$ProdID], 'type' => $LNG['tech'][$ProdID], 'level' => $ProdID > 200 ? $LNG['rs_amount'] : $LNG['rs_lvl'], 'level_type' => $PLANET[$resource[$ProdID]], 'metal_type' => colorNumber(pretty_number($metal[$ProdID])), 'crystal_type' => colorNumber(pretty_number($crystal[$ProdID])), 'deuterium_type' => colorNumber(pretty_number($thisdeu)), 'energy_type' => colorNumber(pretty_number($thisenergy)), 'optionsel' => $PLANET[$resource[$ProdID] . "_porcent"] * 10);
        }
    }
    $metal_total = $PLANET['metal_perhour'] + $CONF['metal_basic_income'] * $CONF['resource_multiplier'];
    $crystal_total = $PLANET['crystal_perhour'] + $CONF['crystal_basic_income'] * $CONF['resource_multiplier'];
    $deuterium_total = $PLANET['deuterium_perhour'] + $CONF['deuterium_basic_income'] * $CONF['resource_multiplier'];
    $energy_total = $PLANET['energy_max'] + $CONF['energy_basic_income'] * $CONF['resource_multiplier'] - abs($PLANET['energy_used']);
    foreach ($reslist['procent'] as $procent) {
        $OptionSelector[$procent] = $procent . "%";
    }
    $template->assign_vars(array('bonus_metal' => colorNumber(pretty_number(array_sum($metal) * ($USER['rpg_geologue'] * GEOLOGUE + $USER['metal_proc_tech'] * 0.02 + (TIMESTAMP - $USER[$resource[703]] <= 0 ? $ExtraDM[703]['add'] : 0)))), 'bonus_crystal' => colorNumber(pretty_number(array_sum($crystal) * ($USER['rpg_geologue'] * GEOLOGUE + $USER['crystal_proc_tech'] * 0.02 + (TIMESTAMP - $USER[$resource[703]] <= 0 ? $ExtraDM[703]['add'] : 0)))), 'bonus_deuterium' => colorNumber(pretty_number(array_sum($deuterium) * ($USER['rpg_geologue'] * GEOLOGUE + $USER['deuterium_proc_tech'] * 0.02 + (TIMESTAMP - $USER[$resource[703]] <= 0 ? $ExtraDM[703]['add'] : 0)))), 'bonus_energy' => colorNumber(pretty_number(array_sum($energy_en) * ($USER['rpg_ingenieur'] * INGENIEUR + (TIMESTAMP - $USER[$resource[704]] <= 0 ? $ExtraDM[704]['add'] : 0)))), 'CurrPlanetList' => $CurrPlanetList, 'Production_of_resources_in_the_planet' => str_replace('%s', $PLANET['name'], $LNG['rs_production_on_planet']), 'metal_basic_income' => $CONF['metal_basic_income'] * $CONF['resource_multiplier'], 'crystal_basic_income' => $CONF['crystal_basic_income'] * $CONF['resource_multiplier'], 'deuterium_basic_income' => $CONF['deuterium_basic_income'] * $CONF['resource_multiplier'], 'energy_basic_income' => $CONF['energy_basic_income'] * $CONF['resource_multiplier'], 'metalmax' => colorNumber($PLANET['metal_max'] / 1000, pretty_number($PLANET['metal_max'] / 1000) . "k"), 'crystalmax' => colorNumber($PLANET['crystal_max'] / 1000, pretty_number($PLANET['crystal_max'] / 1000) . "k"), 'deuteriummax' => colorNumber($PLANET['deuterium_max'] / 1000, pretty_number($PLANET['deuterium_max'] / 1000) . "k"), 'metal_total' => colorNumber(pretty_number($metal_total)), 'crystal_total' => colorNumber(pretty_number($crystal_total)), 'option' => $OptionSelector, 'deuterium_total' => colorNumber(pretty_number($deuterium_total)), 'energy_total' => colorNumber(pretty_number($energy_total)), 'daily_metal' => colorNumber(pretty_number(floor($metal_total * 24))), 'weekly_metal' => colorNumber(pretty_number(floor($metal_total * 24 * 7))), 'daily_crystal' => colorNumber(pretty_number(floor($crystal_total * 24))), 'weekly_crystal' => colorNumber(pretty_number(floor($crystal_total * 24 * 7))), 'daily_deuterium' => colorNumber(pretty_number(floor($deuterium_total * 24))), 'weekly_deuterium' => colorNumber(pretty_number(floor($deuterium_total * 24 * 7))), 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'Energy' => $LNG['Energy'], 'rs_basic_income' => $LNG['rs_basic_income'], 'rs_storage_capacity' => $LNG['rs_storage_capacity'], 'rs_sum' => $LNG['rs_sum'], 'rs_daily' => $LNG['rs_daily'], 'rs_weekly' => $LNG['rs_weekly'], 'rs_calculate' => $LNG['rs_calculate'], 'rs_ress_bonus' => $LNG['rs_ress_bonus']));
    $template->show("resources_overview.tpl");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:89,代码来源:ShowResourcesPage.php

示例13: DefensesBuildingPage

 public function DefensesBuildingPage()
 {
     global $USER, $PLANET, $LNG, $resource, $dpath, $reslist;
     include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.' . PHP_EXT;
     include_once ROOT_PATH . 'includes/functions/GetElementPrice.' . PHP_EXT;
     $template = new template();
     if ($PLANET[$resource[21]] == 0) {
         $template->message($LNG['bd_shipyard_required']);
         exit;
     }
     $fmenge = $_POST['fmenge'];
     $cancel = $_POST['auftr'];
     $action = request_var('action', '');
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     $NotBuilding = true;
     if (!empty($PLANET['b_building_id'])) {
         $CurrentQueue = $PLANET['b_building_id'];
         $QueueArray = explode(";", $CurrentQueue);
         for ($i = 0; $i < count($QueueArray); $i++) {
             $ListIDArray = explode(",", $QueueArray[$i]);
             if ($ListIDArray[0] == 21 || $ListIDArray[0] == 15) {
                 $NotBuilding = false;
             }
         }
     }
     if (isset($fmenge) && $NotBuilding == true && $USER['urlaubs_modus'] == 0) {
         $ebuild = explode(";", $PLANET['b_hangar_id']);
         if (count($ebuild) - 1 >= MAX_FLEET_OR_DEFS_IN_BUILD) {
             $template->message(sprintf($LNG['bd_max_builds'], MAX_FLEET_OR_DEFS_IN_BUILD), "?page=buildings&mode=fleet", 3);
             exit;
         }
         $Missiles[502] = $PLANET[$resource[502]];
         $Missiles[503] = $PLANET[$resource[503]];
         $SiloSize = $PLANET[$resource[44]];
         $MaxMissiles = $SiloSize * 10;
         $BuildQueue = $PLANET['b_hangar_id'];
         $BuildArray = explode(";", $BuildQueue);
         for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
             $ElmentArray = explode(",", $BuildArray[$QElement]);
             $Missiles[$ElmentArray[0]] += $ElmentArray[1];
         }
         foreach ($fmenge as $Element => $Count) {
             $Element = in_array($Element, $reslist['defense']) ? $Element : NULL;
             $Count = is_numeric($Count) ? $Count : 0;
             $Count = max(min($Count, MAX_FLEET_OR_DEFS_PER_ROW), 0);
             $MaxElements = $this->GetMaxConstructibleElements($Element);
             if (empty($Element) || empty($Count) || empty($MaxElements) || !IsTechnologieAccessible($USER, $PLANET, $Element)) {
                 continue;
             }
             if ($Element == 502 || $Element == 503) {
                 $ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
                 $MissilesSpace = $MaxMissiles - $ActuMissiles;
                 if ($Element == 502) {
                     $Count = min($Count, $MissilesSpace);
                 } else {
                     $Count = min($Count, floor($MissilesSpace / 2));
                 }
                 $Count = min($Count, $MaxElements);
                 $Missiles[$Element] += $Count;
             } elseif (in_array($Element, $reslist['one'])) {
                 $Count = $PLANET[$resource[$Element]] == 0 && strpos($PLANET['b_hangar_id'], $Element . ',') === false ? 1 : 0;
             } else {
                 $Count = min($Count, $MaxElements);
             }
             if ($Count < 1) {
                 continue;
             }
             $Ressource = $this->GetElementRessources($Element, $Count);
             $PLANET['metal'] -= $Ressource['metal'];
             $PLANET['crystal'] -= $Ressource['crystal'];
             $PLANET['deuterium'] -= $Ressource['deuterium'];
             $USER['darkmatter'] -= $Ressource['darkmatter'];
             $PLANET['b_hangar_id'] .= $Element . ',' . floattostring($Count) . ';';
         }
     }
     if ($action == "delete" && is_array($cancel) && $USER['urlaubs_modus'] == 0) {
         $this->CancelAuftr($cancel);
     }
     $PlanetRess->SavePlanetToDB();
     if (!empty($PLANET['b_hangar_id'])) {
         $template->loadscript('bcmath.js');
         $template->loadscript('shipyard.js');
         $template->execscript("ShipyardList();BuildlistShipyard();");
     }
     $template->page_header();
     $template->page_topnav();
     $template->page_leftmenu();
     $template->page_planetmenu();
     $template->page_footer();
     foreach ($reslist['defense'] as $Element) {
         if (!IsTechnologieAccessible($USER, $PLANET, $Element)) {
             continue;
         }
         $DefenseList[] = array('id' => $Element, 'name' => $LNG['tech'][$Element], 'descriptions' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element, false), 'restprice' => $this->GetRestPrice($Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'IsAvailable' => IsElementBuyable($USER, $PLANET, $Element, false), 'Available' => pretty_number($PLANET[$resource[$Element]]), 'AlreadyBuild' => in_array($Element, $reslist['one']) && (strpos($PLANET['b_hangar_id'], $Element . ",") !== false || $PLANET[$resource[$Element]] != 0) ? true : false);
     }
     if (!empty($PLANET['b_hangar_id'])) {
         $ElementQueue = explode(';', $PLANET['b_hangar_id']);
         $NbrePerType = "";
         $NamePerType = "";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowShipyardPage.php

示例14: ShowTraderPage

function ShowTraderPage()
{
    global $USER, $PLANET, $LNG, $db;
    $ress = request_var('ress', '');
    $action = request_var('action', '');
    $metal = round(request_var('metal', 0.0), 0);
    $crystal = round(request_var('crystal', 0.0), 0);
    $deut = round(request_var('deuterium', 0.0), 0);
    $PlanetRess = new ResourceUpdate();
    $template = new template();
    $template->loadscript("trader.js");
    $template->page_topnav();
    $template->page_header();
    $template->page_leftmenu();
    $template->page_planetmenu();
    $template->page_footer();
    if ($ress != '') {
        switch ($ress) {
            case 'metal':
                if ($action == "trade") {
                    if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) {
                        $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game." . PHP_EXT . "?page=trader", 1);
                    } elseif ($crystal < 0 || $deut < 0) {
                        $template->message($LNG['tr_only_positive_numbers'], "game." . PHP_EXT . "?page=trader", 1);
                    } else {
                        $trade = $crystal * 2 + $deut * 4;
                        $PlanetRess->CalcResource();
                        if ($PLANET['metal'] > $trade) {
                            $PLANET['metal'] -= $trade;
                            $PLANET['crystal'] += $crystal;
                            $PLANET['deuterium'] += $deut;
                            $USER['darkmatter'] -= DARKMATTER_FOR_TRADER;
                            $template->message($LNG['tr_exchange_done'], "game." . PHP_EXT . "?page=trader", 1);
                        } else {
                            $template->message($LNG['tr_not_enought_metal'], "game." . PHP_EXT . "?page=trader", 1);
                        }
                        $PlanetRess->SavePlanetToDB();
                    }
                } else {
                    $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_metal' => $LNG['tr_sell_metal'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "2", 'mod_ma_res_b' => "4", 'ress' => $ress));
                    $template->show("trader_metal.tpl");
                }
                break;
            case 'crystal':
                if ($action == "trade") {
                    if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) {
                        $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game." . PHP_EXT . "?page=trader", 1);
                    } elseif ($metal < 0 || $deut < 0) {
                        $template->message($LNG['tr_only_positive_numbers'], "game." . PHP_EXT . "?page=trader", 1);
                    } else {
                        $trade = $metal * 0.5 + $deut * 2;
                        $PlanetRess->CalcResource();
                        if ($PLANET['crystal'] > $trade) {
                            $PLANET['metal'] += $metal;
                            $PLANET['crystal'] -= $trade;
                            $PLANET['deuterium'] += $deut;
                            $USER['darkmatter'] -= DARKMATTER_FOR_TRADER;
                            $template->message($LNG['tr_exchange_done'], "game." . PHP_EXT . "?page=trader", 1);
                        } else {
                            $template->message($LNG['tr_not_enought_crystal'], "game." . PHP_EXT . "?page=trader", 1);
                        }
                        $PlanetRess->SavePlanetToDB();
                    }
                } else {
                    $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_crystal' => $LNG['tr_sell_crystal'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "0.5", 'mod_ma_res_b' => "2", 'ress' => $ress));
                    $template->show("trader_crystal.tpl");
                }
                break;
            case 'deuterium':
                if ($action == "trade") {
                    if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) {
                        $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game." . PHP_EXT . "?page=trader", 1);
                    } elseif ($metal < 0 || $crystal < 0) {
                        message($LNG['tr_only_positive_numbers'], "game." . PHP_EXT . "?page=trader", 1);
                    } else {
                        $trade = $metal * 0.25 + $crystal * 0.5;
                        $PlanetRess->CalcResource();
                        if ($PLANET['deuterium'] > $trade) {
                            $PLANET['metal'] += $metal;
                            $PLANET['crystal'] += $crystal;
                            $PLANET['deuterium'] -= $trade;
                            $USER['darkmatter'] -= DARKMATTER_FOR_TRADER;
                            $template->message($LNG['tr_exchange_done'], "game." . PHP_EXT . "?page=trader", 1);
                        } else {
                            $template->message($LNG['tr_not_enought_deuterium'], "game." . PHP_EXT . "?page=trader", 1);
                        }
                        $PlanetRess->SavePlanetToDB();
                    }
                } else {
                    $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_deuterium' => $LNG['tr_sell_deuterium'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "0.25", 'mod_ma_res_b' => "0.5", 'ress' => $ress));
                    $template->show("trader_deuterium.tpl");
                }
                break;
        }
    } else {
        $PlanetRess->CalcResource();
        $PlanetRess->SavePlanetToDB();
        $template->assign_vars(array('tr_cost_dm_trader' => sprintf($LNG['tr_cost_dm_trader'], pretty_number(DARKMATTER_FOR_TRADER), $LNG['Darkmatter']), 'tr_call_trader_who_buys' => $LNG['tr_call_trader_who_buys'], 'tr_call_trader' => $LNG['tr_call_trader'], 'tr_exchange_quota' => $LNG['tr_exchange_quota'], 'tr_call_trader_submit' => $LNG['tr_call_trader_submit'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium']));
        $template->show("trader_overview.tpl");
    }
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowTraderPage.php

示例15: ShowBattleSimPage


//.........这里部分代码省略.........
        foreach ($Array as $ID => $Count) {
            $BattleArray[0][1][$ID] = $Count;
        }
    } else {
        $BattleArray = $_REQUEST['battleinput'];
    }
    if ($action == 'send') {
        $Counts = array(0, 0);
        foreach ($BattleArray as $BattleSlotID => $BattleSlot) {
            if (isset($BattleSlot[0]) && (array_sum($BattleSlot[0]) > 0 || $BattleSlotID == 0)) {
                $Att = mt_rand(1, 1000);
                $attack[$Att]['fleet'] = array('fleet_start_galaxy' => 1, 'fleet_start_system' => 33, 'fleet_start_planet' => 7, 'fleet_end_galaxy' => 1, 'fleet_end_system' => 33, 'fleet_end_planet' => 7, 'metal' => 0, 'crystal' => 0, 'deuterium' => 0);
                $attack[$Att]['user'] = array('username' => $LNG['bs_atter'] . ' Nr.' . ($BattleSlotID + 1), 'military_tech' => $BattleSlot[0][109], 'defence_tech' => $BattleSlot[0][110], 'shield_tech' => $BattleSlot[0][111], 0, 'dm_defensive' => 0, 'dm_attack' => 0);
                foreach ($BattleSlot[0] as $ID => $Count) {
                    if (!in_array($ID, $reslist['fleet']) || $BattleSlot[0][$ID] <= 0) {
                        unset($BattleSlot[0][$ID]);
                    }
                }
                if ($Counts[0] == 0 && $BattleSlotID != 0) {
                    exit('ERROR');
                }
                $Counts[0] = $Counts[0] + array_sum($BattleSlot[1]);
                $attack[$Att]['detail'] = $BattleSlot[0];
            }
            if (isset($BattleSlot[1]) && (array_sum($BattleSlot[1]) > 0 || $BattleSlotID == 0)) {
                $Def = mt_rand(1, 1000);
                $defense[$Def]['fleet'] = array('fleet_start_galaxy' => 1, 'fleet_start_system' => 33, 'fleet_start_planet' => 7, 'fleet_end_galaxy' => 1, 'fleet_end_system' => 33, 'fleet_end_planet' => 7, 'metal' => 0, 'crystal' => 0, 'deuterium' => 0);
                $defense[$Def]['user'] = array('username' => $LNG['bs_deffer'] . ' Nr.' . ($BattleSlotID + 1), 'military_tech' => $BattleSlot[1][109], 'defence_tech' => $BattleSlot[1][110], 'shield_tech' => $BattleSlot[1][111], 0, 'dm_defensive' => 0, 'dm_attack' => 0);
                foreach ($BattleSlot[1] as $ID => $Count) {
                    if (!in_array($ID, $reslist['fleet']) && !in_array($ID, $reslist['defense'])) {
                        unset($BattleSlot[1][$ID]);
                    }
                }
                if ($Countd[1] == 0 && $BattleSlotID != 0) {
                    exit('ERROR');
                }
                $Countd[1] = $Countd[1] + array_sum($BattleSlot[1]);
                $defense[$Def]['def'] = $BattleSlot[1];
            }
        }
        includeLang('FLEET');
        require_once ROOT_PATH . 'includes/classes/missions/calculateAttack.' . PHP_EXT;
        require_once ROOT_PATH . 'includes/classes/missions/calculateSteal.' . PHP_EXT;
        require_once ROOT_PATH . 'includes/classes/missions/GenerateReport.' . PHP_EXT;
        $start = microtime(true);
        $result = calculateAttack($attack, $defense);
        $totaltime = microtime(true) - $start;
        if ($result['won'] == "a") {
            $steal = calculateSteal($attack, array('metal' => $BattleArray[0][1][1], 'crystal' => $BattleArray[0][1][2], 'deuterium' => $BattleArray[0][1][3]), true);
        } else {
            $steal = array('metal' => 0, 'crystal' => 0, 'deuterium' => 0);
        }
        $FleetDebris = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1];
        $StrAttackerUnits = sprintf($LNG['sys_attacker_lostunits'], $result['lost']['att']);
        $StrDefenderUnits = sprintf($LNG['sys_defender_lostunits'], $result['lost']['def']);
        $StrRuins = sprintf($LNG['sys_gcdrunits'], $result['debree']['def'][0] + $result['debree']['att'][0], $LNG['Metal'], $result['debree']['def'][1] + $result['debree']['att'][1], $LNG['Crystal']);
        $DebrisField = $StrAttackerUnits . "<br>" . $StrDefenderUnits . "<br>" . $StrRuins;
        $MoonChance = min(round($FleetDebris / 100000, 0), 20);
        $AllSteal = array_sum($steal);
        $RaportInfo = sprintf($LNG['bs_derbis_raport'], ceil($FleetDebris / $pricelist[219]['capacity']), $LNG['tech'][219], ceil($FleetDebris / $pricelist[209]['capacity']), $LNG['tech'][209]) . "<br>";
        $RaportInfo .= sprintf($LNG['bs_steal_raport'], ceil($AllSteal / $pricelist[202]['capacity']), $LNG['tech'][202], ceil($AllSteal / $pricelist[203]['capacity']), $LNG['tech'][203], ceil($AllSteal / $pricelist[217]['capacity']), $LNG['tech'][217]) . "<br>";
        $INFO['moon']['battlesim'] = $RaportInfo;
        $INFO['steal'] = $steal;
        $INFO['fleet_start_time'] = TIMESTAMP;
        $INFO['moon']['des'] = 0;
        $INFO['moon']['chance'] = $MoonChance;
        $raport = GenerateReport($result, $INFO);
        $rid = md5(microtime(true));
        file_put_contents(ROOT_PATH . 'raports/raport_' . $rid . '.php', '<?php' . "\n" . '$raport = ' . $raport . ';' . "\n" . '?>');
        $SQLQuery = "INSERT INTO " . RW . " SET ";
        $SQLQuery .= "`time` = '" . TIMESTAMP . "', ";
        $SQLQuery .= "`owners` = '" . $USER['id'] . ",0', ";
        $SQLQuery .= "`rid` = '" . $rid . "', ";
        $SQLQuery .= "`raport` = '';";
        $db->query($SQLQuery);
        echo $rid;
        exit;
    }
    $PlanetRess = new ResourceUpdate();
    $PlanetRess->CalcResource();
    $PlanetRess->SavePlanetToDB();
    foreach ($reslist['fleet'] as $ID) {
        $GetFleet[$ID] = $LNG['tech'][$ID];
    }
    foreach ($reslist['defense'] as $ID) {
        if ($ID >= 501) {
            break;
        }
        $GetDef[$ID] = $LNG['tech'][$ID];
    }
    $template = new template();
    $template->loadscript('battlesim.js');
    $template->page_header();
    $template->page_topnav();
    $template->page_leftmenu();
    $template->page_planetmenu();
    $template->page_footer();
    $template->assign_vars(array('lm_battlesim' => $LNG['lm_battlesim'], 'bs_names' => $LNG['bs_names'], 'bs_atter' => $LNG['bs_atter'], 'bs_deffer' => $LNG['bs_deffer'], 'bs_steal' => $LNG['bs_steal'], 'bs_techno' => $LNG['bs_techno'], 'bs_send' => $LNG['bs_send'], 'bs_cancel' => $LNG['bs_cancel'], 'bs_wait' => $LNG['bs_wait'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'attack_tech' => $LNG['tech'][109], 'shield_tech' => $LNG['tech'][110], 'tank_tech' => $LNG['tech'][111], 'GetFleet' => $GetFleet, 'GetDef' => $GetDef, 'Slots' => $Slots, 'battleinput' => $BattleArray));
    $template->show("battlesim.tpl");
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowBattleSimPage.php


注:本文中的template::page_leftmenu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。