本文整理汇总了PHP中GetShipConsumption函数的典型用法代码示例。如果您正苦于以下问题:PHP GetShipConsumption函数的具体用法?PHP GetShipConsumption怎么用?PHP GetShipConsumption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetShipConsumption函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tpl_parse_fleet_db
function tpl_parse_fleet_db($fleet, $index, $user_data = false)
{
global $lang, $time_now, $user, $sn_data;
if (!$user_data) {
$user_data = $user;
}
if ($fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] == 2) {
$aks = doquery("SELECT * FROM {{aks}} WHERE id={$fleet['fleet_group']} LIMIT 1;", '', true);
}
$spy_level = $user['id'] == $fleet['fleet_owner'] ? 100 : $user[$sn_data[TECH_SPY]['name']] + $user[$sn_data[MRC_SPY]['name']];
$return['fleet'] = array('NUMBER' => $index, 'ID' => $fleet['fleet_id'], 'OWNER' => $fleet['fleet_owner'], 'TARGET_OWNER' => $fleet['fleet_target_owner'], 'MESSAGE' => $fleet['fleet_mess'], 'MISSION' => $fleet['fleet_mission'], 'MISSION_NAME' => $lang['type_mission'][$fleet['fleet_mission']], 'ACS' => $aks['name'], 'AMOUNT' => $spy_level >= 4 ? pretty_number($fleet['fleet_amount']) . ($fleet['fleet_resource_metal'] + $fleet['fleet_resource_crystal'] + $fleet['fleet_resource_deuterium'] ? '+' : '') : '?', 'METAL' => $spy_level >= 8 ? $fleet['fleet_resource_metal'] : 0, 'CRYSTAL' => $spy_level >= 8 ? $fleet['fleet_resource_crystal'] : 0, 'DEUTERIUM' => $spy_level >= 8 ? $fleet['fleet_resource_deuterium'] : 0, 'START_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$fleet['fleet_start_type']], 'START_COORDS' => "[{$fleet['fleet_start_galaxy']}:{$fleet['fleet_start_system']}:{$fleet['fleet_start_planet']}]", 'START_TIME_TEXT' => date(FMT_DATE_TIME, $fleet['fleet_end_time']), 'START_LEFT' => floor($fleet['fleet_end_time'] + 1 - $time_now), 'START_URL' => uni_render_coordinates_href($fleet, 'fleet_start_', 3), 'START_NAME' => $fleet['fleet_start_name'], 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$fleet['fleet_end_type']], 'END_COORDS' => "[{$fleet['fleet_end_galaxy']}:{$fleet['fleet_end_system']}:{$fleet['fleet_end_planet']}]", 'END_TIME_TEXT' => date(FMT_DATE_TIME, $fleet['fleet_start_time']), 'END_LEFT' => floor($fleet['fleet_start_time'] + 1 - $time_now), 'END_URL' => uni_render_coordinates_href($fleet, 'fleet_end_', 3), 'END_NAME' => $fleet['fleet_end_name'], 'STAY_TIME' => date(FMT_DATE_TIME, $fleet['fleet_end_stay']), 'STAY_LEFT' => floor($fleet['fleet_end_stay'] + 1 - $time_now), 'OV_LABEL' => $fleet['ov_label'], 'OV_TIME_TEXT' => date(FMT_DATE_TIME, $fleet['ov_time']), 'OV_LEFT' => floor($fleet['ov_time'] + 1 - $time_now), 'OV_THIS_PLANET' => $fleet['ov_this_planet']);
$ship_list = explode(';', $fleet['fleet_array']);
if ($spy_level >= 6) {
foreach ($ship_list as $ship_record) {
if ($ship_record) {
$ship_data = explode(',', $ship_record);
if ($spy_level >= 10) {
$return['ships'][$ship_data[0]] = array('ID' => $ship_data[0], 'NAME' => $lang['tech'][$ship_data[0]], 'AMOUNT' => $ship_data[1], 'CONSUMPTION' => GetShipConsumption($ship_data[0], $user_data), 'SPEED' => get_ship_speed($ship_data[0], $user_data), 'CAPACITY' => $sn_data[$ship_data[0]]['capacity']);
} else {
$return['ships'][$ship_data[0]] = array('ID' => $ship_id++, 'NAME' => $lang['tech'][SHIP_FLEET], 'AMOUNT' => $ship_data[1], 'CONSUMPTION' => 0, 'SPEED' => 0, 'CAPACITY' => 0);
}
}
}
}
return $return;
}
示例2: GetFleetConsumption
function GetFleetConsumption($FleetArray, $SpeedFactor, $MissionDuration, $MissionDistance, $FleetMaxSpeed, $Player)
{
$consumption = 0;
$basicConsumption = 0;
foreach ($FleetArray as $Ship => $Count) {
if ($Ship > 0) {
$ShipSpeed = GetFleetMaxSpeed("", $Ship, $Player);
$ShipConsumption = GetShipConsumption($Ship, $Player);
$spd = 35000 / ($MissionDuration * $SpeedFactor - 10) * sqrt($MissionDistance * 10 / $ShipSpeed);
$basicConsumption = $ShipConsumption * $Count;
$consumption += $basicConsumption * $MissionDistance / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
}
}
$consumption = round($consumption) + 1;
return $consumption;
}
示例3: foreach
$page .= "<input type=\"hidden\" name=\"system\" value=\"" . $_POST["system"] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"planet\" value=\"" . $_POST["planet"] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"" . $_POST["thisplanettype"] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"planettype\" value=\"" . $_POST["planettype"] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"" . $_POST["speedallsmin"] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"speed\" value=\"" . $_POST['speed'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"" . $_POST["speedfactor"] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"" . $_POST["usedfleet"] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"" . $_POST['maxepedition'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"" . $_POST['curepedition'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"fleet_group\" value=\"" . $_POST['fleet_group'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"acs_target_mr\" value=\"" . $_POST['acs_target_mr'] . "\" />\n";
foreach ($fleetarray as $Ship => $Count) {
$page .= "<input type=\"hidden\" name=\"ship" . $Ship . "\" value=\"" . $Count . "\" />\n";
$page .= "<input type=\"hidden\" name=\"capacity" . $Ship . "\" value=\"" . $pricelist[$Ship]['capacity'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"consumption" . $Ship . "\" value=\"" . GetShipConsumption($Ship, $user) . "\" />\n";
$page .= "<input type=\"hidden\" name=\"speed" . $Ship . "\" value=\"" . GetFleetMaxSpeed("", $Ship, $user) . "\" />\n";
}
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">\n";
$page .= "<tbody>\n";
$page .= "<tr align=\"left\" height=\"20\">\n";
$page .= "<td class=\"c\" colspan=\"2\">" . $TableTitle . "</td>\n";
$page .= "</tr>\n";
$page .= "<tr align=\"left\" valign=\"top\">\n";
$page .= "<th width=\"50%\">\n";
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
$page .= "<tbody>\n";
$page .= "<tr height=\"20\">\n";
$page .= "<td class=\"c\" colspan=\"2\">" . $lang['fl_mission'] . "</td>\n";
$page .= "</tr>\n";
$page .= $MissionSelector;
示例4: ShowFleet1Page
function ShowFleet1Page($CurrentUser, $CurrentPlanet)
{
global $resource, $pricelist, $reslist, $phpEx, $lang;
$parse = $lang;
$speed = array(10 => 100, 9 => 90, 8 => 80, 7 => 70, 6 => 60, 5 => 50, 4 => 40, 3 => 30, 2 => 20, 1 => 10);
$g = $_POST['galaxy'];
$s = $_POST['system'];
$p = $_POST['planet'];
$t = $_POST['planet_type'];
if (!$g) {
$g = $CurrentPlanet['galaxy'];
}
if (!$s) {
$s = $CurrentPlanet['system'];
}
if (!$p) {
$p = $CurrentPlanet['planet'];
}
if (!$t) {
$t = $CurrentPlanet['planet_type'];
}
$FleetHiddenBlock = "";
foreach ($reslist['fleet'] as $n => $i) {
if ($i > 201 && $i < 217 && $_POST["ship{$i}"] > "0") {
if ($_POST["ship{$i}"] > $CurrentPlanet[$resource[$i]] or !ctype_digit($_POST["ship{$i}"])) {
header("location:game.php?page=fleet");
} else {
$fleet['fleetarray'][$i] = $_POST["ship{$i}"];
$fleet['fleetlist'] .= $i . "," . $_POST["ship{$i}"] . ";";
$fleet['amount'] += $_POST["ship{$i}"];
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"consumption" . $i . "\" value=\"" . GetShipConsumption($i, $CurrentUser) . "\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"speed" . $i . "\" value=\"" . GetFleetMaxSpeed("", $i, $CurrentUser) . "\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"capacity" . $i . "\" value=\"" . $pricelist[$i]['capacity'] . "\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"ship" . $i . "\" value=\"" . $_POST["ship{$i}"] . "\" />";
$speedalls[$i] = GetFleetMaxSpeed("", $i, $CurrentUser);
}
}
}
if (!$fleet['fleetlist']) {
header("location:game." . $phpEx . "?page=fleet");
} else {
$speedallsmin = min($speedalls);
}
$parse['fleetblock'] = $FleetHiddenBlock;
$parse['speedallsmin'] = $speedallsmin;
$parse['fleetarray'] = str_rot13(base64_encode(serialize($fleet['fleetarray'])));
$parse['galaxy'] = $CurrentPlanet['galaxy'];
$parse['system'] = $CurrentPlanet['system'];
$parse['planet'] = $CurrentPlanet['planet'];
$parse['galaxy_post'] = intval($_POST['galaxy']);
$parse['system_post'] = intval($_POST['system']);
$parse['planet_post'] = intval($_POST['planet']);
$parse['speedfactor'] = GetGameSpeedFactor();
$parse['planet_type'] = $CurrentPlanet['planet_type'];
$parse['metal'] = floor($CurrentPlanet['metal']);
$parse['crystal'] = floor($CurrentPlanet['crystal']);
$parse['deuterium'] = floor($CurrentPlanet['deuterium']);
$parse['g'] = $g;
$parse['s'] = $s;
$parse['p'] = $p;
$parse['options_planettype'] .= "<option value=\"1\"" . ($t == 1 ? " SELECTED" : "") . ">" . $lang['fl_planet'] . "</option>";
$parse['options_planettype'] .= "<option value=\"2\"" . ($t == 2 ? " SELECTED" : "") . ">" . $lang['fl_debris'] . "</option>";
$parse['options_planettype'] .= "<option value=\"3\"" . ($t == 3 ? " SELECTED" : "") . ">" . $lang['fl_moon'] . "</option>";
foreach ($speed as $a => $b) {
$parse['options'] .= "<option value=\"" . $a . "\">" . $b . "</option>";
}
if ($CurrentUser['fleet_shortcut']) {
$scarray = explode("\r\n", $CurrentUser['fleet_shortcut']);
$i = 0;
foreach ($scarray as $a => $b) {
if ($b != "") {
$c = explode(',', $b);
if ($i == 0) {
$ShortCut .= "<tr height=\"20\">";
}
$ShortCut .= "<th><a href=\"javascript:setTarget(" . $c[1] . "," . $c[2] . "," . $c[3] . "," . $c[4] . "); shortInfo();\"";
$ShortCut .= ">" . $c[0] . " " . $c[1] . ":" . $c[2] . ":" . $c[3] . " ";
if ($c[4] == 1) {
$ShortCut .= $lang['fl_planet_shortcut'];
} elseif ($c[4] == 2) {
$ShortCut .= $lang['fl_debris_shortcut'];
} elseif ($c[4] == 3) {
$ShortCut .= $lang['fl_moon_shortcut'];
}
$ShortCut .= "</a></th>";
if ($i == 1) {
$ShortCut .= "</tr>";
}
if ($i == 1) {
$i = 0;
} else {
$i = 1;
}
}
}
if ($i == 1) {
$ShortCut .= "<th></th></tr>";
}
} else {
$ShortCut .= "<tr height=\"20\">";
//.........这里部分代码省略.........
示例5: doquery
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`username` = \"" . $user['username'] . "\";";
doquery($QryUpdateUser, 'users');
message($lang['FLOTEN1_BANNED'], $lang['FLOTEN1_BANNED_TITLE']);
}
if ($_POST["ship{$i}"] > $planetrow[$resource[$i]]) {
$page .= $lang['fl_noenought'];
$speedalls[$i] = GetFleetMaxSpeed("", $i, $user);
} else {
$fleet['fleetarray'][$i] = $_POST["ship{$i}"];
// Tableau des vaisseaux avec leur nombre
$fleet['fleetlist'] .= $i . "," . $_POST["ship{$i}"] . ";";
// Nombre total de vaisseaux
$fleet['amount'] += $_POST["ship{$i}"];
// Tableau des vitesses
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"consumption" . $i . "\" value=\"" . GetShipConsumption($i, $user) . "\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"speed" . $i . "\" value=\"" . GetFleetMaxSpeed("", $i, $user) . "\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"capacity" . $i . "\" value=\"" . $pricelist[$i]['capacity'] . "\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"ship" . $i . "\" value=\"" . $_POST["ship{$i}"] . "\" />";
$speedalls[$i] = GetFleetMaxSpeed("", $i, $user);
}
}
}
}
if (!$fleet['fleetlist']) {
message($lang['fl_unselectall'], $lang['fl_error'], "fleet." . $phpEx, 1);
} else {
$speedallsmin = min($speedalls);
}
$page .= "<script type=\"text/javascript\" src=\"scripts/flotten.js\"></script>";
$page .= "<script type=\"text/javascript\">\n";
示例6: message
message($lang['fl_noplanetrow'], $lang['fl_error']);
}
// Prise des coordonnées sur la ligne de commande
$galaxy = intval($_GET['galaxy']);
$system = intval($_GET['system']);
$planet = intval($_GET['planet']);
$planettype = intval($_GET['planettype']);
$target_mission = intval($_GET['target_mission']);
$ShipData = "";
foreach ($reslist['fleet'] as $n => $i) {
if ($planetrow[$resource[$i]] > 0) {
$page .= "<tr height=\"20\">";
$page .= "<th><a title=\"" . $lang['fl_fleetspeed'] . $CurrentShipSpeed . "\">" . $lang['tech'][$i] . "</a></th>";
$page .= "<th>" . pretty_number($planetrow[$resource[$i]]);
$ShipData .= "<input type=\"hidden\" name=\"maxship" . $i . "\" value=\"" . $planetrow[$resource[$i]] . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"consumption" . $i . "\" value=\"" . GetShipConsumption($i, $user) . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"speed" . $i . "\" value=\"" . GetFleetMaxSpeed("", $i, $user) . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"capacity" . $i . "\" value=\"" . $pricelist[$i]['capacity'] . "\" />";
$page .= "</th>";
// Satelitte Solaire (eux ne peuvent pas bouger !)
if ($i == 212) {
$page .= "<th></th><th></th>";
} else {
$page .= "<th><a href=\"javascript:maxShip('ship" . $i . "'); shortInfo();\">" . $lang['fl_selmax'] . "</a> </th>";
$page .= "<th><input name=\"ship" . $i . "\" size=\"10\" value=\"0\" onfocus=\"javascript:if(this.value == '0') this.value='';\" onblur=\"javascript:if(this.value == '') this.value='0';\" alt=\"" . $lang['tech'][$i] . $planetrow[$resource[$i]] . "\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" /></th>";
}
$page .= "</tr>";
}
$have_ships = true;
}
$btncontinue = "<tr height=\"20\"><th colspan=\"4\"><input type=\"submit\" value=\" " . $lang['fl_continue'] . " \" /></th>";
示例7: ShowFleet2Page
//.........这里部分代码省略.........
$distance = GetTargetDistance($_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet']);
$duration = GetMissionDuration($GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor);
$consumption = GetFleetConsumption($fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $CurrentUser);
$MissionSelector = "";
if (count($missiontype) > 0) {
if ($planet == 16) {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<input type=\"radio\" name=\"mission\" value=\"15\" checked=\"checked\">" . $lang['type_mission'][15] . "<br /><br />";
$MissionSelector .= "<font color=\"red\">" . $lang['fl_expedition_alert_message'] . "</font>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
} else {
$i = 0;
foreach ($missiontype as $a => $b) {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<input id=\"inpuT_" . $i . "\" type=\"radio\" name=\"mission\" value=\"" . $a . "\"" . ($mission == $a ? " checked=\"checked\"" : "") . ">";
$MissionSelector .= "<label for=\"inpuT_" . $i . "\">" . $b . "</label><br>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
$i++;
}
}
} else {
header("location:game.php?page=fleet");
}
if ($_POST['thisplanettype'] == 1) {
$parse['title'] = "" . $_POST['thisgalaxy'] . ":" . $_POST['thissystem'] . ":" . $_POST['thisplanet'] . " - " . $lang['fl_planet'] . "";
} elseif ($_POST['thisplanettype'] == 3) {
$parse['title'] = "" . $_POST['thisgalaxy'] . ":" . $_POST['thissystem'] . ":" . $_POST['thisplanet'] . " - " . $lang['fl_moon'] . "";
}
$parse['metal_fleet'] = floor($CurrentPlanet["metal"]);
$parse['crystal_fleet'] = floor($CurrentPlanet["crystal"]);
$parse['deuterium_fleet'] = floor($CurrentPlanet["deuterium"]);
$parse['consumption'] = $consumption;
$parse['distance'] = $distance;
$parse['speedfactor_fleet'] = $_POST['speedfactor'];
$parse['thisgalaxy_fleet'] = $_POST["thisgalaxy"];
$parse['thissystem_fleet'] = $_POST["thissystem"];
$parse['thisplanet_fleet'] = $_POST["thisplanet"];
$parse['galaxy_fleet'] = $_POST["galaxy"];
$parse['system_fleet'] = $_POST["system"];
$parse['planet_fleet'] = $_POST["planet"];
$parse['thisplanettype_fleet'] = $_POST["thisplanettype"];
$parse['planettype_fleet'] = $_POST["planettype"];
$parse['speedallsmin_fleet'] = $_POST["speedallsmin"];
$parse['speed_fleet'] = $_POST['speed'];
$parse['speedfactor_fleet'] = $_POST["speedfactor"];
$parse['usedfleet_fleet'] = $_POST["usedfleet"];
$parse['maxepedition_fleet'] = $_POST['maxepedition'];
$parse['curepedition_fleet'] = $_POST['curepedition'];
$parse['fleet_group_fleet'] = $_POST['fleet_group'];
$parse['acs_target_mr_fleet'] = $_POST['acs_target_mr'];
foreach ($fleetarray as $Ship => $Count) {
$input_extra .= "<input type=\"hidden\" name=\"ship" . $Ship . "\" value=\"" . $Count . "\" />\n";
$input_extra .= "<input type=\"hidden\" name=\"capacity" . $Ship . "\" value=\"" . $pricelist[$Ship]['capacity'] . "\" />\n";
$input_extra .= "<input type=\"hidden\" name=\"consumption" . $Ship . "\" value=\"" . GetShipConsumption($Ship, $CurrentUser) . "\" />\n";
$input_extra .= "<input type=\"hidden\" name=\"speed" . $Ship . "\" value=\"" . GetFleetMaxSpeed("", $Ship, $CurrentUser) . "\" />\n";
}
$parse['input_extra'] = $input_extra;
$parse['missionselector'] = $MissionSelector;
if ($planet == 16) {
$StayBlock .= "<tr height=\"20\">";
$StayBlock .= "<td class=\"c\" colspan=\"3\">" . $lang['fl_hold_time'] . "</td>";
$StayBlock .= "</tr>";
$StayBlock .= "<tr height=\"20\">";
$StayBlock .= "<th colspan=\"3\">";
$StayBlock .= "<select name=\"expeditiontime\" >";
$StayBlock .= "<option value=\"1\">1</option>";
$StayBlock .= "<option value=\"2\">2</option>";
$StayBlock .= "</select>";
$StayBlock .= "hora(s)";
$StayBlock .= "</th>";
$StayBlock .= "</tr>";
} elseif ($missiontype[5] != '') {
$StayBlock .= "<tr height=\"20\">";
$StayBlock .= "<td class=\"c\" colspan=\"3\">" . $lang['fl_hold_time'] . "</td>";
$StayBlock .= "</tr>";
$StayBlock .= "<tr height=\"20\">";
$StayBlock .= "<th colspan=\"3\">";
$StayBlock .= "<select name=\"holdingtime\" >";
$StayBlock .= "<option value=\"0\">0</option>";
$StayBlock .= "<option value=\"1\">1</option>";
$StayBlock .= "<option value=\"2\">2</option>";
$StayBlock .= "<option value=\"4\">4</option>";
$StayBlock .= "<option value=\"8\">8</option>";
$StayBlock .= "<option value=\"16\">16</option>";
$StayBlock .= "<option value=\"32\">32</option>";
$StayBlock .= "</select>";
$StayBlock .= "hora(s)";
$StayBlock .= "</th>";
$StayBlock .= "</tr>";
}
$parse['stayblock'] = $StayBlock;
foreach ($parse as $key => $value) {
$displays->assign($key, $value);
}
$displays->display();
}
示例8: ShowFleetPage
//.........这里部分代码省略.........
}
}
$FleetPageRow .= "\">" . pretty_number($f['fleet_amount']) . "</a></th>";
$FleetPageRow .= "<th>[" . $f['fleet_start_galaxy'] . ":" . $f['fleet_start_system'] . ":" . $f['fleet_start_planet'] . "]</th>";
$FleetPageRow .= "<th>" . date("d M Y H:i:s", $f['fleet_start_time']) . "</th>";
$FleetPageRow .= "<th>[" . $f['fleet_end_galaxy'] . ":" . $f['fleet_end_system'] . ":" . $f['fleet_end_planet'] . "]</th>";
$FleetPageRow .= "<th>" . date("d M Y H:i:s", $f['fleet_end_time']) . "</th>";
$FleetPageRow .= "<th><font color=\"lime\"><div id=\"time_0\"><font>" . pretty_time(floor($f['fleet_end_time'] + 1 - time())) . "</font></th>";
$FleetPageRow .= "<th>";
if ($f['fleet_mess'] == 0 || $f['fleet_mess'] == 2) {
$FleetPageRow .= "<form action=\"SendFleetBack.php\" method=\"post\">";
$FleetPageRow .= "<input name=\"fleetid\" value=\"" . $f['fleet_id'] . "\" type=\"hidden\">";
$FleetPageRow .= "<input value=\"" . $lang['fl_send_back'] . "\" type=\"submit\" name=\"send\">";
$FleetPageRow .= "</form>";
if ($f[fleet_mission] == 1) {
$FleetPageRow .= "<form action=\"game.php?page=fleetACS\" method=\"post\">";
$FleetPageRow .= "<input name=\"fleetid\" value=\"" . $f['fleet_id'] . "\" type=\"hidden\">";
$FleetPageRow .= "<input value=\"" . $lang['fl_acs'] . "\" type=\"submit\">";
$FleetPageRow .= "</form>";
}
} else {
$FleetPageRow .= " - ";
}
$FleetPageRow .= "</th>";
$FleetPageRow .= "</tr>";
}
if ($i == 0) {
$FleetPageRow .= "<tr>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "<th>-</th>";
$FleetPageRow .= "</tr>";
}
$parse['fleetpagerow'] = $FleetPageRow;
if ($MaxFlottes == $MaxFlyingFleets) {
$parse['message_nofreeslot'] .= "<tr height=\"20\"><th colspan=\"9\"><font color=\"red\">" . $lang['fl_no_more_slots'] . "</font></th></tr>";
}
if (!$CurrentPlanet) {
header("location:game.php?page=fleet");
}
$parse['total_ships'] = 0;
foreach ($reslist['fleet'] as $n => $i) {
if ($CurrentPlanet[$resource[$i]] > 0) {
$page .= "<tr height=\"20\">";
$page .= "<th>";
$page .= $i == 212 ? "" : "<a title=\"" . $lang['fl_speed_title'] . GetFleetMaxSpeed("", $i, $CurrentUser) . "\">";
$page .= $lang['tech'][$i] . "</a></th>";
$page .= "<th>" . pretty_number($CurrentPlanet[$resource[$i]]);
$ShipData .= "<input type=\"hidden\" name=\"maxship" . $i . "\" value=\"" . $CurrentPlanet[$resource[$i]] . "\" />";
$parse['total_ships'] += $CurrentPlanet[$resource[$i]];
$ShipData .= "<input type=\"hidden\" name=\"consumption" . $i . "\" value=\"" . GetShipConsumption($i, $CurrentUser) . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"speed" . $i . "\" value=\"" . GetFleetMaxSpeed("", $i, $CurrentUser) . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"capacity" . $i . "\" value=\"" . $pricelist[$i]['capacity'] . "\" />";
$page .= "</th>";
if ($i == 212) {
$page .= "<th colspan='2'></th>";
} else {
$page .= "<th colspan='2'><input type=button onclick='document.getElementById(\"ship" . $i . "\").value = 0;' value='0' style='width:20px;'/> <input type=button onclick='document.getElementById(\"ship" . $i . "\").value = Math.max(0, parseInt(document.getElementById(\"ship" . $i . "\").value) - 1);' value='-' style='width:20px;'/><input id=\"ship" . $i . "\" name=\"ship" . $i . "\" size=\"10\" value=\"0\" onfocus=\"javascript:if(this.value == '0') this.value='';\" onblur=\"javascript:if(this.value == '') this.value='0';\" alt=\"" . $lang['tech'][$i] . $CurrentPlanet[$resource[$i]] . "\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" /><input type=button onclick='document.getElementById(\"ship" . $i . "\").value = Math.max(0, parseInt(document.getElementById(\"ship" . $i . "\").value) + 1);' value='+' style='width:20px;'/> <input type=button onclick='document.getElementById(\"ship" . $i . "\").value = " . $CurrentPlanet[$resource[$i]] . ";' value='Σ' style='width:20px;'/></th>";
}
$page .= "</tr>";
}
$have_ships = true;
}
$parse['total_ships'] = pretty_number($parse['total_ships']);
$btncontinue = "<tr height=\"20\"><th colspan=\"4\"><input type=\"submit\" value=\"" . $lang['fl_continue'] . "\" /></th>";
$page .= "<tr height=\"20\">";
if (!$have_ships) {
$page .= "<th colspan=\"4\">" . $lang['fl_no_ships'] . "</th>";
$page .= "</tr>";
$page .= $btncontinue;
} else {
$page .= "<th colspan=\"2\"><a href=\"javascript:noShips();shortInfo();noResources();\" >" . $lang['fl_remove_all_ships'] . "</a></th>";
$page .= "<th colspan=\"2\"><a href=\"javascript:maxShips();shortInfo();\" >" . $lang['fl_select_all_ships'] . "</a></th>";
$page .= "</tr>";
if ($MaxFlottes > $MaxFlyingFleets) {
$page .= $btncontinue;
}
}
$page .= "<input type=\"hidden\" name=\"wormhole\" value=\"" . $_GET['wormhole'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"wormhole_galaxy\" value=\"" . $_GET['wormhole_galaxy'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"wormhole_system\" value=\"" . $_GET['wormhole_system'] . "\" />\n";
$page .= "<input type=\"hidden\" name=\"wormhole_planet\" value=\"" . $_GET['wormhole_planet'] . "\" />\n";
$parse['body'] = $page;
$parse['shipdata'] = $ShipData;
$parse['galaxy'] = $galaxy;
$parse['system'] = $system;
$parse['planet'] = $planet;
$parse['planettype'] = $planettype;
$parse['target_mission'] = $target_mission;
$parse['envoimaxexpedition'] = $EnvoiMaxExpedition;
$parse['expeditionencours'] = $ExpeditionEnCours;
$parse['target_mission'] = $target_mission;
display(parsetemplate(gettemplate('fleet/fleet_table'), $parse));
}
示例9: GetFleetConsumption
function GetFleetConsumption($FleetArray, $SpeedFactor, $MissionDuration, $MissionDistance, $FleetMaxSpeed, $Player, $speed_percent = 10)
{
$consumption = 0;
if (empty($FleetArray) || !$FleetMaxSpeed) {
return 0;
}
$MissionDuration = $MissionDuration < 1 ? 1 : $MissionDuration;
$MissionDistance = $MissionDistance < 1 ? 1 : $MissionDistance;
$SpeedFactor = $SpeedFactor == 10 ? 11 : $SpeedFactor;
$spd = $speed_percent * sqrt($FleetMaxSpeed);
foreach ($FleetArray as $Ship => $Count) {
if (!$Ship || !$Count) {
continue;
}
$ShipSpeed = get_ship_speed($Ship, $Player);
$ShipSpeed = $ShipSpeed < 1 ? 1 : $ShipSpeed;
$ShipConsumption = GetShipConsumption($Ship, $Player);
$consumption += $ShipConsumption * $Count * pow($spd / sqrt($ShipSpeed) / 10 + 1, 2);
}
$consumption = round($MissionDistance * $consumption / 35000) + 1;
return $consumption;
}
示例10: GetFleetConsumption
function GetFleetConsumption($FleetArray, $SpeedFactor, $MissionDuration, $MissionDistance, $FleetMaxSpeed, $Player)
{
$consumption = 0;
$basicConsumption = 0;
if (!is_array($FleetArray)) {
ReportError("\$FleetArray is not an array, line 108, unlocalised.php", 'Invalid argument supplied for foreach()', 1);
}
foreach ($FleetArray as $Ship => $Count) {
if ($Ship > 0) {
$ShipSpeed = GetFleetMaxSpeed("", $Ship, $Player);
$ShipConsumption = GetShipConsumption($Ship, $Player);
$spd = 35000 / ($MissionDuration * $SpeedFactor - 10) * sqrt($MissionDistance * 10 / $ShipSpeed);
$basicConsumption = $ShipConsumption * $Count;
$consumption += $basicConsumption * $MissionDistance / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
}
}
$consumption = round($consumption) + 1;
return $consumption;
}