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


PHP ResourceUpdate::getNetworkLevel方法代码示例

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


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

示例1: addResearchToQueue

 public static function addResearchToQueue($Element, $AddMode = true)
 {
     global $PLANET, $USER, $resource, $CONF, $reslist, $pricelist;
     $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET);
     if (!in_array($Element, $reslist['tech']) || !BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element) || !BuildFunctions::CheckLabSettingsInQueue($PLANET)) {
         return;
     }
     $CurrentQueue = unserialize($USER['b_tech_queue']);
     if (!empty($CurrentQueue)) {
         $ActualCount = count($CurrentQueue);
     } else {
         $CurrentQueue = array();
         $ActualCount = 0;
     }
     if (Config::get('max_elements_tech') != 0 && Config::get('max_elements_tech') <= $ActualCount) {
         return false;
     }
     $BuildLevel = $USER[$resource[$Element]] + 1;
     if ($ActualCount == 0) {
         if ($pricelist[$Element]['max'] < $BuildLevel) {
             return;
         }
         $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, !$AddMode);
         if (!BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources)) {
             return;
         }
         if (isset($costRessources[901])) {
             $PLANET[$resource[901]] -= $costRessources[901];
         }
         if (isset($costRessources[902])) {
             $PLANET[$resource[902]] -= $costRessources[902];
         }
         if (isset($costRessources[903])) {
             $PLANET[$resource[903]] -= $costRessources[903];
         }
         if (isset($costRessources[921])) {
             $USER[$resource[921]] -= $costRessources[921];
         }
         $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources);
         $BuildEndTime = TIMESTAMP + $elementTime;
         $USER['b_tech_queue'] = serialize(array(array($Element, $BuildLevel, $elementTime, $BuildEndTime, $PLANET['id'])));
         $USER['b_tech'] = $BuildEndTime;
         $USER['b_tech_id'] = $Element;
         $USER['b_tech_planet'] = $PLANET['id'];
     } else {
         $addLevel = 0;
         foreach ($CurrentQueue as $QueueSubArray) {
             if ($QueueSubArray[0] != $Element) {
                 continue;
             }
             $addLevel++;
         }
         $BuildLevel += $addLevel;
         if ($pricelist[$Element]['max'] < $BuildLevel) {
             return;
         }
         $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, NULL, !$AddMode, $BuildLevel);
         $BuildEndTime = $CurrentQueue[$ActualCount - 1][3] + $elementTime;
         $CurrentQueue[] = array($Element, $BuildLevel, $elementTime, $BuildEndTime, $PLANET['id']);
         $USER['b_tech_queue'] = serialize($CurrentQueue);
     }
 }
开发者ID:joancefet,项目名称:Beta7,代码行数:62,代码来源:class.BuildFunctions.php

示例2: show

 public function show()
 {
     global $PLANET, $USER, $UNI, $LNG, $resource, $reslist, $CONF, $pricelist;
     if ($PLANET[$resource[31]] == 0) {
         $this->printMessage($LNG['bd_lab_required']);
     }
     $TheCommand = HTTP::_GP('cmd', '');
     $Element = HTTP::_GP('tech', 0);
     $ListID = HTTP::_GP('listid', 0);
     $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET);
     if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
         switch ($TheCommand) {
             case 'insert':
                 $this->AddBuildingToQueue($Element, true);
                 break;
         }
         $this->redirectTo('game.php?page=dmtech');
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET);
     $queueData = $this->getQueueData();
     $TechQueue = $queueData['queue'];
     $QueueCount = count($TechQueue);
     $ResearchList = array();
     $Elements = array(106, 108, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 131, 132, 133);
     foreach ($Elements as $ID => $Element) {
         if (!BuildFunctions::isBusyToBuild($USER, $PLANET, $Element)) {
             continue;
         }
         $AllTech = array();
         $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;");
         if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) {
             while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) {
                 $AllTech[] = $x;
             }
         }
         if (isset($queueData['quickinfo'][$Element])) {
             $levelToBuild = $queueData['quickinfo'][$Element];
         } else {
             $levelToBuild = $USER[$resource[$Element]];
         }
         $costRessources = max(1, ($pricelist[$Element]['cost']['901'] + $pricelist[$Element]['cost']['902'] * 2 + $pricelist[$Element]['cost']['903'] * 4) * pow($pricelist[$Element]['factor'], $USER[$resource[$Element]]) / 2500);
         $elementTime = 0;
         $ResearchList[$Element] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => pretty_number($costRessources), 'levelToBuild' => $levelToBuild, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element), 'AllTech' => $AllTech);
     }
     $premium_stage = 0;
     if ($USER['premium_reward_stage'] > 0 && $USER['premium_reward_days'] > TIMESTAMP) {
         $premium_stage = $USER['premium_reward_stage'];
     }
     $this->tplObj->assign_vars(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'IsFullQueue' => Config::get('max_elements_tech') == 0 || Config::get('max_elements_tech') + $premium_stage == count($TechQueue), 'Queue' => $TechQueue));
     $this->display('page.dmtech.default.tpl');
 }
