"<tr><td><font size=2><b>Armour</b> ($sship[minarmour]/$sship[maxarmour])</td>" . "<td valign=bottom>$armour_bars</td></tr>" . "<tr><td><font size=2><b>Shields</b> ($sship[minshields]/$sship[maxshields])</td>" . "<td valign=bottom>$shields_bars</td></tr>" . "<tr><td><font size=2><b>Beams</b> ($sship[minbeams]/$sship[maxbeams])</td>" . "<td valign=bottom>$beams_bars</td></tr>" . "<tr><td><font size=2><b>Torpedo Launchers</b> ($sship[mintorp_launchers]/$sship[maxtorp_launchers])</td>" . "<td valign=bottom>$torp_launchers_bars</td></tr>" . "<tr><td><font size=2><b>Cloak</b> ($sship[mincloak]/$sship[maxcloak])</td>" . "<td valign=bottom>$cloak_bars</td></tr>" . "<tr><td><font color=white size=4><b><br>Price: </b></td>" . "<td><font color=red size=4><b><br>" . NUMBER($sship[cost_credits]) . " C</b></td></tr>" . "<tr><td><font color=white size=4><b><br>You have: </b></td>" . "<td><font color=green size=4><b><br>" . NUMBER($playerinfo[credits]) . " C</b></td></tr>" . "<tr><td><font color=white size=4><b>Current ship<br>trade-in value: </b></td>" . "<td><font color=white size=4><b><br>" . NUMBER(0.8*value_ship($playerinfo[currentship])) . " C</b></td></tr>". "</table><p>"; echo "<form action=shipyard2.php method=POST>" . "<input type=hidden name=stype value=$stype>" . "<input type=submit value=Purchase>" . "</form><br>"; echo "<font size=2 color=silver><b><a href=shipyard3.php>Return to shipyard</a></b></font><p>"; } } else { ?> <table width=100% border=1 cellpadding=5> <tr bgcolor=<? echo $color_line2 ?>><td width=10% align=center> <? echo "<font size=2 color=white><b>Welcome to our shipyard!<br>";
} } else if ($cmd == "buy") { if($playerinfo[turns] < 1) { echo "You need at least one turn to perform this action"; } else { // Check that the ship is owned by Federation $res = $db->Execute("SELECT * FROM $dbtables[ships] WHERE $dbtables[ships].on_planet='Y' AND $dbtables[ships].sector=$playerinfo[sector] AND $dbtables[ships].player_id=1 AND ship_id = $sid"); if (!$res->EOF) { $shipinfo = $res->fields; // Check that we are at a special port $res = $db->Execute("SELECT * FROM $dbtables[universe] WHERE sector_id=$shipinfo[sector] AND port_type='special'"); echo "<h2>Buy Ship</h2>"; if ($res->EOF) { echo "You can only buy a ship at a special port.<br><br>"; } else { $shipprice = floor(0.95*value_ship($sid)); if ($shipprice < 0) { $shipprice = 100; } if ($sship[fur_tech]=="Y") { $shipprice *= 2; } if (empty($sell_confirm)) { echo "The Space Dock owners will sell you the $shipinfo[ship_name] for ".NUMBER($shipprice)." credits.<br><br>"; if ($playerinfo[credits] < $shipprice) { echo "Please come back when you have enough cash to buy it!<br><br>"; } else { if ($sship[fur_tech]=="Y") { echo "Watch out though because this ship contains illegal Furangee tech upgrades and we won't be keen to buy it back from you!<br>"; } echo "<form action=spacedock.php?kk=".date("U")." method=post>";
} $result = $db->Execute("SELECT * FROM $dbtables[players] WHERE email='$username'"); $playerinfo=$result->fields; // Find out what my ship is $res = $db->Execute("SELECT * FROM $dbtables[ship_types],$dbtables[ships] WHERE $dbtables[ship_types].type_id=$dbtables[ships].type AND $dbtables[ships].player_id=$playerinfo[player_id] AND $dbtables[ships].ship_id=$playerinfo[currentship]"); $shipinfo = $res->fields; $shipavg = $shipinfo[hull] + $shipinfo[engines] + $shipinfo[power] + $shipinfo[computer] + $shipinfo[sensors] + $shipinfo[armour] + $shipinfo[shields] + $shipinfo[beams] + $shipinfo[torp_launchers] + $shipinfo[cloak]; $shipavg /= 10; bigtitle(); echo "<B>$l_player: $playerinfo[character_name]</B><br><B>$l_ship: $shipinfo[ship_name]</B><br>"; echo "<b>Ship class:</b> $shipinfo[name]<br>"; echo "<b>Current ship value:</b> ".NUMBER(value_ship($shipinfo[ship_id]))." credits<br>"; if ($shipinfo[fur_tech]=="Y") { echo "This ship contains illegal Furangee tech upgrades!<br>"; } echo "<B>$l_credits on hand: </b>" . NUMBER($playerinfo[credits]) . "<br>"; echo "<BR>"; echo "<p align=center>"; echo "<img src=\"images/big$shipinfo[image]\" border=0></p>"; //echo "<TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0 WIDTH=\"100%\">"; //echo "<TR><TD>"; echo "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH=\"100%\">"; echo "<TR BGCOLOR=\"$color_header\"><TD COLSPAN=3 align=center><B>$l_ship_levels</B></TD></TR>"; echo "<TR BGCOLOR=\"$color_line1\"><TD>$l_hull</TD><TD align=center>$l_level $shipinfo[hull]</TD><TD align=center>Max $l_level $shipinfo[maxhull]</TD></TR>"; echo "<TR BGCOLOR=\"$color_line2\"><TD>$l_engines</TD><TD align=center>$l_level $shipinfo[engines]</TD><TD align=center>Max $l_level $shipinfo[maxengines]</TD></TR>"; echo "<TR BGCOLOR=\"$color_line1\"><TD>$l_power</TD><TD align=center>$l_level $shipinfo[power]</TD><TD align=center>Max $l_level $shipinfo[maxpower]</TD></TR>";
"</form><p>"; } echo "<form action=shipyard2.php method=POST>" . "<input type=hidden name=stype value=$stype>" . "<input type=hidden name=confirm value=yes>" . "<input type=hidden name=trade value=yes>" . "<font size=3><b>Name your new ship: </b></font><input type=text name=shipname size=20 maxlength=20 value='$shipinfo[ship_name]'><p>" . "<input type=submit value='Trade and Buy'>". "</form><p>"; } } else //ok, now we buy the ship for true { if ($trade == "yes") { // This is a trade-in $shipvalue=value_ship($shipinfo[ship_id]); $shipvalue *= 0.8; $totalcost = $sship[cost_credits] - $shipvalue; } else { $totalcost = $sship[cost_credits]; } //Let's do the regular sanity checks first if($playerinfo[turns] < 1) shipyard_die("You need at least one turn to perform this action"); if(!isset($sship)) shipyard_die("Internal error. Cannot find ship class."); /* if($sship[type_id] == $shipinfo[type]) shipyard_die("You already own this model of ship.");