示例#1
0
function Ships_List($focus = 0, $search_name = "")
{
    global $db, $game, $UNIT_NAME, $NEXT_TICK, $ACTUAL_TICK;
    /* AC: Get search name */
    $search_name = htmlspecialchars($_REQUEST['search']);
    /* AC: Check query focus */
    if (isset($_REQUEST['start'])) {
        $focus = $_REQUEST['start'];
    }
    /* AC: Check chosen ordering method */
    if (!isset($_REQUEST['order']) || empty($_REQUEST['order'])) {
        $_REQUEST['order'] = 1;
    }
    /* Filter ship's type */
    if (isset($_GET['filter']) && $_GET['filter'] == 1) {
        $game->option_store('stype_0', (int) (1 - $game->option_retr('stype_0', 1)));
    }
    if (isset($_GET['filter']) && $_GET['filter'] == 2) {
        $game->option_store('stype_1', (int) (1 - $game->option_retr('stype_1', 1)));
    }
    if (isset($_GET['filter']) && $_GET['filter'] == 3) {
        $game->option_store('stype_2', (int) (1 - $game->option_retr('stype_2', 1)));
    }
    if (isset($_GET['filter']) && $_GET['filter'] == 4) {
        $game->option_store('stype_3', (int) (1 - $game->option_retr('stype_3', 1)));
    }
    $_POST['stype_0'] = $game->option_retr('stype_0', 1);
    $_POST['stype_1'] = $game->option_retr('stype_1', 1);
    $_POST['stype_2'] = $game->option_retr('stype_2', 1);
    $_POST['stype_3'] = $game->option_retr('stype_3', 1);
    if ($_POST['stype_0']) {
        $sels[] = 0;
    }
    if ($_POST['stype_1']) {
        $sels[] = 1;
    }
    if ($_POST['stype_2']) {
        $sels[] = 2;
    }
    if ($_POST['stype_3']) {
        $sels[] = 3;
    }
    if (empty($sels)) {
        $sels[] = 4;
    }
    /* */
    $queryfocus = $focus;
    /* AC: Query user ships ordered by shiptorso */
    $ordermethod = 'st.ship_torso DESC,s.ship_name, fl.fleet_name, pl.planet_name, s.ship_scrap,s.ship_repair,st.name ASC';
    /* AC: Query user ships ordered by name */
    if ($_REQUEST['order'] == 2) {
        $ordermethod = 's.ship_name ASC,s.ship_scrap,s.ship_repair,st.name ASC';
    } else {
        if ($_REQUEST['order'] == 3) {
            $ordermethod = 'pl.planet_name, fl.fleet_name ASC,s.ship_scrap,s.ship_repair,st.name ASC';
        } else {
            if ($_REQUEST['order'] == 4) {
                $ordermethod = 's.hitpoints DESC,s.ship_scrap,s.ship_repair,st.name ASC';
            } else {
                if ($_REQUEST['order'] == 5) {
                    $ordermethod = 's.awayteam ASC,s.ship_scrap,s.ship_repair,st.name ASC';
                } else {
                    if ($_REQUEST['order'] == -1) {
                        $ordermethod = 'st.ship_torso ASC,s.ship_name, fl.fleet_name, pl.planet_name, s.ship_scrap,s.ship_repair,st.name ASC';
                    } else {
                        if ($_REQUEST['order'] == -2) {
                            $ordermethod = 's.ship_name DESC,s.ship_scrap,s.ship_repair,st.name ASC';
                        } else {
                            if ($_REQUEST['order'] == -3) {
                                $ordermethod = 'pl.planet_name, fl.fleet_name DESC,s.ship_scrap,s.ship_repair,st.name ASC';
                            } else {
                                if ($_REQUEST['order'] == -4) {
                                    $ordermethod = 's.hitpoints ASC,s.ship_scrap,s.ship_repair,st.name ASC';
                                } else {
                                    if ($_REQUEST['order'] == -5) {
                                        $ordermethod = 's.awayteam DESC,s.ship_scrap,s.ship_repair,st.name ASC';
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    $shipsxpage = 20;
    /* Vary number of displayable ships per page according max number of ships owned */
    $sql = 'SELECT COUNT(ship_id) AS n_ships
			FROM (ships s)
			INNER JOIN (ship_templates st) ON st.id = s.template_id
			WHERE user_id = ' . $game->player['user_id'] . ' AND st.ship_class IN (' . implode(',', $sels) . ')';
    $n_ships = $db->queryrow($sql);
    if ($n_ships['n_ships'] > 500) {
        $shipsxpage = 100;
    }
    $sql = 'SELECT s.ship_id, s.hitpoints, s.ship_repair, s.ship_scrap, s.ship_untouchable, s.awayteam, s.awayteamplanet_id,
			s.unit_1,s.unit_2,s.unit_3,s.unit_4, s.ship_name, s.ship_ncc, s.fleet_id,
			s.construction_time, st.max_unit_1,st.max_unit_2,st.max_unit_3,st.max_unit_4,
			st.name AS template_name, st.value_5 AS max_hitpoints, fl.fleet_name,
			fl.planet_id AS fleet_target, pl.planet_name, pl2.planet_name AS mission_planet
			FROM (ships s)
			INNER JOIN (ship_templates st) ON st.id = s.template_id
			LEFT JOIN (ship_fleets fl) ON fl.fleet_id = s.fleet_id
			LEFT JOIN (planets pl) ON pl.planet_id = ABS(s.fleet_id)
                        LEFT JOIN (planets pl2) ON pl2.planet_id = s.awayteamplanet_id
			WHERE s.user_id = ' . $game->player['user_id'] . '
			AND st.ship_class IN (' . implode(',', $sels) . ') ORDER BY ' . $ordermethod . ' LIMIT ' . $queryfocus . ',' . $shipsxpage;
    $shipquery = $db->query($sql);
    $game->out(constant($game->sprache("TEXT1")) . '<br><br>');
    /* AC: Searching ship */
    $game->out('<br><table border=0 cellpadding=1 cellspacing=1  class="style_outer" width=300><tr><td>
		<table border=0 cellpadding=2 cellspacing=2  class="style_inner" width=300>
		<tr>
			<td align="center" valign="middle">
				<form method="post" action="' . parse_link('a=ships&view=ships_list&order=' . $_REQUEST['order']) . '">
				<input type="text" name="search" size="16" class="field" value="' . htmlspecialchars($_REQUEST['search']) . '">
			</td>
			<td align="center" valign="middle">
				<input type="submit" name="exec_search" class="button" width=100 value="' . constant($game->sprache("TEXT2")) . '">
				</form>
			</td>
		</tr>
		</table>
	</td></tr>
	</table>');
    /* AC: If we have to search ships */
    if ($search_name != "" && $focus == 0) {
        $game->out('<br><table border=0 cellpadding=1 cellspacing=1  class="style_outer" width=300><tr><td>
		<table border=0 cellpadding=2 cellspacing=2 class="style_inner" width=300>
			<tr>
				<td width=150>
					<b>' . constant($game->sprache("TEXT3")) . '</b>
				</td>
				<td>
					<b>' . constant($game->sprache("TEXT5")) . '</b>
				</td>
			</tr>');
        $search_ships = $db->query('SELECT ship_name, ship_id, st.name AS template_name
					FROM (ships s) INNER JOIN (ship_templates st) ON st.id = s.template_id
					WHERE ship_name LIKE "%' . $_REQUEST['search'] . '%" AND user_id = ' . $game->player['user_id'] . ' ORDER by ship_name ASC');
        while (($ship = $db->fetchrow($search_ships)) != false) {
            $game->out('
				<tr>
					<td width=150>
						<a href="' . parse_link('a=ships&view=ship_details&id=' . $ship['ship_id']) . '">' . $ship['ship_name'] . '</a>
					</td>
					<td>
						' . $ship['template_name'] . '
					</td>
				</tr>
			');
        }
        $game->out('</table></td></tr></table>');
    }
    $game->out('<br><br><span class="sub_caption">' . constant($game->sprache("TEXT4")) . ' ' . HelpPopup('ships') . ' :</span><br>');
    /**
     * AC: Create main table
     */
    switch ($_REQUEST['order']) {
        case 1:
        case -1:
            $header1 = '<a href="' . parse_link('a=ships&view=ships_list&order=' . $_REQUEST['order'] * -1 . '&search=' . $search_name) . '"><b><u>' . constant($game->sprache("TEXT5")) . '</u></b></a>';
            $header2 = '<a href="' . parse_link('a=ships&view=ships_list&order=2&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT6")) . '</b></a>';
            $header3 = '<a href="' . parse_link('a=ships&view=ships_list&order=3&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT7")) . '</b></a>';
            $header4 = '<a href="' . parse_link('a=ships&view=ships_list&order=4&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT8")) . '</b></a>';
            $header5 = '<a href="' . parse_link('a=ships&view=ships_list&order=5&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT11")) . '</b></a>';
            break;
        case 2:
        case -2:
            $header1 = '<a href="' . parse_link('a=ships&view=ships_list&order=1&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT5")) . '</b></a>';
            $header2 = '<a href="' . parse_link('a=ships&view=ships_list&order=' . $_REQUEST['order'] * -1 . '&search=' . $search_name) . '"><b><u>' . constant($game->sprache("TEXT6")) . '</u></b></a>';
            $header3 = '<a href="' . parse_link('a=ships&view=ships_list&order=3&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT7")) . '</b></a>';
            $header4 = '<a href="' . parse_link('a=ships&view=ships_list&order=4&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT8")) . '</b></a>';
            $header5 = '<a href="' . parse_link('a=ships&view=ships_list&order=5&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT11")) . '</b></a>';
            break;
        case 3:
        case -3:
            $header1 = '<a href="' . parse_link('a=ships&view=ships_list&order=1&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT5")) . '</b></a>';
            $header2 = '<a href="' . parse_link('a=ships&view=ships_list&order=2&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT6")) . '</b></a>';
            $header3 = '<a href="' . parse_link('a=ships&view=ships_list&order=' . $_REQUEST['order'] * -1 . '&search=' . $search_name) . '"><b><u>' . constant($game->sprache("TEXT7")) . '</u></b></a>';
            $header4 = '<a href="' . parse_link('a=ships&view=ships_list&order=4&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT8")) . '</b></a>';
            $header5 = '<a href="' . parse_link('a=ships&view=ships_list&order=5&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT11")) . '</b></a>';
            break;
        case 4:
        case -4:
            $header1 = '<a href="' . parse_link('a=ships&view=ships_list&order=1&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT5")) . '</b></a>';
            $header2 = '<a href="' . parse_link('a=ships&view=ships_list&order=2&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT6")) . '</b></a>';
            $header3 = '<a href="' . parse_link('a=ships&view=ships_list&order=3&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT7")) . '</b></a>';
            $header4 = '<a href="' . parse_link('a=ships&view=ships_list&order=' . $_REQUEST['order'] * -1 . '&search=' . $search_name) . '"><b><u>' . constant($game->sprache("TEXT8")) . '</u></b></a>';
            $header5 = '<a href="' . parse_link('a=ships&view=ships_list&order=5&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT11")) . '</b></a>';
            break;
        case 5:
        case -5:
            $header1 = '<a href="' . parse_link('a=ships&view=ships_list&order=1&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT5")) . '</b></a>';
            $header2 = '<a href="' . parse_link('a=ships&view=ships_list&order=2&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT6")) . '</b></a>';
            $header3 = '<a href="' . parse_link('a=ships&view=ships_list&order=3&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT7")) . '</b></a>';
            $header4 = '<a href="' . parse_link('a=ships&view=ships_list&order=4&search=' . $search_name) . '"><b>' . constant($game->sprache("TEXT8")) . '</b></a>';
            $header5 = '<a href="' . parse_link('a=ships&view=ships_list&order=' . $_REQUEST['order'] * -1 . '&search=' . $search_name) . '"><b><u>' . constant($game->sprache("TEXT11")) . '</u></b></a>';
            break;
    }
    $game->out('<br><table border=0 cellpadding=2 cellspacing=2 class="style_outer"><tr><td>
	<table border=0 cellpadding=2 cellspacing=2 class="style_inner">
		<tr>
		<td><b>#</b></td>
		<td width=160>' . $header1 . '</td>
		<td width=200>' . $header2 . '</td>
		<td width=100>' . $header3 . '</td>
		<td width=100 align="center">' . $header4 . '</td>
		<td width=75 align="center"><b>' . constant($game->sprache("TEXT9")) . '</b></td>
		<td width=75 align="center"><b>' . constant($game->sprache("TEXT10")) . '</b></td>
		<td width=150 align="center">' . $header5 . '</td></tr>');
    $name_title = constant($game->sprache("TEXT13"));
    $position_title = constant($game->sprache("TEXT14"));
    $condition_title = constant($game->sprache("TEXT15"));
    $status_title = constant($game->sprache("TEXT16"));
    $crew_title = constant($game->sprache("TEXT17"));
    $n = $queryfocus + 1;
    while (($ship = $db->fetchrow($shipquery)) != false) {
        /* Check ship Naval Construction Code */
        $name_desc = constant($game->sprache("TEXT19")) . ' ' . ($ship['ship_ncc'] != '' ? $ship['ship_ncc'] : '<i>' . constant($game->sprache("TEXT20")) . '</i>');
        /* Check ship current position */
        $position = '';
        $position_desc = '';
        if ($ship['fleet_id'] > 0) {
            $position = $ship['fleet_name'];
            /* Check il fleet is moving */
            if ($ship['fleet_target'] != 0) {
                $planet = $db->queryrow('SELECT planet_name FROM planets WHERE planet_id = ' . $ship['fleet_target']);
                $position_desc = constant($game->sprache("TEXT21")) . ' ' . $planet['planet_name'];
                $pos_link = parse_link('a=ship_fleets_display&pfleet_details=' . $ship['fleet_id']);
            } else {
                $position_desc = constant($game->sprache("TEXT22"));
                $pos_link = parse_link('a=ship_fleets_display&mfleet_details=' . $ship['fleet_id']);
            }
            /* Check ship current status */
            $status = '<font color=#80ff80>O</font>';
            $status_desc = constant($game->sprache("TEXT23"));
        } else {
            $position = $ship['planet_name'];
            $position_desc = constant($game->sprache("TEXT24"));
            /* Check ship current status */
            $status = '<font color=#ffff80>S</font>';
            $status_desc = constant($game->sprache("TEXT25"));
            $pos_link = 'javascript:void(0);';
        }
        /* Check ship conditions */
        $per_damage = round($ship['hitpoints'] / $ship['max_hitpoints'] * 100, 0);
        if ($per_damage > 75) {
            $condition = $ship['hitpoints'] . ' / ' . $ship['max_hitpoints'];
        } else {
            if ($per_damage > 50) {
                $condition = '<a href="javascript:void(0);" onmouseover="return overlib(\'' . constant($game->sprache("TEXT26")) . '\', CAPTION, \'' . $condition_title . '\', WIDTH, 250, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><font color=#ffff80>' . $ship['hitpoints'] . '</font></a> / ' . $ship['max_hitpoints'];
            } else {
                $condition = '<a href="javascript:void(0);" onmouseover="return overlib(\'' . constant($game->sprache("TEXT27")) . '\', CAPTION, \'' . $condition_title . '\', WIDTH, 250, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><font color=#ff8080>' . $ship['hitpoints'] . '</font></a> / ' . $ship['max_hitpoints'];
            }
        }
        /* Check ship status */
        if ($ship['ship_repair'] > 0) {
            $status = '<font color=#ff8080>R</font>';
            $status_desc = constant($game->sprache("TEXT28")) . '<br>' . TimeDetailShort($NEXT_TICK + 3 * 60 * ($ship['ship_repair'] - $ACTUAL_TICK)) . '.';
        }
        if ($ship['ship_scrap'] > 0) {
            $status = '<font color=#ff8080>D</font>';
            $status_desc = constant($game->sprache("TEXT29")) . '<br>' . TimeDetailShort($NEXT_TICK + 3 * 60 * ($ship['ship_scrap'] - $ACTUAL_TICK)) . '.';
        }
        if ($ship['ship_untouchable'] > 0 && $ship['ship_repair'] <= 0 && $ship['ship_scrap'] <= 0) {
            $status = 'U';
            $status_desc = constant($game->sprache("TEXT30"));
        }
        /* Check ship crew aboard */
        $crew = '';
        $crew_desc = constant($game->sprache("TEXT31"));
        if ($ship['unit_1'] + $ship['unit_2'] + $ship['unit_3'] + $ship['unit_4'] > 0) {
            $ncrew = 100 / ($ship['max_unit_1'] + $ship['max_unit_2'] + $ship['max_unit_3'] + $ship['max_unit_4']) * ($ship['unit_1'] + $ship['unit_2'] + $ship['unit_3'] + $ship['unit_4']);
            $ncrew = round($ncrew, 0);
            // Critical condition
            if ($ncrew > 0 && $ncrew <= 25) {
                $crew = '<font color=#ff8080>' . $ncrew . '%';
            } else {
                if ($ncrew > 25 && $ncrew <= 50) {
                    $crew = '<font color=#ffff80>' . $ncrew . '%';
                } else {
                    if ($ncrew > 50 && $ncrew <= 75) {
                        $crew = '<font color=#80ff80>' . $ncrew . '%';
                    } else {
                        if ($ncrew >= 75) {
                            $crew = $ncrew . '%';
                        }
                    }
                }
            }
            $crew_desc = '<img src=' . $game->GFX_PATH . 'menu_unit1_small.gif>&nbsp;' . $ship['unit_1'] . '&nbsp;&nbsp;' . addslashes($UNIT_NAME[$game->player['user_race']][0]) . '<br>';
            $crew_desc .= '<img src=' . $game->GFX_PATH . 'menu_unit2_small.gif>&nbsp;' . $ship['unit_2'] . '&nbsp;&nbsp;' . addslashes($UNIT_NAME[$game->player['user_race']][1]) . '<br>';
            $crew_desc .= '<img src=' . $game->GFX_PATH . 'menu_unit3_small.gif>&nbsp;' . $ship['unit_3'] . '&nbsp;&nbsp;' . addslashes($UNIT_NAME[$game->player['user_race']][2]) . '<br>';
            $crew_desc .= '<img src=' . $game->GFX_PATH . 'menu_unit4_small.gif>&nbsp;' . $ship['unit_4'] . '&nbsp;&nbsp;' . addslashes($UNIT_NAME[$game->player['user_race']][3]);
        }
        $game->out('
			<tr>
			<td>' . $n . '</td>
			<td>' . $ship['template_name'] . '</td>
			<td>
				<a href="' . parse_link('a=ships&view=ship_details&id=' . $ship['ship_id'] . '') . '" onmouseover="return overlib(\'' . $name_desc . '\', CAPTION, \'' . $name_title . '\', WIDTH, 300, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . ($ship['ship_name'] != '' ? $ship['ship_name'] : '<i>' . constant($game->sprache("TEXT67")) . '</i>') . '</a>
			</td>
			<td>
				<a href="' . $pos_link . '" onmouseover="return overlib(\'' . $position_desc . '\', CAPTION, \'' . $position_title . '\', WIDTH, 300, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $position . '</a>
			</td>
			<td align="center">' . $condition . '</td>
			<td align="center">
				<a href="javascript:void(0);" onmouseover="return overlib(\'' . $status_desc . '\', CAPTION, \'' . $status_title . '\', WIDTH, 200, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $status . '</a>
			</td>
			<td align="center">
				<a href="javascript:void(0);" onmouseover="return overlib(\'' . $crew_desc . '\', CAPTION, \'' . $crew_title . '\', WIDTH, 200, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $crew . '</a>
			</td>
			<td align="center">' . ($ship['awayteam'] == 0 ? constant($game->sprache("TEXT76")) . '<a href="' . parse_link('a=tactical_cartography&planet_id=' . encode_planet_id($ship['awayteamplanet_id'])) . '">' . $ship['mission_planet'] . '</a>' : intval($ship['awayteam'])) . '</td>
			</tr>');
        $n++;
    }
    $game->out('</table></td></tr></table>');
    /* AC: Pages browsing */
    $sql = 'SELECT COUNT(ship_id) AS n_ships
			FROM (ships s)
			INNER JOIN (ship_templates st) ON st.id = s.template_id
			WHERE user_id = ' . $game->player['user_id'] . ' AND st.ship_class IN (' . implode(',', $sels) . ')';
    $n_ships = $db->queryrow($sql);
    $max_pages = ceil($n_ships['n_ships'] / $shipsxpage);
    $game->out('<br><table border=0 cellpadding=1 cellspacing=1 class="style_outer" width=400><tr><td>
		<table border=0 cellpadding=2 cellspacing=2 class="style_inner" width=400><tr>
		<td width=50 align=middle>
			' . ($queryfocus > 0 ? '<a href="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=0') . '"><span class="text_large">[1]</a>' : '[1]') . '
		</td>
		<td width=150 align=middle>
			' . ($queryfocus > 0 ? '<a href="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=' . ($queryfocus - $shipsxpage)) . '"><span class="text_large">' . constant($game->sprache("TEXT32")) . '</a>' : '') . '
		</td>
		<td width=150 align=middle>
			' . ($queryfocus < $n_ships['n_ships'] - $shipsxpage ? '<a href="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=' . ($queryfocus + $shipsxpage)) . '"><span class="text_large">' . constant($game->sprache("TEXT33")) . '</a>' : '') . '
		</td>
		<td width=50 align=middle>
			' . ($queryfocus < $n_ships['n_ships'] - $shipsxpage ? '<a href="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=' . ($n_ships['n_ships'] - $shipsxpage)) . '"><span class="text_large">[' . $max_pages . ']</a>' : '[' . $max_pages . ']') . '
		</td>
		</tr></table></td></tr></table>');
    /* Show up ship's filter */
    $game->out('<br>
		<table border=0 cellpadding=1 cellspacing=1 class="style_outer" width=300><tr><td>
		<table border=0 cellpadding=1 cellspacing=1 class="style_inner" width=300>
		<tr>
		<td>
			<fieldset><legend>' . constant($game->sprache("TEXT68")) . '</legend>
			<table><tr>
			<td>
			<form name="stype0form" method="post" action="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=' . $queryfocus . '&filter=1') . '">
			<input type="checkbox" name="stype_0" value="1"' . ($_POST['stype_0'] == 1 ? ' checked="checked"' : '') . '  onChange="document.stype0form.submit()">' . constant($game->sprache("TEXT69")) . '
			</form>
			</td>
			<td>
			<form name="stype1form" method="post" action="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=' . $queryfocus . '&filter=2') . '">
			<input type="checkbox" name="stype_1" value="1"' . ($_POST['stype_1'] == 1 ? ' checked="checked"' : '') . '  onChange="document.stype1form.submit()">' . constant($game->sprache("TEXT70")) . '
			</form>
			</td>
			<td>
			<form name="stype2form" method="post" action="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=' . $queryfocus . '&filter=3') . '">
			<input type="checkbox" name="stype_2" value="1"' . ($_POST['stype_2'] == 1 ? ' checked="checked"' : '') . '  onChange="document.stype2form.submit()">' . constant($game->sprache("TEXT71")) . '
			</form>
			</td>
			<td>
			<form name="stype3form" method="post" action="' . parse_link('a=ships&order=' . $_REQUEST['order'] . '&start=' . $queryfocus . '&filter=4') . '">
			<input type="checkbox" name="stype_3" value="1"' . ($_POST['stype_3'] == 1 ? ' checked="checked"' : '') . '  onChange="document.stype3form.submit()">' . constant($game->sprache("TEXT72")) . '
			</form>
			</td></tr></table>
			</fieldset>
		</td>
		</tr></table></td></tr></table>');
}
示例#2
0
    $game->option_store('planetlist_order', (int) $_GET['s_o']);
}
if (isset($_GET['s_s']) && $_GET['s_s'] >= 0 && $_GET['s_s'] <= 3) {
    $game->option_store('planetlist_show', (int) $_GET['s_s']);
}
if (!$game->SITTING_MODE && isset($_GET['s_op']) && $_GET['s_op'] >= 0 && $_GET['s_op'] <= 2) {
    $game->option_store('redalert_options', (int) $_GET['s_op']);
}
if (isset($_REQUEST['a2']) && $_REQUEST['a2'] >= 0) {
    $game->player->active_planet($_REQUEST['a2']);
}
$game->out('<span class="caption">' . constant($game->sprache("TEXT1")) . '</span><br><br>');
$game->out(constant($game->sprache("TEXT2")) . '<br>' . constant($game->sprache("TEXT3")) . '<br>
' . constant($game->sprache("TEXT4")) . '<font color=#80ff80>' . constant($game->sprache("TEXT5")) . '</font>' . constant($game->sprache("TEXT6")) . '<br>
' . constant($game->sprache("TEXT7")) . '<font color=#ffff80>' . constant($game->sprache("TEXT8")) . '</font> ' . constant($game->sprache("TEXT9")) . ' <font color=#ff8080>' . constant($game->sprache("TEXT10")) . '</font>.<br><br>');
$game->out('<span class="sub_caption">' . constant($game->sprache("TEXT12")) . ' ' . HelpPopup('planetlist') . ' :</span><br><br>');
$game->out('
<table border=0 cellpadding=1 cellaspacing=1 class="style_outer">
<tr>
<td>
<table border=0 cellpadding=1 cellspacing=1 class="style_inner">
<tr>
  <td width=130 valign="top"><span class="sub_caption2">' . constant($game->sprache("TEXT13")) . '</span></td>
  <td width=20 valign="top"></td>
  <td width=70 valign="top"><span class="sub_caption2">' . constant($game->sprache("TEXT14")) . '</span></td>
  <td width=70 valign="top"><span class="sub_caption2">' . constant($game->sprache("TEXT57")) . '</span></td>
  <td width=390 valign="top"><span class="sub_caption2">' . constant($game->sprache("TEXT15")) . '</span></td>
  <td width=70 valign="top"><span class="sub_caption2">' . constant($game->sprache("TEXT16")) . '</span></td>
  <td width=50 valign="top"><span class="sub_caption2">' . constant($game->sprache("TEXT17")) . '</span></td>
  <td width=50 valign="top"><span class="sub_caption2">' . constant($game->sprache("TEXT18")) . '</span></td>
</tr>
示例#3
0
function own_bids()
{
    global $db;
    global $game, $ACTUAL_TICK, $NEXT_TICK;
    $per_page = 20;
    if (isset($_GET['trigger']) && $_GET['trigger'] == 1) {
        $game->option_store('type_0', (int) (1 - $game->option_retr('type_0', 1)));
    }
    if (isset($_GET['trigger']) && $_GET['trigger'] == 2) {
        $game->option_store('type_1', (int) (1 - $game->option_retr('type_1', 1)));
    }
    if (isset($_GET['trigger']) && $_GET['trigger'] == 3) {
        $game->option_store('type_2', (int) (1 - $game->option_retr('type_2', 1)));
    }
    if (isset($_GET['trigger']) && $_GET['trigger'] == 4) {
        $game->option_store('type_3', (int) (1 - $game->option_retr('type_3', 1)));
    }
    $_POST['type_0'] = $game->option_retr('type_0', 1);
    $_POST['type_1'] = $game->option_retr('type_1', 1);
    $_POST['type_2'] = $game->option_retr('type_2', 1);
    $_POST['type_3'] = $game->option_retr('type_3', 1);
    if ($_POST['type_0']) {
        $sels[] = 0;
    }
    if ($_POST['type_1']) {
        $sels[] = 1;
    }
    if ($_POST['type_2']) {
        $sels[] = 2;
    }
    if ($_POST['type_3']) {
        $sels[] = 3;
    }
    if (empty($sels)) {
        $sels[] = 4;
    }
    $game->out('
		<script language="JavaScript">
		function ConfirmClick(text,link)
{
		if (confirm(text)==true)
		{
			location.href=link;
		}
}
		</script>');
    /* 27/02/08 - AC: I'm not pretty sure but, if the function's name is own_bids, probabily variable $own_only is true... */
    $own_only = 0;
    if ($own_only == 0) {
        $str_compare = '<>';
    } else {
        $str_compare = '=';
    }
    $own_system = $db->queryrow('SELECT system_global_x, system_global_y FROM starsystems WHERE system_id = ' . $game->planet['system_id']);
    $sql = 'SELECT s.*,u.user_name,COUNT(b.id) AS num_bids FROM (ship_trade s)
			LEFT JOIN (user u) ON u.user_id=s.user
			LEFT JOIN (bidding b) ON b.trade_id=s.id
			LEFT JOIN (ships sh) ON sh.ship_id=s.ship_id
			LEFT JOIN (ship_templates t) ON t.id=sh.template_id
			WHERE s.user ' . $str_compare . ' ' . $game->player['user_id'] . ' AND b.user='******'user_id'] . ' AND s.end_time>=' . $ACTUAL_TICK . ' AND t.ship_class IN (' . implode(',', $sels) . ') GROUP BY s.id ORDER BY s.end_time ASC
			';
    if (($tradedata = $db->queryrowset($sql)) === false) {
        message(DATABASE_ERROR, 'Internal database error');
    }
    $nr = 0;
    $str_firstfield = constant($game->sprache("TEXT98"));
    if ($own_only) {
        $str_firstfield = constant($game->sprache("TEXT99"));
    }
    $str_lastfield = constant($game->sprache("TEXT64"));
    if ($own_only) {
        $str_lastfield = constant($game->sprache("TEXT100"));
    }
    $str_own = '';
    if ($own_only) {
        $str_own = constant($game->sprache("TEXT101")) . ' ';
    }
    /* 26/02/08 - AC: Check if it's currently present in the url request */
    if (!isset($_REQUEST['page'])) {
        $_REQUEST['page'] = 0;
    }
    $game->out('<center><span class="sub_caption">' . $str_own . ' ' . constant($game->sprache("TEXT8")) . ' ' . HelpPopup($own_only == true ? 'trade_viewownauction' : 'trade_viewauction') . ' :</span></center><br>');
    // Men << >>
    $game->out('<br><center><table border=0 cellpadding=2 cellspacing=2 class="style_inner" width=300><tr>
		<td width=150 align=middle><a href="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&page=' . ($_REQUEST['page'] - 1)) . '">' . constant($game->sprache("TEXT102")) . '</a>
		</td><td width=150 align=middle><a href="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&page=' . ($_REQUEST['page'] + 1)) . '">' . constant($game->sprache("TEXT103")) . '</a>
		</td></tr></table><br>');
    $game->out('<center><table border=0 cellpadding=1 cellspacing=1 class="style_outer">
		<tr><td><span class="sub_caption2">' . constant($game->sprache("TEXT104")) . '</span><br>
		<table border=0 cellpadding=1 cellspacing=1 class="style_inner" width=300>
		<tr>
		<td width=150 valign=top>
		<form name="type0form" method="post" action="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&trigger=1&page=' . $_REQUEST['page']) . '"><input type="checkbox" name="type_0" value="1"' . ($_POST['type_0'] == 1 ? ' checked="checked"' : '') . '  onChange="document.type0form.submit()">' . constant($game->sprache("TEXT105")) . '</form>
		</td><td width=150 valign=top>
		<form name="type1form" method="post" action="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&trigger=2&page=' . $_REQUEST['page']) . '"><input type="checkbox" name="type_1" value="1"' . ($_POST['type_1'] == 1 ? ' checked="checked"' : '') . '  onChange="document.type1form.submit()">' . constant($game->sprache("TEXT106")) . '</form>
		</td></tr><td>
		<form name="type2form" method="post" action="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&trigger=3&page=' . $_REQUEST['page']) . '"><input type="checkbox" name="type_2" value="1"' . ($_POST['type_2'] == 1 ? ' checked="checked"' : '') . '  onChange="document.type2form.submit()">' . constant($game->sprache("TEXT107")) . '</form>
		</td><td>
		<form name="type3form" method="post" action="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&trigger=4&page=' . $_REQUEST['page']) . '"><input type="checkbox" name="type_3" value="1"' . ($_POST['type_3'] == 1 ? ' checked="checked"' : '') . '  onChange="document.type3form.submit()">' . constant($game->sprache("TEXT108")) . '</form>
		</td>
		</tr></table>
		</td>
		</tr></table>
		</center><br>');
    $game->out('<center><table border=0 cellpadding=2 cellspacing=2 width=530 class="style_outer">');
    if (!isset($_REQUEST['page']) || $_REQUEST['page'] < 0) {
        $_REQUEST['page'] = 0;
    }
    $game->out('<tr><td width=530>
	<span class="sub_caption2">' . constant($game->sprache("TEXT109")) . ' ' . ($_REQUEST['page'] + 1) . ' ' . constant($game->sprache("TEXT110")) . ' ~' . round(count($tradedata) / $per_page + 1) . ')</span>');
    $game->out('<table border=0 cellpadding=4 cellspacing=0 width=530 class="style_inner">
	<tr><td width=235><b>' . constant($game->sprache("TEXT111")) . '</u></td><td width=200><b>' . constant($game->sprache("TEXT112")) . '</u></td><td width=25><b>#:</b></td><td width=70><b>' . constant($game->sprache("TEXT113")) . '</b></td>');
    for ($t = $_REQUEST['page'] * $per_page; $t < $_REQUEST['page'] * $per_page + $per_page; $t++) {
        if (isset($tradedata[$t])) {
            $sql = 'SELECT COUNT(*) AS num_bids FROM bidding WHERE trade_id = ' . $tradedata[$t]['id'];
            $count_bid = $db->queryrow($sql);
            $tradedata[$t]['num_bids'] = $count_bid['num_bids'];
            if ($tradedata[$t]['num_bids'] < 2) {
                $actual_price = '<img src="' . $game->GFX_PATH . 'menu_metal_small.gif">&nbsp;' . $tradedata[$t]['resource_1'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_mineral_small.gif">&nbsp;' . $tradedata[$t]['resource_2'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_latinum_small.gif">&nbsp;' . $tradedata[$t]['resource_3'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit1_small.gif">&nbsp;' . $tradedata[$t]['unit_1'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit2_small.gif">&nbsp;' . $tradedata[$t]['unit_2'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit3_small.gif">&nbsp;' . $tradedata[$t]['unit_3'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit4_small.gif">&nbsp;' . $tradedata[$t]['unit_4'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit5_small.gif">&nbsp;' . $tradedata[$t]['unit_5'];
                $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit6_small.gif">&nbsp;' . $tradedata[$t]['unit_6'];
            } else {
                $prelast_bid = $db->queryrow('SELECT * FROM bidding  WHERE trade_id = "' . $tradedata[$t]['id'] . '" ORDER BY max_bid DESC LIMIT 1,1');
                // Um zu testen, ob ein Gleichstand besteht, dann wird ja nicht max_bid +1
                $last_bid = $db->queryrow('SELECT * FROM bidding WHERE trade_id = "' . $tradedata[$t]['id'] . '" ORDER BY max_bid DESC LIMIT 1');
                if ($last_bid['max_bid'] != $prelast_bid['max_bid']) {
                    $actual_price = '<img src="' . $game->GFX_PATH . 'menu_metal_small.gif">&nbsp;' . ($tradedata[$t]['resource_1'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_resource_1']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_mineral_small.gif">&nbsp;' . ($tradedata[$t]['resource_2'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_resource_2']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_latinum_small.gif">&nbsp;' . ($tradedata[$t]['resource_3'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_resource_3']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit1_small.gif">&nbsp;' . ($tradedata[$t]['unit_1'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_unit_1']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit2_small.gif">&nbsp;' . ($tradedata[$t]['unit_2'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_unit_2']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit3_small.gif">&nbsp;' . ($tradedata[$t]['unit_3'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_unit_3']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit4_small.gif">&nbsp;' . ($tradedata[$t]['unit_4'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_unit_4']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit5_small.gif">&nbsp;' . ($tradedata[$t]['unit_5'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_unit_5']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit6_small.gif">&nbsp;' . ($tradedata[$t]['unit_6'] + ($prelast_bid['max_bid'] + 1) * $tradedata[$t]['add_unit_6']);
                } else {
                    $actual_price = '<img src="' . $game->GFX_PATH . 'menu_metal_small.gif">&nbsp;' . ($tradedata[$t]['resource_1'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_resource_1']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_mineral_small.gif">&nbsp;' . ($tradedata[$t]['resource_2'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_resource_2']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_latinum_small.gif">&nbsp;' . ($tradedata[$t]['resource_3'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_resource_3']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit1_small.gif">&nbsp;' . ($tradedata[$t]['unit_1'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_unit_1']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit2_small.gif">&nbsp;' . ($tradedata[$t]['unit_2'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_unit_2']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit3_small.gif">&nbsp;' . ($tradedata[$t]['unit_3'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_unit_3']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit4_small.gif">&nbsp;' . ($tradedata[$t]['unit_4'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_unit_4']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit5_small.gif">&nbsp;' . ($tradedata[$t]['unit_5'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_unit_5']);
                    $actual_price .= '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_unit6_small.gif">&nbsp;' . ($tradedata[$t]['unit_6'] + $prelast_bid['max_bid'] * $tradedata[$t]['add_unit_6']);
                }
            }
            $font_color = '#ffffff';
            $font_bold = '';
            if ($tradedata[$t]['font_bold']) {
                $font_bold = '<b>';
            }
            if ($tradedata[$t]['font_colored']) {
                $font_color = '#ffaaaa';
            }
            $game->out('<tr onMouseOver="mOver(this);" onMouseOut="mOut(this);" onClick="location.href=\'' . parse_link('a=trade&view=view_bidding_detail&id=' . $tradedata[$t]['id']) . '\'"  color:' . $font_color . ';">
				<td>' . $font_bold . $tradedata[$t]['header'] . '</b></td><td>' . $font_bold . $actual_price . '</b></td><td>' . $font_bold . $tradedata[$t]['num_bids'] . '</b></td><td>' . $font_bold . Zeit(TICK_DURATION * ($tradedata[$t]['end_time'] - $ACTUAL_TICK) + round($NEXT_TICK / 60, 0)) . '</b></td></tr>');
        }
    }
    $game->out('</table></td></tr></table>');
    // Men << >>
    $game->out('<br><center><table border=0 cellpadding=2 cellspacing=2 class="style_inner" width=300><tr>
		<td width=150 align=middle><a href="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&page=' . ($_REQUEST['page'] - 1)) . '">' . constant($game->sprache("TEXT102")) . '</a>
		</td><td width=150 align=middle><a href="' . parse_link('a=trade&view=' . $_REQUEST['view'] . '&page=' . ($_REQUEST['page'] + 1)) . '">' . constant($game->sprache("TEXT103")) . '</a>
		</td></tr></table>');
}
示例#4
0
function Show_Main()
{
    global $db;
    global $game;
    global $UNIT_NAME, $UNIT_DESCRIPTION, $UNIT_DATA, $MAX_BUILDING_LVL, $NEXT_TICK, $ACTUAL_TICK;
    $pow_factor = 2;
    ///////////////////////// 1st Build in Progress
    if ($game->planet['unittrainid_nexttime'] > 0) {
        $game->out('
<table border="0" cellpadding="1" cellspacing="1" width="350" class="style_outer"><tr><td>
<table border="0" cellpadding="1" cellspacing="1" width="350" class="style_inner"><tr><td>');
        if ($game->planet['unittrainid_' . $game->planet['unittrain_actual']] <= 6) {
            $game->out(constant($game->sprache("Text1")) . ' <b>' . $UNIT_NAME[$game->player['user_race']][$game->planet['unittrainid_' . $game->planet['unittrain_actual']] - 1] . '</b><br>
	' . constant($game->sprache("Text2")));
            if ($game->planet['unittrain_error'] == 0) {
                $game->out('<b id="timer3" title="time1_' . ($NEXT_TICK + TICK_DURATION * 60 * ($game->planet['unittrainid_nexttime'] - $ACTUAL_TICK)) . '_type1_1">&nbsp;</b>');
            } else {
                if ($game->planet['unittrain_error'] == 1) {
                    $game->out('<b>' . constant($game->sprache("Text3")) . '</b>');
                } else {
                    $game->out('<b>' . constant($game->sprache("Text36")) . '</b>');
                }
            }
        } else {
            $text = constant($game->sprache("Text26"));
            if ($game->planet['unittrainid_' . $game->planet['unittrain_actual']] == 11) {
                $text = constant($game->sprache("Text27"));
            }
            if ($game->planet['unittrainid_' . $game->planet['unittrain_actual']] == 12) {
                $text = constant($game->sprache("Text28"));
            }
            $game->out(constant($game->sprache("Text4")) . '- <b>' . $text . '</b><br>' . constant($game->sprache("Text5")) . '
<b id="timer3" title="time1_' . ($NEXT_TICK + TICK_DURATION * 60 * ($game->planet['unittrainid_nexttime'] - $ACTUAL_TICK)) . '_type1_1">&nbsp;</b>');
        }
        $game->out('</td></tr></table></td></tr></table><br>');
        $game->set_autorefresh($NEXT_TICK + TICK_DURATION * 60 * ($game->planet['unittrainid_nexttime'] - $ACTUAL_TICK));
    }
    //////////////////////// 2nd Buildmenu
    $game->out('<table border="0" cellpadding="2" cellspacing="2" width="400" class="style_outer">
  <tr><td width=100%><span class="sub_caption2">' . constant($game->sprache("Text6")) . '</span><br>
  <table border=0 cellpadding=1 cellspacing=1 width=398 class="style_inner">');
    $game->out(constant($game->sprache("Text7")));
    for ($t = 0; $t < 6; $t++) {
        if (UnitMetRequirements($t)) {
            $game->out('<tr height=20><td><img src="' . $game->GFX_PATH . 'menu_unit' . ($t + 1) . '_small.gif">&nbsp;<b><a href="javascript:void(0);" onmouseover="return overlib(\'' . $UNIT_DESCRIPTION[$game->player['user_race']][$t] . constant($game->sprache("Text8")) . GetAttackUnit($t) . constant($game->sprache("Text9")) . $UNIT_DATA[$t][5] . constant($game->sprache("Text10")) . GetDefenseUnit($t) . constant($game->sprache("Text9")) . $UNIT_DATA[$t][6] . ')\', CAPTION, \'' . $UNIT_NAME[$game->player['user_race']][$t] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $UNIT_NAME[$game->player['user_race']][$t] . ' (' . $game->planet['unit_' . ($t + 1) . ''] . ')</a></b></td><td><img src="' . $game->GFX_PATH . 'menu_metal_small.gif"> ' . UnitPrice($t, 0) . '&nbsp;&nbsp; <img src="' . $game->GFX_PATH . 'menu_mineral_small.gif">' . UnitPrice($t, 1) . '&nbsp;&nbsp; <img src="' . $game->GFX_PATH . 'menu_latinum_small.gif"> ' . UnitPrice($t, 2) . '&nbsp;&nbsp; <img src="' . $game->GFX_PATH . 'menu_worker_small.gif"> ' . UnitPrice($t, 3) . '</td><td>' . UnitTime($t) . '</td></tr>');
        }
    }
    $game->out('</td></tr></table></td></tr></table>');
    $game->out('<br><span class="sub_caption">' . constant($game->sprache("Text11")) . HelpPopup('academy_1') . ' :</span><br><br>
<table border="0" cellpadding="2" cellspacing="2" width="400" class="style_outer"><tr><td width=100%><span class="sub_caption2">');
    if ($game->planet['unittrainid_nexttime'] > 0) {
        $game->out(constant($game->sprache("Text12")));
    } else {
        $game->out(constant($game->sprache("Text13")));
    }
    $game->out('</span>');
    $game->out('<table border="0" cellpadding="2" cellspacing="2" width="400" class="style_inner">
<tr><td align="center">
<br>
<form name="academy" method="post" action="' . parse_link('a=academy') . '"><input type="submit" name="start_list" class="button_nosize" value="' . constant($game->sprache("Text23")) . '">&nbsp;&nbsp;&nbsp;<input type="submit" name="stop_list" class="button_nosize" value="' . constant($game->sprache("Text24")) . '"></form>

</td></tr></table></td></tr></table>');
    $game->out('<br><span class="sub_caption">' . constant($game->sprache("Text14")) . ' ' . HelpPopup('academy_2') . ' :</span><br>');
    $game->out('<script language="JavaScript">
function UpdateTroops() {
    var tmpl = document.getElementById("templates_list");
    var units = tmpl.options[tmpl.selectedIndex].value.split(\',\',7);
    for (t=1;t<=6;t++)
        document.getElementById( "unit"+t ).firstChild.nodeValue = units[t];
}
</script>');
    $game->out('<br><form name="academy" method="post" action="' . parse_link('a=academy') . '">
<table border="0" cellpadding="2" cellspacing="2" width="400" class="style_outer">
  <tr><td width=100%><span class="sub_caption2">' . constant($game->sprache("Text38")) . '</span><br>
  <table border=0 cellpadding=1 cellspacing=1 width=398 class="style_inner">');
    $sql = 'SELECT `id`,`name`,`min_unit_1`,`min_unit_2`,`min_unit_3`,
            `min_unit_4`,`unit_5` AS min_unit_5, `unit_6` AS min_unit_6
        FROM ship_templates
        WHERE removed <> 1 AND owner = ' . $game->player['user_id'];
    $templates = $db->query($sql);
    $game->out('<tr><td>' . constant($game->sprache("Text39")) . '<select name="templates_list" id="templates_list" class="Select" size="1" onChange="UpdateTroops();"><option value="-1,0,0,0,0,0,0">' . constant($game->sprache("Text25")) . '</option>');
    while ($template = $db->fetchrow($templates)) {
        $game->out('<option value="' . $template['id'] . ',' . $template['min_unit_1'] . ',' . $template['min_unit_2'] . ',' . $template['min_unit_3'] . ',' . $template['min_unit_4'] . ',' . $template['min_unit_5'] . ',' . $template['min_unit_6'] . '">' . $template['name'] . '</option>');
    }
    $game->out('</select></td>');
    for ($t = 0; $t < 6; $t++) {
        $game->out('<td><img src="' . $game->GFX_PATH . 'menu_unit' . ($t + 1) . '_small.gif">&nbsp;<b id="unit' . ($t + 1) . '">0</b></td>');
    }
    $game->out('<td><input type="submit" name="apply_template" class="button_nosize" value="' . constant($game->sprache("Text40")) . '"></td></tr></table></td></tr></table></form>');
    $game->out('<br><table border="0" cellpadding="2" cellspacing="2" width="400" class="style_outer"><tr><td width=100%>
<span class="sub_caption2">' . constant($game->sprache("Text15")) . '</span><br>
<table border=0 cellpadding=2 cellspacing=2 width=398 class="style_inner">
<tr><td align="center">
<form name="academy" method="post" action="' . parse_link('a=academy') . '">
<table border=0 cellpadding=2 cellspacing=2 width=280><tr><td>&nbsp;</td>' . constant($game->sprache("Text16")) . '</tr>');
    for ($t = 0; $t < 10; $t++) {
        if ($game->planet['unittrain_actual'] != $t + 1) {
            $game->out('<tr><td>&nbsp;</td><td width=40>' . ($t + 1) . ':</td>');
        } else {
            $game->out('<tr><td><img src="' . $game->PLAIN_GFX_PATH . 'arrow_right.png"></td><td width=40><b><u>' . ($t + 1) . '</u></b>:</td>');
        }
        $game->out('<td width=150><select name="listid_' . $t . '" class="Select" size="1"><option value="-1">' . constant($game->sprache("Text25")) . '</option>');
        if ($game->planet['unittrainid_' . ($t + 1)] == 10) {
            $game->out(constant($game->sprache("Text17")));
        } else {
            $game->out(constant($game->sprache("Text18")));
        }
        if ($game->planet['unittrainid_' . ($t + 1)] == 11) {
            $game->out(constant($game->sprache("Text31")));
        } else {
            $game->out(constant($game->sprache("Text32")));
        }
        if ($game->planet['unittrainid_' . ($t + 1)] == 12) {
            $game->out(constant($game->sprache("Text33")));
        } else {
            $game->out(constant($game->sprache("Text34")));
        }
        for ($u = 0; $u < 6; $u++) {
            if (UnitMetRequirements($u)) {
                if ($game->planet['unittrainid_' . ($t + 1)] == $u + 1) {
                    $game->out('<option value="' . ($u + 1) . '" selected>' . $UNIT_NAME[$game->player['user_race']][$u] . '</option>');
                } else {
                    $game->out('<option value="' . ($u + 1) . '">' . $UNIT_NAME[$game->player['user_race']][$u] . '</option>');
                }
            }
        }
        $number = $game->planet['unittrainnumber_' . ($t + 1)];
        if ($game->planet['unittrainendless_' . ($t + 1)] != 1) {
            $number = $game->planet['unittrainnumberleft_' . ($t + 1)];
        }
        $game->out('
</select>
</td>
<td>
<input type="text" name="listnumber_' . $t . '" value="' . $number . '" class="Field_nosize" size="10" maxlength="5">
</td>
<td>
<input type="checkbox" name="listendless_' . $t . '" value="1" ' . ($game->planet['unittrainendless_' . ($t + 1)] ? 'checked="checked"' : '') . '>
</select>
</td>

</tr>
');
    }
    $game->out('</table>' . constant($game->sprache("Text19")) . '&nbsp;<img src="' . $game->PLAIN_GFX_PATH . 'arrow_right.png">&nbsp;' . constant($game->sprache("Text19a")) . '<br>
<input type="submit" name="exec_list" class="button_nosize" value="' . constant($game->sprache("Text22")) . '">&nbsp;&nbsp;
<input type="submit" name="reset_list" class="button_nosize" value="' . constant($game->sprache("Text35")) . '"></form></td></tr></table></td></tr></table>');
}
示例#5
0
function Show_Main()
{
    global $db;
    global $game;
    global $NUM_BUILDING, $BUILDING_DESCRIPTION, $BUILDING_NAME, $BUILDING_DATA, $MAX_BUILDING_LVL, $NEXT_TICK, $ACTUAL_TICK;
    $capital = $game->player['user_capital'] == $game->planet['planet_id'] ? 1 : 0;
    if ($game->player['pending_capital_choice']) {
        $capital = 0;
    }
    // Clickids:
    $game->register_click_id(11);
    // Retrieve construction queue for the planet ordered by time
    $sql = 'SELECT * FROM scheduler_instbuild
            WHERE planet_id="' . $game->planet['planet_id'] . '"
            ORDER by build_start ASC';
    $schedulerquery = $db->query($sql);
    if (($queued = $db->num_rows()) > 0) {
        // Timer ID
        $t = 3;
        while ($scheduler = $db->fetchrow($schedulerquery)) {
            // From now on the level of the building is currently developed at the final stage:
            $game->planet['building_' . ($scheduler['installation_type'] + 1)]++;
            $game->out('<table border=0 cellpadding=1 cellspacing=1 width=330 class="style_outer"><tr><td>
<table border=0 cellpadding=1 cellspacing=1 width=330 class="style_inner"><tr><td>
' . constant($game->sprache("TEXT11")) . ' <b>' . $BUILDING_NAME[$game->player['user_race']][$scheduler['installation_type']] . ' (' . constant($game->sprache("TEXT12")) . ' ' . $game->planet['building_' . ($scheduler['installation_type'] + 1)] . ')</b><br>
' . constant($game->sprache("TEXT13")) . '
<b id="timer' . $t . '" title="time1_' . ($NEXT_TICK + TICK_DURATION * 60 * ($scheduler['build_finish'] - $ACTUAL_TICK)) . '_type1_1">&nbsp;</b><br>
<a href="' . parse_link_ex('a=building&a2=abort_build&id=' . $scheduler['installation_type'], LINK_CLICKID) . '"><b>' . constant($game->sprache("TEXT14")) . '</b></a>
</td></tr></table>
</td></tr></table><br>');
            // Prepare another timer
            $t++;
            $game->set_autorefresh($NEXT_TICK + TICK_DURATION * 60 * ($scheduler['build_finish'] - $ACTUAL_TICK) + TICK_DURATION);
        }
    }
    // Calculate available energy power
    $avail = $game->planet['building_5'] * 11 + 14;
    if (!$capital) {
        $avail = $game->planet['building_5'] * 15 + 3;
    }
    // Calculate energy power consumption
    $used = $game->planet['building_1'] + $game->planet['building_2'] + $game->planet['building_3'] + $game->planet['building_4'] + $game->planet['building_10'] + $game->planet['building_6'] + $game->planet['building_7'] + $game->planet['building_8'] + $game->planet['building_9'] + $game->planet['building_11'] + $game->planet['building_12'] + $game->planet['building_13'];
    $game->out(constant($game->sprache("TEXT16")) . ' <b id="timer2" title="time1_' . $NEXT_TICK . '_type1_3">&nbsp;</b> ' . constant($game->sprache("TEXT17")) . '<br>' . constant($game->sprache("TEXT18")) . ' ' . $used . '/' . $avail . ' ' . constant($game->sprache("TEXT19")) . '<br><br>');
    $game->out('<span class="sub_caption">' . constant($game->sprache($queued ? "TEXT21" : "TEXT20")) . ' ' . HelpPopup('building_1') . ' :</span><br><br>');
    $game->out('<table border=0 cellpadding=2 cellspacing=2 width=90% class="style_outer">
<tr><td width=100%>
<table border=0 cellpadding=2 cellspacing=2 width=100% class="style_inner">
<tr>
    <td width=130><b>' . constant($game->sprache("TEXT29")) . '</b></td>
    <td width=155><b>' . constant($game->sprache("TEXT22")) . '</b></td>
    <td width=75><b>' . constant($game->sprache("TEXT23")) . '</b></td>
    <td width=130><b>' . constant($game->sprache("TEXT24")) . '</b></td>
</tr>');
    for ($tt = 0; $tt <= $NUM_BUILDING; $tt++) {
        if ($tt > 9) {
            $t = $tt - 1;
        } else {
            $t = $tt;
        }
        if ($tt == 9) {
            $t = 12;
        }
        if (areRequirementsMet($t)) {
            // Check if building has reached maximum level
            if ($game->planet['building_' . ($t + 1)] >= $MAX_BUILDING_LVL[$capital][$t]) {
                $met = $min = $lat = $build_time = 0;
                $build_text = constant($game->sprache("TEXT28"));
            } else {
                // Calculate required resources for next building level
                $met = GetBuildingPrice($t, 0);
                $min = GetBuildingPrice($t, 1);
                $lat = GetBuildingPrice($t, 2);
                $fut = GetFuturePts($t);
                // Calculate points gained for this building
                $points = round(pow($game->planet['building_' . ($t + 1)] + 1, 1.5) - pow($game->planet['building_' . ($t + 1)], 1.5));
                if ($game->planet['resource_1'] >= $met && $game->planet['resource_2'] >= $min && $game->planet['resource_3'] >= $lat && $game->planet['planet_available_points'] >= $fut) {
                    $build_text = '<a href="' . parse_link_ex('a=building&a2=start_build&id=' . $t, LINK_CLICKID) . '"><span style="color: green">' . constant($game->sprache("TEXT25")) . ' (~' . $points . ' ' . constant($game->sprache("TEXT26")) . ')</span></a>';
                    if ($game->planet['building_' . ($t + 1)] > 0) {
                        $build_text = '<a href="' . parse_link_ex('a=building&a2=start_build&id=' . $t, LINK_CLICKID) . '"><span style="color: green">' . constant($game->sprache("TEXT27")) . ' ' . ($game->planet['building_' . ($t + 1)] + 1) . ' (~' . $points . ' ' . constant($game->sprache("TEXT26")) . ')</span></a>';
                    }
                } else {
                    $build_text = '<span style="color: red">' . constant($game->sprache("TEXT25")) . ' (~' . $points . ' ' . constant($game->sprache("TEXT26")) . ')</span>';
                    if ($game->planet['building_' . ($t + 1)] > 0) {
                        $build_text = '<span style="color: red">' . constant($game->sprache("TEXT27")) . ' ' . ($game->planet['building_' . ($t + 1)] + 1) . ' (~' . $points . ' ' . constant($game->sprache("TEXT26")) . ')</span>';
                    }
                }
                // Calculate required construction time
                $build_time = GetBuildingTime($t);
            }
            $game->out('
<tr>
    <td><b><a href="javascript:void(0);" onmouseover="return overlib(\'' . $BUILDING_DESCRIPTION[$game->player['user_race']][$t] . '\', CAPTION, \'' . $BUILDING_NAME[$game->player['user_race']][$t] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $BUILDING_NAME[$game->player['user_race']][$t] . '</b></td>
    <td><img src="' . $game->GFX_PATH . 'menu_metal_small.gif"> ' . $met . '&nbsp;&nbsp; <img src="' . $game->GFX_PATH . 'menu_mineral_small.gif">' . $min . '&nbsp;&nbsp; <img src="' . $game->GFX_PATH . 'menu_latinum_small.gif"> ' . $lat . '&nbsp; </td>
    <td>' . $build_time . '</td>
    <td>' . $build_text . '</td>
</tr>');
        }
    }
    $game->out('</table></td></tr></table>');
}
示例#6
0
function Show_Main()
{
    global $db;
    global $game;
    global $ship_components;
    global $TECH_DATA, $TECH_DESCRIPTION, $TECH_NAME, $MAX_RESEARCH_LVL, $NEXT_TICK, $ACTUAL_TICK, $BUILDING_NAME;
    $pow_factor = 2;
    // Clickids:
    $game->register_click_id(12);
    $capital = $game->player['user_capital'] == $game->planet['planet_id'] ? 1 : 0;
    if ($game->player['pending_capital_choice']) {
        $capital = 0;
    }
    $schedulerquery = $db->query('SELECT * FROM scheduler_research WHERE planet_id="' . $game->planet['planet_id'] . '"');
    while ($scheduler = $db->fetchrow($schedulerquery)) {
        $game->out('<table border=0 cellpadding=1 cellspacing=1 width=300 class="style_outer"><tr><td>
<table border=0 cellpadding=2 cellspacing=2 width=300 class="style_inner"><tr><td>');
        if ($scheduler['research_id'] < 5) {
            $game->out(constant($game->sprache("TEXT20")) . ' <b>' . $TECH_NAME[$game->player['user_race']][$scheduler['research_id']] . '</b><br>');
            $timer = 'timer3';
        } else {
            $game->out(constant($game->sprache("TEXT20")) . ' <b>' . $ship_components[$game->player['user_race']][$scheduler['research_id'] - 5][$game->planet['catresearch_' . ($scheduler['research_id'] - 4)]]['name'] . '</b><br>');
            $timer = 'timer4';
        }
        $game->out(constant($game->sprache("TEXT21")) . '
<b id="' . $timer . '" title="time1_' . ($NEXT_TICK + TICK_DURATION * 60 * ($scheduler['research_finish'] - $ACTUAL_TICK)) . '_type1_1">&nbsp;</b><br>
<a href="' . parse_link_ex('a=researchlabs&a2=abort_research&id=' . $scheduler['research_id'], LINK_CLICKID) . '"><b>' . constant($game->sprache("TEXT22")) . '</b></a>
</td></tr></table></td></tr></table><br>');
        $game->set_autorefresh($NEXT_TICK + TICK_DURATION * 60 * ($scheduler['research_finish'] - $ACTUAL_TICK));
    }
    $game->out('' . constant($game->sprache("TEXT23")) . ' <b id="timer2" title="time1_' . $NEXT_TICK . '_type1_3">&nbsp;</b> ' . constant($game->sprache("TEXT24")) . '<br><br><br>');
    // Ship components research:
    $game->out('<span class="sub_caption">' . constant($game->sprache("TEXT25")) . ' ' . HelpPopup('research_catresearch') . ' :</span><br><br>');
    $game->out('<table border=0 cellpadding=2 cellspacing=2 width=90% class="style_outer">');
    $game->out('
<tr><td width=100%>
<table border=0 cellpadding=2 cellspacing=2 width=100% class="style_inner">
<tr>
<td width=18%><b>' . constant($game->sprache("TEXT26")) . '</b></td>
<td width=24%><b>' . constant($game->sprache("TEXT27")) . '</b></td>
<td width=30%><b>' . constant($game->sprache("TEXT0")) . '</b></td>
<td width=14%><b>' . constant($game->sprache("TEXT28")) . '</b></td>
<td width=14%>&nbsp;
</td></tr>
');
    // 30/05/12 - AC: Retrieve research times for all the categories at ONE time
    $cat_times = GetCatsResearchTimes();
    foreach ($ship_components[$game->player['user_race']] as $key => $components) {
        //if ($game->planet['catresearch_'.($key+1)]>=$components['num']) continue;
        if ($game->planet['catresearch_' . ($key + 1)] >= $game->planet['building_9'] && $game->planet['building_9'] < 9) {
            $components[$game->planet['catresearch_' . ($key + 1)]]['name'] = constant($game->sprache("TEXT29"));
            $build_text = '<span style="color: red">' . constant($game->sprache("TEXT30")) . '</span>';
        } elseif ($game->planet['resource_1'] >= GetCatResearchPrice($game->planet['catresearch_' . ($key + 1)], 0) && $game->planet['resource_2'] >= GetCatResearchPrice($game->planet['catresearch_' . ($key + 1)], 1) && $game->planet['resource_3'] >= GetCatResearchPrice($game->planet['catresearch_' . ($key + 1)], 2)) {
            $build_text = '<a href="' . parse_link_ex('a=researchlabs&a2=start_catresearch&id=' . $key, LINK_CLICKID) . '"><span style="color: green">' . constant($game->sprache("TEXT30")) . '</span></a>';
        } else {
            $build_text = '<span style="color: red">' . constant($game->sprache("TEXT30")) . '</span>';
        }
        // 03/04/08 - AC: Show "Completed" instead of remove completely the line
        if ($game->planet['catresearch_' . ($key + 1)] >= $components['num']) {
            $build_text = constant($game->sprache("TEXT39"));
        }
        /* 22/04/08 - AC: Translate HTML code into plain char */
        $trans = array("&#146;" => "'");
        $tmp = strtr(html_entity_decode($components[$game->planet['catresearch_' . ($key + 1)]]['name']), $trans);
        /* */
        if (strlen($tmp) > 18) {
            //$compname=substr($components[$game->planet['catresearch_'.($key+1)]]['name'], 0,16);
            $compname = substr($tmp, 0, 16);
            $compname = $compname . '...';
        } else {
            $compname = $components[$game->planet['catresearch_' . ($key + 1)]]['name'];
        }
        /* 22/04/08 - AC: Translate HTML code into plain char */
        $trans = array("&#146;" => "'");
        $tmp = strtr(html_entity_decode($components['name']), $trans);
        /* */
        if (strlen($tmp) > 13) {
            /*if($components['text_category'] !=null)
            {
            
            //$catname='<a href="javascript:void(0);" onmouseover="return overlib(\''.$components['text_category'].'\',CAPTION,\''.$components['name'].'\', '.OVERLIB_STANDARD.');" onmouseout="return nd();"><font color="#FFFFFF">'.substr($components['name'], 0,11);
            $catname='<a href="javascript:void(0);" onmouseover="return overlib(\''.$components['text_category'].'\',CAPTION,\''.$components['name'].'\', '.OVERLIB_STANDARD.');" onmouseout="return nd();"><font color="#FFFFFF">'.substr($tmp, 0,11);
            $catname=$catname.'...</font></a>';
            }else{*/
            //$catname='<a href="javascript:void(0);" onmouseover="return overlib(\'\',CAPTION,\''.$components['name'].'\', '.OVERLIB_STANDARD.');" onmouseout="return nd();"><font color="#FFFFFF">'.substr($components['name'], 0,11);
            $catname = '<a href="javascript:void(0);" onmouseover="return overlib(\'\',CAPTION,\'' . $components['name'] . '\', ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><font color="#FFFFFF">' . substr($tmp, 0, 11);
            $catname = $catname . '...</font></a>';
            /*}*/
        } else {
            /*if($components['text_category'] !=null)
            {
            $catname='<a href="javascript:void(0);" onmouseover="return overlib(\''.$components['text_category'].'\',CAPTION,\''.$components['name'].'\', '.OVERLIB_STANDARD.');" onmouseout="return nd();"><font color="#FFFFFF">'.$components['name'].'</font></a>';
            }else{*/
            $catname = $components['name'];
            /*}*/
        }
        if ($game->planet['catresearch_' . ($key + 1)] >= $game->planet['building_9'] && $game->planet['building_9'] < 9) {
            // Wenn man nicht erst Forschungszentrum hochbauen muss
            $game->out('<tr><td><b>' . $catname . '</b></td><td><b><a href="javascript:void(0);" onmouseover="return overlib(\'' . constant($game->sprache("TEXT31")) . ' ' . $BUILDING_NAME[$game->player['user_race']]['8'] . ' ' . constant($game->sprache("TEXT32")) . '\', CAPTION, \'' . $components[$game->planet['catresearch_' . ($key + 1)]]['name'] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $compname . '</a></b></td><td>');
        } else {
            $game->out('<tr><td><b>' . $catname . '</b></td><td><b><a href="javascript:void(0);" onmouseover="return overlib(\'' . CreateInfoText($components[$game->planet['catresearch_' . ($key + 1)]]) . '\', CAPTION, \'' . $components[$game->planet['catresearch_' . ($key + 1)]]['name'] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $compname . '</a></b></td><td>');
        }
        $game->out('<img src="' . $game->GFX_PATH . 'menu_metal_small.gif"> ' . GetCatResearchPrice($game->planet['catresearch_' . ($key + 1)], 0) . '&nbsp;&nbsp;
<img src="' . $game->GFX_PATH . 'menu_mineral_small.gif">' . GetCatResearchPrice($game->planet['catresearch_' . ($key + 1)], 1) . '&nbsp;&nbsp;
<img src="' . $game->GFX_PATH . 'menu_latinum_small.gif"> ' . GetCatResearchPrice($game->planet['catresearch_' . ($key + 1)], 2) . '&nbsp; </td><td>' . $cat_times[$key] . '</td><td>' . $build_text . '</td></tr>');
    }
    // while
    $game->out('</table></td></tr></table>');
    $game->out('<br><br>');
    $game->out('<span class="sub_caption">' . constant($game->sprache("TEXT33")) . ' ' . HelpPopup('research_localresearch') . ' :</span><br><br>');
    $game->out('<table border=0 cellpadding=2 cellspacing=2 width=90% class="style_outer">');
    $game->out('
<tr>
<td width=100%>
<table border=0 cellpadding=2 cellspacing=2 width=100% class="style_inner">
<tr><td width=25%><b>' . constant($game->sprache("TEXT34")) . '</b></td><td width=25%><b>' . constant($game->sprache("TEXT35")) . '</b></td><td width=25%><b>' . constant($game->sprache("TEXT36")) . '</b></td><td width=25%>&nbsp;</td></tr>');
    // Local research:
    for ($t = 0; $t < 5; $t++) {
        if ($t == 0 && $game->planet['building_9'] < 1 || $t == 1 && $game->planet['building_9'] < 1 || $t == 2 && $game->planet['building_9'] < 1 || $t == 3 && $game->planet['building_9'] < 1 || $t == 4 && ($game->planet['building_9'] < 3 || $game->planet['building_2'] < 5 || $game->planet['building_3'] < 5 || $game->planet['building_4'] < 5)) {
        } else {
            if ($game->planet['resource_1'] >= GetResearchPrice($t, 0) && $game->planet['resource_2'] >= GetResearchPrice($t, 1) && $game->planet['resource_3'] >= GetResearchPrice($t, 2)) {
                $build_text = '<a href="' . parse_link_ex('a=researchlabs&a2=start_research&id=' . $t, LINK_CLICKID) . '"><span style="color: green">' . constant($game->sprache("TEXT30")) . ' (~' . round(pow($game->planet['research_' . ($t + 1)] + 1, 1.5) - pow($game->planet['research_' . ($t + 1)], 1.5)) . ' ' . constant($game->sprache("TEXT37")) . ')</span></a>';
                if ($game->planet['research_' . ($t + 1)] > 0) {
                    $build_text = '<a href="' . parse_link_ex('a=researchlabs&a2=start_research&id=' . $t, LINK_CLICKID) . '"><span style="color: green">' . constant($game->sprache("TEXT38")) . ' ' . ($game->planet['research_' . ($t + 1)] + 1) . ' (~' . round(pow($game->planet['research_' . ($t + 1)] + 1, 1.5) - pow($game->planet['research_' . ($t + 1)], 1.5)) . ' ' . constant($game->sprache("TEXT37")) . ')</span></a>';
                }
                if ($game->planet['research_' . ($t + 1)] >= $MAX_RESEARCH_LVL[$capital][$t]) {
                    $build_text = constant($game->sprache("TEXT39"));
                }
            } else {
                $build_text = '<span style="color: red">' . constant($game->sprache("TEXT30")) . ' (~' . round(pow($game->planet['research_' . ($t + 1)] + 1, 1.5) - pow($game->planet['research_' . ($t + 1)], 1.5)) . ' ' . constant($game->sprache("TEXT30")) . ')</span>';
                if ($game->planet['research_' . ($t + 1)] > 0) {
                    $build_text = '<span style="color: red">' . constant($game->sprache("TEXT38")) . ' ' . ($game->planet['research_' . ($t + 1)] + 1) . ' (~' . round(pow($game->planet['research_' . ($t + 1)] + 1, 1.5) - pow($game->planet['research_' . ($t + 1)], 1.5)) . ' ' . constant($game->sprache("TEXT37")) . ')</span>';
                }
                if ($game->planet['research_' . ($t + 1)] >= $MAX_RESEARCH_LVL[$capital][$t]) {
                    $build_text = constant($game->sprache("TEXT39"));
                }
            }
            $game->out('<tr><td><b><a href="javascript:void(0);" onmouseover="return overlib(\'' . CreateResearchInfoText($t) . '\', CAPTION, \'' . $TECH_NAME[$game->player['user_race']][$t] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();">' . $TECH_NAME[$game->player['user_race']][$t] . '</b></td><td><img src="' . $game->GFX_PATH . 'menu_metal_small.gif">' . GetResearchPrice($t, 0) . '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_mineral_small.gif">' . GetResearchPrice($t, 1) . '&nbsp;&nbsp;<img src="' . $game->GFX_PATH . 'menu_latinum_small.gif">' . GetResearchPrice($t, 2) . '</td><td>&nbsp;' . GetResearchTime($t) . '</td><td>' . $build_text . '</td></tr>');
        }
    }
    $game->out('</td></tr></table></td></tr></table>');
}
示例#7
0
function Show_Build()
{
    global $db;
    global $game;
    global $SHIP_NAME, $SHIP_DESCRIPTION, $UNIT_DESCRIPTION, $UNIT_DATA, $UNIT_NAME, $SHIP_DATA, $MAX_BUILDING_LVL, $NEXT_TICK, $ACTUAL_TICK;
    if ($_REQUEST['count'] <= 0) {
        exit;
    }
    Show_Common_Menues();
    ///////////////////////// 3rd Ship template menu
    $game->out('<span class="sub_caption">' . constant($game->sprache("TEXT45")) . ' ' . HelpPopup('shipyard_2') . ':</span><br><br>');
    $game->out('<table border=0 cellpadding=2 cellspacing=2 width=400 class="style_outer"><tr><td>');
    $templatequery = $db->query('SELECT * FROM ship_templates WHERE (owner="' . $game->player['user_id'] . '") AND (removed=0) AND (id="' . $_REQUEST['id'] . '")');
    if (($template = $db->fetchrow($templatequery)) != true) {
        exit(0);
    }
    $maxunit[0] = $maxunit[1] = $maxunit[2] = $maxunit[3] = 0;
    if ($game->planet['unit_1'] > 0) {
        $maxunit[0] = floor($game->planet['unit_1'] / $_REQUEST['count']);
    } else {
        $maxunit[0] = 0;
    }
    if ($game->planet['unit_2'] > 0) {
        $maxunit[1] = floor($game->planet['unit_2'] / $_REQUEST['count']);
    } else {
        $maxunit[1] = 0;
    }
    if ($game->planet['unit_3'] > 0) {
        $maxunit[2] = floor($game->planet['unit_3'] / $_REQUEST['count']);
    } else {
        $maxunit[2] = 0;
    }
    if ($game->planet['unit_4'] > 0) {
        $maxunit[3] = floor($game->planet['unit_4'] / $_REQUEST['count']);
    } else {
        $maxunit[3] = 0;
    }
    if ($maxunit[0] > $template['max_unit_1']) {
        $maxunit[0] = $template['max_unit_1'];
    }
    if ($maxunit[1] > $template['max_unit_2']) {
        $maxunit[1] = $template['max_unit_2'];
    }
    if ($maxunit[2] > $template['max_unit_3']) {
        $maxunit[2] = $template['max_unit_3'];
    }
    if ($maxunit[3] > $template['max_unit_4']) {
        $maxunit[3] = $template['max_unit_4'];
    }
    $game->out('<span class="sub_caption2">' . constant($game->sprache("TEXT46")) . ' "' . $_REQUEST['count'] . 'x <a href="javascript:void(0);" onmouseover="return overlib(\'' . CreateInfoText($template) . '\', CAPTION, \'' . addslashes($template['name']) . '\', WIDTH, 500, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><span class="sub_caption2">' . $template['name'] . '</span></a>" ' . constant($game->sprache("TEXT47")) . '</span><br>

<form name="send" method="post" action="index.php?a=shipyard&a2=start_build&id=' . $template['id'] . '" onSubmit="return document.send.submit.disabled = true;">
<script type="text/javascript" language="JavaScript">
function maximum()
{
document.getElementsByName("count1")[0].value=' . $maxunit[0] . ';
document.getElementsByName("count2")[0].value=' . $maxunit[1] . ';
document.getElementsByName("count3")[0].value=' . $maxunit[2] . ';
document.getElementsByName("count4")[0].value=' . $maxunit[3] . ';
}
</script>

<table border=0 cellpadding=1 cellspacing=1 class="style_inner" width=400>

<tr>

<td width=200><img src="' . $game->GFX_PATH . 'menu_unit' . 1 . '_small.gif">&nbsp;<a href="javascript:void(0);" onmouseover="return overlib(\'' . $UNIT_DESCRIPTION[$game->player['user_race']][0] . '<br><u>' . constant($game->sprache("TEXT42")) . '</u> ' . GetAttackUnit(0) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[0][5] . ')<br><u>' . constant($game->sprache("TEXT44")) . '</u> ' . GetDefenseUnit(0) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[0][6] . ')\', CAPTION, \'' . $UNIT_NAME[$game->player['user_race']][0] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><b>' . $UNIT_NAME[$game->player['user_race']][0] . ' </b></a>

&nbsp;(' . $template['min_unit_1'] . '-' . $template['max_unit_1'] . ')

</td>

<td width=200><input type="text" name="count1" size="6" class="field_nosize" value="' . $template['min_unit_1'] . '"></td>

</tr>



<tr>

<td><img src="' . $game->GFX_PATH . 'menu_unit' . 2 . '_small.gif">&nbsp;<a href="javascript:void(0);" onmouseover="return overlib(\'' . $UNIT_DESCRIPTION[$game->player['user_race']][1] . '<br><u>' . constant($game->sprache("TEXT42")) . '</u> ' . GetAttackUnit(1) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[1][5] . ')<br><u>' . constant($game->sprache("TEXT44")) . '</u> ' . GetDefenseUnit(1) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[1][6] . ')\', CAPTION, \'' . $UNIT_NAME[$game->player['user_race']][1] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><b>' . $UNIT_NAME[$game->player['user_race']][1] . ' </b></a>

&nbsp;(' . $template['min_unit_2'] . '-' . $template['max_unit_2'] . ')

</td>

<td><input type="text" name="count2" size="6" class="field_nosize" value="' . $template['min_unit_2'] . '"></td>

</tr>



<tr>

<td><img src="' . $game->GFX_PATH . 'menu_unit' . 3 . '_small.gif">&nbsp;<a href="javascript:void(0);" onmouseover="return overlib(\'' . $UNIT_DESCRIPTION[$game->player['user_race']][2] . '<br><u>' . constant($game->sprache("TEXT42")) . '</u> ' . GetAttackUnit(2) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[2][5] . ')<br><u>' . constant($game->sprache("TEXT44")) . '</u> ' . GetDefenseUnit(2) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[2][6] . ')\', CAPTION, \'' . $UNIT_NAME[$game->player['user_race']][2] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><b>' . $UNIT_NAME[$game->player['user_race']][2] . ' </b></a>

&nbsp;(' . $template['min_unit_3'] . '-' . $template['max_unit_3'] . ')

</td>

<td><input type="text" name="count3" size="6" class="field_nosize" value="' . $template['min_unit_3'] . '"></td>

</tr>



<tr>

<td><img src="' . $game->GFX_PATH . 'menu_unit' . 4 . '_small.gif">&nbsp;<a href="javascript:void(0);" onmouseover="return overlib(\'' . $UNIT_DESCRIPTION[$game->player['user_race']][3] . '<br><u>' . constant($game->sprache("TEXT42")) . '</u> ' . GetAttackUnit(3) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[3][5] . ')<br><u>' . constant($game->sprache("TEXT44")) . '</u> ' . GetDefenseUnit(3) . ' (' . constant($game->sprache("TEXT43")) . ' ' . $UNIT_DATA[3][6] . ')\', CAPTION, \'' . $UNIT_NAME[$game->player['user_race']][3] . '\', WIDTH, 400, ' . OVERLIB_STANDARD . ');" onmouseout="return nd();"><b>' . $UNIT_NAME[$game->player['user_race']][3] . ' </b></a>

&nbsp;(' . $template['min_unit_4'] . '-' . $template['max_unit_4'] . ')

</td>

<td><input type="text" name="count4" size="6" class="field_nosize" value="' . $template['min_unit_4'] . '"></td>

</tr><tr>

<td colspan=2 align="center">

</b><i>' . constant($game->sprache("TEXT48")) . '</i>
<br>
<br><a href="javascript:maximum();"><u>' . constant($game->sprache("TEXT49")) . '</u></a>
<br>



<input type="hidden" name="correct_start" value="1">

<input type="hidden" name="count" value="' . $_REQUEST['count'] . '">

<input type="hidden" name="id" value="' . $_REQUEST['id'] . '"><br>
    
<input type="hidden" name="line_request" value=' . $_REQUEST['line_request'] . '><br>

<input type="submit" name="submit" class="button" value ="' . constant($game->sprache("TEXT50")) . '">

</form>

</td>

</tr>

</table>

</td></tr></table>');
}