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


PHP GetMissionDuration函数代码示例

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


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

示例1: unserialize

	}
*/
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 || $_POST['ship218']) >= 1 && !$YourPlanet && $UsedPlanet) {
    $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, $user);
$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, $user);
$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_expe_warning'] . "</font>";
        $MissionSelector .= "</th>";
        $MissionSelector .= "</tr>";
    } else {
        $i = 0;
        foreach ($missiontype as $a => $b) {
            $MissionSelector .= "<tr height=\"20\">";
            $MissionSelector .= "<th>";
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:floten2.php

示例2: floor

    $DebrisSize = $TargetGalaxy['metal'] + $TargetGalaxy['crystal'];
    $RecyclerNeeded = floor($DebrisSize / $pricelist[209]['capacity']) + 1;
    $RecyclerSpeed = $pricelist[209]['speed'] + $pricelist[209]['speed'] * $user['combustion_tech'] * 0.1;
    $RecyclerCount = $planetrow[$resource[209]];
    if ($RecyclerCount > $RecyclerNeeded) {
        $FleetCount = $RecyclerNeeded;
    } else {
        $FleetCount = $RecyclerCount;
    }
    $FleetArray[209] = $FleetCount;
}
$distance = GetTargetDistance($planetrow['galaxy'], $Galaxy, $planetrow['system'], $System, $planetrow['planet'], $Planet);
$SpeedFactor = $game_config['fleet_speed'];
$GenFleetSpeed = 10;
// a 100%
$duration = GetMissionDuration($GenFleetSpeed, $RecyclerSpeed, $distance, $SpeedFactor);
$page .= "<br /><br />";
$page .= "<center>";
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\">";
$page .= "<span class=\"success\">" . $lang['fl_fleet_send'] . "</span>";
$page .= "</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>" . $lang['fl_mission'] . "</th>";
$page .= "<th>" . $missiontype[$Mode] . "</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>" . $lang['fl_dist'] . "</th>";
$page .= "<th>" . $distance . "</th>";
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:quickfleet.php

示例3: die

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);
    $FleetShipCount += $Count;
    $FleetDBArray .= $Ship . "," . $Count . ";";
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:flotenajax.php

示例4: 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

示例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: 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

示例7: ShowFleet3Page


