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


PHP IsElementBuyable函数代码示例

本文整理汇总了PHP中IsElementBuyable函数的典型用法代码示例。如果您正苦于以下问题:PHP IsElementBuyable函数的具体用法?PHP IsElementBuyable怎么用?PHP IsElementBuyable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: eco_build_hangar


//.........这里部分代码省略.........
            }
            $unit_resources = GetElementRessources($Element, $Count);
            foreach ($unit_resources as $res_name => $res_amount) {
                $units_cost[$res_name] += $res_amount;
            }
            $hangar .= "{$Element},{$Count};";
        }
        if ($hangar != $planet['b_hangar_id']) {
            $new_planet_data = $planet;
            $can_build_def = true;
            $query_string = '';
            foreach ($units_cost as $res_name => $res_amount) {
                if ($res_amount <= 0) {
                    continue;
                }
                if ($planet[$res_name] < $res_amount) {
                    $can_build_def = false;
                    $page_error = $lang['eco_bld_resources_not_enough'];
                    break;
                }
                $new_planet_data[$res_name] -= $res_amount;
                $query_string .= "`{$res_name}` = `{$res_name}` - {$res_amount},";
            }
            if ($can_build_def && $query_string) {
                $planet = $new_planet_data;
                $planet['b_hangar_id'] = $hangar;
                $query_string .= "`b_hangar_id` = '{$hangar}'";
                doquery("UPDATE {{planets}} SET {$query_string} WHERE `id` = '{$planet['id']}' LIMIT 1;");
            }
        }
        doquery('COMMIT');
    }
    // -------------------------------------------------------------------------------------------------------
    // S'il n'y a pas de Chantier ...
    if ($planet[$sn_data[21]['name']] == 0) {
        // Veuillez avoir l'obligeance de construire le Chantier Spacial !!
        message($lang['need_hangar'], $lang['tech'][21]);
    }
    $built = GetRestrictedConstructionNum($planet);
    $SiloSpace = max(0, $planet[$sn_data[44]['name']] * 10 - $built[502] - $built[503] * 2);
    $template = gettemplate("buildings_hangar", true);
    // -------------------------------------------------------------------------------------------------------
    // Construction de la page du Chantier (car si j'arrive ici ... c'est que j'ai tout ce qu'il faut pour ...
    $TabIndex = 0;
    foreach ($sn_data_group as $Element) {
        $unit_message = '';
        if (eco_can_build_unit($user, $planet, $Element)) {
            // On regarde si on peut en acheter au moins 1
            $CanBuildOne = IsElementBuyable($user, $planet, $Element, false);
            // Disponibilité actuelle
            $ElementCount = $planet[$sn_data[$Element]['name']];
            // On affiche le temps de construction (c'est toujours tellement plus joli)
            $baubar = GetMaxConstructibleElements($Element, $planet);
            switch ($Element) {
                case 502:
                    $baubar = min($SiloSpace, $baubar);
                    $restrict = 1;
                    break;
                case 503:
                    $baubar = min(floor($SiloSpace / 2), $baubar);
                    $restrict = 1;
                    break;
                case 407:
                case 408:
                case 409:
                    $baubar = $built[$Element] >= 1 ? 0 : min(1, $baubar);
                    $restrict = 2;
                    break;
                default:
                    $restrict = 0;
                    break;
            }
            // Case nombre d'elements a construire
            if ($CanBuildOne) {
                if (!eco_hangar_is_building($que)) {
                    if ($restrict == 2 and $baubar == 0) {
                        $unit_message .= $lang['only_one'];
                    } elseif ($restrict == 1 and !$baubar) {
                        $unit_message .= $lang['b_no_silo_space'];
                    } else {
                        $TabIndex++;
                    }
                } else {
                    $unit_message = $lang['fleet_on_update'];
                }
            }
            $build_data = eco_get_build_data($user, $planet, $Element, 0);
            $temp[RES_METAL] = floor($planet['metal'] - $build_data[BUILD_CREATE][RES_METAL]);
            // + $fleet_list['own']['total'][RES_METAL]
            $temp[RES_CRYSTAL] = floor($planet['crystal'] - $build_data[BUILD_CREATE][RES_CRYSTAL]);
            // + $fleet_list['own']['total'][RES_CRYSTAL]
            $temp[RES_DEUTERIUM] = floor($planet['deuterium'] - $build_data[BUILD_CREATE][RES_DEUTERIUM]);
            // + $fleet_list['own']['total'][RES_DEUTERIUM]
            $template->assign_block_vars('production', array('ID' => $Element, 'NAME' => $lang['tech'][$Element], 'DESCRIPTION' => $lang['info'][$Element]['description_short'], 'LEVEL' => $ElementCount, 'LEVEL_OLD' => $CurentPlanet[$sn_data[$Element]['name']], 'LEVEL_CHANGE' => $que['in_que'][$Element], 'BUILD_CAN' => min($baubar, $build_data['CAN'][BUILD_CREATE]), 'TIME' => pretty_time($build_data[BUILD_CREATE][RES_TIME]), 'METAL' => $build_data[BUILD_CREATE][RES_METAL], 'CRYSTAL' => $build_data[BUILD_CREATE][RES_CRYSTAL], 'DEUTERIUM' => $build_data[BUILD_CREATE][RES_DEUTERIUM], 'METAL_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_METAL], true, $planet['metal']), 'CRYSTAL_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_CRYSTAL], true, $planet['crystal']), 'DEUTERIUM_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_DEUTERIUM], true, $planet['deuterium']), 'DESTROY_CAN' => $build_data['CAN'][BUILD_DESTROY], 'DESTROY_TIME' => pretty_time($build_data[BUILD_DESTROY][RES_TIME]), 'DESTROY_METAL' => $build_data[BUILD_DESTROY][RES_METAL], 'DESTROY_CRYSTAL' => $build_data[BUILD_DESTROY][RES_CRYSTAL], 'DESTROY_DEUTERIUM' => $build_data[BUILD_DESTROY][RES_DEUTERIUM], 'METAL_REST' => pretty_number($temp[RES_METAL], true, true), 'CRYSTAL_REST' => pretty_number($temp[RES_CRYSTAL], true, true), 'DEUTERIUM_REST' => pretty_number($temp[RES_DEUTERIUM], true, true), 'METAL_REST_NUM' => $temp[RES_METAL], 'CRYSTAL_REST_NUM' => $temp[RES_CRYSTAL], 'DEUTERIUM_REST_NUM' => $temp[RES_DEUTERIUM], 'METAL_BALANCE' => $caps['metal_perhour'][$Element], 'CRYSTAL_BALANCE' => $caps['crystal_perhour'][$Element], 'DEUTERIUM_BALANCE' => $caps['deuterium_perhour'][$Element], 'ENERGY_BALANCE' => $energy_balance, 'ARMOR' => pretty_number($sn_data[$Element]['armor']), 'SHIELD' => pretty_number($sn_data[$Element]['shield']), 'WEAPON' => pretty_number($sn_data[$Element]['attack']), 'TABINDEX' => $TabIndex, 'MESSAGE' => $unit_message));
        }
    }
    $template->assign_vars(array('noresearch' => $NoFleetMessage, 'error_msg' => $page_error, 'MODE' => $que_type, 'QUE_ID' => $que_type, 'TIME_NOW' => $time_now));
    tpl_assign_hangar($que_type, $planet, $template);
    display(parsetemplate($template), $lang[$page_mode]);
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:eco_build_hangar.php

示例2: FleetBuildingPage

function FleetBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $phpEx, $dpath, $_POST;
    if ($CurrentUser['urlaubs_modus'] == 0) {
        if (isset($_POST['fmenge'])) {
            // Es wurde 'Bauen' geklickt
            // Und hat auch eine Liste von [?]
            $AddedInQueue = false;
            // Gut, hier weiss man was und wieviel gebaut werden soll.
            foreach ($_POST['fmenge'] as $Element => $Count) {
                // Bau der Flotte auf der Flottenseite
                // ACHTUNG ! Die Warteschlange der Flotte und Verteidigung werden zusammen verarbeitet.
                // In fmenge, sollte man eine Tabelle der Elemente Baugrundstücke und der Anzahl der Elemente haben
                $Element = intval($Element);
                $Count = intval($Count);
                if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
                    $Count = MAX_FLEET_OR_DEFS_PER_ROW;
                }
                if ($Count != 0) {
                    // Verified, wenn man die notwendige Technologie hat für den Bau des aktuellen Elements
                    if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                        // Verified, hole maximal mögliche Anzahl
                        $MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
                        // Wenn nicht genügend Ressourcen vorhanden sind, wird eine Anpassung der Anzahl der Elemente vorgenommen
                        if ($Count > $MaxElements) {
                            $Count = $MaxElements;
                        }
                        $Ressource = GetElementRessources($Element, $Count);
                        $BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                        if ($Count >= 1) {
                            $CurrentPlanet['metal'] -= $Ressource['metal'];
                            $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                            $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                            $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                        }
                    }
                }
            }
        }
    }
    // -------------------------------------------------------------------------------------------------------
    // Wenn nix gebaut wird / werden kann
    if ($CurrentPlanet[$resource[21]] == 0) {
        // Veuillez avoir l'obligeance de construire le Chantier Spacial !!
        message($lang['need_hangar'], $lang['tech'][21]);
    }
    // -------------------------------------------------------------------------------------------------------
    // Bau der Seite der Baustelle (denn wenn ich hier ... ist, dass ich alles, was Sie brauchen, um ...
    $TabIndex = 0;
    foreach ($lang['tech'] as $Element => $ElementName) {
        if ($Element > 201 && $Element <= 399) {
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                // Disponible à la construction
                // On regarde si on peut en acheter au moins 1
                $CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false);
                // On regarde combien de temps il faut pour construire l'element
                $BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                // Disponibilité actuelle
                $ElementCount = $CurrentPlanet[$resource[$Element]];
                $ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['dispo'] . ": " . pretty_number($ElementCount) . ")";
                // Construction des 3 cases de la ligne d'un element dans la page d'achat !
                // Début de ligne
                $PageTable .= "\n<tr>";
                // Imagette + Link vers la page d'info
                $PageTable .= "<th class=l>";
                $PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">";
                $PageTable .= "<img border=0 src=\"" . $dpath . "gebaeude/" . $Element . ".gif\" align=top width=120 height=120></a>";
                $PageTable .= "</th>";
                // Description
                $PageTable .= "<td class=l>";
                $PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">" . $ElementName . "</a> " . $ElementNbre . "<br>";
                $PageTable .= "" . $lang['res']['descriptions'][$Element] . "<br>";
                // On affiche le 'prix' avec eventuellement ce qui manque en ressource
                $PageTable .= GetElementPrice($CurrentUser, $CurrentPlanet, $Element, false);
                // On affiche le temps de construction (c'est toujours tellement plus joli)
                $PageTable .= ShowBuildTime($BuildOneElementTime);
                $PageTable .= "</td>";
                // Case nombre d'elements a construire
                $PageTable .= "<th class=k>";
                // Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
                if ($CanBuildOne) {
                    $TabIndex++;
                    $PageTable .= "<input type=text name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=5 maxlength=8 value=0 tabindex=" . $TabIndex . ">";
                }
                $PageTable .= "</th>";
                // Fin de ligne (les 3 cases sont construites !!
                $PageTable .= "</tr>";
            }
        }
    }
    if ($CurrentPlanet['b_hangar_id'] != '') {
        $BuildQueue .= ElementBuildListBox($CurrentUser, $CurrentPlanet);
    }
    $parse = $lang;
    // La page se trouve dans $PageTable;
    $parse['buildlist'] = $PageTable;
    // Et la liste de constructions en cours dans $BuildQueue;
    $parse['buildinglist'] = $BuildQueue;
    $page .= parsetemplate(gettemplate('buildings_fleet'), $parse);
    display($page, $lang['Fleet']);
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:FleetBuildingPage.php

示例3: BuildingPage


//.........这里部分代码省略.........
    if ($max_qs > 0) {
        //fine :)
    } else {
        $max_qs = 10;
    }
    if ($Queue['length'] < $max_qs) {
        $CanBuildElement = true;
    } else {
        $CanBuildElement = false;
    }
    if ($_GET['page'] == 'station') {
        if ($planetrow['planet_type'] == 3) {
            $SubTemplate = gettemplate('buildings/station-moon_buttonz');
        } else {
            $SubTemplate = gettemplate('buildings/station_buttonz');
        }
    } elseif ($_GET['page'] == 'resources') {
        $SubTemplate = gettemplate('buildings/resources_buttonz');
    } else {
        die("Hacking attempt");
    }
    $parse = array();
    $infopg = array();
    foreach ($lang['names'] as $Element => $ElementName) {
        if (!$planetrow['planet_type']) {
            die("no planet type");
        }
        if (in_array($Element, $Allowed[$planetrow['planet_type']]) || $_GET['page'] == 'station') {
            if (@in_array($Element, $Allowed[$planetrow['planet_type']])) {
                if (!IsTechnologieAccessible($user, $planetrow, $Element)) {
                    $parse['state_' . $Element] = "off";
                    $parse['mes_' . $Element] = "Requirements are not met";
                    $parse['canbuild_' . $Element] = "";
                } elseif (!IsElementBuyable($user, $planetrow, $Element, true, false) && $Queue['length'] == 0) {
                    $parse['state_' . $Element] = "disabled";
                    $parse['mes_' . $Element] = "Not enough resources!";
                    $parse['canbuild_' . $Element] = "";
                } elseif (!$CanBuildElement) {
                    $parse['state_' . $Element] = "disabled";
                    $parse['mes_' . $Element] = "Queue is full!";
                    $parse['canbuild_' . $Element] = "";
                } else {
                    $parse['state_' . $Element] = "on";
                    $parse['mes_' . $Element] = "";
                    $parse['canbuild_' . $Element] = "\n\t\t\t\t\t\t<a class=\"fastBuild tips\" href=\"#\" onclick=\"loadpage('./?page=" . $_GET['page'] . "&cmd=insert&building={$Element}&id={$Element}',document.title,document.body.id);\">\n\t\t\t\t\t\t\t<img src=\"" . GAME_SKIN . "/img/layout/sofort_bauen.gif\" height=\"14\" width=\"22\">\n\t\t\t\t\t\t</a>";
                }
            } else {
                $parse['state_' . $Element] = "off";
                $parse['mes_' . $Element] = "Not availble";
                $parse['canbuild_' . $Element] = "";
            }
            $parse['name_' . $Element] = $ElementName;
            $parse['count_' . $Element] = $planetrow[$resource[$Element]];
        }
    }
    //Countdowns
    if ($planetrow['b_building'] > 0) {
        $BuildQueue = explode(";", $planetrow['b_building_id']);
        $CurrBuild = explode(",", $BuildQueue[0]);
        $parse['countdown_' . $CurrBuild[0]] = "\n\t\t\t\t\t\t\t\t\t<div class=\"construction\">\n\n\t\t\t\t\t\t\t\t\t\t<div class=\"pusher\" style=\"height: 80px; margin-bottom: -80px;\">\n\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"time\" id=\"resource\">" . parsecountdown($planetrow['b_building']) . "</span>\n\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t</div>\n";
    }
    $BuildingPage = parsetemplate($SubTemplate, $parse);
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['names'][$Element];
    // Faut il afficher la liste de construction ??
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:BuildingPage.php

