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


PHP ShowBuildTime函数代码示例

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


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

示例1: BuildingPage


//.........这里部分代码省略.........
        $parse['bg'] = HEADER_CACHE . "station/" . $parse['type'] . ".png";
    } elseif ($_GET['page'] == 'resources') {
        if (url_exists(HEADER_CACHE . "resources/" . $parse['type'] . $imgnum . ".png")) {
            $parse['bg'] = HEADER_CACHE . "resources/" . $parse['type'] . $imgnum . ".png";
        } else {
            $parse['bg'] = HEADER_CACHE . "resources/default.png";
        }
    } else {
        die("Hacking attempt");
    }
    $parse['hideres'] = "display:none;";
    $parse['hidenorm'] = "";
    $parse['planetname'] = $planetrow['name'];
    if (!$Element) {
        if ($_GET['mode'] == "resources") {
            $parse['hideres'] = "";
            $parse['hidenorm'] = "display:none;";
        }
    } else {
        if (!is_array($Allowed[$planetrow['planet_type']])) {
            $message = $user['username'] . " (" . intval($user['id']) . ") does not have a propper planet_type, so \$Allowed[\$planetrow['planet_type']] was not an array, causing the error which is most likely directly below this.";
            trigger_error($message, E_USER_NOTICE);
        }
        if (in_array($Element, $Allowed[$planetrow['planet_type']])) {
            //Something else
            $HaveRessources = IsElementBuyable($user, $planetrow, $Element, true, false);
            $parse['i'] = $Element;
            $parse['dpath'] = $dpath;
            $BuildingLevel = $planetrow[$resource[$Element]];
            $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
            $parse['n'] = $ElementName;
            $parse['descriptions'] = $lang['res']['descriptions'][$Element];
            $ElementBuildTime = BuildingTime($Element, $BuildingLevel + 1, $planetrow);
            $parse['time'] = ShowBuildTime($ElementBuildTime);
            $parse['price'] = GetElementPrice($user, $planetrow, $Element);
            $parse['rest_price'] = GetRestPrice($user, $planetrow, $Element);
            $parse['click'] = '';
            $NextBuildLevel = $planetrow[$resource[$Element]] + 1;
            $CurrentMaxFields = CalculateMaxPlanetFields($planetrow);
            if ($planetrow["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
                $RoomIsOk = true;
            } else {
                $RoomIsOk = false;
            }
            if ($Element == 31) {
                // Sp�cial Laboratoire
                if ($user["b_tech_planet"] != 0 && $game_config['BuildLabWhileRun'] != 1) {
                    // Variable qui contient le parametre
                    // On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config)
                    $parse['click'] = "<font color=#FF0000>" . $lang['in_working'] . "</font>";
                }
            }
            if (IsTechnologieAccessible($user, $planetrow, $Element)) {
                if ($parse['click'] != '') {
                    // Bin on ne fait rien, vu que l'on l'a deja fait au dessus !!
                } elseif ($RoomIsOk && $CanBuildElement) {
                    if ($Queue['lenght'] == 0) {
                        if ($NextBuildLevel == 1) {
                            if ($HaveRessources == true) {
                                $parse['click'] = "<a href=\"./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element . "\"><font color=#00FF00>" . $lang['BuildFirstLevel'] . "</font></a>";
                                $infopg['build_link'] = "./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element;
                                $infopg['build_text'] = $lang['BuildFirstLevel'];
                            } else {
                                $parse['click'] = "<font color=#FF0000>4" . $lang['BuildFirstLevel'] . "</font>";
                                $infopg['build_text'] = $lang['BuildFirstLevel'];
                            }
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:BuildingPage.php

示例2: DefensesBuildingPage

function DefensesBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $phpEx, $dpath, $_POST;
    if (isset($_POST['fmenge'])) {
        $Missiles[502] = $CurrentPlanet[$resource[502]];
        $Missiles[503] = $CurrentPlanet[$resource[503]];
        $SiloSize = $CurrentPlanet[$resource[44]];
        $MaxMissiles = $SiloSize * 10;
        $BuildQueueList = $CurrentPlanet['b_hangar_id'];
        $BuildArray = explode(";", $BuildQueueList);
        for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
            $ElmentArray = explode(",", $BuildArray[$QElement]);
            if ($ElmentArray[0] == 502 && $ElmentArray[1] >= 0) {
                $Missiles[502] += $ElmentArray[1];
            } elseif ($ElmentArray[0] == 503 && $ElmentArray[1] >= 0) {
                $Missiles[503] += $ElmentArray[1];
            }
        }
        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) {
                $InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
                $IsBuildp = $CurrentPlanet[$resource[407]] >= 1 ? TRUE : FALSE;
                $IsBuildg = $CurrentPlanet[$resource[408]] >= 1 ? TRUE : FALSE;
                if ($Element == 407 && !$IsBuildp && $InQueue === FALSE) {
                    $Count = 1;
                }
                if ($Element == 408 && !$IsBuildg && $InQueue === FALSE) {
                    $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['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=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>";
                $PageTable .= "<td class=l>";
                $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) {
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:DefensesBuildingPage.php

示例3: ShowResearchPage


//.........这里部分代码省略.........
                     }
                     $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;
         }
     }
     $siguiente = 1;
     foreach ($reslist['tech'] as $Tech) {
         if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
             $displays->newblock("research");
             $RowParse['tech_id'] = $Tech;
             $building_level = $CurrentUser[$resource[$Tech]];
             if ($Tech == 106) {
                 $RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $building_level . ")";
                 $RowParse['tech_level'] .= $CurrentUser['rpg_espion'] == 0 ? "" : "<strong><font color=\"lime\"> +" . $CurrentUser['rpg_espion'] * 5 . $lang['bd_spy'] . "</font></strong>";
             } elseif ($Tech == 108) {
                 $RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $building_level . ")";
                 $RowParse['tech_level'] .= $CurrentUser['rpg_commandant'] == 0 ? "" : "<strong><font color=\"lime\"> +" . $CurrentUser['rpg_commandant'] * 3 . $lang['bd_commander'] . "</font></strong>";
             } else {
                 $RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $building_level . " )";
             }
             $RowParse['tech_name'] = $lang['tech'][$Tech];
             $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'] = "Restantes " . $this->GetRestPrice($CurrentUser, $CurrentPlanet, $Tech, true);
             $CanBeDone = IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech);
             if (!$InResearch) {
                 $LevelToDo = 1 + $CurrentUser[$resource[$Tech]];
                 if ($CanBeDone) {
                     if (!$this->CheckLabSettingsInQueue($CurrentPlanet)) {
                         if ($LevelToDo == 1) {
                             $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "</font>";
                         } else {
                             $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "<br>" . $lang['bd_lvl'] . " " . $LevelToDo . "</font>";
                         }
                     } else {
                         $TechnoLink = "<a href=\"game.php?page=buildings&mode=research&cmd=search&tech=" . $Tech . "\">";
                         if ($LevelToDo == 1) {
                             $TechnoLink .= "<font color=#00FF00>" . $lang['bd_research'] . "</font>";
                         } else {
                             $TechnoLink .= "<font color=#00FF00>" . $lang['bd_research'] . "<br>" . $lang['bd_lvl'] . " " . $LevelToDo . "</font>";
                         }
                         $TechnoLink .= "</a>";
                     }
                 } else {
                     if ($LevelToDo == 1) {
                         $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "</font>";
                     } else {
                         $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "<br>" . $lang['bd_lvl'] . " " . $LevelToDo . "</font>";
                     }
                 }
             } else {
                 if ($ThePlanet["b_tech_id"] == $Tech) {
                     $displays->newblock("script");
                     if ($ThePlanet['id'] != $CurrentPlanet['id']) {
                         $bloc['tech_time'] = $ThePlanet["b_tech"] - time();
                         $bloc['tech_name'] = "de<br>" . $ThePlanet["name"];
                         $bloc['tech_home'] = $ThePlanet["id"];
                         $bloc['tech_id'] = $ThePlanet["b_tech_id"];
                     } else {
                         $bloc['tech_time'] = $CurrentPlanet["b_tech"] - time();
                         $bloc['tech_name'] = "";
                         $bloc['tech_home'] = $CurrentPlanet["id"];
                         $bloc['tech_id'] = $CurrentPlanet["b_tech_id"];
                     }
                     foreach ($bloc as $name => $trans) {
                         $displays->assign($name, $trans);
                     }
                 } else {
                     $TechnoLink = "<center>-</center>";
                 }
             }
             $displays->gotoBlock("research");
             $RowParse['tech_link'] = $TechnoLink;
             if ($siguiente % 3 == 0) {
                 $RowParse['cerrar'] = "</tr><tr>";
             }
             $siguiente++;
             foreach ($RowParse as $name => $trans) {
                 $displays->assign($name, $trans);
             }
             unset($RowParse, $TechnoLink);
         }
     }
     $displays->display("Investigación");
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowResearchPage.php

示例4: 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

示例5: 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

示例6: ShowResearchPage


//.........这里部分代码省略.........
                 }
             } 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;
                 $RowParse['tech_id'] = $Tech;
                 $building_level = $CurrentUser[$resource[$Tech]];
                 if ($Tech == 106) {
                     $RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $building_level . ")";
                     $RowParse['tech_level'] .= $CurrentUser['rpg_espion'] == 0 ? "" : "<strong><font color=\"lime\"> +" . $CurrentUser['rpg_espion'] * ESPION . $lang['bd_spy'] . "</font></strong>";
                 } elseif ($Tech == 108) {
                     $RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $building_level . ")";
                     $RowParse['tech_level'] .= $CurrentUser['rpg_commandant'] == 0 ? "" : "<strong><font color=\"lime\"> +" . $CurrentUser['rpg_commandant'] * COMMANDANT . $lang['bd_commander'] . "</font></strong>";
                 } else {
                     $RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $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'] = "Restantes " . $this->GetRestPrice($CurrentUser, $CurrentPlanet, $Tech, true);
                 $CanBeDone = IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech);
                 if ($siguiente == 1) {
                     $parse['abrirtr'] = "<tr>";
                 }
                 if (!$InResearch) {
                     $LevelToDo = 1 + $CurrentUser[$resource[$Tech]];
                     if ($CanBeDone) {
                         if (!$this->CheckLabSettingsInQueue($CurrentPlanet)) {
                             if ($LevelToDo == 1) {
                                 $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "</font>";
                             } else {
                                 $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "<br>" . $lang['bd_lvl'] . " " . $LevelToDo . "</font>";
                             }
                         } else {
                             $TechnoLink = "<a href=\"game.php?page=buildings&mode=research&cmd=search&tech=" . $Tech . "\">";
                             if ($LevelToDo == 1) {
                                 $TechnoLink .= "<font color=#00FF00>" . $lang['bd_research'] . "</font>";
                             } else {
                                 $TechnoLink .= "<font color=#00FF00>" . $lang['bd_research'] . "<br>" . $lang['bd_lvl'] . " " . $LevelToDo . "</font>";
                             }
                             $TechnoLink .= "</a>";
                         }
                     } else {
                         if ($LevelToDo == 1) {
                             $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "</font>";
                         } else {
                             $TechnoLink = "<font color=#FF0000>" . $lang['bd_research'] . "<br>" . $lang['bd_lvl'] . " " . $LevelToDo . "</font>";
                         }
                     }
                 } else {
                     if ($ThePlanet["b_tech_id"] == $Tech) {
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:class.ShowResearchPage.php

示例7: ShowBuildingsPage

 public function ShowBuildingsPage(&$CurrentPlanet, $CurrentUser)
 {
     global $ProdGrid, $lang, $resource, $reslist, $phpEx, $db, $svn_root, $displays;
     include_once $svn_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
     include_once $svn_root . 'includes/functions/GetElementPrice.' . $phpEx;
     $displays->assignContent('buildings/buildings_building');
     CheckPlanetUsedFields($CurrentPlanet);
     $Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 35, 44, 45);
     $Allowed['3'] = array(12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
     if (isset($_GET['cmd'])) {
         $bDoItNow = false;
         $TheCommand = $_GET['cmd'];
         $Element = $_GET['building'];
         $ListID = $_GET['listid'];
         if (!in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
             unset($Element);
         }
         if (isset($Element)) {
             if (!strchr($Element, ",") && !strchr($Element, " ") && !strchr($Element, "+") && !strchr($Element, "*") && !strchr($Element, "~") && !strchr($Element, "=") && !strchr($Element, ";") && !strchr($Element, "'") && !strchr($Element, "#") && !strchr($Element, "-") && !strchr($Element, "_") && !strchr($Element, "[") && !strchr($Element, "]") && !strchr($Element, ".") && !strchr($Element, ":")) {
                 if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
                     $bDoItNow = true;
                 }
             } else {
                 header("location:game.php?page=buildings");
             }
         } elseif (isset($ListID)) {
             $bDoItNow = true;
         }
         if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) {
             $bDoItNow = false;
         }
         if (($Element == 21 or $Element == 14 or $Element == 15) && $CurrentPlanet["b_hangar"] != 0) {
             $bDoItNow = false;
         }
         if ($bDoItNow == true) {
             switch ($TheCommand) {
                 case 'cancel':
                     $this->CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
                     break;
                 case 'remove':
                     $this->RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
                     break;
                 case 'insert':
                     $this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                     break;
                 case 'destroy':
                     $this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
                     break;
             }
             header("location:game.php?page=buildings");
         }
     }
     SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
     $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser);
     $this->BuildingSavePlanetRecord($CurrentPlanet);
     if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
         $CanBuildElement = true;
     } else {
         $CanBuildElement = false;
     }
     $siguiente = 1;
     foreach ($reslist['build'] as $Element) {
         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)) {
                 $displays->newblock('build');
                 $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
                 $parse['i'] = $Element;
                 $BuildingLevel = $CurrentPlanet[$resource[$Element]];
                 $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
                 $parse['n'] = $lang['tech'][$Element];
                 $parse['descriptionss'] = $lang['res']['descriptions'][$Element];
                 $ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                 $parse['time'] = ShowBuildTime($ElementBuildTime);
                 $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
                 $NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
                 if ($RoomIsOk && $CanBuildElement) {
                     if ($Queue['lenght'] == 0) {
                         if ($NextBuildLevel == 1) {
                             if ($HaveRessources == true) {
                                 $parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_build'] . "</font></a>";
                             } else {
                                 $parse['click'] = "<font color=#FF0000>" . $lang['bd_build'] . "</font>";
                             }
                         } else {
                             if ($HaveRessources == true) {
                                 $parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_build_next_level'] . $NextBuildLevel . "</font></a>";
                             } else {
                                 $parse['click'] = "<font color=#FF0000>" . $lang['bd_build_next_level'] . $NextBuildLevel . "</font>";
                             }
                         }
                     } else {
                         $parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_add_to_list'] . "</font></a>";
                     }
                 } elseif ($RoomIsOk && !$CanBuildElement) {
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowBuildingsPage.php

示例8: FleetBuildingPage

function FleetBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $phpEx, $dpath, $_POST;
    if (isset($_POST['fmenge'])) {
        // On vient de Cliquer ' Construire '
        // Et y a une liste de dol&eacute;ances
        $AddedInQueue = false;
        // Ici, on sait precisement ce qu'on aimerait bien construire ...
        foreach ($_POST['fmenge'] as $Element => $Count) {
            // Construction d'Element recuperés sur la page de Flotte ...
            // ATTENTION ! La file d'attente Flotte est Commune a celle des Defenses
            // Dans fmenge, on devrait trouver un tableau des elements constructibles et du nombre d'elements souhaités
            $Element = floatval($Element);
            $Count = floatval($Count);
            if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
                $Count = MAX_FLEET_OR_DEFS_PER_ROW;
            }
            if ($Count != 0) {
                // On verifie si on a les technologies necessaires a la construction de l'element
                if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                    // On verifie combien on sait faire de cet element au max
                    $MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
                    // Si pas assez de ressources, on ajuste le nombre d'elements
                    if ($Count > $MaxElements) {
                        $Count = $MaxElements;
                    }
                    $Ressource = GetElementRessources($Element, $Count);
                    $BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                    if ($Count >= 1) {
                        if ($BuildTime > 0) {
                            $CurrentPlanet['metal'] -= $Ressource['metal'];
                            $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                            $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                            if ($Element == 214) {
                                $requete = doquery("SELECT rpg_destructeur FROM {{table}} WHERE id = " . $CurrentUser['id'] . ";", 'users', true);
                                if ($requete['rpg_destructeur'] == 1) {
                                    $Count = 2 * $Count;
                                }
                            }
                            $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
                        } else {
                            $CurrentPlanet['metal'] -= $Ressource['metal'];
                            $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                            $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                            if ($Element == 214) {
                                $requete = doquery("SELECT rpg_destructeur FROM {{table}} WHERE id = " . $CurrentUser['id'] . ";", 'users', true);
                                if ($requete['rpg_destructeur'] == 1) {
                                    $Count = 2 * $Count;
                                }
                            }
                            $NewFleetNumber = $CurrentPlanet[$resource[$Element]] + $Count;
                            $QryUpdatefleet = "UPDATE {{table}} SET ";
                            $QryUpdatefleet .= "`{$resource[$Element]}` = '" . $NewFleetNumber . "' ";
                            $QryUpdatefleet .= "WHERE ";
                            $QryUpdatefleet .= "`id` = '" . $CurrentPlanet['id'] . "'";
                            doquery($QryUpdatefleet, 'planets');
                        }
                    }
                }
            }
        }
    }
    // -------------------------------------------------------------------------------------------------------
    // S'il n'y a pas de Chantier ...
    if ($CurrentPlanet[$resource[21]] == 0) {
        // Veuillez avoir l'obligeance de construire le Chantier Spacial !!
        message($lang['need_hangar'], $lang['tech'][21]);
    }
    // -------------------------------------------------------------------------------------------------------
    // 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 ($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
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:FleetBuildingPage.php

