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


PHP Functions_Lib::fleet_speed_factor方法代码示例

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


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

示例1: build_page


//.........这里部分代码省略.........
     foreach ($planet_type as $type) {
         $value++;
         $options['value'] = $value;
         if ($value == $t) {
             $options['selected'] = 'SELECTED';
         } else {
             $options['selected'] = '';
         }
         $options['title'] = $this->_lang[$type];
         $parse['options_planettype'] .= parent::$page->parse_template($options_template, $options);
     }
     #####################################################################################################
     // LOAD SPEED OPTIONS
     #####################################################################################################
     $parse['options'] = '';
     foreach ($speed_values as $value => $porcentage) {
         $speed_porcentage['value'] = $value;
         $speed_porcentage['selected'] = '';
         $speed_porcentage['title'] = $porcentage;
         $parse['options'] .= parent::$page->parse_template($options_template, $speed_porcentage);
     }
     #####################################################################################################
     // PARSE THE REST OF THE OPTIONS
     #####################################################################################################
     $parse['fleetblock'] = $FleetHiddenBlock;
     $parse['speedallsmin'] = $speedallsmin;
     $parse['fleetarray'] = str_rot13(base64_encode(serialize($fleet['fleetarray'])));
     $parse['galaxy'] = $this->_current_planet['planet_galaxy'];
     $parse['system'] = $this->_current_planet['planet_system'];
     $parse['planet'] = $this->_current_planet['planet_planet'];
     $parse['galaxy_post'] = (int) $_POST['galaxy'];
     $parse['system_post'] = (int) $_POST['system'];
     $parse['planet_post'] = (int) $_POST['planet'];
     $parse['speedfactor'] = Functions_Lib::fleet_speed_factor();
     $parse['planet_type'] = $this->_current_planet['planet_type'];
     $parse['metal'] = floor($this->_current_planet['planet_metal']);
     $parse['crystal'] = floor($this->_current_planet['planet_crystal']);
     $parse['deuterium'] = floor($this->_current_planet['planet_deuterium']);
     $parse['g'] = $g;
     $parse['s'] = $s;
     $parse['p'] = $p;
     #####################################################################################################
     // LOAD FLEET SHORTCUTS
     #####################################################################################################
     if (Officiers_Lib::is_officier_active($this->_current_user['premium_officier_commander'])) {
         if ($this->_current_user['user_fleet_shortcuts']) {
             $scarray = explode(";", $this->_current_user['user_fleet_shortcuts']);
             foreach ($scarray as $a => $b) {
                 if ($b != "") {
                     $c = explode(',', $b);
                     $shortcut['description'] = $c[0] . " " . $c[1] . ":" . $c[2] . ":" . $c[3] . " ";
                     switch ($c[4]) {
                         case 1:
                             $shortcut['description'] .= $this->_lang['fl_planet_shortcut'];
                             break;
                         case 2:
                             $shortcut['description'] .= $this->_lang['fl_debris_shortcut'];
                             break;
                         case 3:
                             $shortcut['description'] .= $this->_lang['fl_moon_shortcut'];
                             break;
                         default:
                             $shortcut['description'] .= '';
                             break;
                     }
                     $shortcut['select'] = 'shortcuts';
开发者ID:Gritch69,项目名称:XG-Project,代码行数:67,代码来源:fleet2.php

示例2: build_page


//.........这里部分代码省略.........
     if (Fleets_Lib::get_max_fleets($this->_current_user[$resource[108]], $this->_current_user['premium_officier_admiral']) <= $ActualFleets) {
         Functions_Lib::message($this->_lang['fl_no_slots'], "game.php?page=movement", 1);
     }
     if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 && $_POST['mission'] == 3) {
         Functions_Lib::message("<font color=\"lime\"><b>" . $this->_lang['fl_empty_transport'] . "</b></font>", "game.php?page=movement", 1);
     }
     if ($_POST['mission'] != 15) {
         if ($TargetPlanet['planet_user_id'] == '' && $_POST['mission'] < 7) {
             Functions_Lib::redirect('game.php?page=movement');
         }
         if ($TargetPlanet['planet_user_id'] != '' && $_POST['mission'] == 7) {
             Functions_Lib::message("<font color=\"red\"><b>" . $this->_lang['fl_planet_populed'] . "</b></font>", "game.php?page=movement", 2);
         }
         if ($HeDBRec['user_ally_id'] != $MyDBRec['user_ally_id'] && $_POST['mission'] == 4) {
             Functions_Lib::message("<font color=\"red\"><b>" . $this->_lang['fl_stay_not_on_enemy'] . "</b></font>", "game.php?page=movement", 2);
         }
         if ($TargetPlanet['planet_user_id'] == $this->_current_planet['planet_user_id'] && ($_POST['mission'] == 1 or $_POST['mission'] == 6)) {
             Functions_Lib::redirect('game.php?page=movement');
         }
         if ($TargetPlanet['planet_user_id'] != $this->_current_planet['planet_user_id'] && $_POST['mission'] == 4) {
             Functions_Lib::message("<font color=\"red\"><b>" . $this->_lang['fl_deploy_only_your_planets'] . "</b></font>", "game.php?page=movement", 2);
         }
         if ($_POST['mission'] == 5) {
             $buddy = parent::$db->query_fetch("SELECT COUNT( * ) AS buddys\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM  `" . BUDDY . "`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuddy_sender ='" . intval($this->_current_planet['planet_user_id']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND buddy_receiver ='" . intval($TargetPlanet['planet_user_id']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuddy_sender ='" . intval($TargetPlanet['planet_user_id']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND buddy_receiver ='" . intval($this->_current_planet['planet_user_id']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND buddy_status =1");
             if ($HeDBRec['user_ally_id'] != $MyDBRec['user_ally_id'] && $buddy['buddys'] < 1) {
                 Functions_Lib::message("<font color=\"red\"><b>" . $this->_lang['fl_stay_not_on_enemy'] . "</b></font>", "game.php?page=movement", 2);
             }
         }
     }
     $missiontype = Fleets_Lib::get_missions();
     $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
     $AllFleetSpeed = Fleets_Lib::fleet_max_speed($fleetarray, 0, $this->_current_user);
     $GenFleetSpeed = $_POST['speed'];
     $SpeedFactor = Functions_Lib::fleet_speed_factor();
     $MaxFleetSpeed = min($AllFleetSpeed);
     if (!in_array($GenFleetSpeed, $speed_possible)) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     if ($MaxFleetSpeed != $_POST['speedallsmin']) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     if (!$_POST['planettype']) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     if (!$_POST['galaxy'] || !is_numeric($_POST['galaxy']) || $_POST['galaxy'] > MAX_GALAXY_IN_WORLD || $_POST['galaxy'] < 1) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     if (!$_POST['system'] || !is_numeric($_POST['system']) || $_POST['system'] > MAX_SYSTEM_IN_GALAXY || $_POST['system'] < 1) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     if (!$_POST['planet'] || !is_numeric($_POST['planet']) || $_POST['planet'] > MAX_PLANET_IN_SYSTEM + 1 || $_POST['planet'] < 1) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     if ($_POST['thisgalaxy'] != $this->_current_planet['planet_galaxy'] | $_POST['thissystem'] != $this->_current_planet['planet_system'] | $_POST['thisplanet'] != $this->_current_planet['planet_planet'] | $_POST['thisplanettype'] != $this->_current_planet['planet_type']) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     if (!isset($fleetarray)) {
         Functions_Lib::redirect('game.php?page=movement');
     }
     $distance = Fleets_Lib::target_distance($_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet']);
     $duration = Fleets_Lib::mission_duration($GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor);
     $consumption = Fleets_Lib::fleet_consumption($fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $this->_current_user);
     $fleet['start_time'] = $duration + time();
     // START CODE BY JSTAR
     if ($_POST['mission'] == 15) {
         $StayDuration = floor($_POST['expeditiontime']);
开发者ID:rampmaster,项目名称:XG-Proyect-v3.x.x,代码行数:67,代码来源:fleet4.php

示例3: send_fleet


//.........这里部分代码省略.........
         if ($PartialCount < 1) {
             die("611 ");
         }
     }
     $galaxy = isset($_POST['galaxy']) ? (int) $_POST['galaxy'] : 0;
     $system = isset($_POST['system']) ? (int) $_POST['system'] : 0;
     $planet = isset($_POST['planet']) ? (int) $_POST['planet'] : 0;
     $FleetArray = isset($fleet['fleetarray']) ? $fleet['fleetarray'] : NULL;
     if ($galaxy > MAX_GALAXY_IN_WORLD or $galaxy < 1 or ($system > MAX_SYSTEM_IN_GALAXY or $system < 1) or ($planet > MAX_PLANET_IN_SYSTEM or $planet < 1) or is_null($FleetArray)) {
         die("614 ");
     }
     $CurrentFlyingFleets = parent::$db->query_fetch("SELECT COUNT(fleet_id) AS `Nbre`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . FLEETS . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `fleet_owner` = '" . $this->_current_user['user_id'] . "';");
     $CurrentFlyingFleets = $CurrentFlyingFleets['Nbre'];
     $TargetRow = parent::$db->query_fetch("SELECT *\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . parent::$db->escape_value($_POST['galaxy']) . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . parent::$db->escape_value($_POST['system']) . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . parent::$db->escape_value($_POST['planet']) . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = '" . parent::$db->escape_value($_POST['planettype']) . "';");
     if ($TargetRow['planet_user_id'] == '') {
         $TargetUser = $this->_current_user;
     } elseif ($TargetRow['planet_user_id'] != '') {
         $TargetUser = parent::$db->query_fetch("SELECT u.`user_id`, u.`user_onlinetime`, u.`user_authlevel`, s.`setting_vacations_status`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " AS u\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SETTINGS . " AS s ON s.setting_user_id = u.user_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id` = '" . $TargetRow['planet_user_id'] . "';");
     }
     // invisible debris by jstar
     if ($order == 8) {
         $TargetGPlanet = parent::$db->query_fetch("SELECT planet_invisible_start_time, planet_debris_metal, planet_debris_crystal\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE planet_galaxy = '" . parent::$db->escape_value($_POST['galaxy']) . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tplanet_system = '" . parent::$db->escape_value($_POST['system']) . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tplanet_planet = '" . parent::$db->escape_value($_POST['planet']) . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tplanet_type = 1;");
         if ($TargetGPlanet['planet_debris_metal'] == 0 && $TargetGPlanet['planet_debris_crystal'] == 0 && time() > $TargetGPlanet['planet_invisible_start_time'] + DEBRIS_LIFE_TIME) {
             die;
         }
     }
     $user_points = $this->_noob->return_points($this->_current_user['user_id'], $TargetUser['user_id']);
     $CurrentPoints = $user_points['user_points'];
     $TargetPoints = $user_points['target_points'];
     $TargetVacat = $TargetUser['setting_vacations_status'];
     if (Fleets_Lib::get_max_fleets($this->_current_user[$this->_resource[108]], $this->_current_user['premium_officier_admiral']) <= $CurrentFlyingFleets) {
         die("612 ");
     }
     if (!is_array($FleetArray)) {
         die("611 ");
     }
     if (!($order == 6 or $order == 8)) {
         die("601 ");
     }
     if ($TargetVacat && $order != 8 or $this->_current_user['setting_vacations_status']) {
         die("605 ");
     }
     if ($TargetUser['user_onlinetime'] >= time() - 60 * 60 * 24 * 7) {
         if ($this->_noob->is_weak($CurrentPoints, $TargetPoints) && $TargetRow['planet_user_id'] != '' && $order == 6) {
             die("603 ");
         }
         if ($this->_noob->is_strong($CurrentPoints, $TargetPoints) && $TargetRow['planet_user_id'] != '' && $order == 6) {
             die("604 ");
         }
     }
     if ($TargetRow['planet_user_id'] == '' && $order != 8) {
         die("601 ");
     }
     if ($TargetRow['planet_user_id'] == $this->_current_planet['planet_user_id'] && $order == 6) {
         die("601 ");
     }
     $Distance = Fleets_Lib::target_distance($this->_current_planet['planet_galaxy'], $_POST['galaxy'], $this->_current_planet['planet_system'], $_POST['system'], $this->_current_planet['planet_planet'], $_POST['planet']);
     $speedall = Fleets_Lib::fleet_max_speed($FleetArray, 0, $this->_current_user);
     $SpeedAllMin = min($speedall);
     $Duration = Fleets_Lib::mission_duration(10, $SpeedAllMin, $Distance, Functions_Lib::fleet_speed_factor());
     $fleet['fly_time'] = $Duration;
     $fleet['start_time'] = $Duration + time();
     $fleet['end_time'] = $Duration * 2 + time();
     $FleetShipCount = 0;
     $FleetDBArray = "";
     $FleetSubQRY = "";
     $consumption = 0;
     $SpeedFactor = Functions_Lib::fleet_speed_factor();
     foreach ($FleetArray as $Ship => $Count) {
         if ($Ship != '') {
             $ShipSpeed = $this->_pricelist[$Ship]['speed'];
             $spd = 35000 / ($Duration * $SpeedFactor - 10) * sqrt($Distance * 10 / $ShipSpeed);
             $basicConsumption = $this->_pricelist[$Ship]['consumption'] * $Count;
             $consumption += $basicConsumption * $Distance / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
             $FleetShipCount += $Count;
             $FleetDBArray .= $Ship . "," . $Count . ";";
             $FleetSubQRY .= "`" . $this->_resource[$Ship] . "` = `" . $this->_resource[$Ship] . "` - " . $Count . " , ";
         }
     }
     $consumption = round($consumption) + 1;
     if ($UserDeuterium < $consumption) {
         die("613 ");
     }
     if (Functions_Lib::read_config('adm_attack') == 1 && $TargetUser['user_authlevel'] > 0) {
         die("601 ");
     }
     parent::$db->query("INSERT INTO " . FLEETS . " SET\r\n\t\t\t\t\t\t\t\t`fleet_owner` = '" . $this->_current_user['user_id'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_mission` = '" . intval($order) . "',\r\n\t\t\t\t\t\t\t\t`fleet_amount` = '" . $FleetShipCount . "',\r\n\t\t\t\t\t\t\t\t`fleet_array` = '" . $FleetDBArray . "',\r\n\t\t\t\t\t\t\t\t`fleet_start_time` = '" . $fleet['start_time'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_start_galaxy` = '" . $this->_current_planet['planet_galaxy'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_start_system` = '" . $this->_current_planet['planet_system'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_start_planet` = '" . $this->_current_planet['planet_planet'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_start_type` = '" . $this->_current_planet['planet_type'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_end_time` = '" . $fleet['end_time'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_end_galaxy` = '" . intval($_POST['galaxy']) . "',\r\n\t\t\t\t\t\t\t\t`fleet_end_system` = '" . intval($_POST['system']) . "',\r\n\t\t\t\t\t\t\t\t`fleet_end_planet` = '" . intval($_POST['planet']) . "',\r\n\t\t\t\t\t\t\t\t`fleet_end_type` = '" . intval($_POST['planettype']) . "',\r\n\t\t\t\t\t\t\t\t`fleet_target_owner` = '" . $TargetRow['planet_user_id'] . "',\r\n\t\t\t\t\t\t\t\t`fleet_creation` = '" . time() . "';");
     $UserDeuterium -= $consumption;
     parent::$db->query("UPDATE " . PLANETS . " AS p\r\n\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id` SET\r\n\t\t\t\t\t\t\t\t{$FleetSubQRY}\r\n\t\t\t\t\t\t\t\tp.`planet_deuterium` = '" . ($UserDeuterium < 1 ? 0 : $UserDeuterium) . "'\r\n\t\t\t\t\t\t\t\tWHERE p.`planet_id` = '" . $this->_current_planet['planet_id'] . "';");
     $CurrentFlyingFleets++;
     foreach ($FleetArray as $Ships => $Count) {
         if ($max_spy_probes > $this->_current_planet[$this->_resource[$Ships]]) {
             $ResultMessage = "610 " . $FleetShipCount;
         }
     }
     if ($ResultMessage == '') {
         $ResultMessage = "600 " . $Ships;
     }
     die($ResultMessage);
 }
开发者ID:Gritch69,项目名称:XG-Project,代码行数:101,代码来源:galaxy.php


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