public function show() { global $USER, $PLANET, $LNG; $this->tplObj->loadscript('flotten.js'); $targetGalaxy = HTTP::_GP('galaxy', 0); $targetSystem = HTTP::_GP('system', 0); $targetPlanet = HTTP::_GP('planet', 0); $targetType = HTTP::_GP('type', 0); $targetMission = HTTP::_GP('target_mission', 0); $fleetSpeed = HTTP::_GP('speed', 0); $fleetGroup = HTTP::_GP('fleet_group', 0); $token = HTTP::_GP('token', ''); if (!isset($_SESSION['fleet'][$token])) { FleetFunctions::GotoFleetPage(); } $fleetArray = $_SESSION['fleet'][$token]['fleet']; $db = Database::get(); $sql = "SELECT id, id_owner, der_metal, der_crystal FROM %%PLANETS%% WHERE universe = :universe AND galaxy = :targetGalaxy AND system = :targetSystem AND planet = :targetPlanet AND planet_type = '1';"; $targetPlanetData = $db->selectSingle($sql, array(':universe' => Universe::current(), ':targetGalaxy' => $targetGalaxy, ':targetSystem' => $targetSystem, ':targetPlanet' => $targetPlanet)); if ($targetType == 2 && $targetPlanetData['der_metal'] == 0 && $targetPlanetData['der_crystal'] == 0) { $this->printMessage($LNG['fl_error_empty_derbis'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleet1'))); } $MisInfo = array(); $MisInfo['galaxy'] = $targetGalaxy; $MisInfo['system'] = $targetSystem; $MisInfo['planet'] = $targetPlanet; $MisInfo['planettype'] = $targetType; $MisInfo['IsAKS'] = $fleetGroup; $MisInfo['Ship'] = $fleetArray; $MissionOutput = FleetFunctions::GetFleetMissions($USER, $MisInfo, $targetPlanetData); if (empty($MissionOutput['MissionSelector'])) { $this->printMessage($LNG['fl_empty_target'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleet1'))); } $GameSpeedFactor = FleetFunctions::GetGameSpeedFactor(); $MaxFleetSpeed = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetGalaxy, $targetSystem, $targetPlanet)); $duration = FleetFunctions::GetMissionDuration($fleetSpeed, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $USER, $GameSpeedFactor); if ($consumption > $PLANET['deuterium']) { $this->printMessage($LNG['fl_not_enough_deuterium'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=fleetTable'))); } if (!FleetFunctions::CheckUserSpeed($fleetSpeed)) { FleetFunctions::GotoFleetPage(0); } $_SESSION['fleet'][$token]['speed'] = $MaxFleetSpeed; $_SESSION['fleet'][$token]['distance'] = $distance; $_SESSION['fleet'][$token]['targetGalaxy'] = $targetGalaxy; $_SESSION['fleet'][$token]['targetSystem'] = $targetSystem; $_SESSION['fleet'][$token]['targetPlanet'] = $targetPlanet; $_SESSION['fleet'][$token]['targetType'] = $targetType; $_SESSION['fleet'][$token]['fleetGroup'] = $fleetGroup; $_SESSION['fleet'][$token]['fleetSpeed'] = $fleetSpeed; if (!empty($fleet_group)) { $targetMission = 2; } $fleetData = array('fleetroom' => floatToString($_SESSION['fleet'][$token]['fleetRoom']), 'consumption' => floatToString($consumption)); $this->tplObj->execscript('calculateTransportCapacity();'); $this->assign(array('fleetdata' => $fleetData, 'consumption' => floatToString($consumption), 'mission' => $targetMission, 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'type' => $PLANET['planet_type'], 'MissionSelector' => $MissionOutput['MissionSelector'], 'StaySelector' => $MissionOutput['StayBlock'], 'fl_dm_alert_message' => sprintf($LNG['fl_dm_alert_message'], $LNG['type_mission'][11], $LNG['tech'][921]), 'fl_continue' => $LNG['fl_continue'], 'token' => $token)); $this->display('page.fleetStep2.default.tpl'); }
public function show() { global $USER, $PLANET, $LNG, $UNI; $this->tplObj->loadscript('flotten.js'); $targetGalaxy = HTTP::_GP('galaxy', 0); $targetSystem = HTTP::_GP('system', 0); $targetPlanet = HTTP::_GP('planet', 0); $targetType = HTTP::_GP('type', 0); $targetMission = HTTP::_GP('target_mission', 0); $fleetSpeed = HTTP::_GP('speed', 0); $fleetGroup = HTTP::_GP('fleet_group', 0); $token = HTTP::_GP('token', ''); if (!isset($_SESSION['fleet'][$token])) { FleetFunctions::GotoFleetPage(); } $fleetArray = $_SESSION['fleet'][$token]['fleet']; $targetPlanetData = $GLOBALS['DATABASE']->getFirstRow("SELECT `id`, `id_owner`, `der_metal`, `der_crystal`, `der_deuterium` FROM `" . PLANETS . "` WHERE `universe` = " . $UNI . " AND `galaxy` = " . $targetGalaxy . " AND `system` = " . $targetSystem . " AND `planet` = " . $targetPlanet . " AND `planet_type` = '1';"); if ($targetType == 2 && $targetPlanetData['der_metal'] == 0 && $targetPlanetData['der_crystal'] == 0 && $targetPlanetData['der_deuterium'] == 0) { $this->printMessage($LNG['fl_error_empty_derbis']); } ##PlayerUnit::maxPlanetCount $MisInfo = array(); $MisInfo['galaxy'] = $targetGalaxy; $MisInfo['system'] = $targetSystem; $MisInfo['planet'] = $targetPlanet; $MisInfo['planettype'] = $targetType; $MisInfo['IsAKS'] = $fleetGroup; $MisInfo['Ship'] = $fleetArray; $MissionOutput = FleetFunctions::GetFleetMissions($USER, $MisInfo, $targetPlanetData); if (empty($MissionOutput['MissionSelector'])) { $this->printMessage($LNG['fl_empty_target']); } $GameSpeedFactor = FleetFunctions::GetGameSpeedFactor(); $MaxFleetSpeed = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetGalaxy, $targetSystem, $targetPlanet)); $duration = FleetFunctions::GetMissionDuration($fleetSpeed, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $MaxFleetSpeed, $USER, $GameSpeedFactor); if ($consumption > $PLANET['deuterium']) { $this->printMessage($LNG['fl_not_enough_deuterium']); } if (!FleetFunctions::CheckUserSpeed($fleetSpeed)) { FleetFunctions::GotoFleetPage(0); } $_SESSION['fleet'][$token]['speed'] = $MaxFleetSpeed; $_SESSION['fleet'][$token]['distance'] = $distance; $_SESSION['fleet'][$token]['targetGalaxy'] = $targetGalaxy; $_SESSION['fleet'][$token]['targetSystem'] = $targetSystem; $_SESSION['fleet'][$token]['targetPlanet'] = $targetPlanet; $_SESSION['fleet'][$token]['targetType'] = $targetType; $_SESSION['fleet'][$token]['fleetGroup'] = $fleetGroup; $_SESSION['fleet'][$token]['fleetSpeed'] = $fleetSpeed; if (!empty($fleet_group)) { $targetMission = 2; } $fleetData = array('fleetroom' => floattostring($_SESSION['fleet'][$token]['fleetRoom']), 'consumption' => floattostring($consumption)); $this->tplObj->execscript('calculateTransportCapacity();'); $this->tplObj->assign_vars(array('fleetdata' => $fleetData, 'consumption' => floattostring($consumption), 'mission' => $targetMission, 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'type' => $PLANET['planet_type'], 'MissionSelector' => $MissionOutput['MissionSelector'], 'StaySelector' => $MissionOutput['StayBlock'], 'fl_dm_alert_message' => sprintf($LNG['fl_dm_alert_message'], $LNG['type_mission'][11], $LNG['tech'][921]), 'fl_continue' => $LNG['fl_continue'], 'token' => $token)); $this->display('page.fleetStep2.default.tpl'); }
function TargetEvent() { $senderUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE id = " . $this->_fleet['fleet_owner'] . ";"); $senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']); $fleetArray = fleetAmountToArray($this->_fleet['fleet_array']); $duration = $this->_fleet['fleet_start_time'] - $this->_fleet['start_time']; require_once 'includes/classes/class.FleetFunctions.php'; $fleetMaxSpeed = FleetFunctions::GetFleetMaxSpeed($fleetArray, $senderUser); $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $distance = FleetFunctions::GetTargetDistance(array($this->_fleet['fleet_start_galaxy'], $this->_fleet['fleet_start_system'], $this->_fleet['fleet_start_planet']), array($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'])); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $fleetMaxSpeed, $senderUser, $SpeedFactor); $this->UpdateFleet('fleet_resource_elyrium', $this->_fleet['fleet_resource_elyrium'] + $consumption / 2); $LNG = $this->getLanguage($senderUser['lang']); $TargetUserID = $this->_fleet['fleet_target_owner']; $TargetMessage = '<div style="text-align : justify;"> ' . $LNG['fleet_deploy_9'] . ' : </div> <div class="citation"> <div class="guillemet ouvrir">«</div> <div class="guillemet fermer">»</div> ' . $LNG['fleet_deploy_10'] . ' Base Alpha 5 [' . $this->_fleet['fleet_end_system'] . ':' . $this->_fleet['fleet_end_planet'] . '] ' . $LNG['fleet_deploy_11'] . ' <br> <div style="padding-left : 20px; padding-top : 10px;"> — ' . $LNG['fleet_deploy_12'] . ' ' . date('d/m/Y H:i:s', TIMESTAMP) . '<br> — ' . $LNG['fleet_deploy_13'] . ' : Home001 [' . $this->_fleet['fleet_start_system'] . ':' . $this->_fleet['fleet_start_planet'] . ']<br> — ' . $LNG['fleet_deploy_14'] . ' : Base Alpha 5 [' . $this->_fleet['fleet_end_system'] . ':' . $this->_fleet['fleet_end_planet'] . '] <br> </div> </div> <h3>' . $LNG['fleet_deploy_7'] . ' :</h3> <div class="conteneur_item" style="margin-top : 5px;"> <div class="element_item"> <img src="/media/ingame/image/metal.jpg"> ' . $LNG['tech'][901] . ' : <span class="orange">' . pretty_number($this->_fleet['fleet_resource_metal']) . '</span> ' . $LNG['lm_achat_units'] . ' </div> <div class="element_item"> <img src="/media/ingame/image/oro.jpg"> ' . $LNG['tech'][902] . ' : <span class="orange">' . pretty_number($this->_fleet['fleet_resource_crystal']) . '</span> ' . $LNG['lm_achat_units'] . ' </div> <div class="element_item"> <img src="/media/ingame/image/crystal.jpg"> ' . $LNG['tech'][903] . ' : <span class="orange">' . pretty_number($this->_fleet['fleet_resource_deuterium']) . '</span> ' . $LNG['lm_achat_units'] . ' </div> <div class="element_item"> <img src="/media/ingame/image/elyrium.jpg"> ' . $LNG['tech'][904] . ' : <span class="orange">' . pretty_number($this->_fleet['fleet_resource_elyrium']) . '</span> ' . $LNG['lm_achat_units'] . ' </div> </div> <div class="explication_utilisateur"> ' . $LNG['fleet_deploy_15'] . ' </div>'; SendSimpleMessage($TargetUserID, 0, $this->_fleet['fleet_start_time'], 7, $LNG['sys_mess_tower_deploy_good'], $LNG['sys_stat_mess_stay'], $TargetMessage); $this->RestoreFleet(false); }
function TargetEvent() { $sql = 'SELECT * FROM %%USERS%% WHERE id = :userId;'; $senderUser = Database::get()->selectSingle($sql, array(':userId' => $this->_fleet['fleet_owner'])); $senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']); $fleetArray = FleetFunctions::unserialize($this->_fleet['fleet_array']); $duration = $this->_fleet['fleet_start_time'] - $this->_fleet['start_time']; $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $distance = FleetFunctions::GetTargetDistance(array($this->_fleet['fleet_start_galaxy'], $this->_fleet['fleet_start_system'], $this->_fleet['fleet_start_planet']), array($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'])); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $senderUser, $SpeedFactor); $this->UpdateFleet('fleet_resource_deuterium', $this->_fleet['fleet_resource_deuterium'] + $consumption / 2); $LNG = $this->getLanguage($senderUser['lang']); $TargetUserID = $this->_fleet['fleet_target_owner']; $TargetMessage = sprintf($LNG['sys_stat_mess'], GetTargetAddressLink($this->_fleet, ''), pretty_number($this->_fleet['fleet_resource_metal']), $LNG['tech'][901], pretty_number($this->_fleet['fleet_resource_crystal']), $LNG['tech'][902], pretty_number($this->_fleet['fleet_resource_deuterium']), $LNG['tech'][903]); PlayerUtil::sendMessage($TargetUserID, 0, $LNG['sys_mess_tower'], 5, $LNG['sys_stat_mess_stay'], $TargetMessage, $this->_fleet['fleet_start_time'], NULL, 1, $this->_fleet['fleet_universe']); $this->RestoreFleet(false); }
function TargetEvent() { $senderUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE id = " . $this->_fleet['fleet_owner'] . ";"); $senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']); $fleetArray = fleetAmountToArray($this->_fleet['fleet_array']); $duration = $this->_fleet['fleet_start_time'] - $this->_fleet['start_time']; require_once 'includes/classes/class.FleetFunctions.php'; $fleetMaxSpeed = FleetFunctions::GetFleetMaxSpeed($fleetArray, $senderUser); $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $distance = FleetFunctions::GetTargetDistance(array($this->_fleet['fleet_start_galaxy'], $this->_fleet['fleet_start_system'], $this->_fleet['fleet_start_planet']), array($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'])); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $fleetMaxSpeed, $senderUser, $SpeedFactor); $this->UpdateFleet('fleet_resource_deuterium', $this->_fleet['fleet_resource_deuterium'] + $consumption / 2); $LNG = $this->getLanguage($senderUser['lang']); $TargetUserID = $this->_fleet['fleet_target_owner']; $TargetMessage = sprintf($LNG['sys_stat_mess'], GetTargetAdressLink($this->_fleet, ''), pretty_number($this->_fleet['fleet_resource_metal']), $LNG['tech'][901], pretty_number($this->_fleet['fleet_resource_crystal']), $LNG['tech'][902], pretty_number($this->_fleet['fleet_resource_deuterium']), $LNG['tech'][903]); SendSimpleMessage($TargetUserID, 0, $this->_fleet['fleet_start_time'], 5, $LNG['sys_mess_tower'], $LNG['sys_stat_mess_stay'], $TargetMessage); $this->RestoreFleet(false); }
public function ajax() { global $USER, $PLANET, $LNG, $LANG, $CONF, $UNI, $resource, $reslist; $this->setWindow('ajax'); $targetGalaxy = HTTP::_GP('galaxy', 0); $targetSystem = HTTP::_GP('system', 0); $targetPlanet = HTTP::_GP('planet', 0); $targetType = HTTP::_GP('type', 0); $targetMission = HTTP::_GP('target_mission', 0); $fleetGroup = HTTP::_GP('fleet_group', 0); $token = HTTP::_GP('token', ''); $fleetSpeed = HTTP::_GP('speed', 0); $fleetArray = $_SESSION['fleet'][$token]['fleet']; $targetPlanetData = $GLOBALS['DATABASE']->getFirstRow("SELECT `id`, `id_owner`, `der_metal`, `der_crystal`, `der_deuterium` FROM `" . PLANETS . "` WHERE `universe` = " . $UNI . " AND `galaxy` = " . $targetGalaxy . " AND `system` = " . $targetSystem . " AND `planet` = " . $targetPlanet . " AND `planet_type` = '1';"); $MisInfo = array(); $MisInfo['galaxy'] = $targetGalaxy; $MisInfo['system'] = $targetSystem; $MisInfo['planet'] = $targetPlanet; $MisInfo['planettype'] = $targetType; $MisInfo['IsAKS'] = $fleetGroup; $MisInfo['Ship'] = $fleetArray; $MissionOutput = FleetFunctions::GetFleetMissions($USER, $MisInfo, $targetPlanetData); $GameSpeedFactor = FleetFunctions::GetGameSpeedFactor(); $MaxFleetSpeed = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetGalaxy, $targetSystem, $targetPlanet)); $duration = FleetFunctions::GetMissionDuration($fleetSpeed, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $duration, $distance, $MaxFleetSpeed, $USER, $GameSpeedFactor); $_SESSION['fleet'][$token]['speed'] = $MaxFleetSpeed; $_SESSION['fleet'][$token]['distance'] = $distance; $_SESSION['fleet'][$token]['targetGalaxy'] = $targetGalaxy; $_SESSION['fleet'][$token]['targetSystem'] = $targetSystem; $_SESSION['fleet'][$token]['targetPlanet'] = $targetPlanet; $_SESSION['fleet'][$token]['targetType'] = $targetType; $_SESSION['fleet'][$token]['fleetGroup'] = $fleetGroup; $_SESSION['fleet'][$token]['fleetSpeed'] = $fleetSpeed; $this->tplObj->assign_vars(array('MissionSelector' => $MissionOutput['MissionSelector'], 'StaySelector' => $MissionOutput['StayBlock'], 'mission' => $targetMission, 'tokens' => $token)); $this->display('page.mission.default.tpl'); }
public static function FleetAjax() { global $USER, $PLANET, $db, $resource, $LNG; $UserSpyProbes = $PLANET[$resource[210]]; $UserRecycles = $PLANET[$resource[209]]; $UserGRecycles = $PLANET[$resource[219]]; $UserDeuterium = $PLANET['deuterium']; $UserMissiles = $PLANET['interplanetary_misil']; $thisgalaxy = $PLANET['galaxy']; $thissystem = $PLANET['system']; $thisplanet = $PLANET['planet']; $thisplanettype = $PLANET['planet_type']; $galaxy = request_var('galaxy', 0); $system = request_var('system', 0); $planet = request_var('planet', 0); $planettype = request_var('planettype', 0); $mission = request_var('mission', 0); $CurrentFlyingFleets = parent::GetCurrentFleets($USER['id']); switch ($mission) { case 6: $SpyProbes = request_var('ships', 0); $SpyProbes = min($SpyProbes, $PLANET[$resource[210]]); if (empty($SpyProbes)) { exit($ResultMessage = "611; " . $LNG['fa_no_spios'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } $FleetArray = array(210 => $SpyProbes); break; case 8: $SRecycles = explode("|", request_var('ships', '')); $GRecycles = min($SRecycles[0], $PLANET[$resource[219]]); $Recycles = min($SRecycles[1], $PLANET[$resource[209]]); if (empty($Recycles) && empty($GRecycles)) { exit($ResultMessage = "611; " . $LNG['fa_no_recyclers'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } $FleetArray = array(219 => $GRecycles, 209 => $Recycles); break; default: exit("610; " . $LNG['fa_not_enough_probes'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); break; } parent::CleanFleetArray($FleetArray); if (empty($FleetArray)) { exit("610; " . $LNG['fa_not_enough_probes'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } if (parent::GetMaxFleetSlots($USER) <= $CurrentFlyingFleets) { $ResultMessage = "612; " . $LNG['fa_no_more_slots'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } if ($galaxy > MAX_GALAXY_IN_WORLD || $galaxy < 1) { $ResultMessage = "602; " . $LNG['fa_galaxy_not_exist'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } if ($system > MAX_SYSTEM_IN_GALAXY || $system < 1) { $ResultMessage = "602; " . $LNG['fa_system_not_exist'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } if ($planet > MAX_PLANET_IN_SYSTEM || $planet < 1) { $ResultMessage = "602; " . $LNG['fa_planet_not_exist'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } $QrySelectEnemy = "SELECT id_level, id_owner FROM " . PLANETS . " "; $QrySelectEnemy .= "WHERE "; $QrySelectEnemy .= "`galaxy` = '" . $galaxy . "' AND "; $QrySelectEnemy .= "`system` = '" . $system . "' AND "; $QrySelectEnemy .= "`planet` = '" . $planet . "' AND "; $QrySelectEnemy .= "`planet_type` = '" . $planettype . "';"; $TargetRow = $db->uniquequery($QrySelectEnemy); if ($TargetRow['id_level'] > $USER['authlevel'] && $mission == 6 && $CONF['adm_attack'] == 0) { exit("619; " . $LNG['fa_action_not_allowed'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } $TargetUser = GetUserByID($TargetRow['id_owner'], array('id', 'onlinetime', 'urlaubs_modus')); if ($USER['urlaubs_modus'] == 1) { $ResultMessage = "620; " . $LNG['fa_vacation_mode_current'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } if ($mission == 6) { $TargetVacat = $TargetUser['urlaubs_modus']; if ($TargetVacat) { $ResultMessage = "605; " . $LNG['fa_vacation_mode'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } $UserPoints = $USER; $User2Points = $db->uniquequery("SELECT `total_points` FROM " . STATPOINTS . " WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $TargetRow['id_owner'] . "';"); $IsNoobProtec = CheckNoobProtec($UserPoints, $User2Points, $TargetUser['onlinetime']); if ($IsNoobProtec['NoobPlayer']) { exit("603; " . $LNG['fa_week_player'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } elseif ($IsNoobProtec['StrongPlayer']) { exit("604; " . $LNG['fa_strong_player'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } if (empty($TargetRow['id_owner'])) { $ResultMessage = "601; " . $LNG['fa_planet_not_exist'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } if ($TargetRow["id_owner"] == $PLANET["id_owner"]) { $ResultMessage = "618; " . $LNG['fa_not_spy_yourself'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles; die($ResultMessage); } } $SpeedFactor = parent::GetGameSpeedFactor(); $Distance = parent::GetTargetDistance($thisgalaxy, $galaxy, $thissystem, $system, $thisplanet, $planet); $SpeedAllMin = parent::GetFleetMaxSpeed($FleetArray, $USER); $Duration = parent::GetMissionDuration(10, $SpeedAllMin, $Distance, $SpeedFactor, $USER); $consumption = parent::GetFleetConsumption($FleetArray, $Duration, $Distance, $SpeedAllMin, $USER, $SpeedFactor); $UserDeuterium -= $consumption; if ($UserDeuterium < 0) { exit("613; " . $LNG['fa_not_enough_fuel'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } elseif ($consumption > parent::GetFleetRoom($FleetArray)) { exit("613; " . $LNG['fa_no_fleetroom'] . " |" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserGRecycles . " " . $UserMissiles); } $fleet['fly_time'] = $Duration; $fleet['start_time'] = $Duration + TIMESTAMP; $fleet['end_time'] = $Duration * 2 + TIMESTAMP; $FleetShipCount = 0; $FleetDBArray = ""; $FleetSubQRY = ""; foreach ($FleetArray as $Ship => $Count) { $FleetShipCount += $Count; $FleetDBArray .= $Ship . "," . $Count . ";"; $FleetSubQRY .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , "; } if (connection_aborted()) { exit; } $QryUpdate = "LOCK TABLE " . FLEETS . " WRITE, " . PLANETS . " WRITE;"; $QryUpdate .= "INSERT INTO " . FLEETS . " SET "; $QryUpdate .= "`fleet_owner` = '" . $USER['id'] . "', "; $QryUpdate .= "`fleet_mission` = '" . $mission . "', "; $QryUpdate .= "`fleet_amount` = '" . $FleetShipCount . "', "; $QryUpdate .= "`fleet_array` = '" . $FleetDBArray . "', "; $QryUpdate .= "`fleet_start_time` = '" . $fleet['start_time'] . "', "; $QryUpdate .= "`fleet_start_galaxy` = '" . $thisgalaxy . "', "; $QryUpdate .= "`fleet_start_system` = '" . $thissystem . "', "; $QryUpdate .= "`fleet_start_planet` = '" . $thisplanet . "', "; $QryUpdate .= "`fleet_start_type` = '" . $thisplanettype . "', "; $QryUpdate .= "`fleet_end_time` = '" . $fleet['end_time'] . "', "; $QryUpdate .= "`fleet_end_galaxy` = '" . $galaxy . "', "; $QryUpdate .= "`fleet_end_system` = '" . $system . "', "; $QryUpdate .= "`fleet_end_planet` = '" . $planet . "', "; $QryUpdate .= "`fleet_end_type` = '" . $planettype . "', "; $QryUpdate .= "`fleet_target_owner` = '" . $TargetRow['id_owner'] . "', "; $QryUpdate .= "`start_time` = '" . TIMESTAMP . "';"; $QryUpdate .= "UPDATE " . PLANETS . " SET "; $QryUpdate .= $FleetSubQRY; $QryUpdate .= "`deuterium` = '" . floattostring($UserDeuterium) . "' "; $QryUpdate .= "WHERE "; $QryUpdate .= "`id` = '" . $PLANET['id'] . "';"; $QryUpdate .= "UNLOCK TABLES;"; $db->multi_query($QryUpdate); $CurrentFlyingFleets++; $ResultMessage = "600; " . $LNG['fa_sending'] . " " . $FleetShipCount . " " . $LNG['tech'][$Ship] . " a " . $galaxy . ":" . $system . ":" . $planet . "...|"; $ResultMessage .= $CurrentFlyingFleets . " " . ($UserSpyProbes - $SpyProbes) . " " . ($UserRecycles - $Recycles) . " " . ($UserGRecycles - $GRecycles) . " " . $UserMissiles; die($ResultMessage); }
public function show() { global $USER, $PLANET, $resource, $LNG, $pricelist; $UserDeuterium = $PLANET['deuterium']; $planetID = HTTP::_GP('planetID', 0); $targetMission = HTTP::_GP('mission', 0); $activeSlots = FleetFunctions::GetCurrentFleets($USER['id']); $maxSlots = FleetFunctions::GetMaxFleetSlots($USER); $this->returnData['slots'] = $activeSlots; if (IsVacationMode($USER)) { $this->sendData(620, $LNG['fa_vacation_mode_current']); } if (empty($planetID)) { $this->sendData(601, $LNG['fa_planet_not_exist']); } if ($maxSlots <= $activeSlots) { $this->sendData(612, $LNG['fa_no_more_slots']); } $fleetArray = array(); $db = Database::get(); switch ($targetMission) { case 6: if (!isModuleAvailable(MODULE_MISSION_SPY)) { $this->sendData(699, $LNG['sys_module_inactive']); } $ships = min($USER['spio_anz'], $PLANET[$resource[210]]); if (empty($ships)) { $this->sendData(611, $LNG['fa_no_spios']); } $fleetArray = array(210 => $ships); $this->returnData['ships'][210] = $PLANET[$resource[210]] - $ships; break; case 8: if (!isModuleAvailable(MODULE_MISSION_RECYCLE)) { $this->sendData(699, $LNG['sys_module_inactive']); } $sql = "SELECT (der_metal + der_crystal) as sum FROM %%PLANETS%% WHERE id = :planetID;"; $totalDebris = $db->selectSingle($sql, array(':planetID' => $planetID), 'sum'); $recElementIDs = array(219, 209); $fleetArray = array(); foreach ($recElementIDs as $elementID) { $shipsNeed = min(ceil($totalDebris / $pricelist[$elementID]['capacity']), $PLANET[$resource[$elementID]]); $totalDebris -= $shipsNeed * $pricelist[$elementID]['capacity']; $fleetArray[$elementID] = $shipsNeed; $this->returnData['ships'][$elementID] = $PLANET[$resource[$elementID]] - $shipsNeed; if ($totalDebris <= 0) { break; } } if (empty($fleetArray)) { $this->sendData(611, $LNG['fa_no_recyclers']); } break; default: $this->sendData(610, $LNG['fa_not_enough_probes']); break; } $fleetArray = array_filter($fleetArray); if (empty($fleetArray)) { $this->sendData(610, $LNG['fa_not_enough_probes']); } $sql = "SELECT planet.id_owner as id_owner,\n\t\tplanet.galaxy as galaxy,\n\t\tplanet.system as system,\n\t\tplanet.planet as planet,\n\t\tplanet.planet_type as planet_type,\n\t\ttotal_points, onlinetime, urlaubs_modus, banaday, authattack\n\t\tFROM %%PLANETS%% planet\n\t\tINNER JOIN %%USERS%% user ON planet.id_owner = user.id\n\t\tLEFT JOIN %%STATPOINTS%% as stat ON stat.id_owner = user.id AND stat.stat_type = '1'\n\t\tWHERE planet.id = :planetID;"; $targetData = $db->selectSingle($sql, array(':planetID' => $planetID)); if (empty($targetData)) { $this->sendData(601, $LNG['fa_planet_not_exist']); } if ($targetMission == 6) { if (Config::get()->adm_attack == 1 && $targetData['authattack'] > $USER['authlevel']) { $this->sendData(619, $LNG['fa_action_not_allowed']); } if (IsVacationMode($targetData)) { $this->sendData(605, $LNG['fa_vacation_mode']); } $sql = 'SELECT total_points FROM %%STATPOINTS%% WHERE id_owner = :userId AND stat_type = :statType'; $USER += Database::get()->selectSingle($sql, array(':userId' => $USER['id'], ':statType' => 1)); $IsNoobProtec = CheckNoobProtec($USER, $targetData, $targetData); if ($IsNoobProtec['NoobPlayer']) { $this->sendData(603, $LNG['fa_week_player']); } if ($IsNoobProtec['StrongPlayer']) { $this->sendData(604, $LNG['fa_strong_player']); } if ($USER['id'] == $targetData['id_owner']) { $this->sendData(618, $LNG['fa_not_spy_yourself']); } } $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $Distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetData['galaxy'], $targetData['system'], $targetData['planet'])); $SpeedAllMin = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $Duration = FleetFunctions::GetMissionDuration(10, $SpeedAllMin, $Distance, $SpeedFactor, $USER); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $Duration, $Distance, $USER, $SpeedFactor); $UserDeuterium -= $consumption; if ($UserDeuterium < 0) { $this->sendData(613, $LNG['fa_not_enough_fuel']); } if ($consumption > FleetFunctions::GetFleetRoom($fleetArray)) { $this->sendData(613, $LNG['fa_no_fleetroom']); } if (connection_aborted()) { exit; } $this->returnData['slots']++; $fleetResource = array(901 => 0, 902 => 0, 903 => 0); $fleetStartTime = $Duration + TIMESTAMP; $fleetStayTime = $fleetStartTime; $fleetEndTime = $fleetStayTime + $Duration; $shipID = array_keys($fleetArray); FleetFunctions::sendFleet($fleetArray, $targetMission, $USER['id'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $targetData['id_owner'], $planetID, $targetData['galaxy'], $targetData['system'], $targetData['planet'], $targetData['planet_type'], $fleetResource, $fleetStartTime, $fleetStayTime, $fleetEndTime); $this->sendData(600, $LNG['fa_sending'] . " " . array_sum($fleetArray) . " " . $LNG['tech'][$shipID[0]] . " " . $LNG['gl_to'] . " " . $targetData['galaxy'] . ":" . $targetData['system'] . ":" . $targetData['planet'] . " ..."); }
function show() { global $USER, $PLANET, $LNG, $UNI; $this->tplObj->loadscript('flotten.js'); $stats_sql = 'SELECT DISTINCT p.* FROM ' . PLANETS . ' as p WHERE p.`universe` = ' . $UNI . ' AND destruyed = 0 AND p.`id_owner` = ' . $USER['id'] . ' AND p.`id` != ' . $PLANET['id'] . ' ;'; $query = $GLOBALS['DATABASE']->query($stats_sql); $RangeList = array(); while ($StatRow = $GLOBALS['DATABASE']->fetch_array($query)) { $slowestShip = 202; if ($StatRow['small_ship_cargo'] > 0) { $slowestShip = 202; } elseif ($StatRow['big_ship_cargo'] > 0) { $slowestShip = 203; } elseif ($StatRow['light_hunter'] > 0) { $slowestShip = 204; } elseif ($StatRow['heavy_hunter'] > 0) { $slowestShip = 205; } elseif ($StatRow['crusher'] > 0) { $slowestShip = 206; } elseif ($StatRow['battle_ship'] > 0) { $slowestShip = 207; } elseif ($StatRow['recycler'] > 0) { $slowestShip = 209; } elseif ($StatRow['bomber_ship'] > 0) { $slowestShip = 211; } elseif ($StatRow['destructor'] > 0) { $slowestShip = 213; } elseif ($StatRow['battleship'] > 0) { $slowestShip = 215; } elseif ($StatRow['galleon'] > 0) { $slowestShip = 225; } elseif ($StatRow['destroyer'] > 0) { $slowestShip = 226; } elseif ($StatRow['frigate'] > 0) { $slowestShip = 227; } elseif ($StatRow['black_wanderer'] > 0) { $slowestShip = 228; } $GameSpeedFactor = FleetFunctions::GetGameSpeedFactor(); $MaxFleetSpeed = FleetFunctions::GetFleetMaxSpeed($slowestShip, $USER); $distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($StatRow['galaxy'], $StatRow['system'], $StatRow['planet'])); $duration = FleetFunctions::GetMissionDuration(10, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER); $RangeList[] = array('name' => $StatRow['name'], 'id' => $StatRow['id'], 'galaxy' => $StatRow['galaxy'], 'system' => $StatRow['system'], 'planet' => $StatRow['planet'], 'metal' => pretty_number($StatRow['metal']), 'crystal' => pretty_number($StatRow['crystal']), 'deuterium' => pretty_number($StatRow['deuterium']), 'duration' => gmdate("H:i:s", round($duration)), 'small_ship_cargo' => pretty_number($StatRow['small_ship_cargo']), 'big_ship_cargo' => pretty_number($StatRow['big_ship_cargo']), 'light_hunter' => pretty_number($StatRow['light_hunter']), 'heavy_hunter' => pretty_number($StatRow['heavy_hunter']), 'crusher' => pretty_number($StatRow['crusher']), 'battle_ship' => pretty_number($StatRow['battle_ship']), 'recycler' => pretty_number($StatRow['recycler']), 'bomber_ship' => pretty_number($StatRow['bomber_ship']), 'destructor' => pretty_number($StatRow['destructor']), 'battleship' => pretty_number($StatRow['battleship']), 'galleon' => pretty_number($StatRow['galleon']), 'destroyer' => pretty_number($StatRow['destroyer']), 'frigate' => pretty_number($StatRow['frigate']), 'black_wanderer' => pretty_number($StatRow['black_wanderer']), 'lune_noir' => pretty_number($StatRow['lune_noir'])); } $this->tplObj->assign_vars(array('RangeList' => $RangeList)); $this->display('page.reducefleets.default.tpl'); }
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']); } } if (connection_aborted()) { exit; } $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $Distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetData['galaxy'], $targetData['system'], $targetData['planet'])); $SpeedAllMin = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $Duration = 1; $consumption = 0; $fleetRessource = array(901 => 0, 902 => 0, 903 => 0, 904 => 0); $fleetPopulation = array(301 => 0, 302 => 0, 303 => 0, 304 => 0, 305 => 0, 306 => 0, 307 => 0, 309 => 0); if ($targetMission == 7) { $targetData = array('id' => 0, 'id_owner' => 0, 'planettype' => 1); } $fleetStartTime = $Duration + TIMESTAMP; $fleetStayTime = $fleetStartTime; $fleetEndTime = $fleetStayTime + 1; $shipID = array_keys($fleetArray); if ($targetMission == 7) { FleetFunctions::sendFleet($fleetArray, $targetMission, $USER['id'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $targetData['id_owner'], 0, $galaxyC, $systemC, $planetC, 1, $fleetRessource, $fleetPopulation, $fleetStartTime, $fleetStayTime, $fleetEndTime); } else { FleetFunctions::sendFleet($fleetArray, $targetMission, $USER['id'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $targetData['id_owner'], $targetData['id'], $targetData['galaxy'], $targetData['system'], $targetData['planet'], $targetData['planet_type'], $fleetRessource, $fleetPopulation, $fleetStartTime, $fleetStayTime, $fleetEndTime); } if ($targetMission == 7) { $finalMsg = sprintf($LNG['fleet_ajax_10'], $systemC, $planetC); } else { $finalMsg = sprintf($LNG['fleet_ajax_17'], $targetData['name'], $targetData['system'], $targetData['planet'], $this->getUsername($targetData['id_owner'])); } $this->sendData('vert', $finalMsg); }
function show() { global $USER, $PLANET, $LNG, $UNI, $resource, $reslist; //if($USER['id'] != 1){ // $this->printMessage('This page is under maintenance', true, array('game.php?page=overview', 4)); //} $PlanetRess = new ResourceUpdate(); $this->tplObj->loadscript('flotten.js'); $stats_sql = 'SELECT DISTINCT p.* FROM ' . PLANETS . ' as p WHERE p.`universe` = ' . $UNI . ' AND destruyed = 0 AND p.`id_owner` = ' . $USER['id'] . ' AND p.`id` != ' . $PLANET['id'] . ' ;'; $query = $GLOBALS['DATABASE']->query($stats_sql); $RangeList = array(); while ($StatRow = $GLOBALS['DATABASE']->fetch_array($query)) { list($USER, $StatRow) = $PlanetRess->CalcResource($USER, $StatRow, true); $GameSpeedFactor = FleetFunctions::GetGameSpeedFactor(); $MaxFleetSpeed = FleetFunctions::GetFleetMaxSpeed(217, $USER); $distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($StatRow['galaxy'], $StatRow['system'], $StatRow['planet'])); $duration = FleetFunctions::GetMissionDuration(10, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER); $needed_ships = round(($StatRow['metal'] + $StatRow['crystal'] + $StatRow['deuterium']) / 390000000); if ($needed_ships == 0) { $needed_ships = 1; } $RangeList[] = array('name' => $StatRow['name'], 'id' => $StatRow['id'], 'galaxy' => $StatRow['galaxy'], 'system' => $StatRow['system'], 'planet' => $StatRow['planet'], 'metal' => pretty_number($StatRow['metal']), 'crystal' => pretty_number($StatRow['crystal']), 'deuterium' => pretty_number($StatRow['deuterium']), 'ev_transporter' => pretty_number($StatRow['ev_transporter']), 'duration' => gmdate("H:i:s", round($duration)), 'needed_ships' => $needed_ships, 'needed_ships1' => pretty_number($needed_ships)); } $this->tplObj->assign_vars(array('RangeList' => $RangeList)); $this->display('page.reduceresources.default.tpl'); }
function missionSend() { global $LNG, $ProdGrid, $resource, $reslist, $CONF, $pricelist, $USER, $PLANET; $mission = HTTP::_GP('target_mission', 0); $population202 = HTTP::_GP('population203', 0); $population203 = HTTP::_GP('population203', 0); $population204 = HTTP::_GP('population204', 0); $population205 = HTTP::_GP('population205', 0); $population206 = HTTP::_GP('population206', 0); $population207 = HTTP::_GP('population207', 0); $population211 = HTTP::_GP('population211', 0); $population214 = HTTP::_GP('population214', 0); $population215 = HTTP::_GP('population215', 0); $population216 = HTTP::_GP('population216', 0); $population209 = HTTP::_GP('population209', 0); $population223 = HTTP::_GP('population223', 0); $population219 = HTTP::_GP('population219', 0); $population210 = HTTP::_GP('population210', 0); $population224 = HTTP::_GP('population224', 0); $population301 = HTTP::_GP('population301', 0); $population302 = HTTP::_GP('population302', 0); $population303 = HTTP::_GP('population303', 0); $population304 = HTTP::_GP('population304', 0); $population305 = HTTP::_GP('population305', 0); $population306 = HTTP::_GP('population306', 0); $population307 = HTTP::_GP('population307', 0); $system = HTTP::_GP('system', 0); $planet = HTTP::_GP('planet', 0); $fleetArray = array(); switch ($mission) { case 17: $ship202 = min($population202, $PLANET[$resource[202]]); $ship203 = min($population203, $PLANET[$resource[203]]); $ship204 = min($population204, $PLANET[$resource[204]]); $ship205 = min($population205, $PLANET[$resource[205]]); $ship206 = min($population206, $PLANET[$resource[206]]); $ship207 = min($population207, $PLANET[$resource[207]]); $ship211 = min($population211, $PLANET[$resource[211]]); $ship214 = min($population214, $PLANET[$resource[214]]); $ship215 = min($population215, $PLANET[$resource[215]]); $ship216 = min($population216, $PLANET[$resource[216]]); $ship209 = min($population209, $PLANET[$resource[209]]); $ship223 = min($population223, $PLANET[$resource[223]]); $ship219 = min($population219, $PLANET[$resource[219]]); $ship210 = min($population210, $PLANET[$resource[210]]); $ship224 = min($population224, $PLANET[$resource[224]]); $fleetArray = array(202 => $ship202, 203 => $ship203, 204 => $ship204, 205 => $ship205, 206 => $ship206, 207 => $ship207, 211 => $ship211, 214 => $ship214, 215 => $ship215, 216 => $ship216, 209 => $ship209, 223 => $ship223, 219 => $ship219, 210 => $ship210, 224 => $ship224); break; case 14: $fleetArray = array(210 => 1); break; } $fleetArray = array_filter($fleetArray); if (empty($fleetArray)) { $this->printMessage('<span class="rouge">NO ARRAY</span>'); } $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.galaxy = '1' AND planet.system = " . $system . " AND planet.planet = " . $planet . ";"); $galaxy = 1; $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $Distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($galaxy, $system, $planet)); $SpeedAllMin = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $Duration = 1; $consumption = 0; $fleetRessource = array(901 => 0, 902 => 0, 903 => 0, 904 => 0); $fleetPopulation = array(301 => $population301, 302 => $population302, 303 => $population303, 304 => $population304, 305 => $population305, 306 => $population306, 307 => $population307, 309 => 0); $PLANET[$resource[901]] -= $fleetRessource[901]; $PLANET[$resource[902]] -= $fleetRessource[902]; $PLANET[$resource[903]] -= $fleetRessource[903]; $PLANET[$resource[904]] -= $fleetRessource[904]; $PLANET[$resource[301]] -= $fleetPopulation[301]; $PLANET[$resource[302]] -= $fleetPopulation[302]; $PLANET[$resource[303]] -= $fleetPopulation[303]; $PLANET[$resource[304]] -= $fleetPopulation[304]; $PLANET[$resource[305]] -= $fleetPopulation[305]; $PLANET[$resource[306]] -= $fleetPopulation[306]; $PLANET[$resource[307]] -= $fleetPopulation[307]; $PLANET[$resource[309]] -= $fleetPopulation[309]; $fleetStartTime = $Duration + TIMESTAMP; $fleetStayTime = $fleetStartTime; $fleetEndTime = $fleetStayTime + 1; $shipID = array_keys($fleetArray); FleetFunctions::sendFleet($fleetArray, $mission, $USER['id'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $targetData['id_owner'], $targetData['id'], $targetData['galaxy'], $targetData['system'], $targetData['planet'], $targetData['planet_type'], $fleetRessource, $fleetPopulation, $fleetStartTime, $fleetStayTime, $fleetEndTime); $this->printMessage('<span class="vert">OK</span>'); $this->tplObj->assign_vars(array()); }
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']) { $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 (FleetFunctions::CheckBashPortal($targetData['id'])) { $this->sendData('rouge', $LNG['fl_bash_protection']); } 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']); } } if (connection_aborted()) { exit; } $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $Distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetData['galaxy'], $targetData['system'], $targetData['planet'])); $SpeedAllMin = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $Duration = 1; $consumption = 0; $fleetRessource = array(901 => 0, 902 => 0, 903 => 0, 904 => 0); $fleetPopulation = array(301 => 0, 302 => 0, 303 => 0, 304 => 0, 305 => 0, 306 => 0, 307 => 0, 309 => 0); $fleetStartTime = $Duration + TIMESTAMP; $fleetStayTime = $fleetStartTime; $fleetEndTime = $fleetStayTime + 1; $shipID = array_keys($fleetArray); FleetFunctions::sendFleet($fleetArray, $targetMission, $USER['id'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $targetData['id_owner'], $targetData['id'], $targetData['galaxy'], $targetData['system'], $targetData['planet'], $targetData['planet_type'], $fleetRessource, $fleetPopulation, $fleetStartTime, $fleetStayTime, $fleetEndTime); //$finalMsg = sprintf($LNG['fleet_ajax_17'], $targetData['name'], $targetData['system'],$targetData['planet'],$this->getUsername($targetData['id_owner'])); $finalMsg = sprintf($LNG['fleet_ajax_20'], $targetData['name'], $targetData['system'], $targetData['planet'], $this->getUsername($targetData['id_owner'])); $this->sendData('vert', $finalMsg); }
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); $activeSlots = FleetFunctions::GetCurrentFleets($USER['id']); $maxSlots = FleetFunctions::GetMaxFleetSlots($USER); $this->returnData['slots'] = $activeSlots; if (IsVacationMode($USER)) { $this->sendData('rouge', $LNG['fa_vacation_mode_current']); } if (empty($planetID)) { $this->sendData('rouge', $LNG['fa_planet_not_exist']); } if ($maxSlots <= $activeSlots) { $this->sendData('rouge', $LNG['fa_no_more_slots']); } $fleetArray = array(); switch ($targetMission) { case 1: 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; case 6: if (!isModulAvalible(MODULE_MISSION_SPY)) { $this->sendData('rouge', $LNG['sys_module_inactive']); } $ships = min($USER['spio_anz'], $PLANET[$resource[224]]); if (empty($ships)) { $this->sendData('rouge', $LNG['fleet_ajax_2']); } $fleetArray = array(224 => $ships); $this->returnData['ships'][224] = $PLANET[$resource[224]] - $ships; break; case 8: if (!isModulAvalible(MODULE_MISSION_RECYCLE)) { $this->sendData('rouge', $LNG['sys_module_inactive']); } $totalDebris = $GLOBALS['DATABASE']->getFirstCell("SELECT der_metal + der_crystal + der_deuterium FROM " . PLANETS . " WHERE id = " . $planetID . ";"); $usedDebris = 0; $recElementIDs = array(219, 209, 223); $fleetArray = array(); foreach ($recElementIDs as $elementID) { $shipsNeed = min(ceil($totalDebris / $pricelist[$elementID]['capacity']), $PLANET[$resource[$elementID]]); $totalDebris -= $shipsNeed * $pricelist[$elementID]['capacity']; $fleetArray[$elementID] = $shipsNeed; $this->returnData['ships'][$elementID] = $PLANET[$resource[$elementID]] - $shipsNeed; if ($totalDebris <= 0) { break; } } if (empty($fleetArray)) { $this->sendData('rouge', $LNG['fleet_ajax_1']); } if ($PLANET[$resource[219]] == 0 && $PLANET[$resource[209]] == 0 && $PLANET[$resource[223]] == 0) { $this->sendData('rouge', $LNG['fleet_ajax_1']); } 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.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\ttotal_points, onlinetime, 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.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 == 6 || $targetMission == 1) { if ($targetMission == 1) { if (FleetFunctions::CheckBash($targetData['id_owner'])) { $this->sendData('rouge', $LNG['fl_bash_protection']); } } 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']); } } $SpeedFactor = FleetFunctions::GetGameSpeedFactor(); $Distance = FleetFunctions::GetTargetDistance(array($PLANET['galaxy'], $PLANET['system'], $PLANET['planet']), array($targetData['galaxy'], $targetData['system'], $targetData['planet'])); $SpeedAllMin = FleetFunctions::GetFleetMaxSpeed($fleetArray, $USER); $Duration = FleetFunctions::GetMissionDuration(10, $SpeedAllMin, $Distance, $SpeedFactor, $USER); $consumption = FleetFunctions::GetFleetConsumption($fleetArray, $Duration, $Distance, $SpeedAllMin, $USER, $SpeedFactor); $UserDeuterium -= $consumption; if ($UserDeuterium < 0) { $this->sendData('rouge', $LNG['fa_not_enough_fuel']); } if ($consumption > FleetFunctions::GetFleetRoom($fleetArray)) { $this->sendData('rouge', $LNG['fa_no_fleetroom']); } if (connection_aborted()) { exit; } $this->returnData['slots']++; $fleetRessource = array(901 => 0, 902 => 0, 903 => 0, 904 => 0); $fleetPopulation = array(301 => 0, 302 => 0, 303 => 0, 304 => 0, 305 => 0, 306 => 0, 307 => 0, 309 => 0); $fleetStartTime = $Duration + TIMESTAMP; $fleetStayTime = $fleetStartTime; $fleetEndTime = $fleetStayTime + $Duration; $shipID = array_keys($fleetArray); FleetFunctions::sendFleet($fleetArray, $targetMission, $USER['id'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $targetData['id_owner'], $planetID, $targetData['galaxy'], $targetData['system'], $targetData['planet'], $targetData['planet_type'], $fleetRessource, $fleetPopulation, $fleetStartTime, $fleetStayTime, $fleetEndTime); if ($targetMission == 6) { $finalMsg = sprintf($LNG['fleet_ajax_9'], $targetData['name'], $targetData['galaxy'], $targetData['system'], $targetData['planet']); } else { $finalMsg = sprintf($LNG['fleet_ajax_16'], array_sum($fleetArray), $targetData['name'], $targetData['system'], $targetData['planet'], $LNG['type_missionbis'][$targetMission]); } $this->sendData('vert', $finalMsg); }