<?php
/****************************************************************************
* Copyright (C) 2000 Bryan Brunton
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/
page_open(array("sess" => "ME_Session_Uncached", "auth" => "ME_Auth", "user" => "ME_User"));
$sess->register("player_id");
$sess->register("player_dead");
include("./lib/player.php");
include("./lib/ship.php");
include("./merchantempiresdefines.php");
include("./lib/player_redirect.php");
?>
<html><head><title>Merchant Empires: Ship Forces</title>
<link rel=stylesheet href="./merchantempires.css" type=text/css>
</head><body text=white background="./images/createbg.gif"><?php
include("./templates/header.html");
?>
<table width=100%><tr>
<td width=100 vAlign=top><?php
$player = new ME_Player;
$player->get_player($player_id);
$player_dead = $player->f("dead");
$game_id = $player->f("game_id");
$ship = new ME_Ship;
$ship->get_ship($player_id);
$ship->add_parameter("time", date ("Y H:i:s"));
echo $ship->get_transform("./xslt/mainmenu.xslt", $ship->get_xml());
?>
</td>
<td vAlign=top align=left width=0> </td>
<td vAlign=top width=500>
<table border=0 cellPadding=0 cellSpacing=0>
<tr>
<td bgColor=#993300>
<table border=0 cellPadding=5 cellSpacing=1 width=500>
<tr>
<td width=500 bgColor=#000000 align=left valign=middle>
<table border=0>
<tr>
<td align=left colspan=6>
<font color=#3333FF face=arial,helvetica,swiss size=5>Ship Forces</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<form action=<?php
$sector_id = $ship->f("sector_id");
$db_f = new ME_DB;
$db_f->query("SELECT * from forces where sector_id = '$sector_id' and player_id = '$player_id'");
$db_f->next_record();
if ( $db_f->nf() > 0 ) {
$sector_combat = $db_f->f("combat");
$sector_scout = $db_f->f("scout");
$sector_mine = $db_f->f("mine");
} else {
$sector_combat = 0;
$sector_scout = 0;
$sector_mine = 0;
}
echo $sess->url(URL . "ship_forces_update.php");
?>
method=post onsubmit='if(this.submitted) return false; else {this.submitted=true; return true;}'>
<table border=0 cellPadding=0 cellSpacing=0 width=500>
<tr>
<td bgColor=#003399>
<table border=0 cellpadding=2 cellspacing=1 width=500>
<tr>
<td bgColor=#000033>
<font color=#ffffff face=arial,helvetica,swiss size=3>
<center>Type</center>
</font>
</td>
<td bgColor=#000033>
<font color=#ffffff face=arial,helvetica,swiss size=3>
<center>Amount on Ship</center>
</font>
</td>
<td bgColor=#000033>
<font color=#ffffff face=arial,helvetica,swiss size=3>
<center>Amount in Sector</center>
</font>
</td>
<td bgColor=#000033>
<font color=#ffffff face=arial,helvetica,swiss size=3>
<center>Amount</center>
</font>
</td>
</tr><?php
echo "<tr>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "Combat Drones";
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo $ship->f("combatcurrent");
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo $sector_combat;
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "<input type=textbox size=5 name=amount_combat></center>";
echo "</small></font></td>";
echo "</tr>";
echo "<tr>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "Scout Drones";
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo $ship->f("scoutcurrent");
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo $sector_scout;
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "<input type=textbox size=5 name=amount_scout></center>";
echo "</small></font></td>";
echo "</tr>";
echo "<tr>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "Mines";
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo $ship->f("minescurrent");
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo $sector_mine;
echo "</center></font></td>";
echo "<td bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "<input type=textbox size=5 name=amount_mines></center>";
echo "</small></font></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=4 bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "<input type=submit name=drop value='Drop in Sector'> ";
echo "<input type=submit name=take value='Take from Sector'>";
echo "</center></font></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=4 bgColor=#000000><font color=#cccccc face=arial,helvetica,swiss size=3><center>";
echo "<a href=";
echo $sess->url(URL . "merchant_forces.php");
echo " >View Forces</a></center>";
echo "</center></font></td>";
echo "</tr>";
?>
</table>
<td>
</tr>
</table>
</form><br><?php
if ( $error ) {
$db = new ME_DB_Xml;
$db->add_parameter("title", "Error");
if ($error == 1) {
$db->add_parameter("message", "Amount to drop is larger than the amount on ship.");
} elseif ($error == 2) {
$db->add_parameter("message", "Amount to take is larger than the amount in the sector.");
} elseif ($error == 3) {
$db->add_parameter("message", "Current sector contains none of your forces.");
} elseif ($error == 4) {
$db->add_parameter("message", "Forces may not be dropped in a sector that contains a location.");
} elseif ($error == 5) {
$db->add_parameter("message", "Command not processed due to invalid amount entered.");
} elseif ($error == 6) {
$db->add_parameter("message", "Amount to take is larger than ship capacity.");
} elseif ($error == 7) {
$db->add_parameter("message", "Amount to drop exceeds sector capacity.");
}
echo $db->get_transform("./xslt/message_box.xslt", "");
}
?>
</td>
<td valign=top align=right width=100%><?php
include("./messages_display.php");
echo $player->get_transform("./xslt/player.xslt", $player->get_xml());
include("./ship_display.php");
?>
</td></tr></table>
</body></html><?php
page_close();
?>