开发者ID:Decoder1978,项目名称:Xterium,代码行数:51,代码来源:class.ShowDmtechPage.php

示例3: show

 public function show()
 {
     global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $pricelist;
     $TheCommand = HTTP::_GP('cmd', '');
     $Element = HTTP::_GP('tech', 0);
     $ListID = HTTP::_GP('listid', 0);
     $lvlup1 = HTTP::_GP('lvlup1', 0);
     $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET);
     if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
         switch ($TheCommand) {
             case 'cancel':
                 $this->CancelBuildingFromQueue();
                 break;
             case 'remove':
                 $this->RemoveBuildingFromQueue($ListID);
                 break;
             case 'instant':
                 $this->InstantBuildingFromQueue();
                 break;
             case 'insert':
                 $this->AddBuildingToQueue($Element, $lvlup1, true);
                 break;
             case 'destroy':
                 $this->DoAddBuildingToQueue($Element, false);
                 break;
         }
         $this->redirectTo('game.php?page=research');
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET);
     $queueData = $this->getQueueData();
     $TechQueue = $queueData['queue'];
     $QueueCount = count($TechQueue);
     $ResearchList = array();
     foreach ($reslist['tech'] as $ID => $Element) {
         $AllTech = array();
         $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;");
         if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) {
             while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) {
                 $AllTech[] = $x;
             }
         }
         if (isset($queueData['quickinfo'][$Element])) {
             $levelToBuild = $queueData['quickinfo'][$Element];
         } else {
             $levelToBuild = $USER[$resource[$Element]];
         }
         $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild);
         $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources);
         $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources);
         $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources);
         $ResearchList[$Element] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'factor' => $pricelist[$Element]['factor'], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element));
     }
     $this->tplObj->loadscript('research.js');
     $premium_stage = 0;
     if ($USER['premium_reward_stage'] > 0 && $USER['premium_reward_stage_days'] > TIMESTAMP) {
         $premium_stage = $USER['premium_reward_stage'];
     }
     $manual_step_5 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 5 && $PLANET['laboratory'] < 3) {
         $manual_step_5 = 0;
     }
     $manual_step_5_1 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 5 && $PLANET['laboratory'] >= 3) {
         $manual_step_5_1 = 0;
     }
     $manual_step_6 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 6) {
         $manual_step_6 = 0;
     }
     $manual_step_6_1 = 1;
     $manual_step_7 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 6 && $USER['spy_tech'] >= 3) {
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '8' WHERE `id` = " . $USER['id'] . ";");
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `experience_peace` = `experience_peace` + '650' WHERE `id` = " . $USER['id'] . ";");
         $manual_step_7 = 0;
     }
     $manual_step_9 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 9) {
         $manual_step_9 = 0;
     }
     $manual_step_16 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 16) {
         $manual_step_16 = 0;
     }
     $this->tplObj->assign_vars(array('manual_step_5_1' => $manual_step_5_1, 'manual_step_16' => $manual_step_16, 'manual_step_5' => $manual_step_5, 'manual_step_9' => $manual_step_9, 'manual_step_6' => $manual_step_6, 'dmavaible' => $USER['darkmatter'], 'modinstant' => $CONF['modinstant'], 'mod_research_cost' => $CONF['modinstantresearch'], 'modinstantresen' => $CONF['modinstantresen'], 'manual_step_7' => $manual_step_7, 'ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'IsFullQueue' => Config::get('max_elements_tech') == 0 || Config::get('max_elements_tech') + $premium_stage == count($TechQueue), 'Queue' => $TechQueue));
     $this->display('page.research.default.tpl');
 }
开发者ID:Decoder1978,项目名称:Xterium,代码行数:87,代码来源:class.ShowResearchPage.php

示例4: show

 public function show()
 {
     global $PLANET, $USER, $LNG, $resource, $reslist, $pricelist;
     if ($PLANET[$resource[31]] == 0) {
         $this->printMessage($LNG['bd_lab_required']);
     }
     $TheCommand = HTTP::_GP('cmd', '');
     $elementId = HTTP::_GP('tech', 0);
     $ListID = HTTP::_GP('listid', 0);
     $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET);
     if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
         switch ($TheCommand) {
             case 'cancel':
                 $this->CancelBuildingFromQueue();
                 break;
             case 'remove':
                 $this->RemoveBuildingFromQueue($ListID);
                 break;
             case 'insert':
                 $this->AddBuildingToQueue($elementId, true);
                 break;
             case 'destroy':
                 $this->AddBuildingToQueue($elementId, false);
                 break;
         }
         $this->redirectTo('game.php?page=research');
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET);
     $queueData = $this->getQueueData();
     $TechQueue = $queueData['queue'];
     $QueueCount = count($TechQueue);
     $ResearchList = array();
     foreach ($reslist['tech'] as $elementId) {
         if (!BuildFunctions::isTechnologieAccessible($USER, $PLANET, $elementId)) {
             continue;
         }
         if (isset($queueData['quickinfo'][$elementId])) {
             $levelToBuild = $queueData['quickinfo'][$elementId];
         } else {
             $levelToBuild = $USER[$resource[$elementId]];
         }
         $costResources = BuildFunctions::getElementPrice($USER, $PLANET, $elementId, false, $levelToBuild);
         $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $elementId, $costResources);
         $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $elementId, $costResources);
         $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $elementId, $costResources);
         $ResearchList[$elementId] = array('id' => $elementId, 'level' => $USER[$resource[$elementId]], 'maxLevel' => $pricelist[$elementId]['max'], 'costResources' => $costResources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild);
     }
     $this->assign(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'IsFullQueue' => Config::get()->max_elements_tech == 0 || Config::get()->max_elements_tech == count($TechQueue), 'Queue' => $TechQueue));
     $this->display('page.research.default.tpl');
 }