示例4: BatimentBuildingPage

/**
 * BatimentBuildingPage.php
 *
 * @version 1.1
 * @copyright 2008 by Chlorel for XNova
 *
 * fix by vomi, zeus (team xorbit) for XNova
 */
function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
    CheckPlanetUsedFields($CurrentPlanet);
    // Tables des batiments possibles par type de planete
    $Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44);
    $Allowed['3'] = array(12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
    // Boucle d'interpretation des eventuelles commandes
    if ($CurrentUser['urlaubs_modus'] == 0) {
        if (isset($_GET['cmd'])) {
            // On passe une commande
            $bDoItNow = false;
            $TheCommand = $_GET['cmd'];
            $Gebaude = false;
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $_GET['building'])) {
                $Gebaude = IsElementBuyable($CurrentUser, $CurrentPlanet, $_GET['building'], true, false);
            }
            //Gebäude-Cheat-Fix Wolle1989
            //ändern für andere Bannzeiten in Sekunden
            $bannzeit = 60;
            // so lassen
            $time = time();
            $bantime = $time + $bannzeit;
            $Gebaude = false;
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $_GET['building'])) {
                $Gebaude = IsElementBuyable($CurrentUser, $CurrentPlanet, $_GET['building'], true, false);
            }
            $Element = $_GET['building'];
            if (!$Gebaude) {
                doquery("UPDATE {{table}} SET bana='1', banaday='{$bantime}' WHERE id='{$CurrentUser['id']}'", "users");
                doquery("INSERT INTO {{table}} SET\r\n\t\t\t\t`who` = '{$CurrentUser['username']}',\r\n\t\t\t\t`theme`= 'Cheatversuch',\r\n\t\t\t\t`who2` = '{$CurrentUser['id']}',\r\n\t\t\t\t`time` = '{$time}',\r\n\t\t\t\t`longer` = '{$bantime}',\r\n\t\t\t\t`author` = 'SYSTEM: B',\r\n\t\t\t\t`email` = 'n'", 'banned');
                message($lang['CHEATATTEMPT'], $lang['CHEATATTEMPT_TITLE']);
                die;
            }
            $ListID = $_GET['listid'];
            if (isset($Element)) {
                if (!strchr($Element, ",")) {
                    if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
                        $bDoItNow = true;
                    }
                }
            } elseif (isset($ListID)) {
                $bDoItNow = true;
            }
            //Hier wird geprüft ob ein ; in die URL(GET)Geschrieben wurde
            foreach ($_GET as $check_url) {
                if (eregi(";", $check_url)) {
                    die($lang['ANTICHEAT_MESSAGE']);
                }
            }
            //Hier wird gescheckt ob ein user das zeichen ; in einen INPUT schreibt
            foreach ($_POST as $check_pos) {
                if (eregi(";", $check_post, $check_url)) {
                    die($lang['ANTICHEAT_MESSAGE']);
                }
            }
            if ($bDoItNow == true) {
                switch ($TheCommand) {
                    case 'cancel':
                        // Interrompre le premier batiment de la queue
                        CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
                        break;
                    case 'remove':
                        // Supprimer un element de la queue (mais pas le premier)
                        // $RemID -> element de la liste a supprimer
                        RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
                        break;
                    case 'insert':
                        // Insere un element dans la queue
                        AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                        break;
                    case 'destroy':
                        // Detruit un batiment deja construit sur la planete !
                        AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
                        break;
                    default:
                        break;
                }
                // switch
            }
        }
    }
    SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
    $Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
    // On enregistre ce que l'on a modifi� dans planet !
    BuildingSavePlanetRecord($CurrentPlanet);
    // On enregistre ce que l'on a eventuellement modifi� dans users
    BuildingSaveUserRecord($CurrentUser);
    if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
        $CanBuildElement = true;
    } else {
        $CanBuildElement = false;
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:BatimentBuildingPage.php

示例5: BatimentBuildingPage

/**
 * BatimentBuildingPage.php
 *
 * @version 1.1
 * @copyright 2008 by Chlorel for XNova
 */
function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
    CheckPlanetUsedFields($CurrentPlanet);
    // Tables des batiments possibles par type de planete
    $Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44);
    $Allowed['3'] = array(12, 14, 15, 21, 34, 41, 42, 43);
    // Boucle d'interpretation des eventuelles commandes
    if (isset($_GET['cmd'])) {
        // On passe une commande
        $bThisIsCheated = false;
        $bDoItNow = false;
        $TheCommand = $_GET['cmd'];
        $Element = $_GET['building'];
        $ListID = $_GET['listid'];
        if (isset($Element)) {
            if (!strchr($Element, " ")) {
                if (!strchr($Element, ",")) {
                    if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
                        $bDoItNow = true;
                    } else {
                        $bThisIsCheated = true;
                    }
                } else {
                    $bThisIsCheated = true;
                }
            } else {
                $bThisIsCheated = true;
            }
        } elseif (isset($ListID)) {
            $bDoItNow = true;
        }
        if ($bDoItNow == true) {
            switch ($TheCommand) {
                case 'cancel':
                    // Interrompre le premier batiment de la queue
                    CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
                    break;
                case 'remove':
                    // Supprimer un element de la queue (mais pas le premier)
                    // $RemID -> element de la liste a supprimer
                    RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
                    break;
                case 'insert':
                    // Insere un element dans la queue
                    AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                    break;
                case 'destroy':
                    // Detruit un batiment deja construit sur la planete !
                    AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
                    break;
                default:
                    break;
            }
            // switch
        } elseif ($bThisIsCheated == true) {
            ResetThisFuckingCheater($CurrentUser['id']);
        }
    }
    SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
    $Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
    // On enregistre ce que l'on a modifi&eacute; dans planet !
    BuildingSavePlanetRecord($CurrentPlanet);
    // On enregistre ce que l'on a eventuellement modifi&eacute; dans users
    BuildingSaveUserRecord($CurrentUser);
    if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
        $CanBuildElement = true;
    } else {
        $CanBuildElement = false;
    }
    $SubTemplate = gettemplate('buildings_builds_row');
    $BuildingPage = "";
    foreach ($lang['tech'] as $Element => $ElementName) {
        if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
            $CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
            if ($CurrentPlanet["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
                $RoomIsOk = true;
            } else {
                $RoomIsOk = false;
            }
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
                $parse = array();
                $parse['dpath'] = $dpath;
                $parse['i'] = $Element;
                $BuildingLevel = $CurrentPlanet[$resource[$Element]];
                $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
                $parse['n'] = $ElementName;
                $parse['descriptions'] = $lang['res']['descriptions'][$Element];
                $ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                $parse['time'] = ShowBuildTime($ElementBuildTime);
                $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
                $parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
                $parse['click'] = '';
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:BatimentBuildingPage.php

示例6: DefensesBuildingPage


//.........这里部分代码省略.........
                $InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
                $IsBuild = $CurrentPlanet[$resource[407]] >= 1 ? true : false;
                if ($Element == 407 || $Element == 408) {
                    if ($InQueue === false && !$IsBuild) {
                        $Count = 1;
                    }
                }
                if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                    $MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
                    if ($Element == 502 || $Element == 503) {
                        $ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
                        $MissilesSpace = $MaxMissiles - $ActuMissiles;
                        if ($Element == 502) {
                            if ($Count > $MissilesSpace) {
                                $Count = $MissilesSpace;
                            }
                        } else {
                            if ($Count > floor($MissilesSpace / 2)) {
                                $Count = floor($MissilesSpace / 2);
                            }
                        }
                        if ($Count > $MaxElements) {
                            $Count = $MaxElements;
                        }
                        $Missiles[$Element] += $Count;
                    } else {
                        if ($Count > $MaxElements) {
                            $Count = $MaxElements;
                        }
                    }
                    $Ressource = GetElementRessources($Element, $Count);
                    $BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                    if ($Count >= 1) {
                        $CurrentPlanet['metal'] -= $Ressource['metal'];
                        $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                        $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                        $CurrentPlanet['tachyon'] -= $Ressource['tachyon'];
                        $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                    }
                }
            }
        }
    }
    if ($CurrentPlanet[$resource[21]] == 0) {
        message($lang['need_hangar'], $lang['tech'][21]);
    }
    $TabIndex = 0;
    $PageTable = "";
    foreach ($lang['tech'] as $Element => $ElementName) {
        if ($Element > 400 && $Element <= 599) {
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                $CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false);
                $BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                $ElementCount = $CurrentPlanet[$resource[$Element]];
                $ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['dispo'] . ": " . pretty_number($ElementCount) . ")";
                $PageTable .= "\n<tr>";
                $PageTable .= "<th class=k>";
                $PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">";
                $PageTable .= "<img border=0 src=\"" . $dpath . "gebaeude/" . $Element . ".gif\" align=top width=120 height=120></a>";
                $PageTable .= "</th>";
                $PageTable .= "<td class=k>";
                $PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">" . $ElementName . "</a> " . $ElementNbre . "<br>";
                $PageTable .= "" . $lang['res']['descriptions'][$Element] . "<br>";
                $PageTable .= GetElementPrice($CurrentUser, $CurrentPlanet, $Element, false);
                $PageTable .= ShowBuildTime($BuildOneElementTime);
                $PageTable .= "</td>";
                $PageTable .= "<th class=k>";
                if ($CanBuildOne) {
                    $InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
                    $IsBuild = $CurrentPlanet[$resource[407]] >= 1 ? true : false;
                    $BuildIt = true;
                    if ($Element == 407 || $Element == 408) {
                        $BuildIt = false;
                        if ($InQueue === false && !$IsBuild) {
                            $BuildIt = true;
                        }
                    }
                    if (!$BuildIt) {
                        $PageTable .= "<font color=\"red\">" . $lang['only_one'] . "</font>";
                    } else {
                        $TabIndex++;
                        $PageTable .= "<input type=text name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=7 maxlength=7 value=0 tabindex=" . $TabIndex . ">";
                        $PageTable .= "</th>";
                    }
                } else {
                    $PageTable .= "</th>";
                }
                $PageTable .= "</tr>";
            }
        }
    }
    if ($CurrentPlanet['b_hangar_id'] != '') {
        $BuildQueue .= ElementBuildListBox($CurrentUser, $CurrentPlanet);
    }
    $parse = $lang;
    $parse['buildlist'] = $PageTable;
    $parse['buildinglist'] = $BuildQueue;
    $page .= parsetemplate(gettemplate('buildings_defense'), $parse);
    display($page, $lang['Defense']);
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:DefensesBuildingPage.php

