本文整理汇总了PHP中isModulAvalible函数的典型用法代码示例。如果您正苦于以下问题:PHP isModulAvalible函数的具体用法?PHP isModulAvalible怎么用?PHP isModulAvalible使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isModulAvalible函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: allowPhalanx
static function allowPhalanx($toGalaxy, $toSystem)
{
global $PLANET, $resource;
if ($PLANET['galaxy'] != $toGalaxy || $PLANET[$resource[42]] == 0 || !isModulAvalible(MODULE_PHALANX) || $PLANET[$resource[903]] < PHALANX_DEUTERIUM) {
return false;
}
$PhRange = self::GetPhalanxRange($PLANET[$resource[42]]);
$systemMin = max(1, $PLANET['system'] - $PhRange);
$systemMax = $PLANET['system'] + $PhRange;
return $toSystem >= $systemMin && $toSystem <= $systemMax;
}
示例2: GetAvailableMissions
public static function GetAvailableMissions($USER, $MissionInfo, $GetInfoPlanet)
{
$YourPlanet = !empty($GetInfoPlanet['id_owner']) && $GetInfoPlanet['id_owner'] == $USER['id'] ? true : false;
$UsedPlanet = !empty($GetInfoPlanet['id_owner']) ? true : false;
$avalibleMissions = array();
if ($MissionInfo['planettype'] == 2) {
if ((isset($MissionInfo['Ship'][209]) || isset($MissionInfo['Ship'][219]) || isset($MissionInfo['Ship'][223])) && isModulAvalible(MODULE_MISSION_RECYCLE && $GetInfoPlanet['id_owner'] != Asteroid_Id)) {
$avalibleMissions[] = 8;
}
} else {
if (!$UsedPlanet) {
if (isset($MissionInfo['Ship'][208]) && $MissionInfo['planettype'] == 1 && isModulAvalible(MODULE_MISSION_COLONY)) {
$avalibleMissions[] = 7;
}
} else {
if (isModulAvalible(MODULE_MISSION_TRANSPORT) && $GetInfoPlanet['id_owner'] != Asteroid_Id) {
$avalibleMissions[] = 3;
}
if (!$YourPlanet && self::OnlyShipByID($MissionInfo['Ship'], 224) && isModulAvalible(MODULE_MISSION_SPY) && $USER['immunity_until'] < TIMESTAMP && $GetInfoPlanet['id_owner'] != Asteroid_Id) {
$avalibleMissions[] = 6;
}
//if (!$YourPlanet && self::OnlyShipByID($MissionInfo['Ship'], 210) && isModulAvalible(MODULE_MISSION_SPY))
//$avalibleMissions[] = 14;
if ((isset($MissionInfo['Ship'][209]) || isset($MissionInfo['Ship'][219]) || isset($MissionInfo['Ship'][223])) && $GetInfoPlanet['id_owner'] == Asteroid_Id && $MissionInfo['planettype'] == 1) {
$avalibleMissions[] = 16;
}
if (!$YourPlanet) {
if (isModulAvalible(MODULE_MISSION_ATTACK)) {
$avalibleMissions[] = 12;
}
if (isModulAvalible(MODULE_MISSION_ATTACK) && $USER['immunity_until'] < TIMESTAMP && $GetInfoPlanet['id_owner'] != Asteroid_Id) {
$avalibleMissions[] = 1;
}
} elseif (isModulAvalible(MODULE_MISSION_STATION) && $GetInfoPlanet['id_owner'] != Asteroid_Id) {
$avalibleMissions[] = 4;
}
}
}
return $avalibleMissions;
}
示例3: define
* @author Jan Kröpke <info@2moons.cc>
* @copyright 2012 Jan Kröpke <info@2moons.cc>
* @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
* @version 1.7.3 (2013-05-19)
* @info $Id: userpic.php 2643 2013-03-26 17:13:31Z slaver7 $
* @link http://2moons.cc/
*/
define('MODE', 'BANNER');
define('ROOT_PATH', str_replace('\\', '/', dirname(__FILE__)) . '/');
set_include_path(ROOT_PATH);
if (!extension_loaded('gd')) {
clearGIF();
}
require 'includes/common.php';
$id = HTTP::_GP('id', 0);
if (!isModulAvalible(MODULE_BANNER) || $id == 0) {
clearGIF();
}
$LNG = new Language();
$LNG->getUserAgentLanguage();
$LNG->includeData(array('L18N', 'BANNER', 'CUSTOM'));
require 'includes/classes/class.StatBanner.php';
$banner = new StatBanner();
$Data = $banner->GetData($id);
if (!isset($Data) || !is_array($Data)) {
clearGIF();
}
$ETag = md5(implode('', $Data));
header('ETag: ' . $ETag);
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $ETag) {
HTTP::sendHeader('HTTP/1.0 304 Not Modified');
示例4: TargetEvent
function TargetEvent()
{
global $pricelist, $reslist, $resource;
$senderUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE id = " . $this->_fleet['fleet_owner'] . ";");
$senderPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT galaxy, system, planet, name FROM " . PLANETS . " WHERE id = " . $this->_fleet['fleet_start_id'] . ";");
$senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']);
$ownSpyLvl = max($senderUser['spy_tech'], 1);
$LNG = $this->getLanguage($senderUser['lang']);
$targetUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE id = " . $this->_fleet['fleet_target_owner'] . ";");
$targetPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE id = " . $this->_fleet['fleet_end_id'] . ";");
$totale_ris = ($targetPlanet['metal'] + $targetPlanet['crystal'] + $targetPlanet['deuterium']) / 2;
$fleet_202 = pretty_number(ceil($totale_ris / $pricelist[202]['capacity']));
$fleet_203 = pretty_number(ceil($totale_ris / $pricelist[203]['capacity']));
$fleet_209 = pretty_number(ceil($totale_ris / $pricelist[209]['capacity']));
$fleet_219 = pretty_number(ceil($totale_ris / $pricelist[219]['capacity']));
$risorsi = pretty_number($totale_ris);
$targetSpyLvl = max($targetUser['spy_tech'], 1);
$targetUser['factor'] = getFactors($targetUser, 'basic', $this->_fleet['fleet_start_time']);
$PlanetRess = new ResourceUpdate();
list($targetUser, $targetPlanet) = $PlanetRess->CalcResource($targetUser, $targetPlanet, true, $this->_fleet['fleet_start_time']);
$targetStayFleets = $GLOBALS['DATABASE']->query("SELECT * FROM " . FLEETS . " WHERE fleet_end_id = " . $this->_fleet['fleet_end_id'] . " AND fleet_mission = 5 AND fleet_end_stay > " . $this->_fleet['fleet_start_time'] . ";");
while ($fleetRow = $GLOBALS['DATABASE']->fetch_array($targetStayFleets)) {
$temp = explode(';', $fleetRow['fleet_array']);
foreach ($temp as $temp2) {
$temp2 = explode(',', $temp2);
if (!isset($targetPlanet[$resource[$temp2[0]]])) {
$targetPlanet[$resource[$temp2[0]]] = 0;
}
$targetPlanet[$resource[$temp2[0]]] += $temp2[1];
}
}
$GLOBALS['DATABASE']->free_result($targetStayFleets);
$fleetAmount = $this->_fleet['fleet_amount'] * (1 + $senderUser['factor']['SpyPower']);
$Diffence = abs($ownSpyLvl - $targetSpyLvl);
$MinAmount = ($ownSpyLvl > $targetSpyLvl ? -1 : 1) * pow($Diffence * SPY_DIFFENCE_FACTOR, 2);
$SpyFleet = $fleetAmount >= $MinAmount;
$SpyDef = $fleetAmount >= $MinAmount + 1 * SPY_VIEW_FACTOR;
$SpyBuild = $fleetAmount >= $MinAmount + 3 * SPY_VIEW_FACTOR;
$SpyTechno = $fleetAmount >= $MinAmount + 5 * SPY_VIEW_FACTOR;
$classIDs[900] = array_merge($reslist['resstype'][1], $reslist['resstype'][2]);
if ($SpyFleet) {
$classIDs[200] = $reslist['fleet'];
}
if ($SpyDef) {
$classIDs[400] = $reslist['defense'];
}
if ($SpyBuild) {
$classIDs[0] = $reslist['build'];
}
if ($SpyTechno) {
$classIDs[100] = $reslist['tech'];
}
$targetChance = mt_rand(0, min($fleetAmount / 4 * ($targetSpyLvl / $ownSpyLvl), 100));
$spyChance = mt_rand(0, 100);
foreach ($classIDs as $classID => $elementIDs) {
foreach ($elementIDs as $elementID) {
if ($classID == 100) {
$spyData[$classID][$elementID] = $targetUser[$resource[$elementID]];
} else {
$spyData[$classID][$elementID] = $targetPlanet[$resource[$elementID]];
}
}
if ($senderUser['spyMessagesMode'] == 1) {
$spyData[$classID] = array_filter($spyData[$classID]);
}
}
// I'm use template class here, because i want to exclude HTML in PHP.
require_once 'includes/classes/class.template.php';
$template = new template();
$template->caching = true;
$template->compile_id = $senderUser['lang'];
$template->loadFilter('output', 'trimwhitespace');
list($tplDir) = $template->getTemplateDir();
$template->setTemplateDir($tplDir . 'game/');
$template->assign_vars(array('spyData' => $spyData, 'targetPlanet' => $targetPlanet, 'targetChance' => $targetChance, 'spyChance' => $spyChance, 'isBattleSim' => ENABLE_SIMULATOR_LINK == true && isModulAvalible(MODULE_SIMULATOR), 'title' => sprintf($LNG['sys_mess_head'], $targetPlanet['name'], $targetPlanet['galaxy'], $targetPlanet['system'], $targetPlanet['planet'], _date($LNG['php_tdformat'], $this->_fleet['fleet_end_time'], $targetUser['timezone'], $LNG)), 'tot_risorsi' => $risorsi, 'fleet_202' => "" . $LNG['tech'][202] . " " . $fleet_202 . "", 'fleet_203' => "" . $LNG['tech'][203] . " " . $fleet_203 . "", 'fleet_209' => "" . $LNG['tech'][209] . " " . $fleet_209 . "", 'fleet_219' => "" . $LNG['tech'][219] . " " . $fleet_219 . ""));
$template->assign_vars(array('LNG' => $LNG), false);
$spyRaport = $template->fetch('shared.mission.spyraport.tpl');
SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 0, $LNG['sys_mess_qg'], $LNG['sys_mess_spy_report'], $spyRaport);
$LNG = $this->getLanguage($targetUser['lang']);
$targetMessage = $LNG['sys_mess_spy_ennemyfleet'] . " " . $senderPlanet['name'];
if ($this->_fleet['fleet_start_type'] == 3) {
$targetMessage .= $LNG['sys_mess_spy_report_moon'] . ' ';
}
$targetMessage .= '<a href="game.php?page=galaxy&galaxy=' . $senderPlanet["galaxy"] . '&system=' . $senderPlanet["system"] . '">' . '[' . $senderPlanet['galaxy'] . ':' . $senderPlanet['system'] . ':' . $senderPlanet['planet'] . ']</a> ' . $LNG['sys_mess_spy_seen_at'] . ' ' . $targetPlanet['name'] . ' [' . $targetPlanet['galaxy'] . ':' . $targetPlanet['system'] . ':' . $targetPlanet['planet'] . '] ' . $LNG['sys_mess_spy_seen_at2'] . '.';
SendSimpleMessage($this->_fleet['fleet_target_owner'], 0, $this->_fleet['fleet_start_time'], 0, $LNG['sys_mess_spy_control'], $LNG['sys_mess_spy_activity'], $targetMessage);
if ($targetChance >= $spyChance) {
$CONF = Config::getAll(NULL, $this->_fleet['fleet_universe']);
$WhereCol = $this->_fleet['fleet_end_type'] == 3 ? "id_luna" : "id";
$GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET\n\t\t\tder_metal = der_metal + " . $fleetAmount * $pricelist[210]['cost'][901] * (Config::get('Fleet_Cdr') / 100) . ", \n\t\t\tder_crystal = der_crystal + " . $fleetAmount * $pricelist[210]['cost'][902] * (Config::get('Fleet_Cdr') / 100) . " \n\t\t\tWHERE " . $WhereCol . " = " . $this->_fleet['fleet_end_id'] . ";");
$this->KillFleet();
} else {
$this->setState(FLEET_RETURN);
$this->SaveFleet();
}
}
示例5: GetUserShotcut
private function GetUserShotcut()
{
global $USER;
if (!isModulAvalible(MODULE_SHORTCUTS)) {
return array();
}
$db = Database::get();
$sql = "SELECT * FROM %%SHORTCUTS%% WHERE ownerID = :userID;";
$ShortcutResult = $db->select($sql, array(':userID' => $USER['id']));
$ShortcutList = array();
foreach ($ShortcutResult as $ShortcutRow) {
$ShortcutList[$ShortcutRow['shortcutID']] = $ShortcutRow;
}
return $ShortcutList;
}
示例6: show
public function show()
{
global $USER, $PLANET, $resource, $LNG, $CONF, $pricelist;
$UserDeuterium = $PLANET['elyrium'];
$planetID = HTTP::_GP('planetID', 0);
$targetMission = HTTP::_GP('mission', 0);
$galaxyC = HTTP::_GP('galaxyC', 0);
$systemC = HTTP::_GP('systemC', 0);
$planetC = HTTP::_GP('planetC', 0);
if (IsVacationMode($USER)) {
$this->sendData(620, $LNG['fa_vacation_mode_current']);
}
$fleetArray = array();
switch ($targetMission) {
case 14:
if (!isModulAvalible(MODULE_MISSION_SPY)) {
$this->sendData('rouge', $LNG['sys_module_inactive']);
}
if ($PLANET['teleport_portal'] == 0) {
$this->sendData('rouge', $LNG['fleet_ajax_11']);
}
$ships = min($USER['spio_anz'], $PLANET[$resource[210]]);
if (empty($ships)) {
$this->sendData('rouge', $LNG['fleet_ajax_22']);
}
$fleetArray = array(210 => $ships);
$this->returnData['ships'][210] = $PLANET[$resource[210]] - $ships;
break;
case 7:
if (!isModulAvalible(MODULE_MISSION_COLONY)) {
$this->sendData('rouge', $LNG['sys_module_inactive']);
}
if ($PLANET['teleport_portal'] == 0) {
$this->sendData('rouge', $LNG['fleet_ajax_11']);
}
if ($PLANET[$resource[303]] < 10 || $PLANET[$resource[306]] < 100) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_12'], $PLANET[$resource[303]], $PLANET[$resource[306]]));
}
$fleetArray = array(303 => 10, 306 => 100);
break;
default:
$this->sendData('rouge', $LNG['fleet_ajax_22']);
break;
}
$fleetArray = array_filter($fleetArray);
if (empty($fleetArray)) {
$this->sendData('rouge', $LNG['fleet_ajax_22']);
}
$iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $USER['id'] . "' AND `planet_type` = '1' AND `destruyed` = '0';");
$MaxPlanets = PlayerUtil::maxPlanetCount($USER);
if ($iPlanetCount >= $MaxPlanets && $targetMission == 7) {
$this->sendData('rouge', $LNG['fleet_ajax_14']);
}
$targetData = $GLOBALS['DATABASE']->getFirstRow("SELECT planet.id_owner as id_owner, \n\t\t\t\t\t\t\t\t\t\tplanet.id as id, \n\t\t\t\t\t\t\t\t\t\tplanet.name as name, \n\t\t\t\t\t\t\t\t\t\tplanet.galaxy as galaxy, \n\t\t\t\t\t\t\t\t\t\tplanet.system as system, \n\t\t\t\t\t\t\t\t\t\tplanet.planet as planet,\n\t\t\t\t\t\t\t\t\t\tplanet.planet_type as planet_type, \n\t\t\t\t\t\t\t\t\t\tplanet.force_field_timer as force_field_timer, \n\t\t\t\t\t\t\t\t\t\tplanet.teleport_portal as teleport_portal, \n\t\t\t\t\t\t\t\t\t\ttotal_points, onlinetime, forcefield_tech, urlaubs_modus, banaday, authattack, user_deleted, username\n\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " planet\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . USERS . " user ON planet.id_owner = user.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . STATPOINTS . " as stat ON stat.id_owner = user.id AND stat.stat_type = '1' \n\t\t\t\t\t\t\t\t\t\tWHERE planet.galaxy = " . $galaxyC . " AND planet.system = " . $systemC . " AND planet.planet = " . $planetC . ";");
$BuddyCheck = $GLOBALS['DATABASE']->query("SELECT * FROM uni1_buddy WHERE (sender = '" . $USER['id'] . "' AND owner = '" . $targetData['id_owner'] . "' AND state = '1') OR (owner = '" . $USER['id'] . "' AND sender = '" . $targetData['id_owner'] . "' AND state = '1');");
if ($targetMission == 1 || $targetMission == 6 || $targetMission == 3 || $targetMission == 14 || $targetMission == 13) {
$ipCheck = $GLOBALS['DATABASE']->query("SELECT userID, secondID FROM uni1_ipblock WHERE userID = " . $USER['id'] . " OR secondID = '" . $USER['id'] . "';");
if ($GLOBALS['DATABASE']->numRows($ipCheck) > 0) {
while ($xb = $GLOBALS['DATABASE']->fetch_array($ipCheck)) {
if ($targetData['id_owner'] == $xb['userID'] || $targetData['id_owner'] == $xb['secondID']) {
$this->sendData('rouge', '<span class=rouge>' . sprintf($LNG['fleet_multi_block'], $this->getUsername($targetData['id_owner'])) . '</span>');
}
}
}
if ($GLOBALS['DATABASE']->numRows($BuddyCheck) >= 1) {
$this->sendData('rouge', sprintf($LNG['fleet_pact'], $this->getUsername($targetData['id_owner'])));
}
}
if ($targetMission == 14) {
if ($targetData['id_owner'] == $USER['id']) {
$this->sendData('rouge', $LNG['fleet_ajax_19']);
}
if ($targetData['force_field_timer'] > TIMESTAMP && $USER['virus_tech'] < $targetData['forcefield_tech']) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_21'], $this->getUsername($targetData['id_owner'])));
}
if ($targetData['teleport_portal'] == 0) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_18'], $targetData['name'], $targetData['system'], $targetData['planet']));
}
if ($targetData['user_deleted'] == 1) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_3'], $targetData['username']));
}
if ($targetData['banaday'] > TIMESTAMP) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_4'], $targetData['username']));
}
if (Config::get('adm_attack') == 1 && $targetData['authattack'] > $USER['authlevel']) {
$this->sendData('rouge', $LNG['fa_action_not_allowed']);
}
if (IsVacationMode($targetData)) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_5'], $targetData['username']));
}
$IsNoobProtec = CheckNoobProtec($USER, $targetData, $targetData);
if ($IsNoobProtec['NoobPlayer']) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_6'], $targetData['username']));
}
if ($IsNoobProtec['StrongPlayer']) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_7'], $targetData['username']));
}
if ($USER['id'] == $targetData['id_owner']) {
$this->sendData('rouge', $LNG['fleet_ajax_8']);
}
//.........这里部分代码省略.........
示例7: GetUserShotcut
private function GetUserShotcut()
{
global $USER;
if (!isModulAvalible(MODULE_SHORTCUTS)) {
return array();
}
$ShortcutResult = $GLOBALS['DATABASE']->query("SELECT * FROM " . SHORTCUTS . " WHERE ownerID = " . $USER['id'] . ";");
$ShortcutList = array();
while ($ShortcutRow = $GLOBALS['DATABASE']->fetch_array($ShortcutResult)) {
$ShortcutList[$ShortcutRow['shortcutID']] = $ShortcutRow;
}
$GLOBALS['DATABASE']->free_result($ShortcutResult);
return $ShortcutList;
}
示例8: show
public function show()
{
global $USER, $PLANET, $resource, $reslist, $LNG, $pricelist;
$updateID = HTTP::_GP('id', 0);
if (!empty($updateID) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
if (isModulAvalible(MODULE_OFFICIER) && in_array($updateID, $reslist['officier'])) {
$this->UpdateOfficier($updateID);
} elseif (isModulAvalible(MODULE_DMEXTRAS) && in_array($updateID, $reslist['dmfunc'])) {
$this->UpdateExtra($updateID);
}
}
$darkmatterList = array();
$officierList = array();
if (isModulAvalible(MODULE_DMEXTRAS)) {
foreach ($reslist['dmfunc'] as $Element) {
if ($USER[$resource[$Element]] > TIMESTAMP) {
$this->tplObj->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
}
$costResources = BuildFunctions::getElementPrice($USER, $PLANET, $Element);
$buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costResources);
$costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costResources);
$elementBonus = BuildFunctions::getAvalibleBonus($Element);
$darkmatterList[$Element] = array('timeLeft' => max($USER[$resource[$Element]] - TIMESTAMP, 0), 'costResources' => $costResources, 'buyable' => $buyable, 'time' => $pricelist[$Element]['time'], 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus);
}
}
if (isModulAvalible(MODULE_OFFICIER)) {
foreach ($reslist['officier'] as $Element) {
if (!BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)) {
continue;
}
$costResources = BuildFunctions::getElementPrice($USER, $PLANET, $Element);
$buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costResources);
$costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costResources);
$elementBonus = BuildFunctions::getAvalibleBonus($Element);
$officierList[$Element] = array('level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costResources' => $costResources, 'buyable' => $buyable, 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus);
}
}
$this->assign(array('officierList' => $officierList, 'darkmatterList' => $darkmatterList, 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['tech'][921])));
$this->display('page.officier.default.tpl');
}
示例9: TargetEvent
function TargetEvent()
{
global $pricelist, $reslist, $resource;
$db = Database::get();
$sql = 'SELECT * FROM %%USERS%% WHERE id = :userId;';
$senderUser = $db->selectSingle($sql, array(':userId' => $this->_fleet['fleet_owner']));
$targetUser = $db->selectSingle($sql, array(':userId' => $this->_fleet['fleet_target_owner']));
$sql = 'SELECT * FROM %%PLANETS%% WHERE id = :planetId;';
$targetPlanet = $db->selectSingle($sql, array(':planetId' => $this->_fleet['fleet_end_id']));
$sql = 'SELECT name FROM %%PLANETS%% WHERE id = :planetId;';
$senderPlanetName = $db->selectSingle($sql, array(':planetId' => $this->_fleet['fleet_start_id']), 'name');
$LNG = $this->getLanguage($senderUser['lang']);
$senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']);
$targetUser['factor'] = getFactors($targetUser, 'basic', $this->_fleet['fleet_start_time']);
$planetUpdater = new ResourceUpdate();
list($targetUser, $targetPlanet) = $planetUpdater->CalcResource($targetUser, $targetPlanet, true, $this->_fleet['fleet_start_time']);
$sql = 'SELECT * FROM %%FLEETS%% WHERE fleet_end_id = :planetId AND fleet_mission = 5 AND fleet_end_stay > :time;';
$targetStayFleets = $db->select($sql, array(':planetId' => $this->_fleet['fleet_end_id'], ':time' => $this->_fleet['fleet_start_time']));
foreach ($targetStayFleets as $fleetRow) {
$fleetData = FleetFunctions::unserialize($fleetRow['fleet_array']);
foreach ($fleetData as $shipId => $shipAmount) {
$targetPlanet[$resource[$shipId]] += $shipAmount;
}
}
$fleetAmount = $this->_fleet['fleet_amount'] * (1 + $senderUser['factor']['SpyPower']);
$senderSpyTech = max($senderUser['spy_tech'], 1);
$targetSpyTech = max($targetUser['spy_tech'], 1);
$techDifference = abs($senderSpyTech - $targetSpyTech);
$MinAmount = ($senderSpyTech > $targetSpyTech ? -1 : 1) * pow($techDifference * SPY_DIFFENCE_FACTOR, 2);
$SpyFleet = $fleetAmount >= $MinAmount;
$SpyDef = $fleetAmount >= $MinAmount + 1 * SPY_VIEW_FACTOR;
$SpyBuild = $fleetAmount >= $MinAmount + 3 * SPY_VIEW_FACTOR;
$SpyTechno = $fleetAmount >= $MinAmount + 5 * SPY_VIEW_FACTOR;
$classIDs[900] = array_merge($reslist['resstype'][1], $reslist['resstype'][2]);
if ($SpyFleet) {
$classIDs[200] = $reslist['fleet'];
}
if ($SpyDef) {
$classIDs[400] = array_merge($reslist['defense'], $reslist['missile']);
}
if ($SpyBuild) {
$classIDs[0] = $reslist['build'];
}
if ($SpyTechno) {
$classIDs[100] = $reslist['tech'];
}
$targetChance = mt_rand(0, min($fleetAmount / 4 * ($targetSpyTech / $senderSpyTech), 100));
$spyChance = mt_rand(0, 100);
$spyData = array();
foreach ($classIDs as $classID => $elementIDs) {
foreach ($elementIDs as $elementID) {
if (isset($targetUser[$resource[$elementID]])) {
$spyData[$classID][$elementID] = $targetUser[$resource[$elementID]];
} else {
$spyData[$classID][$elementID] = $targetPlanet[$resource[$elementID]];
}
}
if ($senderUser['spyMessagesMode'] == 1) {
$spyData[$classID] = array_filter($spyData[$classID]);
}
}
// I'm use template class here, because i want to exclude HTML in PHP.
require_once 'includes/classes/class.template.php';
$template = new template();
$template->caching = true;
$template->compile_id = $senderUser['lang'];
$template->loadFilter('output', 'trimwhitespace');
list($tplDir) = $template->getTemplateDir();
$template->setTemplateDir($tplDir . 'game/');
$template->assign_vars(array('spyData' => $spyData, 'targetPlanet' => $targetPlanet, 'targetChance' => $targetChance, 'spyChance' => $spyChance, 'isBattleSim' => ENABLE_SIMULATOR_LINK == true && isModulAvalible(MODULE_SIMULATOR), 'title' => sprintf($LNG['sys_mess_head'], $targetPlanet['name'], $targetPlanet['galaxy'], $targetPlanet['system'], $targetPlanet['planet'], _date($LNG['php_tdformat'], $this->_fleet['fleet_end_time'], $targetUser['timezone'], $LNG))));
$template->assign_vars(array('LNG' => $LNG), false);
$spyReport = $template->fetch('shared.mission.spyReport.tpl');
PlayerUtil::sendMessage($this->_fleet['fleet_owner'], 0, $LNG['sys_mess_qg'], 0, $LNG['sys_mess_spy_report'], $spyReport, $this->_fleet['fleet_start_time'], NULL, 1, $this->_fleet['fleet_universe']);
$LNG = $this->getLanguage($targetUser['lang']);
$targetMessage = $LNG['sys_mess_spy_ennemyfleet'] . " " . $senderPlanetName;
if ($this->_fleet['fleet_start_type'] == 3) {
$targetMessage .= $LNG['sys_mess_spy_report_moon'] . ' ';
}
$text = '<a href="game.php?page=galaxy&galaxy=%1$s&system=%2$s">[%1$s:%2$s:%3$s]</a> %7$s
%8$s <a href="game.php?page=galaxy&galaxy=%4$s&system=%5$s">[%4$s:%5$s:%6$s]</a> %9$s';
$targetMessage .= sprintf($text, $this->_fleet['fleet_start_galaxy'], $this->_fleet['fleet_start_system'], $this->_fleet['fleet_start_planet'], $this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $LNG['sys_mess_spy_seen_at'], $targetPlanet['name'], $LNG['sys_mess_spy_seen_at2']);
PlayerUtil::sendMessage($this->_fleet['fleet_target_owner'], 0, $LNG['sys_mess_spy_control'], 0, $LNG['sys_mess_spy_activity'], $targetMessage, $this->_fleet['fleet_start_time'], NULL, 1, $this->_fleet['fleet_universe']);
if ($targetChance >= $spyChance) {
$config = Config::get($this->_fleet['fleet_universe']);
$whereCol = $this->_fleet['fleet_end_type'] == 3 ? "id_luna" : "id";
$sql = 'UPDATE %%PLANETS%% SET
der_metal = der_metal + :metal,
der_crystal = der_crystal + :crystal
WHERE ' . $whereCol . ' = :planetId;';
$db->update($sql, array(':metal' => $fleetAmount * $pricelist[210]['cost'][901] * $config->Fleet_Cdr / 100, ':crystal' => $fleetAmount * $pricelist[210]['cost'][902] * $config->Fleet_Cdr / 100, ':planetId' => $this->_fleet['fleet_end_id']));
$this->KillFleet();
} else {
$this->setState(FLEET_RETURN);
$this->SaveFleet();
}
}
示例10: GetAvailableMissions
public static function GetAvailableMissions($USER, $MissionInfo, $GetInfoPlanet)
{
$YourPlanet = !empty($GetInfoPlanet['id_owner']) && $GetInfoPlanet['id_owner'] == $USER['id'] ? true : false;
$UsedPlanet = !empty($GetInfoPlanet['id_owner']) ? true : false;
$availableMissions = array();
if ($MissionInfo['planet'] == Config::get($USER['universe'])->max_planets + 1 && isModulAvalible(MODULE_MISSION_EXPEDITION)) {
$availableMissions[] = 15;
} elseif ($MissionInfo['planettype'] == 2) {
if ((isset($MissionInfo['Ship'][209]) || isset($MissionInfo['Ship'][219])) && isModulAvalible(MODULE_MISSION_RECYCLE) && !($GetInfoPlanet['der_metal'] == 0 && $GetInfoPlanet['der_crystal'] == 0)) {
$availableMissions[] = 8;
}
} else {
if (!$UsedPlanet) {
if (isset($MissionInfo['Ship'][208]) && $MissionInfo['planettype'] == 1 && isModulAvalible(MODULE_MISSION_COLONY)) {
$availableMissions[] = 7;
}
} else {
if (isModulAvalible(MODULE_MISSION_TRANSPORT)) {
$availableMissions[] = 3;
}
if (!$YourPlanet && self::OnlyShipByID($MissionInfo['Ship'], 210) && isModulAvalible(MODULE_MISSION_SPY)) {
$availableMissions[] = 6;
}
if (!$YourPlanet) {
if (isModulAvalible(MODULE_MISSION_ATTACK)) {
$availableMissions[] = 1;
}
if (isModulAvalible(MODULE_MISSION_HOLD)) {
$availableMissions[] = 5;
}
} elseif (isModulAvalible(MODULE_MISSION_STATION)) {
$availableMissions[] = 4;
}
if (!empty($MissionInfo['IsAKS']) && !$YourPlanet && isModulAvalible(MODULE_MISSION_ATTACK) && isModulAvalible(MODULE_MISSION_ACS)) {
$availableMissions[] = 2;
}
if (!$YourPlanet && $MissionInfo['planettype'] == 3 && isset($MissionInfo['Ship'][214]) && isModulAvalible(MODULE_MISSION_DESTROY)) {
$availableMissions[] = 9;
}
if ($YourPlanet && $MissionInfo['planettype'] == 3 && self::OnlyShipByID($MissionInfo['Ship'], 220) && isModulAvalible(MODULE_MISSION_DARKMATTER)) {
$availableMissions[] = 11;
}
}
}
return $availableMissions;
}
示例11: GetAvailableMissions
public static function GetAvailableMissions($USER, $MissionInfo, $GetInfoPlanet)
{
global $PLANET;
$YourPlanet = !empty($GetInfoPlanet['id_owner']) && $GetInfoPlanet['id_owner'] == $USER['id'] ? true : false;
$UsedPlanet = !empty($GetInfoPlanet['id_owner']) ? true : false;
$avalibleMissions = array();
if ($MissionInfo['planet'] == Config::get('max_planets') + 1 && $USER['immunity_until'] < TIMESTAMP) {
$avalibleMissions[] = 15;
} elseif ($MissionInfo['planettype'] == 2) {
if ((isset($MissionInfo['Ship'][209]) || isset($MissionInfo['Ship'][219])) && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_type'] != 4 && isModulAvalible(MODULE_MISSION_RECYCLE) && !($GetInfoPlanet['der_metal'] == 0 && $GetInfoPlanet['der_crystal'] == 0)) {
$avalibleMissions[] = 8;
}
} else {
if (!$UsedPlanet) {
if (isset($MissionInfo['Ship'][208]) && $GetInfoPlanet['id_owner'] != Asteroid_Id && $MissionInfo['planettype'] == 1 && isModulAvalible(MODULE_MISSION_COLONY)) {
$avalibleMissions[] = 7;
}
} else {
if (isModulAvalible(MODULE_MISSION_TRANSPORT) && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_type'] != 4) {
$avalibleMissions[] = 3;
}
if (isModulAvalible(MODULE_MISSION_TRANSPORT) && $GetInfoPlanet['id_owner'] == $USER['id'] && $GetInfoPlanet['planet_type'] == 4) {
$avalibleMissions[] = 3;
}
if (!$YourPlanet && $USER['immunity_until'] < TIMESTAMP && $GetInfoPlanet['id_owner'] != Asteroid_Id && self::OnlyShipByID($MissionInfo['Ship'], 210) && isModulAvalible(MODULE_MISSION_SPY)) {
$avalibleMissions[] = 6;
}
if ($GetInfoPlanet['id_owner'] == Asteroid_Id && $GetInfoPlanet['planet_type'] != 4 && $MissionInfo['planettype'] == 1) {
$avalibleMissions[] = 12;
}
if ($GetInfoPlanet['id_owner'] == Fortress_Id && $GetInfoPlanet['planet_type'] == 4 && $MissionInfo['planettype'] == 4) {
$avalibleMissions[] = 20;
}
if (!$YourPlanet) {
if (isModulAvalible(MODULE_MISSION_ATTACK) && $USER['immunity_until'] < TIMESTAMP && $PLANET['last_relocate'] < TIMESTAMP - 15 * 60 && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_protection'] < TIMESTAMP && $GetInfoPlanet['planet_type'] != 4) {
$avalibleMissions[] = 1;
}
if (isModulAvalible(MODULE_MISSION_HOLD) && $USER['immunity_until'] < TIMESTAMP && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_type'] != 4) {
$avalibleMissions[] = 5;
}
} elseif (isModulAvalible(MODULE_MISSION_STATION) && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_type'] != 4) {
$avalibleMissions[] = 4;
}
if (!empty($MissionInfo['IsAKS']) && $USER['immunity_until'] < TIMESTAMP && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_type'] != 4 && !$YourPlanet && isModulAvalible(MODULE_MISSION_ATTACK) && isModulAvalible(MODULE_MISSION_ACS)) {
$avalibleMissions[] = 2;
}
if (!$YourPlanet && $USER['immunity_until'] < TIMESTAMP && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_type'] != 4 && $MissionInfo['planettype'] == 3 && $PLANET['last_relocate'] < TIMESTAMP - 15 * 60 && isset($MissionInfo['Ship'][214]) && isModulAvalible(MODULE_MISSION_DESTROY) && $USER['rpg_destructeur'] > 0) {
$avalibleMissions[] = 9;
}
if ($YourPlanet && $GetInfoPlanet['id_owner'] != Asteroid_Id && $GetInfoPlanet['planet_type'] != 4 && $MissionInfo['planettype'] == 3 && self::OnlyShipByID($MissionInfo['Ship'], 220) && isModulAvalible(MODULE_MISSION_DARKMATTER)) {
$avalibleMissions[] = 11;
}
}
}
return $avalibleMissions;
}
示例12: array_combine
$dbTableNames = array_combine($dbTableNames['keys'], $dbTableNames['names']);
foreach ($dbTableNames as $dbAlias => $dbName) {
define(substr($dbAlias, 2, -2), $dbName);
}
}
$config = Config::get();
date_default_timezone_set($config->timezone);
require 'includes/vars.php';
if (MODE === 'INGAME' || MODE === 'ADMIN') {
$session = Session::load();
if (!$session->isValidSession()) {
HTTP::redirectTo('index.php?code=3');
}
require 'includes/classes/class.BuildFunctions.php';
require 'includes/classes/class.PlanetRessUpdate.php';
if (!AJAX_REQUEST && MODE === 'INGAME' && isModulAvalible(MODULE_FLEET_EVENTS)) {
require 'includes/FleetHandler.php';
}
$db = Database::get();
$sql = "SELECT \n\tuser.*,\n\tCOUNT(message.message_id) as messages\n\tFROM %%USERS%% as user\n\tLEFT JOIN %%MESSAGES%% as message ON message.message_owner = user.id AND message.message_unread = :unread\n\tWHERE user.id = :userId\n\tGROUP BY message.message_owner;";
$USER = $db->selectSingle($sql, array(':unread' => 1, ':userId' => $session->userId));
if (empty($USER)) {
HTTP::redirectTo('index.php?code=3');
}
$LNG = new Language($USER['lang']);
$LNG->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
$THEME->setUserTheme($USER['dpath']);
if ($config->game_disable == 0 && $USER['authlevel'] == AUTH_USR) {
ShowErrorPage::printError($LNG['sys_closed_game'] . '<br><br>' . $config->close_reason, false);
}
if ($USER['bana'] == 1) {
示例13: show
public function show()
{
global $USER, $PLANET, $resource, $LNG, $CONF, $pricelist;
$UserDeuterium = $PLANET['elyrium'];
$planetID = HTTP::_GP('planetID', 0);
$targetMission = HTTP::_GP('mission', 0);
$select = HTTP::_GP('select', 0);
if (IsVacationMode($USER)) {
$this->sendData(620, $LNG['fa_vacation_mode_current']);
}
$fleetArray = array();
switch ($targetMission) {
case 13:
if (!isModulAvalible(MODULE_MISSION_ATTACK)) {
$this->sendData('rouge', $LNG['sys_module_inactive']);
}
$GetuserComp = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_fleets_manage` WHERE userID = " . $USER['id'] . " AND manageID = " . $select . ";");
$num_rows = $GLOBALS['DATABASE']->numRows($GetuserComp);
if ($num_rows == 0) {
$this->sendData('rouge', 'You need to create a fleet shortcut first');
} else {
while ($xb = $GLOBALS['DATABASE']->fetch_array($GetuserComp)) {
$ship202 = min($xb['ship202'], $PLANET[$resource[202]]);
$ship203 = min($xb['ship203'], $PLANET[$resource[203]]);
$ship204 = min($xb['ship204'], $PLANET[$resource[204]]);
$ship205 = min($xb['ship205'], $PLANET[$resource[205]]);
$ship206 = min($xb['ship206'], $PLANET[$resource[206]]);
$ship207 = min($xb['ship207'], $PLANET[$resource[207]]);
$ship211 = min($xb['ship211'], $PLANET[$resource[211]]);
$ship214 = min($xb['ship214'], $PLANET[$resource[214]]);
$ship215 = min($xb['ship215'], $PLANET[$resource[215]]);
$ship216 = min($xb['ship216'], $PLANET[$resource[216]]);
if (empty($ship202) && $xb['ship202'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship203) && $xb['ship203'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship204) && $xb['ship204'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship205) && $xb['ship205'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship206) && $xb['ship206'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship207) && $xb['ship207'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship211) && $xb['ship211'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship214) && $xb['ship214'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship215) && $xb['ship215'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
} elseif (empty($ship216) && $xb['ship216'] > 0) {
$this->sendData(611, sprintf($LNG['fleet_ajax_15'], $LNG['tech'][202]));
}
$fleetArray = array(202 => $ship202, 203 => $ship203, 204 => $ship204, 205 => $ship205, 206 => $ship206, 207 => $ship207, 211 => $ship211, 214 => $ship214, 215 => $ship215, 216 => $ship216);
$this->returnData['ships'][202] = $PLANET[$resource[202]] - $ship202;
$this->returnData['ships'][203] = $PLANET[$resource[203]] - $ship203;
$this->returnData['ships'][204] = $PLANET[$resource[204]] - $ship204;
$this->returnData['ships'][205] = $PLANET[$resource[205]] - $ship205;
$this->returnData['ships'][206] = $PLANET[$resource[206]] - $ship206;
$this->returnData['ships'][207] = $PLANET[$resource[207]] - $ship207;
$this->returnData['ships'][211] = $PLANET[$resource[211]] - $ship211;
$this->returnData['ships'][214] = $PLANET[$resource[214]] - $ship214;
$this->returnData['ships'][215] = $PLANET[$resource[215]] - $ship215;
$this->returnData['ships'][216] = $PLANET[$resource[216]] - $ship216;
}
}
break;
default:
$this->sendData('rouge', $LNG['fleet_ajax_2']);
break;
}
$fleetArray = array_filter($fleetArray);
if (empty($fleetArray)) {
$this->sendData('rouge', $LNG['fleet_ajax_2']);
}
$targetData = $GLOBALS['DATABASE']->getFirstRow("SELECT planet.id_owner as id_owner, \n\t\t\t\t\t\t\t\t\t\tplanet.id as id, \n\t\t\t\t\t\t\t\t\t\tplanet.name as name, \n\t\t\t\t\t\t\t\t\t\tplanet.galaxy as galaxy, \n\t\t\t\t\t\t\t\t\t\tplanet.system as system, \n\t\t\t\t\t\t\t\t\t\tplanet.planet as planet,\n\t\t\t\t\t\t\t\t\t\tplanet.planet_type as planet_type, \n\t\t\t\t\t\t\t\t\t\tplanet.teleport_portal as teleport_portal, \n\t\t\t\t\t\t\t\t\t\tplanet.force_field_timer as force_field_timer, \n\t\t\t\t\t\t\t\t\t\ttotal_points, onlinetime, urlaubs_modus, banaday, forcefield_tech, authattack, user_deleted, username\n\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " planet\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . USERS . " user ON planet.id_owner = user.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . STATPOINTS . " as stat ON stat.id_owner = user.id AND stat.stat_type = '1' \n\t\t\t\t\t\t\t\t\t\tWHERE planet.id = " . $planetID . ";");
$BuddyCheck = $GLOBALS['DATABASE']->query("SELECT * FROM uni1_buddy WHERE (sender = '" . $USER['id'] . "' AND owner = '" . $targetData['id_owner'] . "' AND state = '1') OR (owner = '" . $USER['id'] . "' AND sender = '" . $targetData['id_owner'] . "' AND state = '1');");
if (empty($targetData)) {
$this->sendData('rouge', $LNG['fa_planet_not_exist']);
}
if ($targetMission == 1 || $targetMission == 6 || $targetMission == 3 || $targetMission == 14 || $targetMission == 13) {
$ipCheck = $GLOBALS['DATABASE']->query("SELECT userID, secondID FROM uni1_ipblock WHERE userID = " . $USER['id'] . " OR secondID = '" . $USER['id'] . "';");
if ($GLOBALS['DATABASE']->numRows($ipCheck) > 0) {
while ($xb = $GLOBALS['DATABASE']->fetch_array($ipCheck)) {
if ($targetData['id_owner'] == $xb['userID'] || $targetData['id_owner'] == $xb['secondID']) {
$this->sendData('rouge', '<span class=rouge>' . sprintf($LNG['fleet_multi_block'], $this->getUsername($targetData['id_owner'])) . '</span>');
}
}
}
if ($GLOBALS['DATABASE']->numRows($BuddyCheck) >= 1) {
$this->sendData('rouge', sprintf($LNG['fleet_pact'], $this->getUsername($targetData['id_owner'])));
}
}
if ($targetMission == 13) {
if ($targetMission == 13) {
if (FleetFunctions::CheckBashPortal($targetData['id_owner'])) {
$this->sendData('rouge', $LNG['fl_bash_protection']);
}
}
if ($targetData['id_owner'] == $USER['id']) {
//.........这里部分代码省略.........
示例14: define
<?php
/*
* @package AJAX_Chat
* @author Sebastian Tschan
* @copyright (c) Sebastian Tschan
* @license GNU Affero General Public License
* @link https://blueimp.net/ajax/
*/
// Include custom libraries and initialization code here
define('MODE', 'CHAT');
define('ROOT_PATH', str_replace('\\', '/', dirname(AJAX_CHAT_PATH)) . '/');
set_include_path(ROOT_PATH);
chdir(ROOT_PATH);
require 'includes/pages/game/AbstractPage.class.php';
require 'includes/pages/game/ShowErrorPage.class.php';
require 'includes/common.php';
$session = Session::load();
if (!$session->isValidSession() || Config::get()->game_disable == 0 && isset($USER['authlevel']) && $USER['authlevel'] == AUTH_USR) {
HTTP::redirectTo('index.php?code=3');
}
if (!isModulAvalible(MODULE_CHAT)) {
/** @var $LNG array */
ShowErrorPage::printError($LNG['sys_module_inactive']);
}
示例15: show
public function show()
{
global $USER, $CONF, $PLANET, $resource, $reslist, $LNG, $pricelist;
$updateID = HTTP::_GP('id', 0);
if (!empty($updateID) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
if (isModulAvalible(MODULE_OFFICIER) && in_array($updateID, $reslist['officier'])) {
$this->UpdateOfficier($updateID);
} elseif (isModulAvalible(MODULE_DMEXTRAS) && in_array($updateID, $reslist['dmfunc'])) {
$this->UpdateExtra($updateID);
}
}
$this->tplObj->loadscript('officier.js');
$darkmatterList = array();
$officierList = array();
if (isModulAvalible(MODULE_DMEXTRAS)) {
foreach ($reslist['dmfunc'] as $Element) {
if ($USER[$resource[$Element]] > TIMESTAMP) {
$this->tplObj->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
}
$costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element);
$buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources);
$costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources);
$elementBonus = BuildFunctions::getAvalibleBonus($Element);
$darkmatterList[$Element] = array('timeLeft' => max($USER[$resource[$Element]] - TIMESTAMP, 0), 'costRessources' => $costRessources, 'buyable' => $buyable, 'time' => $pricelist[$Element]['time'], 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus);
}
}
if (isModulAvalible(MODULE_OFFICIER)) {
foreach ($reslist['officier'] as $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;
}
}
$costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element);
$buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources);
$costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources);
$elementBonus = BuildFunctions::getAvalibleBonus($Element);
$officierList[$Element] = array('level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => $costRessources, 'buyable' => $buyable, 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element));
}
}
$close_to = 1;
if ($USER['rpg_geologue'] >= 1 && $USER['rpg_amiral'] >= 1 && $USER['training_step'] == 23) {
$GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '24' WHERE `id` = " . $USER['id'] . ";");
$GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `experience_peace` = `experience_peace` + '24' WHERE `id` = " . $USER['id'] . ";");
$close_to = 0;
}
$manual_23_step = 1;
if ($USER['training'] == 0 && $USER['training_step'] == 23 && $close_to == 1) {
$manual_23_step = 0;
}
$this->tplObj->assign_vars(array('manual_23_step' => $manual_23_step, 'close_to' => $close_to, 'officierList' => $officierList, 'darkmatterList' => $darkmatterList, 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['tech'][921])));
$this->display('page.officier.default.tpl');
}