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


PHP SetNextQueueElementOnTop函数代码示例

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


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

示例1: UpdatePlanetBatimentQueueList

function UpdatePlanetBatimentQueueList(&$CurrentPlanet, &$CurrentUser)
{
    $RetValue = false;
    if ($CurrentPlanet['b_building_id'] != 0) {
        while ($CurrentPlanet['b_building_id'] != 0) {
            if ($CurrentPlanet['b_building'] <= time()) {
                PlanetResourceUpdate($CurrentUser, $CurrentPlanet, $CurrentPlanet['b_building'], false);
                $IsDone = CheckPlanetBuildingQueue($CurrentPlanet, $CurrentUser);
                if ($IsDone == true) {
                    SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
                }
            } else {
                $RetValue = true;
                break;
            }
        }
    }
    return $RetValue;
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:19,代码来源:UpdatePlanetBatimentQueueList.php

示例2: __construct

 public function __construct(&$CurrentPlanet, $CurrentUser)
 {
     global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
     include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
     include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
     include_once $xgp_root . 'includes/functions/CheckPlanetUsedFields.' . $phpEx;
     CheckPlanetUsedFields($CurrentPlanet);
     $parse = $lang;
     $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);
     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;
             }
         }
         if ($_GET['r'] == 'overview') {
             header('location:game.php?page=overview');
         } else {
             header("Location: game.php?page=buildings&mode=buildings");
         }
     }
     SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
     // $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser); // OLD CODE
     // START FIX BY JSTAR
     $Sprice = array();
     $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser, $Sprice);
     // END FIX BY JSTAR
     $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 . ")";
                 $parse['n'] = $ElementName;
                 $parse['descriptions'] = $lang['res']['descriptions'][$Element];
                 /* OLD CODE ---------------------------------------------------- OLD CODE ------------------------------------- //
                 					$ElementBuildTime      	= GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
                 					$parse['time']         	= ShowBuildTime($ElementBuildTime);
                 					$parse['price']        	= GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
                    OLD CODE ---------------------------------------------------- OLD CODE ------------------------------------- //
                 */
                 // START FIX BY JSTAR
                 $really_lvl = isset($Sprice[$Element]) ? $Sprice[$Element] : $BuildingLevel;
                 $ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element, $really_lvl);
                 $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element, true, $really_lvl);
                 $parse['time'] = ShowBuildTime($ElementBuildTime);
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowBuildingsPage.php

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

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

示例5: ShowBuildingsPage

 public function ShowBuildingsPage(&$CurrentPlanet, $CurrentUser)
 {
     global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
     include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
     include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
     CheckPlanetUsedFields($CurrentPlanet);
     $parse = $lang;
     $Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 35, 44);
     $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 ($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;
             }
         }
     }
     SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
     $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser);
     $this->BuildingSavePlanetRecord($CurrentPlanet);
     if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
         $CanBuildElement = true;
     } else {
         $CanBuildElement = false;
     }
     $BuildingPage = "";
     $zaehler = 1;
     $siguiente = 1;
     foreach ($lang['tech'] as $BuildID => $ElementName) {
         if (in_array($BuildID, $Allowed[$CurrentPlanet['planet_type']])) {
             $parse = $lang;
             $parse['dpath'] = $dpath;
             $parse['name'] = $lang['info'][$BuildID]['name'];
             $parse['image'] = $BuildID;
             $parse['description'] = $lang['info'][$BuildID]['description'];
             $NeededRessources = GetBuildingPrice($CurrentUser, $CurrentPlanet, $BuildID, true, true);
             $DestroyTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $BuildID) / 2;
             $parse['destroyurl'] = "game.php?page=buildings&cmd=destroy&building=" . $BuildID;
             $parse['levelvalue'] = $CurrentPlanet[$resource[$BuildID]];
             $parse['nfo_metal'] = $lang['Metal'];
             $parse['nfo_crysta'] = $lang['Crystal'];
             $parse['nfo_deuter'] = $lang['Deuterium'];
             $parse['metal'] = pretty_number($NeededRessources['metal']);
             $parse['crystal'] = pretty_number($NeededRessources['crystal']);
             $parse['deuterium'] = pretty_number($NeededRessources['deuterium']);
             $parse['destroytime'] = pretty_time($DestroyTime);
             $infodiv .= parsetemplate(gettemplate('buildings/buildings_info_row'), $parse);
         }
     }
     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;
                 if ($siguiente == 1) {
                     $parse['abrirtr'] = "<tr>";
                 }
                 $parse['i'] = $Element;
                 $BuildingLevel = $CurrentPlanet[$resource[$Element]];
                 $parse['nivel'] = $BuildingLevel == 0 ? " (" . $lang['bd_lvl'] . " 0)" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
                 $BuildLevelFactor = $CurrentPlanet[$resource[$Element] . "_porcent"];
                 $BuildTemp = $CurrentPlanet['temp_max'];
                 $CurrentBuildtLvl = $BuildingLevel;
                 $BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowBuildingsPage.php

