/* check to ensure target is in the same sector as player */ if($targetinfo[sector] != $playerinfo[sector]) { echo $l_planet_noscan; } else { if($playerinfo[turns] < 1) { echo $l_scan_turn; } else { /* determine per cent chance of success in scanning target ship - based on player's sensors and opponent's cloak */ $success= SCAN_SUCCESS($playerinfo[sensors], $targetinfo[cloak]); if($success < 5) { $success = 5; } if($success > 95) { $success = 95; } $roll = rand(1, 100); if($roll > $success) { /* if scan fails - inform both player and target. */ echo $l_planet_noscan; playerlog($targetinfo[player_id], LOG_SHIP_SCAN_FAIL, "$playerinfo[character_name]"); }
else { $tollstring = NUMBER($fighterstoll); $l_chf_youpaidsometoll = str_replace("[chf_tollstring]", $tollstring, $l_chf_youpaidsometoll); echo "$l_chf_youpaidsometoll<BR>"; $db->Execute("UPDATE $dbtables[players] SET credits=credits-$fighterstoll where player_id=$playerinfo[player_id]"); distribute_toll($sector,$fighterstoll,$total_sector_fighters); playerlog($playerinfo[player_id], LOG_TOLL_PAID, "$tollstring|$sector"); $ok=1; $toll_pay=true; } break; case "sneak": { $db->Execute("UPDATE $dbtables[players] SET cleared_defences = ' ' WHERE player_id = $playerinfo[player_id]"); $success = SCAN_SUCCESS($fighters_owner_ship[sensors], $shipinfo[cloak]); if($success < 5) { $success = 5; } if($success > 95) { $success = 95; } $roll = rand(1, 100); if($roll < $success) { // sector defences detect incoming ship bigtitle(); echo "$l_chf_thefightersdetectyou<BR>"; include("sector_fighters.php");
if (array_key_exists('ship_selected', $_SESSION) == false || $_SESSION['ship_selected'] != $ship_id) { echo "You need to Click on the ship first.<BR><BR>"; TEXT_GOTOMAIN(); include "footer.php"; die; } unset($_SESSION['ship_selected']); // Check to ensure target is in the same sector as player if ($targetinfo['sector'] != $playerinfo['sector']) { echo $l_planet_noscan; } else { if ($playerinfo['turns'] < 1) { echo $l_scan_turn; } else { // Determine per cent chance of success in scanning target ship - based on player's sensors and opponent's cloak $success = SCAN_SUCCESS($playerinfo['sensors'], $targetinfo['cloak']); if ($success < 5) { $success = 5; } if ($success > 95) { $success = 95; } $roll = mt_rand(1, 100); if ($roll > $success) { // If scan fails - inform both player and target. echo $l_planet_noscan; playerlog($db, $targetinfo['ship_id'], LOG_SHIP_SCAN_FAIL, $playerinfo['character_name']); } else { // If scan succeeds, show results and inform target. Scramble results by scan error factor. // Get total bounty on this player, if any $btyamount = 0;
playerlog($playerinfo[player_id], LOG_TOLL_PAID, "$tollstring|$sector"); $ok=1; $toll_pay=true; } } else { echo "That is not a valid option!<br>"; $ok=0; } break; case "sneak": { $db->Execute("UPDATE $dbtables[players] SET cleared_defences = ' ' WHERE player_id = $playerinfo[player_id]"); // Now we need to decide how goot the sensor network is for the fighters. The answer is, it is the AVERAGE of all fighter owners $res = $db->Execute("SELECT (SUM(sensors)/COUNT(*)) AS sensor_average FROM $dbtables[ships], $dbtables[players], $dbtables[sector_defence] WHERE ( $dbtables[players].player_id = $dbtables[sector_defence].player_id ) AND ($dbtables[players].currentship = $dbtables[ships].ship_id) AND $dbtables[sector_defence].sector_id = $sector AND ( team = 0 OR team != $playerinfo[team] ) AND $dbtables[sector_defence].player_id != $playerinfo[player_id] AND defence_type='F'"); $sensor_average = $res->fields; $success = SCAN_SUCCESS($sensor_average[sensor_average], $shipinfo[cloak]); echo "<br>DEBUG: $success = SCAN_SUCCESS($sensor_average[sensor_average], $shipinfo[cloak]);<br>"; if($success < 5) { $success = 5; } if($success > 95) { $success = 95; } $roll = rand(1, 100); if($roll < $success) { // sector defences detect incoming ship bigtitle(); echo "$l_chf_thefightersdetectyou<BR>";
$totalcount=0; echo "<center>"; while(!$result4->EOF) { $targetship=$result4->fields; // Is the ship owned or not? Unowned ships are always visible if ($targetship[player_id]==0) { echo "<a href=ship.php?kk=".date("U")."&ship_id=$targetship[ship_id]><img src=\"images/", $targetship[image],"\" border=0></a><BR><font size=", $basefontsize +1, " color=#ffffff face=\"arial\">$targetship[ship_name]<br>(Unowned)<br></font>"; $totalcount++; } else { // If the ship is towing anything then it's cloak is going to be weakened if ($targetship[tow]>0) { $targetship[cloak] = min($targetship[cloak]-1,0); } $success = SCAN_SUCCESS($shipinfo[sensors], $targetship[cloak]); if($success < 5) { $success = 5; } if($success > 95) { $success = 95; } $roll = rand(1, 100); if($roll < $success) { // Get the player's medals $medRes = $db->Execute("SELECT graphic,medal_name FROM award_winners, $dbtables[medals], $dbtables[config] WHERE character_name='".addslashes($targetship[character_name])."' AND award_winners.type_id=$dbtables[medals].type_id AND award_winners.game_num=($dbtables[config].game_num-1)"); $medalList = ""; if (!$medRes->EOF) {
$ok = 0; } else { $tollstring = NUMBER($fighterstoll); $l_chf_youpaidsometoll = str_replace("[chf_tollstring]", $tollstring, $l_chf_youpaidsometoll); echo "{$l_chf_youpaidsometoll}<br>"; $resx = $db->Execute("UPDATE {$db->prefix}ships SET credits=credits-{$fighterstoll} WHERE ship_id=?;", array($playerinfo['ship_id'])); db_op_result($db, $resx, __LINE__, __FILE__, $db_logging); distribute_toll($db, $sector, $fighterstoll, $total_sector_fighters); playerlog($db, $playerinfo['ship_id'], LOG_TOLL_PAID, "{$tollstring}|{$sector}"); $ok = 1; } break; case "sneak": $resx = $db->Execute("UPDATE {$db->prefix}ships SET cleared_defences = ' ' WHERE ship_id = ?;", array($playerinfo['ship_id'])); db_op_result($db, $resx, __LINE__, __FILE__, $db_logging); $success = SCAN_SUCCESS($fighters_owner['sensors'], $playerinfo['cloak']); if ($success < 5) { $success = 5; } if ($success > 95) { $success = 95; } $roll = mt_rand(1, 100); if ($roll < $success) { // Sector defences detect incoming ship ?> <div class="tablecell content both-border"> <div class="pad"> <?php bigtitle(); echo "{$l_chf_thefightersdetectyou}<br>";
{ $num_detected = 0; while(!$result4->EOF) { $row = $result4->fields; if ($row[tow]>0) { // Cloak is reduced $row[cloak] = min($row[cloak]-1,0); } // If the ship is unowned you can always see it if ($row[player_id] == 0) { $num_detected++; echo $row['ship_name'] . " (" . $row['character_name'] . ")<BR>"; } else { // display other ships in sector - unless they are successfully cloaked $success = SCAN_SUCCESS($shipinfo[sensors], $row[cloak]); if($success < 5) { $success = 5; } if($success > 95) { $success = 95; } $roll = rand(1, 100); if($roll < $success) { $num_detected++; echo $row['ship_name'] . " (" . $row['character_name'] . ")<BR>"; } }