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


PHP GetFleetMaxSpeed函数代码示例

本文整理汇总了PHP中GetFleetMaxSpeed函数的典型用法代码示例。如果您正苦于以下问题:PHP GetFleetMaxSpeed函数的具体用法?PHP GetFleetMaxSpeed怎么用?PHP GetFleetMaxSpeed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: 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;
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:16,代码来源:unlocalised.php

示例2: die

    die($ResultMessage);
}
if ($TargetRow['id_owner'] == '' and $_POST['mission'] != 8) {
    $ResultMessage = "601;" . $lang['gs_c601'] . "|" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserMissiles;
    die($ResultMessage);
}
if ($TargetRow["id_owner"] == $planetrow["id_owner"] and $_POST["mission"] == 6) {
    $ResultMessage = "618;" . $lang['gs_c618'] . "|" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserMissiles;
    die($ResultMessage);
}
if ($_POST['thisgalaxy'] != $planetrow['galaxy'] | $_POST['thissystem'] != $planetrow['system'] | $_POST['thisplanet'] != $planetrow['planet'] | $_POST['thisplanettype'] != $planetrow['planet_type']) {
    $ResultMessage = "618;" . $lang['gs_c618'] . "|" . $CurrentFlyingFleets . " " . $UserSpyProbes . " " . $UserRecycles . " " . $UserMissiles;
    die($ResultMessage);
}
$Distance = GetTargetDistance($_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet']);
$speedall = GetFleetMaxSpeed($FleetArray, 0, $user);
$SpeedAllMin = min($speedall);
$Duration = GetMissionDuration(10, $SpeedAllMin, $Distance, GetGameSpeedFactor());
$fleet['fly_time'] = $Duration;
$fleet['start_time'] = $Duration + time();
$fleet['end_time'] = $Duration * 2 + time();
$FleetShipCount = 0;
$FleetDBArray = "";
$FleetSubQRY = "";
$consumption = 0;
$SpeedFactor = GetGameSpeedFactor();
foreach ($FleetArray as $Ship => $Count) {
    $ShipSpeed = $pricelist[$Ship]["speed"];
    $spd = 35000 / ($Duration * $SpeedFactor - 10) * sqrt($Distance * 10 / $ShipSpeed);
    $basicConsumption = $pricelist[$Ship]["consumption"] * $Count;
    $consumption += $basicConsumption * $Distance / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:flotenajax.php

示例3: GetFleetMaxSpeed

            }
            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";
$page .= "function getStorageFaktor() {\n";
$page .= "\treturn 1\n";
$page .= "}\n";
$page .= "</script>\n";
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:floten1.php

示例4: intval

}
// 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>";
$page .= "<tr height=\"20\">";
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:fleet.php

示例5: ShowFleet2Page