示例7: ShowResearchPage

 public function ShowResearchPage(&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
 {
     global $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
     include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
     include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
     $PageParse = $lang;
     $NoResearchMessage = "";
     $bContinue = true;
     if ($CurrentPlanet[$resource[31]] == 0) {
         message($lang['bd_lab_required'], '', '', true);
     }
     if (!$this->CheckLabSettingsInQueue($CurrentPlanet)) {
         $NoResearchMessage = $lang['bd_building_lab'];
         $bContinue = false;
     }
     if (isset($_GET['cmd'])) {
         $TheCommand = $_GET['cmd'];
         $Techno = intval($_GET['tech']);
         if (isset($Techno)) {
             if (!strstr($Techno, ",") && !strchr($Techno, " ") && !strchr($Techno, "+") && !strchr($Techno, "*") && !strchr($Techno, "~") && !strchr($Techno, "=") && !strchr($Techno, ";") && !strchr($Techno, "'") && !strchr($Techno, "#") && !strchr($Techno, "-") && !strchr($Techno, "_") && !strchr($Techno, "[") && !strchr($Techno, "]") && !strchr($Techno, ".") && !strchr($Techno, ":")) {
                 if (in_array($Techno, $reslist['tech'])) {
                     if (is_array($ThePlanet)) {
                         $WorkingPlanet = $ThePlanet;
                     } else {
                         $WorkingPlanet = $CurrentPlanet;
                     }
                     switch ($TheCommand) {
                         case 'cancel':
                             if ($ThePlanet['b_tech_id'] == $Techno) {
                                 $costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
                                 $WorkingPlanet['metal'] += $costs['metal'];
                                 $WorkingPlanet['crystal'] += $costs['crystal'];
                                 $WorkingPlanet['deuterium'] += $costs['deuterium'];
                                 $WorkingPlanet['darkmatter'] += $costs['darkmatter'];
                                 $WorkingPlanet['b_tech_id'] = 0;
                                 $WorkingPlanet["b_tech"] = 0;
                                 $CurrentUser['b_tech_planet'] = 0;
                                 $UpdateData = true;
                                 $InResearch = false;
                             }
                             break;
                         case 'search':
                             if (IsTechnologieAccessible($CurrentUser, $WorkingPlanet, $Techno) && IsElementBuyable($CurrentUser, $WorkingPlanet, $Techno)) {
                                 $costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
                                 $WorkingPlanet['metal'] -= $costs['metal'];
                                 $WorkingPlanet['crystal'] -= $costs['crystal'];
                                 $WorkingPlanet['deuterium'] -= $costs['deuterium'];
                                 $WorkingPlanet['darkmatter'] -= $costs['darkmatter'];
                                 $WorkingPlanet["b_tech_id"] = $Techno;
                                 $WorkingPlanet["b_tech"] = time() + GetBuildingTime($CurrentUser, $WorkingPlanet, $Techno);
                                 $CurrentUser["b_tech_planet"] = $WorkingPlanet["id"];
                                 $UpdateData = true;
                                 $InResearch = true;
                             }
                             break;
                     }
                     if ($UpdateData == true) {
                         $QryUpdatePlanet = "UPDATE {{table}} SET ";
                         $QryUpdatePlanet .= "`b_tech_id` = '" . $WorkingPlanet['b_tech_id'] . "', ";
                         $QryUpdatePlanet .= "`b_tech` = '" . $WorkingPlanet['b_tech'] . "', ";
                         $QryUpdatePlanet .= "`metal` = '" . $WorkingPlanet['metal'] . "', ";
                         $QryUpdatePlanet .= "`crystal` = '" . $WorkingPlanet['crystal'] . "', ";
                         $QryUpdatePlanet .= "`deuterium` = '" . $WorkingPlanet['deuterium'] . "', ";
                         $QryUpdatePlanet .= "`darkmatter` = '" . $WorkingPlanet['darkmatter'] . "' ";
                         $QryUpdatePlanet .= "WHERE ";
                         $QryUpdatePlanet .= "`id` = '" . $WorkingPlanet['id'] . "';";
                         doquery($QryUpdatePlanet, 'planets');
                         $QryUpdateUser = "UPDATE {{table}} SET ";
                         $QryUpdateUser .= "`b_tech_planet` = '" . $CurrentUser['b_tech_planet'] . "' ";
                         $QryUpdateUser .= "WHERE ";
                         $QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
                         doquery($QryUpdateUser, 'users');
                     }
                     $CurrentPlanet = $WorkingPlanet;
                     if (is_array($ThePlanet)) {
                         $ThePlanet = $WorkingPlanet;
                     } else {
                         $CurrentPlanet = $WorkingPlanet;
                         if ($TheCommand == 'search') {
                             $ThePlanet = $CurrentPlanet;
                         }
                     }
                 }
             } else {
                 die(header("location:game.php?page=buildings&mode=research"));
             }
         } else {
             $bContinue = false;
         }
         header("Location: game.php?page=buildings&mode=research");
     }
     $siguiente = 1;
     $BuildingPage = "";
     $zaehler = 1;
     $TechRowTPL = gettemplate('buildings/buildings_research_row');
     $TechScrTPL = gettemplate('buildings/buildings_research_script');
     foreach ($lang['tech'] as $Tech => $TechName) {
         if ($Tech > 105 && $Tech <= 199) {
             if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
                 $RowParse['dpath'] = $dpath;
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowResearchPage.php

示例8: DefensesBuildingPage


//.........这里部分代码省略.........
                        }
                        $Ressource = GetElementRessources($Element, $Count);
                        $BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                        if ($Count >= 1) {
                            $CurrentPlanet['metal'] -= $Ressource['metal'];
                            $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                            $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                            $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                        }
                    }
                }
            }
        }
    }
    // -------------------------------------------------------------------------------------------------------
    // S'il n'y a pas de Chantier ...
    if ($CurrentPlanet[$resource[21]] == 0) {
        $shipyard = false;
    } else {
        $shipyard = true;
    }
    // -------------------------------------------------------------------------------------------------------
    // Construction de la page du Chantier (car si j'arrive ici ... c'est que j'ai tout ce qu'il faut pour ...
    $TabIndex = 0;
    $PageTable = "";
    $SubTemplate = gettemplate('buildings/defense_buttonz');
    $parse = array();
    $infopg = array();
    foreach ($lang['tech'] as $Element => $ElementName) {
        if (in_array($Element, $reslist['defense'])) {
            if (!IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                $parse['state_' . $Element] = "off";
                $parse['mes_' . $Element] = "Requirements are not met";
            } elseif (!IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false)) {
                $parse['state_' . $Element] = "disabled";
                $parse['mes_' . $Element] = "Not enough resources!";
            } else {
                $parse['state_' . $Element] = "on";
                $parse['mes_' . $Element] = "";
            }
            $parse['name_' . $Element] = $ElementName;
            $parse['count_' . $Element] = $CurrentPlanet[$resource[$Element]];
        } else {
            $parse['state_' . $Element] = "off";
            $parse['mes_' . $Element] = "Not availble";
        }
    }
    $Buttonz = parsetemplate($SubTemplate, $parse);
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['tech'][$Element];
    if (!$Element) {
        $parse['bg'] = "../img/headerCache/station/" . $parse['type'] . ".png";
    } else {
        if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element) && IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false)) {
            $infopg['build_link'] = '#" onclick="document.forms.shipyard.submit()';
        }
        //Building Info
        if ($infopg['build_link']) {
            $infopg['buildit_class'] = "build-it";
            $infopg['build_text'] = "Build";
        } else {
            $infopg['buildit_class'] = "build-it_disabled";
            $infopg['build_text'] = "Build";
        }
        $infopg['id'] = $Element;
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:DefensesBuildingPage.php