示例6: BuildStores

 protected function BuildStores()
 {
     global $resource, $lang;
     $CurrentQueue = $this->CurrentPlanet['b_building_id'];
     if ($CurrentQueue != 0) {
         $QueueArray = explode(";", $CurrentQueue);
         $ActualCount = count($QueueArray);
     } else {
         $QueueArray = "";
         $ActualCount = 0;
     }
     $StoreLevel = array(22 => 20, 23 => 20, 24 => 20);
     foreach ($StoreLevel as $Element => $Max) {
         if ($Element == 22) {
             if ($ActualCount <= 0 and $this->CurrentPlanet[$resource[$Element]] < $Max and $this->CurrentPlanet['metal'] >= $this->CurrentPlanet['metal_max'] and $Queue2['lenght'] < 2 and IsElementBuyable($this->user, $this->CurrentPlanet, $Element, true, false) and $this->CurrentPlanet["field_current"] < CalculateMaxPlanetFields($this->CurrentPlanet)) {
                 $this->AddBuildingToQueue($this->CurrentPlanet, $this->user, $Element, true);
                 if (!is_null($this->log)) {
                     $this->log .= '	Construir: ' . $lang['tech'][$Element] . ' al nivel ' . ($this->CurrentPlanet[$resource[$Element]] + 1) . "\n";
                 }
                 $ActualCount++;
             }
         } elseif ($Element == 23) {
             if ($ActualCount <= 0 and $this->CurrentPlanet[$resource[$Element]] < $Max and $this->CurrentPlanet['crystal'] >= $this->CurrentPlanet['crystal_max'] and $Queue2['lenght'] < 2 and IsElementBuyable($this->user, $this->CurrentPlanet, $Element, true, false) and $this->CurrentPlanet["field_current"] < CalculateMaxPlanetFields($this->CurrentPlanet)) {
                 $this->AddBuildingToQueue($this->CurrentPlanet, $this->user, $Element, true);
                 if (!is_null($this->log)) {
                     $this->log .= '	Construir: ' . $lang['tech'][$Element] . ' al nivel ' . ($this->CurrentPlanet[$resource[$Element]] + 1) . "\n";
                 }
                 $ActualCount++;
             }
         } elseif ($Element == 24) {
             if ($ActualCount <= 0 and $this->CurrentPlanet[$resource[$Element]] < $Max and $this->CurrentPlanet['deuterium'] >= $this->CurrentPlanet['deuterium_max'] and $Queue2['lenght'] < 2 and IsElementBuyable($this->user, $this->CurrentPlanet, $Element, true, false) and $this->CurrentPlanet["field_current"] < CalculateMaxPlanetFields($this->CurrentPlanet)) {
                 $this->AddBuildingToQueue($this->CurrentPlanet, $this->user, $Element, true);
                 if (!is_null($this->log)) {
                     $this->log .= '	Construir: ' . $lang['tech'][$Element] . ' al nivel ' . ($this->CurrentPlanet[$resource[$Element]] + 1) . "\n";
                 }
                 $ActualCount++;
             }
         } elseif ($Element == 0) {
         }
     }
     SetNextQueueElementOnTop($this->CurrentPlanet, $this->user);
     $this->SavePlanetRecord();
 }
开发者ID:Artea,项目名称:xg-bot,代码行数:43,代码来源:class.Bot.php

示例7: BatimentBuildingPage

/**
 * BatimentBuildingPage.php
 *
 * @version 1.1
 * @copyright 2008 by Chlorel for XNova
 */
