$sc_shields = number_format(round($ownerinfo['shields'] * $sc_error / 100), 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']); echo "<td>{$sc_shields}</td></tr>"; } else { echo "<td>???</td></tr>"; } echo "</table><br>"; // $roll=random_int(1, 100); // if ($ownerinfo[sector] == $playerinfo[sector] && $ownerinfo[on_planet] == 'Y' && $roll < $success) // { // echo "<strong>" . $ownerinfo['character_name'] . " " . $langvars['l_planet_ison'] . "</strong><br>"; // } $res = $db->Execute("SELECT * FROM {$db->prefix}ships WHERE on_planet = 'Y' and planet_id = ?;", array($planet_id)); Tki\Db::LogDbErrors($pdo_db, $res, __LINE__, __FILE__); while (!$res->EOF) { $row = $res->fields; $success = Tki\Scan::success($playerinfo['sensors'], $row['cloak']); if ($success < 5) { $success = 5; } if ($success > 95) { $success = 95; } $roll = random_int(1, 100); if ($roll < $success) { echo "<strong>" . $row['character_name'] . " " . $langvars['l_planet_ison'] . "</strong><br>"; } $res->MoveNext(); } } $update = $db->Execute("UPDATE {$db->prefix}ships SET turns = turns - 1, turns_used = turns_used + 1 WHERE ship_id = ?;", array($playerinfo['ship_id'])); Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
$ok = 0; } else { $tollstring = number_format($fighterstoll, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']); $langvars['l_chf_youpaidsometoll'] = str_replace("[chf_tollstring]", $tollstring, $langvars['l_chf_youpaidsometoll']); echo $langvars['l_chf_youpaidsometoll'] . "<br>"; $resx = $db->Execute("UPDATE {$db->prefix}ships SET credits=credits - {$fighterstoll} WHERE ship_id = ?;", array($playerinfo['ship_id'])); Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__); Tki\Toll::distribute($pdo_db, $sector, $fighterstoll, $total_sector_fighters); Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_TOLL_PAID, "{$tollstring}|{$sector}"); $ok = 1; } break; case "sneak": $resx = $db->Execute("UPDATE {$db->prefix}ships SET cleared_defenses = ' ' WHERE ship_id = ?;", array($playerinfo['ship_id'])); Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__); $success = Tki\Scan::success($fighters_owner['sensors'], $playerinfo['cloak']); if ($success < 5) { $success = 5; } if ($success > 95) { $success = 95; } $roll = random_int(1, 100); if ($roll < $success) { // Sector defenses detect incoming ship echo "<h1>" . $title . "</h1>\n"; echo $langvars['l_chf_thefightersdetectyou'] . "<br>"; include_once './sector_fighters.php'; break; } else { // Sector defenses don't detect incoming ship