示例9: ProductionBuildingPage


//.........这里部分代码省略.........
                    break;
            }
            // switch
        } elseif ($bThisIsCheated == true) {
            ResetThisFuckingCheater($CurrentUser['id']);
        }
    }
    SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
    $Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
    // On enregistre ce que l'on a modifi� dans planet !
    BuildingSavePlanetRecord($CurrentPlanet);
    // On enregistre ce que l'on a eventuellement modifi� dans users
    BuildingSaveUserRecord($CurrentUser);
    $max_qs = MAX_BUILDING_QUEUE_SIZE;
    if ($max_qs > 0) {
        //fine :)
    } else {
        $max_qs = 10;
    }
    if ($Queue['lenght'] < $max_qs) {
        $CanBuildElement = true;
    } else {
        $CanBuildElement = false;
    }
    $SubTemplate = gettemplate('buildings_res_buttonz');
    $parse = array();
    $infopg = array();
    foreach ($lang['tech'] as $Element => $ElementName) {
        if (in_array($Element, $Allowed[1])) {
            if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
                if (!IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                    $parse['state_' . $Element] = "off";
                    $parse['mes_' . $Element] = "Requirements are not met";
                } elseif (!IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false)) {
                    $parse['state_' . $Element] = "disabled";
                    $parse['mes_' . $Element] = "Not enough resources!";
                } else {
                    $parse['state_' . $Element] = "on";
                    $parse['mes_' . $Element] = "";
                }
            } else {
                $parse['state_' . $Element] = "off";
                $parse['mes_' . $Element] = "Not availble";
            }
            $parse['name_' . $Element] = $ElementName;
            $parse['count_' . $Element] = $CurrentPlanet[$resource[$Element]];
        }
    }
    $BuildingPage = parsetemplate($SubTemplate, $parse);
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['tech'][$Element];
    // Faut il afficher la liste de construction ??
    if ($Queue['lenght'] > 0) {
        $parse['BuildListScript'] = '';
        //$parse['BuildListScript']  = InsertBuildListScript ( "buildings" );
        $parse['BuildList'] = $Queue['buildlist'];
    } else {
        $parse['BuildListScript'] = "";
        $parse['BuildList'] = "";
    }
    $de_planettype = PlanetType($CurrentPlanet['image']);
    $parse['type'] = $de_planettype['type'];
    $parse['bg'] = GAME_SKIN . "/img/header/resources/" . $parse['type'] . $imgnum . ".png";
    $parse['hideres'] = "display:none;";
    $parse['hidenorm'] = "";
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:ProductionBuildingPage.php

示例10: ShowBuildingQueue