开发者ID:tatarysh,项目名称:2Moons,代码行数:50,代码来源:ShowResearchPage.class.php

示例5: show

 public function show()
 {
     global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $pricelist;
     $TheCommand = HTTP::_GP('cmd', '');
     $Element = HTTP::_GP('tech', 0);
     $ListID = HTTP::_GP('listid', 0);
     $mode = HTTP::_GP('cmdd', 'physik');
     $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET);
     if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
         switch ($TheCommand) {
             case 'cancel':
                 $this->CancelBuildingFromQueue();
                 break;
             case 'remove':
                 $this->RemoveBuildingFromQueue($ListID);
                 break;
             case 'insert':
                 $this->AddBuildingToQueue($Element, true);
                 break;
             case 'destroy':
                 $this->AddBuildingToQueue($Element, false);
                 break;
         }
         $this->redirectTo('game.php?page=research&cmdd=' . $mode . '');
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET);
     $queueData = $this->getQueueData();
     $TechQueue = $queueData['queue'];
     $QueueCount = count($TechQueue);
     $ResearchList = array();
     if ($mode == 'space') {
         $elementIDs = array(109, 110, 111, 115, 117, 118);
     } elseif ($mode == 'militar') {
         $elementIDs = array(145, 106, 146, 147, 148, 149);
     } else {
         $elementIDs = array(113, 140, 141, 142, 143, 144);
     }
     foreach ($elementIDs as $ID => $Element) {
         $AllTech = array();
         $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;");
         if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) {
             while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) {
                 $AllTech[] = $x;
             }
         }
         if (isset($queueData['quickinfo'][$Element])) {
             $levelToBuild = $queueData['quickinfo'][$Element];
         } else {
             $levelToBuild = $USER[$resource[$Element]];
         }
         $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild);
         $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources);
         $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources);
         $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources);
         $ResearchList[$Element] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element));
     }
     if ($USER['b_tech_id'] != 0) {
         $this->tplObj->loadscript('research.js');
     }
     $max_build = Config::get('max_elements_tech');
     if ($USER['mode_chaine'] > TIMESTAMP) {
         $max_build += 2;
     }
     if ($mode == 'space') {
         $Tab = 'Space research';
     } elseif ($mode == 'militar') {
         $Tab = 'Military research';
     } else {
         $Tab = 'Theoretical Physics';
     }
     $this->tplObj->assign_vars(array('Tab' => $Tab, 'ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'IsFullQueue' => $max_build == 0 || $max_build == count($TechQueue), 'Queue' => $TechQueue, 'mode' => $mode));
     $this->display('page.research.default.tpl');
 }
开发者ID:fuding,项目名称:Antaris,代码行数:73,代码来源:class.ShowResearchPage.php


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