echo " <td>" . number_format($playerinfo['torp_launchers'], 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']) . "</td>\n"; echo " <td>\n "; echo Tki\Ports::dropdown("torp_launchers_upgrade", $playerinfo['torp_launchers'], $onchange, $tkireg->max_upgrades_devices); echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td>" . $langvars['l_shields'] . "</td>\n"; echo " <td><input type=text readonly class='portcosts2' name=shields_costper value='0' tabindex='0' {$onblur}></td>\n"; echo " <td>" . number_format($playerinfo['shields'], 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']) . "</td>\n"; echo " <td>\n "; echo Tki\Ports::dropdown("shields_upgrade", $playerinfo['shields'], $onchange, $tkireg->max_upgrades_devices); echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " <br>\n"; echo " <table>\n"; echo " <tr>\n"; echo " <th><strong>" . $langvars['l_item'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_cost'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_current'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_max'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_qty'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_item'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_cost'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_current'] . "</strong></th>\n"; echo " <th><strong>" . $langvars['l_max'] . "</strong></th>\n";
} else { echo $langvars['l_lrs_zero']; } echo "</td></tr>"; echo "<tr bgcolor=\"{$tkireg->color_line2}\"><td><strong>" . $langvars['l_port'] . "</strong></td></tr>"; echo "<tr><td>"; if ($sectorinfo['port_type'] == "none") { echo $langvars['l_none']; } else { if ($sectorinfo['port_type'] != "none") { $port_type = $sectorinfo['port_type']; $icon_alt_text = ucfirst(Tki\Ports::getType($port_type, $langvars)); $icon_port_type_name = $port_type . ".png"; $image_string = "<img align=absmiddle height=12 width=12 alt=\"{$icon_alt_text}\" src=\"images/{$icon_port_type_name}\">"; } echo "{$image_string} " . Tki\Ports::getType($sectorinfo['port_type'], $langvars); } echo "</td></tr>"; echo "<tr bgcolor=\"{$tkireg->color_line2}\"><td><strong>" . $langvars['l_planets'] . "</strong></td></tr>"; echo "<tr><td>"; $query = $db->Execute("SELECT name, owner FROM {$db->prefix}planets WHERE sector_id = ?;", array($sectorinfo['sector_id'])); Tki\Db::LogDbErrors($pdo_db, $query, __LINE__, __FILE__); if ($query->EOF) { echo $langvars['l_none']; } while (!$query->EOF) { $planet = $query->fields; if (empty($planet['name'])) { echo $langvars['l_unnamed']; } else { echo "{$planet['name']}";
$trade_goods = false; } // Detect if this variable exists, and filter it. Returns false if anything wasn't right. $trade_energy = null; $trade_energy = (int) filter_input(INPUT_POST, 'trade_energy', FILTER_SANITIZE_NUMBER_INT); if (mb_strlen(trim($trade_energy)) === 0) { $trade_energy = false; } $trade_ore = round(abs($trade_ore)); $trade_organics = round(abs($trade_organics)); $trade_goods = round(abs($trade_goods)); $trade_energy = round(abs($trade_energy)); $trade_ore = Tki\Ports::trade($tkireg->ore_price, $tkireg->ore_delta, $sectorinfo['port_ore'], $tkireg->ore_limit, $tkireg->inventory_factor, "ore", $trade_ore, $price_array, $sectorinfo); $trade_organics = Tki\Ports::trade($tkireg->organics_price, $tkireg->organics_delta, $sectorinfo['port_organics'], $tkireg->organics_limit, $tkireg->inventory_factor, "organics", $trade_organics, $price_array, $sectorinfo); $trade_goods = Tki\Ports::trade($tkireg->goods_price, $tkireg->goods_delta, $sectorinfo['port_goods'], $tkireg->goods_limit, $tkireg->inventory_factor, "goods", $trade_goods, $price_array, $sectorinfo); $trade_energy = Tki\Ports::trade($tkireg->energy_price, $tkireg->energy_delta, $sectorinfo['port_energy'], $tkireg->energy_limit, $tkireg->inventory_factor, "energy", $trade_energy, $price_array, $sectorinfo); // $tkireg->ore_price = $price_array['ore']; // $tkireg->organics_price = $price_array['organics']; // $tkireg->goods_price = $price_array['goods']; // $tkireg->energy_price = $price_array['energy']; $cargo_exchanged = $trade_ore + $trade_organics + $trade_goods; $free_holds = Tki\CalcLevels::holds($playerinfo['hull'], $tkireg) - $playerinfo['ship_ore'] - $playerinfo['ship_organics'] - $playerinfo['ship_goods'] - $playerinfo['ship_colonists']; $free_power = Tki\CalcLevels::energy($playerinfo['power'], $tkireg) - $playerinfo['ship_energy']; $total_cost = $trade_ore * $tkireg->ore_price + $trade_organics * $tkireg->organics_price + $trade_goods * $tkireg->goods_price + $trade_energy * $tkireg->energy_price; // Debug info // echo "$trade_ore * $tkireg->ore_price + $trade_organics * $tkireg->organics_price + $trade_goods * $tkireg->goods_price + $trade_energy * $tkireg->energy_price = $total_cost"; if ($free_holds < $cargo_exchanged) { echo $langvars['l_notenough_cargo'] . " <br><br>"; } elseif ($trade_energy > $free_power) { echo $langvars['l_notenough_power'] . " <br><br>"; } elseif ($playerinfo['turns'] < 1) {
} else { $result = $db->Execute("SELECT name, sector_id FROM {$db->prefix}planets WHERE planet_id=?;", array($traderoutes[$i]['dest_id'])); Tki\Db::LogDbErrors($pdo_db, $result, __LINE__, __FILE__); if ($result) { $planet2 = $result->fields; echo " " . $langvars['l_tdr_planet'] . " <strong>{$planet2['name']}</strong>" . $langvars['l_tdr_within'] . "<a href=\"rsmove.php?engage=1&destination=" . $planet2['sector_id'] . "\">" . $planet2['sector_id'] . "</a></font></td>"; } else { echo " " . $langvars['l_tdr_nonexistance'] . "</font></td>"; } } echo "<td align='center'><font size=2 color=white>"; if ($traderoutes[$i]['dest_type'] == 'P') { $result = $db->Execute("SELECT * FROM {$db->prefix}universe WHERE sector_id = ?;", array($traderoutes[$i]['dest_id'])); Tki\Db::LogDbErrors($pdo_db, $result, __LINE__, __FILE__); $port2 = $result->fields; echo " " . Tki\Ports::getType($port2['port_type'], $langvars) . "</font></td>"; } else { if (empty($planet2)) { echo " " . $langvars['l_tdr_na'] . "</font></td>"; } else { echo " "; if ($playerinfo['trade_colonists'] == 'N' && $playerinfo['trade_fighters'] == 'N' && $playerinfo['trade_torps'] == 'N') { echo $langvars['l_tdr_none']; } else { if ($playerinfo['trade_colonists'] == 'Y') { echo $langvars['l_tdr_colonists']; } if ($playerinfo['trade_fighters'] == 'Y') { if ($playerinfo['trade_colonists'] == 'Y') { echo ", "; }
echo " </tr>\n"; echo " <tr>\n"; echo " <td style='white-space:nowrap; height:2px; background-color:transparent;'></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style='white-space:nowrap; border:#fff 1px solid; background-color:#500050;'>\n"; echo " <div style='padding-left:4px; text-align:center;'><a class='mnu' href='traderoute.php'>{$langvars['l_trade_control']}</a></div>\n"; echo " </td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<br>\n"; echo "</td>\n"; echo "<td style='vertical-align:top;'>\n"; if ($sectorinfo['port_type'] != "none" && mb_strlen($sectorinfo['port_type']) > 0) { echo "<div style='color:#fff; text-align:center; font-size:14px;'>\n"; echo "{$langvars['l_tradingport']}: <span style='color:#0f0;'>" . ucfirst(Tki\Ports::getType($sectorinfo['port_type'], $langvars)) . "</span>\n"; echo "<br><br>\n"; echo "<a class='new_link' style='font-size:14px;' href='port.php' title='Dock with Space Port'><img style='width:100px; height:70px;' class='mnu' src='" . $template->getVariables('template_dir') . "/images/space_station_port.png' alt='Space Station Port'></a>\n"; echo "</div>\n"; } else { echo "<div style='color:#fff; text-align:center;'>{$langvars['l_tradingport']} {$langvars['l_none']}</div>\n"; } echo "<br>\n"; // Put all the Planets into a div container and center it. echo "<div style='margin-left:auto; margin-right:auto; text-align:center; border:transparent 1px solid;'>\n"; echo "<div style='text-align:center; font-size:12px; color:#fff; font-weight:bold;'>{$langvars['l_planet_in_sec']} {$sectorinfo['sector_id']}</div>\n"; echo "<table style='height:150px; text-align:center; margin:auto; border:0px'>\n"; echo " <tr>\n"; if ($num_planets > 0) { $totalcount = 0; $curcount = 0;