function ShowFleet2Page($CurrentUser, $CurrentPlanet)
{
    global $resource, $pricelist, $reslist, $phpEx, $lang, $db, $displays;
    //$parse			= $lang;
    $displays->assignContent('fleet/fleet2_table');
    $galaxy = intval($_POST['galaxy']);
    $system = intval($_POST['system']);
    $planet = intval($_POST['planet']);
    $planettype = intval($_POST['planettype']);
    $fleet_group_mr = intval($_POST['fleet_group']);
    //print_r($_POST);
    $YourPlanet = false;
    $UsedPlanet = false;
    $select = $db->query("SELECT `id_owner`,`galaxy`,`system`,`planet`,`planet_type` FROM `{{table}}`", "planets");
    while ($row = mysql_fetch_array($select)) {
        if ($galaxy == $row['galaxy'] && $system == $row['system'] && $planet == $row['planet'] && $planettype == $row['planet_type']) {
            if ($row['id_owner'] == $CurrentUser['id']) {
                $YourPlanet = true;
                $UsedPlanet = true;
            } else {
                $UsedPlanet = true;
            }
            break;
        }
    }
    if ($_POST['planettype'] == 2) {
        if ($_POST['ship209'] >= 1) {
            $missiontype = array(8 => $lang['type_mission'][8]);
        } else {
            $missiontype = array();
        }
    } elseif ($_POST['planettype'] == 1 or $_POST['planettype'] == 3) {
        if ($_POST['ship208'] >= 1 && !$UsedPlanet) {
            $missiontype = array(7 => $lang['type_mission'][7]);
        } elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
            $missiontype = array(6 => $lang['type_mission'][6]);
        }
        if ($_POST['ship202'] >= 1 || $_POST['ship203'] >= 1 || $_POST['ship204'] >= 1 || $_POST['ship205'] >= 1 || $_POST['ship206'] >= 1 || $_POST['ship207'] >= 1 || $_POST['ship210'] >= 1 || $_POST['ship211'] >= 1 || $_POST['ship213'] >= 1 || $_POST['ship214'] >= 1 || $_POST['ship215'] >= 1 || $_POST['ship216'] >= 1 || $_POST['ship217'] >= 1 || $_POST['ship218'] >= 1 || $_POST['ship219'] >= 1 || $_POST['ship220'] >= 1 || $_POST['ship221'] >= 1 || $_POST['ship222'] >= 1 || $_POST['ship223'] >= 1 || $_POST['ship224'] >= 1 || $_POST['ship225'] >= 1 || $_POST['ship226'] >= 1) {
            if (!$YourPlanet) {
                $missiontype[1] = $lang['type_mission'][1];
            }
            $missiontype[3] = $lang['type_mission'][3];
            $missiontype[5] = $lang['type_mission'][5];
        }
    } elseif ($_POST['ship209'] >= 1 || $_POST['ship208']) {
        $missiontype[3] = $lang['type_mission'][3];
    }
    if ($YourPlanet) {
        $missiontype[4] = $lang['type_mission'][4];
    }
    if (($_POST['planettype'] == 3 || $_POST['planettype'] == 1) && $fleet_group_mr > 0 && $UsedPlanet) {
        $missiontype[2] = $lang['type_mission'][2];
    }
    if ($_POST['planettype'] == 3 && $_POST['ship214'] >= 1 && !$YourPlanet && $UsedPlanet && $CurrentUser['rpg_empereur'] == 1) {
        $missiontype[9] = $lang['type_mission'][9];
    }
    $fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"])));
    $mission = $_POST['target_mission'];
    $SpeedFactor = $_POST['speedfactor'];
    $AllFleetSpeed = GetFleetMaxSpeed($fleetarray, 0, $CurrentUser);
    $GenFleetSpeed = $_POST['speed'];
    $MaxFleetSpeed = min($AllFleetSpeed);
    $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'];
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowFleet2Page.php