function ShowBuildingQueue($CurrentPlanet, $CurrentUser)
{
    global $lang, $dpath, $reslist, $resource;
    $BuildingNow = array();
    $CurrentQueue = $CurrentPlanet['b_building_id'];
    $QueueID = 0;
    if ($CurrentQueue != 0) {
        $QueueArray = explode(";", $CurrentQueue);
        $ActualCount = count($QueueArray);
    } else {
        $QueueArray = "0";
        $ActualCount = 0;
    }
    $ListIDRow = "";
    if ($ActualCount != 0) {
        $ListIDRow .= "<tr><td class='c' colspan='3' align='center'>" . $lang['Constructions'] . "<font color='#00FF00'>" . $ActualCount . "</font> von <font color='#FF0000'>" . MAX_BUILDING_QUEUE_SIZE . "</font></td></tr>";
        $PlanetID = $CurrentPlanet['id'];
        $totalBuildTime = 0;
        $totalBuildEndTime = time();
        if (MAX_BUILDING_QUEUE_SIZE - $ActualCount > 0) {
            $CanBuild = true;
        } else {
            $Canbuild = false;
        }
        foreach ($reslist['build'] as $Element) {
            $BuildingNow[$Element] = $CurrentPlanet[$resource[$Element]];
        }
        for ($QueueID = 0; $QueueID < $ActualCount; $QueueID++) {
            $BuildArray = explode(",", $QueueArray[$QueueID]);
            $BuildEndTime = floor($BuildArray[3]);
            $CurrentTime = floor(time());
            if ($BuildEndTime >= $CurrentTime) {
                $ListID = $QueueID + 1;
                $Element = $BuildArray[0];
                $BuildingNow[$Element] = $BuildArray[1];
                $BuildLevel = $BuildArray[1];
                $BuildMode = $BuildArray[4];
                $BuildTime = $BuildEndTime - time();
                $totalBuildTime = $BuildTime;
                $totalBuildEndTime = $BuildEndTime;
                $ElementTitle = $lang['tech'][$Element];
                if (IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false) and IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element) and $CanBuild and $CurrentPlanet["field_current"] < CalculateMaxPlanetFields($CurrentPlanet) - $ActualCount) {
                    $CanBuild = true;
                } else {
                    $CanBuild = false;
                }
                if ($BuildMode == 'build') {
                    $modo_rep = 'insert';
                    $multi = 1;
                } else {
                    $modo_rep = 'destroy';
                    $multi = 2;
                }
                if ($CanBuild) {
                    $levelmore = "<a href='buildings.php?cmd={$modo_rep}&building=" . $Element . "'>" . $lang['Next'] . "</a> ";
                } else {
                    $levelmore = '';
                }
                if ($ListID > 0) {
                    $ListIDRow .= "<tr>";
                    if ($ListID == 1) {
                        $ListIDRow .= "<th colspan=\"3\">";
                        $ListIDRow .= "    <table width=\"100%\">";
                        $ListIDRow .= "        <tr>";
                        $ListIDRow .= "                <td width='80' rowspan='2'><a href='infos.php?gid=" . $Element . "'><img border='0' src='" . $dpath . "gebaeude/" . $Element . ".gif' align='top' title='" . $ElementTitle . "' width='80' height='80'></a></td>";
                        if ($BuildMode == 'build') {
                            $ListIDRow .= "            <td><center>";
                            $ListIDRow .= "            <table>";
                            $ListIDRow .= "            <tr>";
                            $ListIDRow .= "            <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
                            $ListIDRow .= "            <td class='c'><center><font color =\"#6699FF\"><a href='infos.php?gid=" . $Element . "'><font color =\"#6699FF\">- " . $ElementTitle . " </font></a><br />" . $lang['BuildNextLevel'] . "<font color=\"#FF8C00\"><b>" . $lang['level'] . " " . $BuildLevel . "</b></font></font></center></td>";
                            $ListIDRow .= "            <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
                            $ListIDRow .= "            </tr>";
                            $ListIDRow .= "            <tr>";
                            $ListIDRow .= "            <td class='c' colspan='3'><center>" . $levelmore . "</center></td>";
                            $ListIDRow .= "            </tr>";
                            $ListIDRow .= "            </table>";
                            $ListIDRow .= "            </center></td>";
                        } else {
                            $ListIDRow .= "            <td class='c'><center>";
                            $ListIDRow .= "            <table>";
                            $ListIDRow .= "            <tr>";
                            $ListIDRow .= "            <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
                            $ListIDRow .= "            <td class='c'><center><font color =\"#6699FF\"><a href='infos.php?gid=" . $Element . "'><font color =\"#6699FF\"> " . $ElementTitle . " </font></a><br /><font color=\"#87CEEB\"><blink>" . $lang['bd_dismantle'] . "</blink></font> en <font color=\"#FF8C00\"><b>Nivel " . $BuildLevel . "</b></font></font></center></td>";
                            $ListIDRow .= "            <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
                            $ListIDRow .= "            </tr>";
                            $ListIDRow .= "            </table>";
                            $ListIDRow .= "            </center></td>";
                        }
                        $ListIDRow .= "            <td class='c' width=\"56\" rowspan='2'><center>";
                        $ListIDRow .= "                <div id=\"blc\" class=\"z\">" . $BuildTime . "<br><a href=\"buildings.php?listid=" . $ListID . "&amp;cmd=cancel&amp;planet=" . $PlanetID . "\">" . $lang['bd_interrupt'] . "</a></div>";
                        $ListIDRow .= "                <script language=\"JavaScript\">";
                        $ListIDRow .= "                    pp = \"" . $BuildTime . "\";\n";
                        $ListIDRow .= "                    pk = \"" . $ListID . "\";\n";
                        $ListIDRow .= "                    pm = \"cancel\";\n";
                        $ListIDRow .= "                    pl = \"" . $PlanetID . "\";\n";
                        $ListIDRow .= "                    t();\n";
                        $ListIDRow .= "                </script>";
                        $ListIDRow .= "                <strong color=\"lime\"><br><font color=\"lime\">" . date("j/m H:i:s", $BuildEndTime) . "</font></strong></center>";
                        $ListIDRow .= "            </td>";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowBuildingQueue.php

示例11: BatimentBuildingPage


//.........这里部分代码省略.........
                default:
                    break;
            }
            // switch
        } elseif ($bThisIsCheated == true) {
            ResetThisFuckingCheater($CurrentUser['id']);
        }
        sleep(1);
        // es wird 1 sekunde geschlafen
    }
    SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
    $Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
    // On enregistre ce que l'on a modifi&eacute; dans planet !
    BuildingSavePlanetRecord($CurrentPlanet);
    // On enregistre ce que l'on a eventuellement modifi&eacute; dans users
    BuildingSaveUserRecord($CurrentUser);
    if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
        $CanBuildElement = true;
    } else {
        $CanBuildElement = false;
    }
    $SubTemplate = gettemplate('buildings_builds_row');
    $BuildingPage = "";
    $zaehler = 1;
    foreach ($lang['tech'] as $Element => $ElementName) {
        if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
            $CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
            if ($CurrentPlanet['field_current'] < $CurrentMaxFields - $Queue['lenght']) {
                $RoomIsOk = true;
            } else {
                $RoomIsOk = false;
            }
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
                $parse = array();
                $parse['dpath'] = $dpath;
                $parse['i'] = $Element;
                $BuildingLevel = $CurrentPlanet[$resource[$Element]];
                $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
                $parse['n'] = $ElementName;
                $parse['descriptions'] = $lang['res']['descriptions'][$Element];
                $ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                $parse['time'] = ShowBuildTime($ElementBuildTime);
                $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
                $parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
                $parse['click'] = '';
                $NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
                // show energy on BuildingPage
                //================================
                $BuildLevelFactor = $CurrentPlanet[$resource[$Element] . "_porcent"];
                $BuildTemp = $CurrentPlanet['temp_max'];
                $CurrentBuildtLvl = $BuildingLevel;
                $BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
                $Prod[3] = floor(eval($ProdGrid[$Element]['formule']['deuterium']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_geologue'] * 0.05);
                $Prod[11] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
                if ($Element != 12) {
                    $ActualNeed = floor($Prod[11]);
                } else {
                    $ActualNeed = floor($Prod[3]);
                }
                $BuildLevel++;
                $Prod[3] = floor(eval($ProdGrid[$Element]['formule']['deuterium']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_geologue'] * 0.05);
                $Prod[11] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
                if ($Element != 12) {
                    $bloc['build_prod'] = pretty_number(floor($Prod[$BuildID]));
                    $bloc['build_prod_diff'] = colorNumber(pretty_number(floor($Prod[$BuildID] - $ActualProd)));
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:BatimentBuildingPage.php

示例12: ResearchBuildingPage

function ResearchBuildingPage(&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
{
    global $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
    $NoResearchMessage = "";
    $bContinue = true;
    if ($CurrentPlanet[$resource[31]] == 0) {
        message($lang['no_laboratory'], $lang['Research']);
    }
    if (!CheckLabSettingsInQueue($CurrentPlanet)) {
        $NoResearchMessage = $lang['labo_on_update'];
        $bContinue = false;
    }
    if (isset($_GET['cmd'])) {
        $TheCommand = $_GET['cmd'];
        $Techno = intval($_GET['tech']);
        if (is_numeric($Techno)) {
            if (in_array($Techno, $reslist['tech'])) {
                if (is_array($ThePlanet)) {
                    $WorkingPlanet = $ThePlanet;
                } else {
                    $WorkingPlanet = $CurrentPlanet;
                }
                switch ($TheCommand) {
                    case 'cancel':
                        if ($ThePlanet['b_tech_id'] == $Techno) {
                            $Needed = GetBuildingPrice($CurrentUser, $CurrentPlanet, $Techno, true, $ForDestroy);
                            $CurrentPlanet['metal'] += $Needed['metal'];
                            $CurrentPlanet['crystal'] += $Needed['crystal'];
                            $CurrentPlanet['deuterium'] += $Needed['deuterium'];
                            $WorkingPlanet['b_tech_id'] = 0;
                            $WorkingPlanet["b_tech"] = 0;
                            $CurrentUser['b_tech_planet'] = 0;
                            $UpdateData = true;
                            $InResearch = false;
                        }
                        break;
                    case 'search':
                        if (IsTechnologieAccessible($CurrentUser, $WorkingPlanet, $Techno) && IsElementBuyable($CurrentUser, $WorkingPlanet, $Techno)) {
                            $costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
                            $WorkingPlanet['metal'] -= $costs['metal'];
                            $WorkingPlanet['crystal'] -= $costs['crystal'];
                            $WorkingPlanet['deuterium'] -= $costs['deuterium'];
                            $WorkingPlanet["b_tech_id"] = $Techno;
                            $WorkingPlanet["b_tech"] = time() + GetBuildingTime($CurrentUser, $WorkingPlanet, $Techno);
                            $CurrentUser["b_tech_planet"] = $WorkingPlanet["id"];
                            $UpdateData = true;
                            $InResearch = true;
                        }
                        break;
                }
                if ($UpdateData == true) {
                    $QryUpdatePlanet = "UPDATE {{table}} SET ";
                    $QryUpdatePlanet .= "`b_tech_id` = '" . $WorkingPlanet['b_tech_id'] . "', ";
                    $QryUpdatePlanet .= "`b_tech` = '" . $WorkingPlanet['b_tech'] . "', ";
                    $QryUpdatePlanet .= "`metal` = '" . $WorkingPlanet['metal'] . "', ";
                    $QryUpdatePlanet .= "`crystal` = '" . $WorkingPlanet['crystal'] . "', ";
                    $QryUpdatePlanet .= "`deuterium` = '" . $WorkingPlanet['deuterium'] . "' ";
                    $QryUpdatePlanet .= "WHERE ";
                    $QryUpdatePlanet .= "`id` = '" . $WorkingPlanet['id'] . "';";
                    doquery($QryUpdatePlanet, 'planets');
                    $QryUpdateUser = "UPDATE {{table}} SET ";
                    $QryUpdateUser .= "`b_tech_planet` = '" . $CurrentUser['b_tech_planet'] . "' ";
                    $QryUpdateUser .= "WHERE ";
                    $QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
                    doquery($QryUpdateUser, 'users');
                }
                if (is_array($ThePlanet)) {
                    $ThePlanet = $WorkingPlanet;
                } else {
                    $CurrentPlanet = $WorkingPlanet;
                    if ($TheCommand == 'search') {
                        $ThePlanet = $CurrentPlanet;
                    }
                }
            }
        } else {
            $bContinue = false;
        }
    }
    $TechRowTPL = gettemplate('buildings_research_row');
    $TechScrTPL = gettemplate('buildings_research_script');
    foreach ($lang['tech'] as $Tech => $TechName) {
        if ($Tech > 105 && $Tech <= 199) {
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
                $RowParse = $lang;
                $RowParse['dpath'] = $dpath;
                $RowParse['tech_id'] = $Tech;
                $building_level = $CurrentUser[$resource[$Tech]];
                $RowParse['tech_level'] = $building_level == 0 ? "" : "( " . $lang['level'] . " " . $building_level . " )";
                $RowParse['tech_name'] = $TechName;
                $RowParse['tech_descr'] = $lang['res']['descriptions'][$Tech];
                $RowParse['tech_price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Tech);
                $SearchTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Tech);
                $RowParse['search_time'] = ShowBuildTime($SearchTime);
                $RowParse['tech_restp'] = $lang['Rest_ress'] . " " . GetRestPrice($CurrentUser, $CurrentPlanet, $Tech, true);
                $CanBeDone = IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech);
                if (!$InResearch) {
                    $LevelToDo = 1 + $CurrentUser[$resource[$Tech]];
                    if ($CanBeDone) {
                        if (!CheckLabSettingsInQueue($CurrentPlanet)) {
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ResearchBuildingPage.php

示例13: DefensesBuildingPage


//.........这里部分代码省略.........
                     $Ressource = $this->GetElementRessources($Element, $Count);
                     if ($Count >= 1) {
                         $CurrentPlanet['metal'] -= $Ressource['metal'];
                         $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                         $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                         $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                     }
                 }
             }
         }
         header("Location: game.php?page=buildings&mode=defense");
     }
     if ($CurrentPlanet[$resource[21]] == 0) {
         message($lang['bd_shipyard_required'], '', '', true);
     }
     $NotBuilding = true;
     if ($CurrentPlanet['b_building_id'] != 0) {
         $CurrentQueue = $CurrentPlanet['b_building_id'];
         if (strpos($CurrentQueue, ";")) {
             // FIX BY LUCKY - IF THE SHIPYARD IS IN QUEUE THE USER CANT RESEARCH ANYTHING...
             $QueueArray = explode(";", $CurrentQueue);
             for ($i = 0; $i < MAX_BUILDING_QUEUE_SIZE; $i++) {
                 $ListIDArray = explode(",", $QueueArray[$i]);
                 $Element = $ListIDArray[0];
                 if ($Element == 21 or $Element == 14 or $Element == 15) {
                     break;
                 }
             }
             // END - FIX
         } else {
             $CurrentBuilding = $CurrentQueue;
         }
         if ($CurrentBuilding == 21 or $CurrentBuilding == 14 or $CurrentBuilding == 15 or ($Element == 21 or $Element == 14 or $Element == 15)) {
             $parse[message] = "<font color=\"red\">" . $lang['bd_building_shipyard'] . "</font>";
             $NotBuilding = false;
         }
     }
     $TabIndex = 0;
     $PageTable = "";
     foreach ($lang['tech'] as $Element => $ElementName) {
         if ($Element > 400 && $Element <= 599) {
             if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                 $CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false);
                 $BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                 $ElementCount = $CurrentPlanet[$resource[$Element]];
                 $ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['bd_available'] . pretty_number($ElementCount) . ")";
                 $PageTable .= "\n<tr>";
                 $PageTable .= "<th class=l>";
                 $PageTable .= "<a href=game." . $phpEx . "?page=infos&gid=" . $Element . ">";
                 $PageTable .= "<img border=0 src=\"" . $dpath . "gebaeude/" . $Element . ".gif\" align=top width=120 height=120></a>";
                 $PageTable .= "</th>";
                 $PageTable .= "<td class=l>";
                 $PageTable .= "<a href=game." . $phpEx . "?page=infos&gid=" . $Element . ">" . $ElementName . "</a> " . $ElementNbre . "<br>";
                 $PageTable .= "" . $lang['res']['descriptions'][$Element] . "<br>";
                 $PageTable .= GetElementPrice($CurrentUser, $CurrentPlanet, $Element, false);
                 $PageTable .= ShowBuildTime($BuildOneElementTime);
                 $PageTable .= "</td>";
                 $PageTable .= "<th class=k>";
                 if ($CanBuildOne) {
                     $InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
                     $IsBuildp = $CurrentPlanet[$resource[407]] >= 1 ? TRUE : FALSE;
                     $IsBuildg = $CurrentPlanet[$resource[408]] >= 1 ? TRUE : FALSE;
                     $IsBuildpp = $CurrentPlanet[$resource[409]] >= 1 ? TRUE : FALSE;
                     $BuildIt = TRUE;
                     if ($Element == 407 || $Element == 408 || $Element == 409) {
                         $BuildIt = false;
                         if ($Element == 407 && !$IsBuildp && $InQueue === FALSE) {
                             $BuildIt = TRUE;
                         }
                         if ($Element == 408 && !$IsBuildg && $InQueue === FALSE) {
                             $BuildIt = TRUE;
                         }
                         if ($Element == 409 && !$IsBuildpp && $InQueue === FALSE) {
                             $BuildIt = TRUE;
                         }
                     }
                     if (!$BuildIt) {
                         $PageTable .= "<font color=\"red\">" . $lang['bd_protection_shield_only_one'] . "</font>";
                     } elseif ($NotBuilding) {
                         $TabIndex++;
                         $PageTable .= "<input type=text name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=6 maxlength=6 value=0 tabindex=" . $TabIndex . ">";
                         $PageTable .= "</th>";
                     }
                     if ($NotBuilding) {
                         $parse[build_defenses] = "<tr><td class=\"c\" colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"" . $lang['bd_build_defenses'] . "\"></td></tr>";
                     }
                 } else {
                     $PageTable .= "</th>";
                 }
                 $PageTable .= "</tr>";
             }
         }
     }
     if ($CurrentPlanet['b_hangar_id'] != '') {
         $BuildQueue .= $this->ElementBuildListBox($CurrentUser, $CurrentPlanet);
     }
     $parse['buildlist'] = $PageTable;
     $parse['buildinglist'] = $BuildQueue;
     display(parsetemplate(gettemplate('buildings/buildings_defense'), $parse));
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowShipyardPage.php

示例14: FleetBuildingPage

function FleetBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $planetrow, $lang, $pricelist, $resource, $phpEx, $dpath, $_POST;
    if (isset($_GET[action])) {
        switch ($_GET[action]) {
            case "cancelqueue":
                $ElementQueue = explode(';', $CurrentPlanet['b_hangar_id']);
                foreach ($ElementQueue as $ElementLine => $Element) {
                    if ($Element != '') {
                        $Element = explode(',', $Element);
                        $ResourcesToUpd[metal] += floor($pricelist[$Element[0]][metal] * $Element[1]);
                        $ResourcesToUpd[crystal] += floor($pricelist[$Element[0]][crystal] * $Element[1]);
                        $ResourcesToUpd[deuterium] += floor($pricelist[$Element[0]][deuterium] * $Element[1]);
                        $ResourcesToUpd[tachyon] += floor($pricelist[$Element[0]][tachyon] * $Element[1]);
                    }
                }
                $SetRes = "UPDATE {{table}} SET ";
                $SetRes .= "`metal` = metal + '" . $ResourcesToUpd[metal] . "', ";
                $SetRes .= "`crystal` = crystal + '" . $ResourcesToUpd[crystal] . "', ";
                $SetRes .= "`deuterium` = deuterium + '" . $ResourcesToUpd[deuterium] . "', ";
                $SetRes .= "`tachyon` = tachyon + '" . $ResourcesToUpd[tachyon] . "', ";
                $SetRes .= "`b_hangar` = '', ";
                $SetRes .= "`b_hangar_id` = ''";
                $SetRes .= " WHERE `id` = '" . $CurrentPlanet['id'] . "'";
                doquery($SetRes, 'planets');
                header("location: " . $_SERVER['PHP_SELF'] . "?mode=" . $_GET[mode]);
                exit;
                break;
        }
    }
    if (isset($_POST['fmenge'])) {
        $AddedInQueue = false;
        foreach ($_POST['fmenge'] as $Element => $Count) {
            $Element = intval($Element);
            $Count = intval($Count);
            if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
                $Count = MAX_FLEET_OR_DEFS_PER_ROW;
            }
            if ($Count != 0) {
                if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                    $MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
                    if ($Count > $MaxElements) {
                        $Count = $MaxElements;
                    }
                    $Ressource = GetElementRessources($Element, $Count);
                    $BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                    if ($Count >= 1) {
                        $CurrentPlanet['metal'] -= $Ressource['metal'];
                        $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                        $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                        $CurrentPlanet['tachyon'] -= $Ressource['tachyon'];
                        $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                    }
                }
            }
        }
    }
    if ($CurrentPlanet[$resource[21]] == 0) {
        message($lang['need_hangar'], $lang['tech'][21]);
    }
    $TabIndex = 0;
    foreach ($lang['tech'] as $Element => $ElementName) {
        if ($Element > 201 && $Element <= 399) {
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                $CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false);
                $BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                $ElementCount = $CurrentPlanet[$resource[$Element]];
                $ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['dispo'] . ": " . pretty_number($ElementCount) . ")";
                $PageTable .= "\n<tr>";
                $PageTable .= "<th class=k>";
                $PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">";
                $PageTable .= "<img border=0 src=\"" . $dpath . "gebaeude/" . $Element . ".gif\" align=top width=120 height=120></a>";
                $PageTable .= "</th>";
                $PageTable .= "<td class=k>";
                $PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">" . $ElementName . "</a> " . $ElementNbre . "<br>";
                $PageTable .= "" . $lang['res']['descriptions'][$Element] . "<br>";
                $PageTable .= GetElementPrice($CurrentUser, $CurrentPlanet, $Element, false);
                $PageTable .= ShowBuildTime($BuildOneElementTime);
                $PageTable .= "</td>";
                $PageTable .= "<th class=k>";
                if ($CanBuildOne) {
                    $TabIndex++;
                    $PageTable .= "<input type=text name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=7 maxlength=7 value=0 tabindex=" . $TabIndex . ">";
                }
                $PageTable .= "</th>";
                $PageTable .= "</tr>";
            }
        }
    }
    if ($CurrentPlanet['b_hangar_id'] != '') {
        $BuildQueue .= ElementBuildListBox($CurrentUser, $CurrentPlanet);
    }
    $parse = $lang;
    $parse['buildlist'] = $PageTable;
    $parse['buildinglist'] = $BuildQueue;
    $page .= parsetemplate(gettemplate('buildings_fleet'), $parse);
    display($page, $lang['Fleet']);
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:98,代码来源:FleetBuildingPage.php

示例15: __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


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