示例9: DefensesBuildingPage


//.........这里部分代码省略.........
                     } else {
                         if ($Count > $MaxElements) {
                             $Count = $MaxElements;
                         }
                     }
                     $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 . ";";
                     }
                 }
             }
         }
         //$CurrentPlanet['b_hangar_id']=substr($CurrentPlanet['b_hangar_id'], 0, -1);
         header("location: ?page=buildings&mode=defense");
     }
     $NotBuilding = true;
     if ($CurrentPlanet['b_building_id'] != '') {
         $CurrentQueue = explode(";", $CurrentPlanet['b_building_id']);
         foreach ($CurrentQueue as $a) {
             if ($i < 1) {
                 $QueueArray = explode(",", $a);
                 if ($QueueArray[0] == 21 || $QueueArray[0] == 15) {
                     $NotCan = TRUE;
                 }
             }
             $i++;
         }
         if ($NotCan) {
             $parse[message] = "<font color=\"red\">" . $lang['bd_building_shipyard'] . "</font>";
             $NotBuilding = false;
         }
     }
     $TabIndex = 0;
     $fila = 1;
     foreach ($reslist['defense'] as $Element) {
         if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
             $displays->newblock("buildlist");
             $CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false);
             $BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
             $ElementCount = $CurrentPlanet[$resource[$Element]];
             $ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['bd_available'] . pretty_number($ElementCount) . ")";
             $parserow["i"] = $Element;
             $parserow["dpath"] = $dpath;
             $parserow["count"] = $ElementNbre;
             $parserow["name"] = $lang['tech'][$Element];
             $parserow["descripcion"] = $lang['res']['descriptions'][$Element];
             $parserow["price"] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element, false);
             $parserow["time"] = ShowBuildTime($BuildOneElementTime);
             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) {
                     $parserow["click"] = "<font color=\"red\">" . $lang['bd_protection_shield_only_one'] . "</font>";
                 } elseif ($NotBuilding) {
                     $TabIndex++;
                     $maxElement = $this->GetMaxConstructibleElements($Element, $CurrentPlanet);
                     $parserow["click"] = "<input type=text name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=9 maxlength=9 value=0 tabindex=" . $TabIndex . ">\r\n\t\t\t\t\t\t\t\t<a href='javascript:' onclick=\"document.getElementsByName('fmenge[" . $Element . "]')[0].value = '{$maxElement}';\">M&aacute;x.</a>";
                 }
             }
             if ($fila % 3 == 0) {
                 $parserow['cerrartr'] = "</tr><tr>";
             }
             $fila++;
             foreach ($parserow as $key => $value) {
                 $displays->assign($key, $value);
             }
             //$buildefense.=parsetemplate(gettemplate('buildings/buildings_defense_row'), $parserow);
             unset($parserow);
         }
     }
     if ($CurrentPlanet['b_hangar_id'] != '') {
         $this->ElementBuildListBox($CurrentUser, $CurrentPlanet);
     }
     $displays->gotoBlock("_ROOT");
     if ($NotBuilding) {
         $parse['build_defenses'] = "<tr><td class=\"c\" colspan=\"3\" align=\"center\"><input type=\"submit\" value=\"" . $lang['bd_build_ships'] . "\"></td></tr>";
     }
     foreach ($parse as $key => $value) {
         $displays->assign($key, $value);
     }
     $displays->display();
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowBuildFleetPage.php