//.........这里部分代码省略.........
        exit(header("Location: game." . $phpEx . "?page=fleet"));
    }
    if (!isset($fleetarray)) {
        exit(header("Location: game." . $phpEx . "?page=fleet"));
    }
    if ($_POST['wormhole'] == 'on') {
        $WormHole = doquery("SELECT * FROM {{table}} WHERE (`start_galaxy` = '" . $_POST['wormhole_galaxy'] . "' AND `start_system` = '" . $_POST['wormhole_system'] . "' AND `start_planet` = '" . $_POST['wormhole_planet'] . "') OR (`end_galaxy` = '" . $_POST['wormhole_galaxy'] . "' AND `end_system` = '" . $_POST['wormhole_system'] . "' AND `end_planet` = '" . $_POST['wormhole_planet'] . "');", 'wormholes', true);
        if ($WormHole) {
            if ($WormHole['state'] == 0) {
                message('El Agujero de gusano esta inestable', "game." . $phpEx . "?page=fleet");
            }
            if ($WormHole['time'] < time() and $WormHole['state'] == 1) {
                message('El Agujero de gusano esta inestable', "game." . $phpEx . "?page=fleet");
            }
            if ($fleetarray[210] >= 1) {
                message('Las Sondas de espionaje no pueden atravesar los Agujeros de gusano', "game." . $phpEx . "?page=fleet");
            }
            if ($WormHole['start_galaxy'] == $_POST['wormhole_galaxy'] and $WormHole['start_system'] == $_POST['wormhole_system'] and $WormHole['start_planet'] == $_POST['wormhole_planet']) {
                $Orientation = 'end';
            } else {
                $Orientation = 'start';
            }
            $distance1 = GetTargetDistance($_POST['thisgalaxy'], $_POST['wormhole_galaxy'], $_POST['thissystem'], $_POST['wormhole_system'], $_POST['thisplanet'], $_POST['wormhole_planet']);
            $distance2 = GetTargetDistance($WormHole[$Orientation . '_galaxy'], $_POST['galaxy'], $WormHole[$Orientation . '_system'], $_POST['system'], $WormHole[$Orientation . '_planet'], $_POST['planet']);
            $distance = $distance1 + $distance2;
            $wormhole_id = $WormHole['id'] . ',' . $Orientation;
        } else {
            message('El Agujero de gusano no existe', "game." . $phpEx . "?page=fleet");
        }
    } else {
        $wormhole_id = 0;
        $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) {
        $StayDuration = $_POST['expeditiontime'] * 3600;
        $StayTime = $fleet['start_time'] + $_POST['expeditiontime'] * 3600;
    } elseif ($_POST['mission'] == 5) {
        $StayDuration = $_POST['holdingtime'] * 3600;
        $StayTime = $fleet['start_time'] + $_POST['holdingtime'] * 3600;
    } else {
        $StayDuration = 0;
        $StayTime = 0;
    }
    $fleet['end_time'] = $StayDuration + 2 * $duration + time();
    $FleetStorage = 0;
    $FleetShipCount = 0;
    $fleet_array = "";
    $FleetSubQRY = "";
    foreach ($fleetarray as $Ship => $Count) {
        $FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
        $FleetShipCount += $Count;
        $fleet_array .= $Ship . "," . $Count . ";";
        $FleetSubQRY .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . ", ";
    }
    $FleetStorage -= $consumption;
    $StorageNeeded = 0;
    $_POST['resource1'] = max(0, (int) trim($_POST['resource1']));
    $_POST['resource2'] = max(0, (int) trim($_POST['resource2']));
    $_POST['resource3'] = max(0, (int) trim($_POST['resource3']));
    $_POST['resource4'] = max(0, (int) trim($_POST['resource4']));
    if ($_POST['resource1'] < 1) {
        $TransMetal = 0;
    } else {
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:ShowFleet3Page.php

示例8: 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

示例9: ShowFleet3Page


//.........这里部分代码省略.........
        }
    }
    $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) {
        $StayDuration = $_POST['expeditiontime'] * 3600;
        $StayTime = $fleet['start_time'] + $_POST['expeditiontime'] * 3600;
    } elseif ($_POST['mission'] == 5) {
        $StayDuration = $_POST['holdingtime'] * 3600;
        $StayTime = $fleet['start_time'] + $_POST['holdingtime'] * 3600;
    } else {
        $StayDuration = 0;
        $StayTime = 0;
    }
    $StorageNeeded = 0;
    $_POST['resource1'] = max(0, (int) trim($_POST['resource1']));
    $_POST['resource2'] = max(0, (int) trim($_POST['resource2']));
    $_POST['resource3'] = max(0, (int) trim($_POST['resource3']));
    if ($_POST['resource1'] < 1) {
        $TransMetal = 0;
    } else {
        $TransMetal = $_POST['resource1'];
        $StorageNeeded += $TransMetal;
    }
    if ($_POST['resource2'] < 1) {
        $TransCrystal = 0;
    } else {
        $TransCrystal = $_POST['resource2'];
        $StorageNeeded += $TransCrystal;
    }
    if ($_POST['resource3'] < 1) {
        $TransDeuterium = 0;
    } else {
        $TransDeuterium = $_POST['resource3'];
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:ShowFleet3Page.php

示例10: die

        $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}";
        die($ResultMessage);
    }
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:flotenajax.php

示例11: ksort

                                    $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;
$parse['planet'] = $planet;
$parse['planet_type'] = $planet_type;
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:fleet.php

示例12: GetShipSpeed

        $speeds[$id] = GetShipSpeed($id);
        //Cargo space
        $capacity += $pricelist[$id]['capacity'] * $fleetarray[$id];
        //Fuel use
        if ($pricelist[$id]['upgrade'] > 0 && $user[$resource[$pricelist[$id]['drive2']]] > $pricelist[$id]['upgrade']) {
            $fuel += $pricelist[$id]['consumption2'] * $fleetarray[$id];
        } else {
            $fuel += $pricelist[$id]['consumption'] * $fleetarray[$id];
        }
    }
}
//Find the minimum speed.
$speed = min($speeds);
//How Far?
$distance = GetTargetDistance($planetrow['galaxy'], $galaxy, $planetrow['system'], $system, $planetrow['planet'], $planet);
$duration = GetMissionDuration(GetGameSpeedFactor(), $speed, $distance, $fleetspeed);
//$fuelused = GetFleetFuelReq($fleetarray,$speeds,$speed,$fleetspeed,$fuel,$distance);
$fuelused = GetFleetFuelReq($fleetspeed, $fuel, $distance);
//Holding the fleet
if ($fleetmission == 15) {
    $stay = $_GET['expeditiontime'] * 3600;
} elseif ($fleetmission == 5) {
    $stay = $_GET['holdingtime'] * 3600;
} else {
    $stay = 0;
}
//Remove fuel from capacity.
$capacity -= $consumption;
//Currently need no storage... ...but add metal crystal and deut.
$StorageNeeded = 0;
if ($_GET['resource1'] <= 0) {
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:fleet4.php


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