function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $user;
    CheckPlanetUsedFields($CurrentPlanet);
    PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
    // Was gebaut werden darf in Abhängikeit zum gewählten Volk.
    switch ($user['volk']) {
        case "A":
            $Allowed['1'] = array(1, 2, 3, 11, 12, 14, 15, 21, 22, 23, 24, 25, 26, 27, 31, 33, 34, 44);
            $Allowed['3'] = array(4, 12, 14, 15, 21, 25, 26, 34, 41, 42, 43);
            break;
        case "B":
            $Allowed['1'] = array(1, 2, 3, 11, 12, 14, 15, 21, 22, 23, 24, 25, 26, 31, 33, 34, 44, 45);
            $Allowed['3'] = array(4, 12, 14, 15, 21, 25, 26, 34, 41, 42, 43);
            break;
        case "C":
            $Allowed['1'] = array(1, 2, 3, 11, 12, 14, 15, 21, 22, 23, 24, 25, 26, 31, 33, 34, 44, 46);
            $Allowed['3'] = array(4, 12, 14, 15, 21, 25, 26, 34, 41, 42, 43, 46);
            break;
    }
    //Werte auf null setzen
    $bThisIsCheated = 0;
    $bDoItNow = 0;
    $TheCommand = 0;
    $Element = 0;
    $ListID = 0;
    // 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 (!strchr($Element, ";")) {
                        if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
                            $bDoItNow = true;
                        } else {
                            $bThisIsCheated = true;
                        }
                    } else {
                        $bThisIsCheated = true;
                    }
                } else {
                    $bThisIsCheated = true;
                }
            } else {
                $bThisIsCheated = true;
            }
        } elseif (isset($ListID)) {
            $bDoItNow = true;
        }
        if ($bDoItNow == true) {
            $Element = abs($Element);
            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']);
        }
        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 {
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:BatimentBuildingPage.php

示例8: ProductionBuildingPage

/**
 * BatimentBuildingPage.php
 *
 * @version 1.1
 * @copyright 2008 by Chlorel for XNova
 */
function ProductionBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $reslist, $pricelist, $phpEx, $dpath, $game_config, $_GET;
    CheckPlanetUsedFields($CurrentPlanet);
    // Tables des batiments possibles par type de planete
    $Allowed['1'] = array(1, 2, 3, 4, 12, 212, 22, 23, 24);
    $Allowed['3'] = array(212, 22, 23, 24);
    //Right, lets see what he has an generate him an image.
    $imgnum = '';
    if ($CurrentPlanet[$resource[1]] > 0) {
        $imgnum .= "_1";
    }
    if ($CurrentPlanet[$resource[2]] > 0) {
        $imgnum .= "_2";
    }
    if ($CurrentPlanet[$resource[3]] > 0) {
        $imgnum .= "_3";
    }
    if ($CurrentPlanet[$resource[4]] > 0) {
        $imgnum .= "_4";
    }
    // 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;
                        $bDoItNow = 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
                    $fields_rem = $CurrentPlanet['field_max'] - $CurrentPlanet['field_current'] + $CurrentPlanet[$resource[33]] * 5;
                    if ($fields_rem >= 0) {
                        AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                    } else {
                        echo $fields_rem . " < 0";
                        die("Hacking Attempt!");
                    }
                    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� 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;
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ProductionBuildingPage.php

示例9: BatimentBuildingPage

function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
    CheckPlanetUsedFields($CurrentPlanet);
    $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);
    if (isset($_GET['cmd'])) {
        $bDoItNow = false;
        $TheCommand = $_GET['cmd'];
        $Element = $_GET['building'];
        $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;
        }
        if ($bDoItNow == true) {
            switch ($TheCommand) {
                case 'cancel':
                    CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
                    break;
                case 'remove':
                    RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
                    break;
                case 'insert':
                    AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                    break;
                case 'destroy':
                    AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
                    break;
                default:
                    break;
            }
        }
    }
    SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
    $Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
    BuildingSavePlanetRecord($CurrentPlanet);
    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'] = '';
                $NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
                if ($Element == 31) {
                    if ($CurrentUser["b_tech_planet"] != 0 && $game_config['BuildLabWhileRun'] != 1) {
                        $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=\"?cmd=insert&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=\"?cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font></a>";
                            } else {
                                $parse['click'] = "<font color=#FF0000>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font>";
                            }
                        }
                    } else {
                        $parse['click'] = "<a href=\"?cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['InBuildQueue'] . "</font></a>";
                    }
                } elseif ($RoomIsOk && !$CanBuildElement) {
                    if ($NextBuildLevel == 1) {
                        $parse['click'] = "<font color=#FF0000>" . $lang['BuildFirstLevel'] . "</font>";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:BatimentBuildingPage.php

示例10: BatimentBuildingPage

/**
 * BatimentBuildingPage.php
 *
 * @version 1.1
 * @copyright 2008 by Chlorel for XNova
 */
function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
    global $lang, $resource, $reslist, $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 (isset($_GET['cmd'])) {
        // On passe une commande
        $bThisIsCheated = false;
        $bDoItNow = false;
        $TheCommand = $_GET['cmd'];
        if (isset($_GET['building'])) {
            //Wenn Variable gefüllt ist
            $Element = intval($_GET['building']);
            // Muss ne Zahl sein
            if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
                $bDoItNow = true;
                // Ist true wenns vorhanden ist und eine Zahl aus der Whitelist des jeweiligen Typs enthält.
            } else {
                $bThisIsCheated = true;
            }
        }
        if (isset($_GET['listid'])) {
            //Wenn Variable gefüllt ist...
            $ListID = intval($_GET['listid']);
            // Das hier muss ne Zahl sein
            $bDoItNow = true;
            // Und ist auch true wenn $ListID vorhanden ist
        }
        if ($bDoItNow == true) {
            // Wenn True dann mach hier weiter
            switch ($TheCommand) {
                case 'cancel':
                    // Bricht den aktuell laufenden Auftrag ab
                    CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
                    break;
                case 'remove':
                    // Entfernt ein wartendes Element aus der Bauschleife
                    RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
                    break;
                case 'insert':
                    // Fügt ein Element zur Bauschleife hinzu
                    if ($Element == 31) {
                        if ($CurrentUser["b_tech_planet"] == 0 || $game_config['BuildLabWhileRun'] == 1) {
                            AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                        }
                    } else {
                        AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                    }
                    break;
                case 'destroy':
                    // Baut ein Gebäude eine Stufe ab
                    if ($Element == 31) {
                        if ($CurrentUser["b_tech_planet"] == 0 || $game_config['BuildLabWhileRun'] == 1) {
                            AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
                        }
                    } else {
                        AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
                    }
                    break;
                default:
                    break;
            }
        }
        header('Location: ?action=internalBuildings');
        //Nach nem Klick Weiterleitung auf die Bauseite um Doppelklicke zu vermeiden
    }
    SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
    $Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
    // Ä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);
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:BatimentBuildingPage.php

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

示例12: __construct

 public function __construct(&$CurrentPlanet, $CurrentUser)
 {
     global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
     include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
     include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
     CheckPlanetUsedFields($CurrentPlanet);
     $parse = $lang;
     $Allowed['1'] = array(1, 2, 3, 4, 5, 12, 14, 15, 21, 22, 23, 24, 25, 31, 33, 34, 35, 44, 45);
     $Allowed['3'] = array(12, 14, 21, 22, 23, 24, 25, 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;
             }
         }
         if ($_GET['r'] == 'overview') {
             header('location:game.php?page=overview');
         } else {
             header("Location: game.php?page=buildings&mode=buildings");
         }
     }
     SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
     if (empty($CurrentPlanet['b_building_id'])) {
         $CurrentPlanetID = intval($CurrentPlanet['id']);
         doquery("UPDATE {{table}} SET `b_building_id` = '0', `b_building` = '0' WHERE `id` = '{$CurrentPlanetID}';", 'planets');
         $CurrentPlanet['b_building_id'] = "0";
         $CurrentPlanet['b_building'] = 0;
     }
     $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser);
     $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>";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowBuildingsPage.php