示例10: DefensesBuildingPage


//.........这里部分代码省略.........
                         $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                         $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                         $CurrentPlanet['darkmatter'] -= $Ressource['darkmatter'];
                         $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=18 maxlength=18 value=0 tabindex=" . $TabIndex . ">";
                         $maxElement = $this->GetMaxConstructibleElements($Element, $CurrentPlanet);
                         $PageTable .= "<br><th><a href='javascript:' onclick=\"document.getElementsByName('fmenge[" . $Element . "]')[0].value = '{$maxElement}';\">Max.</a></th>";
                         $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

示例11: ResearchBuildingPage


//.........这里部分代码省略.........
                        $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);
                // Arbre de decision de ce que l'on met dans la derniere case de la ligne
                if (!$InResearch) {
                    $LevelToDo = 1 + $CurrentUser[$resource[$Tech]];
                    if ($CanBeDone) {
                        if (!CheckLabSettingsInQueue($CurrentPlanet)) {
                            // Le laboratoire est cours de construction ou d'evolution
                            // Et dans la config du systeme, on ne permet pas la recherche pendant
                            // que le labo est en construction ou evolution !
                            if ($LevelToDo == 1) {
                                $TechnoLink = "<font color=#FF0000>" . $lang['Rechercher'] . "</font>";
                            } else {
                                $TechnoLink = "<font color=#FF0000>" . $lang['Rechercher'] . "<br>" . $lang['level'] . " " . $LevelToDo . "</font>";
                            }
                        } else {
                            $TechnoLink = "<a href='#' onclick=\"document.location.replace('buildings.php?mode=research&cmd=search&tech=" . $Tech . "')\">";
                            if ($LevelToDo == 1) {
                                $TechnoLink .= "<font color=#00FF00>" . $lang['Rechercher'] . "</font>";
                            } else {
                                $TechnoLink .= "<font color=#00FF00>" . $lang['Rechercher'] . "<br>" . $lang['level'] . " " . $LevelToDo . "</font>";
                            }
                            $TechnoLink .= "</a>";
                        }
                    } else {
                        if ($LevelToDo == 1) {
                            $TechnoLink = "<font color=#FF0000>" . $lang['Rechercher'] . "</font>";
                        } else {
                            $TechnoLink = "<font color=#FF0000>" . $lang['Rechercher'] . "<br>" . $lang['level'] . " " . $LevelToDo . "</font>";
                        }
                    }
                } else {
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:ResearchBuildingPage.php

示例12: __construct


//.........这里部分代码省略.........
     $this->BuildingSavePlanetRecord($CurrentPlanet);
     if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
         $CanBuildElement = true;
     } else {
         $CanBuildElement = false;
     }
     $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 = $lang;
                 $parse['dpath'] = $dpath;
                 $parse['i'] = $Element;
                 $BuildingLevel = $CurrentPlanet[$resource[$Element]];
                 $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
                 $BuildLevelFactor = 10;
                 $BuildTemp = $CurrentPlanet['temp_max'];
                 $CurrentBuildtLvl = $BuildingLevel;
                 $BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
                 $EnergyTechLevel = $CurrentUser["energy_tech"];
                 $Prod[4] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
                 $ActualNeed = floor($Prod[4]);
                 $BuildLevel++;
                 $Prod[4] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
                 $EnergyNeed = colorNumber(pretty_number(floor($Prod[4] - $ActualNeed)));
                 if ($Element >= 1 && $Element <= 3 or $Element == 5) {
                     $parse['energy'] = "&nbsp;<font color=#FF0000>" . $EnergyNeed . "</font>";
                     $BuildLevel = 0;
                 } elseif ($Element == 4 || $Element == 12) {
                     $parse['energy'] = "&nbsp;<font color=#00FF00>+" . $EnergyNeed . "</font>";
                     $BuildLevel = 0;
                 }
                 $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['click'] = '';
                 $NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
                 if ($RoomIsOk && $CanBuildElement) {
                     if ($Queue['lenght'] == 0) {
                         if ($NextBuildLevel == 1) {
                             if ($HaveRessources == true) {
                                 $parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_build'] . "</font></a>";
                             } else {
                                 $parse['click'] = "<font color=#FF0000>" . $lang['bd_build'] . "</font>";
                             }
                         } else {
                             if ($HaveRessources == true) {
                                 $parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_build_next_level'] . $NextBuildLevel . "</font></a>";
                             } else {
                                 $parse['click'] = "<font color=#FF0000>" . $lang['bd_build_next_level'] . $NextBuildLevel . "</font>";
                             }
                         }
                     } else {
                         if ($HaveRessources == true) {
                             $parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_add_to_list'] . "</font></a>";
                         } else {
                             $parse['click'] = "<font color=#FF0000>" . $lang['bd_add_to_list'] . "</font>";
                         }
                     }
                 } elseif ($RoomIsOk && !$CanBuildElement) {
                     if ($NextBuildLevel == 1) {
                         $parse['click'] = "<font color=#FF0000>" . $lang['bd_build'] . "</font>";
                     } else {
                         $parse['click'] = "<font color=#FF0000>" . $lang['bd_build_next_level'] . $NextBuildLevel . "</font>";
                     }
                 } else {
                     $parse['click'] = "<font color=#FF0000>" . $lang['bd_no_more_fields'] . "</font>";
                 }
                 if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) {
                     $parse['click'] = "<font color=#FF0000>" . $lang['bd_working'] . "</font>";
                 }
                 if (($Element == 21 or $Element == 14 or $Element == 15) && $CurrentPlanet["b_hangar"] != 0) {
                     $parse['click'] = "<font color=#FF0000>" . $lang['bd_working'] . "</font>";
                 }
                 $BuildingPage .= parsetemplate(gettemplate('buildings/buildings_builds_row'), $parse);
             }
         }
     }
     if ($Queue['lenght'] > 0) {
         include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx;
         $parse['BuildListScript'] = InsertBuildListScript("buildings");
         $parse['BuildList'] = $Queue['buildlist'];
     } else {
         $parse['BuildListScript'] = "";
         $parse['BuildList'] = "";
     }
     $parse['BuildingsList'] = $BuildingPage;
     display(parsetemplate(gettemplate('buildings/buildings_builds'), $parse));
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowBuildingsPage.php