示例6: message

    if ($TargetPlanet['ally_deposit'] < 1 and $HeDBRec != $MyDBRec and $_POST['mission'] == 5) {
        message("<font color=\"red\"><b>" . $lang['fl_no_allydeposit'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
    }
    if ($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"] and $_POST["mission"] == 1) {
        message("<font color=\"red\"><b>" . $lang['fl_no_self_attack'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
    }
    if ($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"] and $_POST["mission"] == 6) {
        message("<font color=\"red\"><b>" . $lang['fl_no_self_spy'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
    }
    if ($TargetPlanet["id_owner"] != $CurrentPlanet["id_owner"] and $_POST["mission"] == 4) {
        message("<font color=\"red\"><b>" . $lang['fl_only_stay_at_home'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
    }
}
$missiontype = array(1 => $lang['type_mission'][1], 2 => $lang['type_mission'][2], 3 => $lang['type_mission'][3], 4 => $lang['type_mission'][4], 5 => $lang['type_mission'][5], 6 => $lang['type_mission'][6], 7 => $lang['type_mission'][7], 8 => $lang['type_mission'][8], 9 => $lang['type_mission'][9], 15 => $lang['type_mission'][15]);
$speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
$AllFleetSpeed = GetFleetMaxSpeed($fleetarray, 0, $user);
$GenFleetSpeed = $_POST['speed'];
$SpeedFactor = $_POST['speedfactor'];
$MaxFleetSpeed = min($AllFleetSpeed);
if (!in_array($GenFleetSpeed, $speed_possible)) {
    message("<font color=\"red\"><b>" . $lang['fl_cheat_speed'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
}
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $user['current_planet'] . "';", 'planets', true);
if ($MaxFleetSpeed != $_POST['speedallsmin']) {
    message("<font color=\"red\"><b>" . $lang['fl_cheat_speed'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
}
if (!$_POST['planettype']) {
    message("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
}
// Test de coherance de la destination (voir si elle se trouve dans les limites de l'univers connu
$error = 0;
开发者ID:topstdio,项目名称:xnova,代码行数:31,代码来源:floten3.php

示例7: flt_t_send_fleet

function flt_t_send_fleet($user, &$from, $to, $fleet, $mission, $options = array())
{
    //ini_set('error_reporting', E_ALL);
    //doquery('SET autocommit = 0;');
    //doquery('LOCK TABLES {{users}} READ, {{planets}} WRITE, {{fleet}} WRITE, {{aks}} WRITE, {{statpoints}} READ;');
    doquery('START TRANSACTION;');
    $from = sys_o_get_updated($user, $from['id'], $GLOBALS['time_now']);
    $from = $from['planet'];
    $speed_factor = get_fleet_speed();
    $distance = GetTargetDistance($from['galaxy'], $to['galaxy'], $from['system'], $to['system'], $from['planet'], $to['planet']);
    $fleet_speed = min(GetFleetMaxSpeed($fleet, 0, $user));
    $duration = GetMissionDuration(10, $fleet_speed, $distance, $speed_factor);
    $consumption = GetFleetConsumption($fleet, $speed_factor, $duration, $distance, $fleet_speed, $user);
    //!!
    $fleet_group = 0;
    //!!
    $options = array();
    $can_attack = flt_can_attack($from, $to, $fleet, $mission, $options);
    if ($can_attack != ATTACK_ALLOWED) {
        doquery('ROLLBACK');
        return $can_attack;
    }
    global $time_now, $sn_data;
    $fleet_start_time = $time_now + $duration;
    if ($mission == MT_EXPLORE or $mission == MT_HOLD) {
        $stay_duration = $options['stay_time'] * 3600;
        $stay_time = $fleet_start_time + $stay_duration;
    } else {
        $stay_duration = 0;
        $stay_time = 0;
    }
    $fleet_end_time = $fleet_start_time + $duration + $stay_duration;
    $fleet_ship_count = 0;
    $fleet_string = '';
    $planet_sub_query = '';
    foreach ($fleet as $unit_id => $amount) {
        if (!$amount || !$unit_id) {
            continue;
        }
        if (in_array($unit_id, $sn_data['groups']['fleet'])) {
            $fleet_ship_count += $amount;
            $fleet_string .= "{$unit_id},{$amount};";
        }
        $planet_sub_query .= "`{$sn_data[$unit_id]['name']}` = `{$sn_data[$unit_id]['name']}` - {$amount},";
    }
    $to['id_owner'] = intval($to['id_owner']);
    $QryInsertFleet = "INSERT INTO {{fleets}} SET ";
    $QryInsertFleet .= "`fleet_owner` = '{$user['id']}', ";
    $QryInsertFleet .= "`fleet_mission` = '{$mission}', ";
    $QryInsertFleet .= "`fleet_amount` = '{$fleet_ship_count}', ";
    $QryInsertFleet .= "`fleet_array` = '{$fleet_string}', ";
    $QryInsertFleet .= "`fleet_start_time` = '{$fleet_start_time}', ";
    $QryInsertFleet .= "`fleet_start_galaxy` = '{$from['galaxy']}', ";
    $QryInsertFleet .= "`fleet_start_system` = '{$from['system']}', ";
    $QryInsertFleet .= "`fleet_start_planet` = '{$from['planet']}', ";
    $QryInsertFleet .= "`fleet_start_type` = '{$from['planet_type']}', ";
    $QryInsertFleet .= "`fleet_end_time` = '{$fleet_end_time}', ";
    $QryInsertFleet .= "`fleet_end_stay` = '{$stay_time}', ";
    $QryInsertFleet .= "`fleet_end_galaxy` = '{$to['galaxy']}', ";
    $QryInsertFleet .= "`fleet_end_system` = '{$to['system']}', ";
    $QryInsertFleet .= "`fleet_end_planet` = '{$to['planet']}', ";
    $QryInsertFleet .= "`fleet_end_type` = '{$to['planet_type']}', ";
    $QryInsertFleet .= "`fleet_resource_metal` = '{$fleet[RES_METAL]}', ";
    $QryInsertFleet .= "`fleet_resource_crystal` = '{$fleet[RES_CRYSTAL]}', ";
    $QryInsertFleet .= "`fleet_resource_deuterium` = '{$fleet[RES_DEUTERIUM]}', ";
    $QryInsertFleet .= "`fleet_target_owner` = '{$to['id_owner']}', ";
    $QryInsertFleet .= "`fleet_group` = '{$fleet_group}', ";
    $QryInsertFleet .= "`start_time` = '{$time_now}';";
    doquery($QryInsertFleet);
    $QryUpdatePlanet = "UPDATE {{planets}} SET {$planet_sub_query} `deuterium` = `deuterium` - '{$consumption}' WHERE `id` = '{$from['id']}' LIMIT 1;";
    doquery($QryUpdatePlanet);
    if (BE_DEBUG) {
        debug($QryInsertFleet);
        debug($QryUpdatePlanet);
    }
    doquery("COMMIT;");
    // doquery('SET autocommit = 1;');
    $from = doquery("SELECT * FROM {{planets}} WHERE `id` = '{$from['id']}' LIMIT 1;", '', true);
    return ATTACK_ALLOWED;
    //ini_set('error_reporting', E_ALL ^ E_NOTICE);
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:81,代码来源:flt_fleet.php

示例8: ksort

                                $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
                                if ($planet_type == PT_MOON && $fleetarray[SHIP_DEATH_STAR]) {
                                    $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
                                }
                            }
                        }
                    }
                }
            }
        }
        if (!$target_mission && is_array($missiontype)) {
            $target_mission = MT_ATTACK;
        }
        ksort($missiontype);
        $speed_percent = intval($_POST['speed']);
        $fleet_speed = min(GetFleetMaxSpeed($fleetarray, 0, $user));
        $distance = GetTargetDistance($planetrow['galaxy'], $galaxy, $planetrow['system'], $system, $planetrow['planet'], $planet);
        $duration = GetMissionDuration($speed_percent, $fleet_speed, $distance, $SpeedFactor);
        $consumption = GetFleetConsumption($fleetarray, $SpeedFactor, $duration, $distance, $fleet_speed, $user, $speed_percent);
        // No Break
    // No Break
    case 1:
    case 0:
        $parse['thisgalaxy'] = $planetrow['galaxy'];
        $parse['thissystem'] = $planetrow['system'];
        $parse['thisplanet'] = $planetrow['planet'];
        $parse['thisplanet_type'] = $planetrow['planet_type'];
        // no break
}
$parse['galaxy'] = $galaxy;
$parse['system'] = $system;
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:fleet.php

示例9: flt_can_attack

function flt_can_attack($planet_src, $planet_dst, $fleet = array(), $mission, $options = false)
{
    global $config, $sn_data, $user, $time_now;
    if ($user['vacation']) {
        return ATTACK_OWN_VACATION;
    }
    if (empty($fleet) || !is_array($fleet)) {
        return ATTACK_NO_FLEET;
    }
    foreach ($fleet as $ship_id => $ship_count) {
        if ($ship_count > $planet_src[$sn_data[$ship_id]['name']]) {
            return ATTACK_NO_SHIPS;
        }
    }
    $speed = $options['speed'];
    if ($speed && ($speed != intval($speed) || $speed < 1 || $speed > 10)) {
        return ATTACK_WRONG_SPEED;
    }
    $speed_factor = get_fleet_speed();
    $distance = GetTargetDistance($planet_src['galaxy'], $planet_dst['galaxy'], $planet_src['system'], $planet_dst['system'], $planet_src['planet'], $planet_dst['planet']);
    $fleet_speed = min(GetFleetMaxSpeed($fleet, 0, $user));
    $fleet_speed_percent = $options['fleet_speed_percent'] ? $options['fleet_speed_percent'] : 10;
    $duration = GetMissionDuration($fleet_speed_percent, $fleet_speed, $distance, $speed_factor);
    $consumption = GetFleetConsumption($fleet, $speed_factor, $duration, $distance, $fleet_speed, $user, $fleet_speed_percent);
    if ($planet_src[$sn_data[RES_DEUTERIUM]['name']] < $fleet[RES_DEUTERIUM] + $consumption) {
        return ATTACK_NO_FUEL;
    }
    $fleet_start_time = $time_now + $duration;
    $fleet_group = $options['fleet_group'];
    if ($fleet_group) {
        if ($mission != MT_AKS) {
            return ATTACK_WRONG_MISSION;
        }
        $acs = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", '', true);
        if (!$acs['id']) {
            return ATTACK_NO_ACS;
        }
        if ($planet_dst['galaxy'] != $acs['galaxy'] || $planet_dst['system'] != $acs['system'] || $planet_dst['planet'] != $acs['planet'] || $planet_dst['planet_type'] != $acs['planet_type']) {
            return ATTACK_ACS_WRONG_TARGET;
        }
        if ($fleet_start_time > $acs['ankunft']) {
            return ATTACK_ACS_TOO_LATE;
        }
    }
    $flying_fleets = $options['flying_fleets'];
    if (!$flying_fleets) {
        $flying_fleets = doquery("SELECT COUNT(fleet_id) AS `flying_fleets` FROM {{fleets}} WHERE `fleet_owner` = '{$user['id']}';", '', true);
        $flying_fleets = $flying_fleets['flying_fleets'];
    }
    if (GetMaxFleets($user) <= $flying_fleets && $mission != MT_MISSILE) {
        return ATTACK_NO_SLOTS;
    }
    // Checking for no planet
    if (!$planet_dst['id_owner']) {
        if ($mission == MT_COLONIZE && !$fleet[SHIP_COLONIZER]) {
            return ATTACK_NO_COLONIZER;
        }
        if ($mission == MT_EXPLORE || $mission == MT_COLONIZE) {
            return ATTACK_ALLOWED;
        }
        return ATTACK_NO_TARGET;
    }
    if ($mission == MT_RECYCLE) {
        if ($planet_dst['debris_metal'] + $planet_dst['debris_crystal'] <= 0) {
            return ATTACK_NO_DEBRIS;
        }
        if ($fleet[SHIP_RECYCLER] <= 0) {
            return ATTACK_NO_RECYCLERS;
        }
        return ATTACK_ALLOWED;
    }
    // Got planet. Checking if it is ours
    if ($planet_dst['id_owner'] == $user['id']) {
        if ($mission == MT_TRANSPORT || $mission == MT_RELOCATE) {
            return ATTACK_ALLOWED;
        }
        return ATTACK_OWN;
    }
    // No, planet not ours. Cutting mission that can't be send to not-ours planet
    if ($mission == MT_RELOCATE || $mission == MT_COLONIZE || $mission == MT_EXPLORE) {
        return ATTACK_WRONG_MISSION;
    }
    $enemy = doquery("SELECT * FROM {{users}} WHERE `id` = '{$planet_dst['id_owner']}' LIMIT 1;", '', true);
    // We cannot attack or send resource to users in VACATION mode
    if ($enemy['vacation'] && $target_mission != MT_RECYCLE) {
        return ATTACK_VACATION;
    }
    // Multi IP protection. Here we need a procedure to check proxies
    if (sys_is_multiaccount($user, $enemy)) {
        return ATTACK_SAME_IP;
    }
    $user_points = doquery("SELECT total_points FROM {{statpoints}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '{$user['id']}';", '', true);
    $user_points = $user_points['total_points'];
    $enemy_points = doquery("SELECT total_points FROM {{statpoints}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '{$enemy['id']}';", '', true);
    $enemy_points = $enemy_points['total_points'];
    // Is it transport? If yes - checking for buffing to prevent mega-alliance destroyer
    if ($mission == MT_TRANSPORT) {
        if ($user_points >= $enemy_points || $config->allow_buffing) {
            return ATTACK_ALLOWED;
        } else {
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:flt_can_attack.php

示例10: 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 .= "&nbsp;-&nbsp;";
        }
        $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;'/>&nbsp;<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;'/>&nbsp;<input type=button onclick='document.getElementById(\"ship" . $i . "\").value = " . $CurrentPlanet[$resource[$i]] . ";' value='&Sigma;' 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));
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowFleetPage.php

示例11: GetFleet

 protected function GetFleet()
 {
     global $resource, $reslist, $pricelist;
     $planet = $this->player['planet'];
     $system = $this->player['system'];
     $galaxy = $this->player['galaxy'];
     $fleetarray = array();
     $totalships = 0;
     foreach ($reslist['fleet'] as $Element) {
         if ($this->CurrentPlanet[$resource[$Element]] > 0 and $Element != 212) {
             $fleetarray[$Element] = $this->CurrentPlanet[$resource[$Element]];
             $totalships += $this->CurrentPlanet[$resource[$Element]];
         }
     }
     if ($this->CurrentPlanet[$resource[21]] <= 5 and $totalships > 150 or $totalships > 5000) {
         $AllFleetSpeed = GetFleetMaxSpeed($fleetarray, 0, $this->player);
         $MaxFleetSpeed = min($AllFleetSpeed);
         $distance = GetTargetDistance($this->CurrentPlanet['galaxy'], $galaxy, $this->CurrentPlanet['system'], $system, $this->CurrentPlanet['planet'], $planet);
         $duration = GetMissionDuration(10, $MaxFleetSpeed, $distance, GetGameSpeedFactor());
         $consumption = GetFleetConsumption($fleetarray, GetGameSpeedFactor(), $duration, $distance, $MaxFleetSpeed, $this->player);
         $StayDuration = 0;
         $StayTime = 0;
         $fleet['start_time'] = $duration + time();
         $fleet['end_time'] = $StayDuration + 2 * $duration + time();
         $FleetStorage = 0;
         $fleet_array2 = '';
         $FleetShipCount = 0;
         $FleetSubQRY = "";
         $Mining = array();
         foreach ($fleetarray as $Ship => $Count) {
             $FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
             $FleetShipCount += $Count;
             $fleet_array2 .= $Ship . "," . $Count . ";";
             $FleetSubQRY .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , ";
         }
         $FleetStorage -= $consumption;
         if ($this->CurrentPlanet['metal'] > $FleetStorage / 3) {
             $Mining['metal'] = $FleetStorage / 3;
             $FleetStorage = $FleetStorage - $Mining['metal'];
         } else {
             $Mining['metal'] = $this->CurrentPlanet['metal'];
             $FleetStorage = $FleetStorage - $Mining['metal'];
         }
         if ($this->CurrentPlanet['crystal'] > $FleetStorage / 2) {
             $Mining['crystal'] = $FleetStorage / 2;
             $FleetStorage = $FleetStorage - $Mining['crystal'];
         } else {
             $Mining['crystal'] = $this->CurrentPlanet['crystal'];
             $FleetStorage = $FleetStorage - $Mining['crystal'];
         }
         if ($this->CurrentPlanet['deuterium'] > $FleetStorage) {
             $Mining['deuterium'] = $FleetStorage;
             $FleetStorage = $FleetStorage - $Mining['deuterium'];
         } else {
             $Mining['deuterium'] = $this->CurrentPlanet['deuterium'];
             $FleetStorage = $FleetStorage - $Mining['deuterium'];
         }
         $QryInsertFleet = "INSERT INTO {{table}} SET ";
         $QryInsertFleet .= "`fleet_owner` = '" . $this->player['id'] . "', ";
         $QryInsertFleet .= "`fleet_mission` = '4', ";
         $QryInsertFleet .= "`fleet_amount` = '" . $FleetShipCount . "', ";
         $QryInsertFleet .= "`fleet_array` = '" . $fleet_array2 . "', ";
         $QryInsertFleet .= "`fleet_start_time` = '" . $fleet['start_time'] . "', ";
         $QryInsertFleet .= "`fleet_start_galaxy` = '" . $this->CurrentPlanet['galaxy'] . "', ";
         $QryInsertFleet .= "`fleet_start_system` = '" . $this->CurrentPlanet['system'] . "', ";
         $QryInsertFleet .= "`fleet_start_planet` = '" . $this->CurrentPlanet['planet'] . "', ";
         $QryInsertFleet .= "`fleet_start_type` = '" . $this->CurrentPlanet['planet_type'] . "', ";
         $QryInsertFleet .= "`fleet_end_time` = '" . $fleet['end_time'] . "', ";
         $QryInsertFleet .= "`fleet_end_stay` = '" . $StayTime . "', ";
         $QryInsertFleet .= "`fleet_end_galaxy` = '" . $galaxy . "', ";
         $QryInsertFleet .= "`fleet_end_system` = '" . $system . "', ";
         $QryInsertFleet .= "`fleet_end_planet` = '" . $planet . "', ";
         $QryInsertFleet .= "`fleet_end_type` = '1', ";
         $QryInsertFleet .= "`fleet_resource_metal` = '" . $Mining['metal'] . "', ";
         $QryInsertFleet .= "`fleet_resource_crystal` = '" . $Mining['crystal'] . "', ";
         $QryInsertFleet .= "`fleet_resource_deuterium` = '" . $Mining['deuterium'] . "', ";
         $QryInsertFleet .= "`fleet_target_owner` = '0', ";
         $QryInsertFleet .= "`fleet_group` = '0', ";
         $QryInsertFleet .= "`start_time` = '" . time() . "';";
         doquery($QryInsertFleet, 'fleets');
         $QryUpdatePlanet = "UPDATE {{table}} SET ";
         $QryUpdatePlanet .= $FleetSubQRY;
         $QryUpdatePlanet .= "`id` = '" . $this->CurrentPlanet['id'] . "' ";
         $QryUpdatePlanet .= "WHERE ";
         $QryUpdatePlanet .= "`id` = '" . $this->CurrentPlanet['id'] . "'";
         doquery($QryUpdatePlanet, "planets");
         $this->CurrentPlanet["metal"] -= $Mining['metal'];
         $this->CurrentPlanet["crystal"] -= $Mining['crystal'];
         $this->CurrentPlanet["deuterium"] -= $consumption + $Mining['deuterium'];
     }
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:91,代码来源:newbot.class.php

示例12: ShowFleet3Page


//.........这里部分代码省略.........
    		$displays->message("<font color=\"lime\"><b>".$lang['fl_in_vacation_player']."</b></font>", "game." . $phpEx . "?page=fleet", 2);
    */
    //FIN DE PROTECCION
    $FlyingFleets = mysql_fetch_assoc($db->query("SELECT COUNT(fleet_id) as Number FROM {{table}} WHERE `fleet_owner`='{$CurrentUser['id']}'", 'fleets'));
    $ActualFleets = $FlyingFleets["Number"];
    if (1 + $CurrentUser[$resource[108]] + $CurrentUser['rpg_commandant'] * 3 <= $ActualFleets) {
        $displays->message($lang['fl_no_slots'], "game." . $phpEx . "?page=fleet", 1);
    }
    if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 && $_POST['mission'] == 3) {
        $displays->message("<font color=\"lime\"><b>" . $lang['fl_empty_transport'] . "</b></font>", "game." . $phpEx . "?page=fleet", 1);
    }
    if ($_POST['mission'] != 15) {
        if ($TargetPlanet['id_owner'] == '' && $_POST['mission'] < 7) {
            exit(header("location:game." . $phpEx . "?page=fleet"));
        }
        if ($TargetPlanet['id_owner'] != '' && $_POST['mission'] == 7) {
            $displays->message("<font color=\"red\"><b>" . $lang['fl_planet_populed'] . "</b></font>", "game." . $phpEx . "?page=fleet", 2);
        }
        if ($HeDBRec['ally_id'] != $MyDBRec['ally_id'] && $_POST['mission'] == 4) {
            $displays->message("<font color=\"red\"><b>" . $lang['fl_stay_not_on_enemy'] . "</b></font>", "game." . $phpEx . "?page=fleet", 2);
        }
        if ($TargetPlanet['ally_deposit'] < 1 && $HeDBRec != $MyDBRec && $_POST['mission'] == 5) {
            $displays->message("<font color=\"red\"><b>" . $lang['fl_not_ally_deposit'] . "</b></font>", "game." . $phpEx . "?page=fleet", 2);
        }
        if ($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"] && ($_POST["mission"] == 1 or $_POST["mission"] == 6)) {
            exit(header("location:game." . $phpEx . "?page=fleet"));
        }
        if ($TargetPlanet["id_owner"] != $CurrentPlanet["id_owner"] && $_POST["mission"] == 4) {
            $displays->message("<font color=\"red\"><b>" . $lang['fl_deploy_only_your_planets'] . "</b></font>", "game." . $phpEx . "?page=fleet", 2);
        }
    }
    $missiontype = array(1 => $lang['type_mission'][1], 2 => $lang['type_mission'][2], 3 => $lang['type_mission'][3], 4 => $lang['type_mission'][4], 5 => $lang['type_mission'][5], 6 => $lang['type_mission'][6], 7 => $lang['type_mission'][7], 8 => $lang['type_mission'][8], 9 => $lang['type_mission'][9], 15 => $lang['type_mission'][15]);
    $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
    $AllFleetSpeed = GetFleetMaxSpeed($fleetarray, 0, $CurrentUser);
    $GenFleetSpeed = $_POST['speed'];
    $SpeedFactor = $_POST['speedfactor'];
    $MaxFleetSpeed = min($AllFleetSpeed);
    if (!in_array($GenFleetSpeed, $speed_possible)) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    if ($MaxFleetSpeed != $_POST['speedallsmin']) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    if (!$_POST['planettype']) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    if (!$_POST['galaxy'] || !is_numeric($_POST['galaxy']) || $_POST['galaxy'] > MAX_GALAXY_IN_WORLD || $_POST['galaxy'] < 1) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    if (!$_POST['system'] || !is_numeric($_POST['system']) || $_POST['system'] > MAX_SYSTEM_IN_GALAXY || $_POST['system'] < 1) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    if (!$_POST['planet'] || !is_numeric($_POST['planet']) || $_POST['planet'] > MAX_PLANET_IN_SYSTEM + 1 || $_POST['planet'] < 1) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    if ($_POST['thisgalaxy'] != $CurrentPlanet['galaxy'] | $_POST['thissystem'] != $CurrentPlanet['system'] | $_POST['thisplanet'] != $CurrentPlanet['planet'] | $_POST['thisplanettype'] != $CurrentPlanet['planet_type']) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    if (!isset($fleetarray)) {
        exit(header("location:game." . $phpEx . "?page=fleet"));
    }
    $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);
    $fleet['start_time'] = $duration + time();
    if ($_POST['mission'] == 15) {
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:ShowFleet3Page.php

示例13: 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>" . gmdate("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>" . gmdate("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=\"?page=fleetback\" 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 || $f["fleet_mission"] == 2) {
                $FleetPageRow .= "<form action=\"game.php?page=fleetsac\" method=\"post\">";
                $FleetPageRow .= "<input name=\"fleetid\" value=\"" . $f['fleet_id'] . "\" type=\"hidden\">";
                $FleetPageRow .= "<input value=\"" . $lang['fl_acs'] . "\" type=\"submit\">";
                $FleetPageRow .= "</form>";
            }
        } else {
            $FleetPageRow .= "&nbsp;-&nbsp;";
        }
        $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");
    }
    foreach ($reslist['fleet'] as $n => $i) {
        if ($CurrentPlanet[$resource[$i]] > 0) {
            $displays->newblock("list_fleet");
            //$page .= "<tr height=\"20\">";
            //$page .= "<th>";
            $parses["link"] = $i == 212 ? $lang['tech'][$i] : "<a title=\"" . $lang['fl_speed_title'] . GetFleetMaxSpeed("", $i, $CurrentUser) . "\">" . $lang['tech'][$i] . "</a>";
            $parses["numero"] = pretty_number($CurrentPlanet[$resource[$i]]);
            $enviar["ship" . $i] = str_replace(".", "", $parses["numero"]);
            if ($i != 212) {
                $parses["max"] = "<a href=\"javascript:maxShip2('" . str_replace(".", "", $parses["numero"]) . "','ship" . $i . "');\">" . $lang['fl_max'] . "</a>";
                $parses["input"] = "<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]] . "\"  />";
            }
            foreach ($parses as $key => $value) {
                $displays->assign($key, $value);
            }
            unset($parses);
            $have_ships = true;
        }
        //$have_ships = true;
    }
    $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();\" >" . $lang['fl_remove_all_ships'] . "</a></th>";
        $page .= "<th colspan=\"2\"><a href=\"#\" onclick=\" ";
        //javascript:maxShips();\" >".$lang['fl_select_all_ships']."</a></th>";
        foreach ($enviar as $key => $value) {
            $page .= "maxShip2('" . $value . "','" . $key . "');";
        }
        $page .= "\" >" . $lang['fl_select_all_ships'] . "</a></th>";
        if ($MaxFlottes > $MaxFlyingFleets) {
            $page .= $btncontinue;
        }
    }
    $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;
    $displays->gotoBlock("_ROOT");
    foreach ($parse as $key => $value) {
        $displays->assign($key, $value);
    }
    $displays->display();
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowFleetPage.php

示例14: intval

    $target_structure = intval($_POST['structures']);
    if ($target_structure && !in_array($target_structure, $sn_data['groups']['defense_active'])) {
        $cant_attack = ATTACK_WRONG_STRUCTURE;
        die("{$cant_attack}|{$lang['fl_attack_error'][$cant_attack]}|{$CurrentFlyingFleets}|{$UserSpyProbes}|{$UserRecycles}|{$UserMissiles}");
    }
    $mips_sent = $fleet_array[503];
    $distance = abs($target_system - $planetrow['system']);
    $mipRange = $user['impulse_motor_tech'] * 5 - 1;
    $arrival = $time_now + round((30 + 60 * $distance) / get_fleet_speed());
    doquery("INSERT INTO `{{iraks}}` SET\r\n     `zielid` = '{$TargetRow['id_owner']}', `galaxy` = '{$target_galaxy}', `system` = '{$target_system}', `planet` = '{$target_planet}',\r\n     `owner` = '{$user['id']}', `galaxy_angreifer` = '{$planetrow['galaxy']}', `system_angreifer` = '{$planetrow['system']}', `planet_angreifer` = '{$planetrow['planet']}',\r\n     `zeit` = '{$arrival}', `anzahl` = '{$mips_sent}', `primaer` = '{$target_structure}';");
    $FleetSubQRY = "`{$sn_data[503]['name']}` = `{$sn_data[503]['name']}` - '{$mips_sent}', ";
    $Ship = 503;
    //doquery("UPDATE `{{planets}}` SET  WHERE `id` = '{$user['current_planet']}' LIMIT 1;");
} else {
    $Distance = GetTargetDistance($planetrow['galaxy'], $target_galaxy, $planetrow['system'], $target_system, $planetrow['planet'], $target_planet);
    $speedall = GetFleetMaxSpeed($fleet_array, 0, $user);
    $SpeedAllMin = min($speedall);
    $Duration = GetMissionDuration(10, $SpeedAllMin, $Distance, get_fleet_speed());
    $fleet_start_time = $Duration + time();
    $fleet_end_time = $Duration * 2 + time();
    $consumption = 0;
    $SpeedFactor = get_fleet_speed();
    foreach ($fleet_array as $Ship => $Count) {
        $ShipSpeed = $sn_data[$Ship]["speed"];
        $spd = 35000 / ($Duration * $SpeedFactor - 10) * sqrt($Distance * 10 / $ShipSpeed);
        $basicConsumption = $sn_data[$Ship]["consumption"] * $Count;
        $consumption += $basicConsumption * $Distance / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
    }
    $consumption = round($consumption) + 1;
    if ($UserDeuterium < $consumption) {
        $ResultMessage = "13|{$lang['gs_c13']}|{$CurrentFlyingFleets}|{$UserSpyProbes}|{$UserRecycles}|{$UserMissiles}";
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:flotenajax.php

示例15: 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\">";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowFleet1Page.php


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