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


PHP GetGameSpeedFactor函数代码示例

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


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

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

示例2: die

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 . ";";
    $FleetSubQRY .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , ";
}
$consumption = round($consumption) + 1;
if ($TargetRow['id_level'] > $user['authlevel']) {
    $Allowed = true;
    switch ($_POST['mission']) {
        case 1:
        case 2:
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:flotenajax.php

示例3: GetFleet

 protected function GetFleet()
 {
     global $resource, $reslist, $pricelist;
     $planet = $this->user['planet'];
     $system = $this->user['system'];
     $galaxy = $this->user['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 = Fleets::fleet_max_speed($fleetarray, 0, $this->user);
         $MaxFleetSpeed = min($AllFleetSpeed);
         $distance = Fleets::target_distance($this->CurrentPlanet['galaxy'], $galaxy, $this->CurrentPlanet['system'], $system, $this->CurrentPlanet['planet'], $planet);
         $duration = Fleets::mission_duration(10, $MaxFleetSpeed, $distance, GetGameSpeedFactor());
         $consumption = Fleets::fleet_consumption($fleetarray, GetGameSpeedFactor(), $duration, $distance, $MaxFleetSpeed, $this->user);
         $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'];
         }
         $QryInsertFleet = "INSERT INTO {{table}} SET ";
         $QryInsertFleet .= "`fleet_owner` = '" . $this->user['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:Artea,项目名称:xg-bot,代码行数:84,代码来源:class.Bot.php

示例4: getStorageFaktor

$page .= "<script type=\"text/javascript\">\n";
$page .= "function getStorageFaktor() {\n";
$page .= "\treturn 1\n";
$page .= "}\n";
$page .= "</script>\n";
$page .= "<form action=\"floten2.php\" method=\"post\">";
$page .= $FleetHiddenBlock;
$page .= "<input type=\"hidden\" name=\"speedallsmin\"   value=\"" . $speedallsmin . "\" />";
$page .= "<input type=\"hidden\" name=\"usedfleet\"      value=\"" . str_rot13(base64_encode(serialize($fleet['fleetarray']))) . "\" />";
$page .= "<input type=\"hidden\" name=\"thisgalaxy\"     value=\"" . $planetrow['galaxy'] . "\" />";
$page .= "<input type=\"hidden\" name=\"thissystem\"     value=\"" . $planetrow['system'] . "\" />";
$page .= "<input type=\"hidden\" name=\"thisplanet\"     value=\"" . $planetrow['planet'] . "\" />";
$page .= "<input type=\"hidden\" name=\"galaxyend\"      value=\"" . intval($_POST['galaxy']) . "\" />";
$page .= "<input type=\"hidden\" name=\"systemend\"      value=\"" . intval($_POST['system']) . "\" />";
$page .= "<input type=\"hidden\" name=\"planetend\"      value=\"" . intval($_POST['planet']) . "\" />";
$page .= "<input type=\"hidden\" name=\"speedfactor\"    value=\"" . GetGameSpeedFactor() . "\" />";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"" . $planetrow['planet_type'] . "\" />";
$page .= "<input type=\"hidden\" name=\"thisresource1\"  value=\"" . floor($planetrow['metal']) . "\" />";
$page .= "<input type=\"hidden\" name=\"thisresource2\"  value=\"" . floor($planetrow['crystal']) . "\" />";
$page .= "<input type=\"hidden\" name=\"thisresource3\"  value=\"" . floor($planetrow['deuterium']) . "\" />";
$page .= "<br><div><center>";
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">" . $lang['fl_floten1_ttl'] . "</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th width=\"50%\">" . $lang['fl_dest'] . "</th>";
$page .= "<th>";
$page .= "<input name=\"galaxy\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"" . $g . "\" />";
$page .= "<input name=\"system\" size=\"3\" maxlength=\"3\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"" . $s . "\" />";
$page .= "<input name=\"planet\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"" . $p . "\" />";
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:floten1.php

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


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