示例13: ResearchPage


//.........这里部分代码省略.........
        } else {
            $parse['state_' . $Tech] = "off";
            $parse['mes_' . $Tech] = "Not availble";
        }
        $parse['name_' . $Tech] = $TechName;
        $parse['count_' . $Tech] = $CurrentUser[$resource[$Tech]];
    }
    //Anything currently building?
    if ($CurrentUser['b_tech_planet']) {
        $WorkingPlanet = doquery("SELECT `id`,`name`,`b_tech_id`,`b_tech` FROM {{table}} WHERE `id` = '" . $CurrentUser['b_tech_planet'] . "';", 'planets', true);
        //Whats currently building
        $curbuild = $WorkingPlanet['b_tech_id'];
        $parse['countdown_' . $curbuild] = "\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"pusher\" id=\"b_research" . $curbuild . "\" style=\"height:80px;margin-bottom:-80px;\">\n\r\n\t\t\t\t\t\t\t\t\t\t\t<a><span class=\"time\" id=\"test\" name=\"zeit\">" . parsecountdown($WorkingPlanet['b_tech']) . "</span></a>\n\r\n\t\t\t\t\t\t\t\t\t\t</div>\n";
    } else {
        $curbuild = 0;
    }
    $Buttonz = parsetemplate($SubTemplate, $parse);
    $parse = $lang;
    $Element = idstring($_GET['id']);
    $ElementName = $lang['names'][$Element];
    $de_planettype = PlanetType($CurrentPlanet['image']);
    $parse['type'] = $de_planettype['type'];
    if ($Element) {
        if (in_array($Element, $reslist['tech'])) {
            /*
            $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);
            */
            $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element);
            $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'] = '';
            $buildlink = "./?page=research&cmd=search&id=" . $Element . "&tech=" . $Element;
            if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                if ($NextBuildLevel == 1) {
                    if ($HaveRessources == true) {
                        $infopg['build_link'] = $buildlink;
                        $infopg['build_text'] = $lang['BuildFirstLevel'];
                    } else {
                        $infopg['build_text'] = $lang['BuildFirstLevel'];
                    }
                } else {
                    if ($HaveRessources == true) {
                        $infopg['build_link'] = $buildlink;
                        $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel;
                    } else {
                        $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel;
                    }
                }
            } elseif ($InResearch) {
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:ResearchPage.php

示例14: FleetBuildingPage


//.........这里部分代码省略.........
            }
            if ($BuildTime > 0) {
                $CurrentPlanet['metal'] -= $Ressource['metal'];
                $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                if ($Element == 214 && $CurrentUser['rpg_destructeur'] == 1) {
                    $Count = $Count * 2;
                    //On multiplie les EDLM par 2
                }
                $CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
            } else {
                $res = doquery("SELECT " . $resource[$Element] . " FROM {{table}} WHERE id = '" . $CurrentPlanet['id'] . "'  ;", 'planets');
                $NombreVaisseauxActuel = mysql_result($res, 0, $resource[$Element]);
                $CurrentPlanet['metal'] -= $Ressource['metal'];
                $CurrentPlanet['crystal'] -= $Ressource['crystal'];
                $CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
                $NewFleetNumber = $CurrentPlanet[$resource[$Element]] + $Count;
                if ($Element == 214 && $CurrentUser['rpg_destructeur'] == 1) {
                    $Count = $Count * 2;
                    //On multiplie les EDLM par 2
                }
                $QryUpdatefleet = "UPDATE {{table}} SET ";
                $QryUpdatefleet .= "`{$resource[$Element]}` = '" . $NombreVaisseauxActuel . "' + '" . $Count . "' ";
                $QryUpdatefleet .= "WHERE ";
                $QryUpdatefleet .= "`id` = '" . $CurrentPlanet['id'] . "'";
                doquery($QryUpdatefleet, 'planets');
            }
        }
    }
    // -------------------------------------------------------------------------------------------------------
    // S'il n'y a pas de Chantier ...
    if ($CurrentPlanet[$resource[21]] == 0) {
        // Veuillez avoir l'obligeance de construire le Chantier Spacial !!
        message($lang['need_hangar'], $lang['tech'][21]);
    }
    // -------------------------------------------------------------------------------------------------------
    // 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 ($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." . PHPEXT . "?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." . PHPEXT . "?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 id=fmenge[" . $Element . "] name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' value=0 tabindex=" . $TabIndex . ">";
                    $MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
                    if ($MaxElements > MAX_FLEET_OR_DEFS_PER_ROW) {
                        $MaxElements = MAX_FLEET_OR_DEFS_PER_ROW;
                    }
                    $PageTable .= '<BR><BR><A ONCLICK="document.getElementById(\'fmenge[' . $Element . ']\').value=\'' . intval($MaxElements) . '\';" STYLE="cursor:pointer;">Nombre max (' . intval($MaxElements) . ')</A></th>';
                } else {
                    $PageTable .= $lang['no_enought_res'] . '</th>';
                }
                $MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
                if ($MaxElements > MAX_FLEET_OR_DEFS_PER_ROW) {
                    $MaxElements = MAX_FLEET_OR_DEFS_PER_ROW;
                }
                // 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