示例13: CheckPlanetBuildingQueue

function CheckPlanetBuildingQueue(&$CurrentPlanet, &$CurrentUser)
{
    global $lang, $resource;
    // Table des batiments donnant droit de l'experience minier
    $XPBuildings = array(1, 2, 3, 22, 23, 24);
    $RetValue = false;
    if ($CurrentPlanet['b_building_id'] != 0) {
        $CurrentQueue = $CurrentPlanet['b_building_id'];
        if ($CurrentQueue != 0) {
            $QueueArray = explode(";", $CurrentQueue);
            $ActualCount = count($QueueArray);
        }
        $BuildArray = explode(",", $QueueArray[0]);
        $BuildEndTime = floor($BuildArray[3]);
        $BuildMode = $BuildArray[4];
        $Element = $BuildArray[0];
        array_shift($QueueArray);
        if ($BuildMode == 'destroy') {
            $ForDestroy = true;
        } else {
            $ForDestroy = false;
        }
        if ($BuildEndTime <= time()) {
            // Mise a jours des points
            $Needed = GetBuildingPrice($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
            $Units = $Needed['metal'] + $Needed['crystal'] + $Needed['deuterium'];
            if ($ForDestroy == false) {
                // Mise a jours de l'XP Minier
                if (in_array($Element, $XPBuildings)) {
                    $AjoutXP = round($Units / 1000);
                    $CurrentUser['xpminier'] += $AjoutXP;
                }
            } else {
                // Mise a jours de l'XP Minier
                if (in_array($Element, $XPBuildings)) {
                    $AjoutXP = round($Units * 3 / 1000);
                    $CurrentUser['xpminier'] -= $AjoutXP;
                }
            }
            $current = intval($CurrentPlanet['field_current']);
            $max = intval($CurrentPlanet['field_max']);
            // Pour une lune
            if ($CurrentPlanet['planet_type'] == 3) {
                if ($Element == 41) {
                    // Base Lunaire
                    $current += 1;
                    $max += FIELDS_BY_MOONBASIS_LEVEL;
                    $CurrentPlanet[$resource[$Element]]++;
                } elseif ($Element != 0) {
                    if ($ForDestroy == false) {
                        $current += 1;
                        $CurrentPlanet[$resource[$Element]]++;
                    } else {
                        $current -= 1;
                        $CurrentPlanet[$resource[$Element]]--;
                    }
                }
            } elseif ($CurrentPlanet['planet_type'] == 1) {
                if ($ForDestroy == false) {
                    $current += 1;
                    $CurrentPlanet[$resource[$Element]]++;
                } else {
                    $current -= 1;
                    $CurrentPlanet[$resource[$Element]]--;
                }
            }
            if (count($QueueArray) == 0) {
                $NewQueue = 0;
            } else {
                $NewQueue = implode(";", $QueueArray);
            }
            $CurrentPlanet['b_building'] = 0;
            $CurrentPlanet['b_building_id'] = $NewQueue;
            $CurrentPlanet['field_current'] = $current;
            $CurrentPlanet['field_max'] = $max;
            SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
            $QryUpdatePlanet = "UPDATE {{table}} SET ";
            $QryUpdatePlanet .= "`" . $resource[$Element] . "` = '" . $CurrentPlanet[$resource[$Element]] . "', ";
            // Mise a 0 de l'heure de fin de construction ...
            // Ca va activer la mise en place du batiment suivant de la queue
            $QryUpdatePlanet .= "`b_building` = '" . $CurrentPlanet['b_building'] . "' , ";
            $QryUpdatePlanet .= "`b_building_id` = '" . $CurrentPlanet['b_building_id'] . "' , ";
            $QryUpdatePlanet .= "`field_current` = '" . $CurrentPlanet['field_current'] . "' , ";
            $QryUpdatePlanet .= "`field_max` = '" . $CurrentPlanet['field_max'] . "' , ";
            $QryUpdatePlanet .= "`metal` = '" . $CurrentPlanet['metal'] . "' , ";
            $QryUpdatePlanet .= "`crystal` = '" . $CurrentPlanet['crystal'] . "' , ";
            $QryUpdatePlanet .= "`deuterium` = '" . $CurrentPlanet['deuterium'] . "' , ";
            $QryUpdatePlanet .= "`last_update` = '" . $CurrentPlanet['last_update'] . "'   ";
            $QryUpdatePlanet .= "WHERE ";
            $QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
            doquery($QryUpdatePlanet, 'planets');
            /*
            $QryUpdateUser    = "UPDATE {{table}} SET ";
            $QryUpdateUser   .= "`xpminier` = '".$CurrentUser['xpminier']."' ";
            $QryUpdateUser   .= "WHERE ";
            $QryUpdateUser   .= "`id` = '" . $CurrentUser['id'] . "';";
            doquery( $QryUpdateUser, 'users');
            */
            $RetValue = true;
        } else {
//.........这里部分代码省略.........
开发者ID:GaryHuang-CL,项目名称:y1910061,代码行数:101,代码来源:CheckPlanetBuildingQueue.php


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