示例15: BatimentBuildingPage


//.........这里部分代码省略.........
    // Änderungen in den Planeten Rekorden übernehmen
    BuildingSavePlanetRecord($CurrentPlanet);
    // Änderungen in den Userrekorden übernehmen
    BuildingSaveUserRecord($CurrentUser);
    if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
        //Solange noch Platz in der Bauischleife ist...
        $CanBuildElement = true;
        // ...kann man bauen
    } 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);
                $ElementBuildTimeWithoutTechs = GetBuildingTimeWithoutTechs($CurrentUser, $CurrentPlanet, $Element);
                //Bauzeiten parsen
                $parse['timewithouttechs'] = ShowBuildTimeWithoutTechs($ElementBuildTimeWithoutTechs);
                $parse['technobonus'] = ShowBuildTime($ElementBuildTimeWithoutTechs - $ElementBuildTime);
                $parse['time'] = ShowBuildTime($ElementBuildTime);
                //Sprachvariablen für die Bauzeit laden
                $parse['BuildingTime'] = $lang['BuildingTime'];
                $parse['NeededRess'] = $lang['NeededRess'];
                $parse['ConstructionTimeWithoutTechs'] = $lang['ConstructionTimeWithoutTechs'];
                $parse['TechBonus'] = $lang['TechBonus'];
                $parse['ConstructionTime'] = $lang['ConstructionTime'];
                $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
                $parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
                $parse['click'] = '';
                $NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
                if ($Element == 31) {
                    // Sonderstatus fürs FOrschungslabor
                    if ($CurrentUser["b_tech_planet"] != 0 && $game_config['BuildLabWhileRun'] != 1) {
                        // Config Einstellung die das Forschen während des Ausbaus erlaubt
                        $parse['click'] = "<font color=\"#FF0000\">" . $lang['in_working'] . "</font>";
                    }
                }
                if ($parse['click'] != '') {
                } elseif ($RoomIsOk && $CanBuildElement) {
                    if ($Queue['lenght'] == 0) {
                        if ($NextBuildLevel == 1) {
                            if ($HaveRessources == true) {
                                $parse['click'] = "<a href=\"?action=internalBuildings&amp;cmd=insert&amp;building=" . $Element . "\"><font color=\"#00FF00\">" . $lang['BuildFirstLevel'] . "</font></a>";
                            } else {
                                $parse['click'] = "<font color=\"#FF0000\">" . $lang['BuildFirstLevel'] . "</font>";
                            }
                        } else {
                            if ($HaveRessources == true) {
                                $parse['click'] = "<a href=\"?action=internalBuildings&amp;cmd=insert&amp;building=" . $Element . "\"><font color=\"#00FF00\">" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font></a>";
                            } else {
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:BatimentBuildingPage.php


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