function Show_Save()
{
    global $db;
    global $game;
    global $SHIP_TORSO, $SHIP_TORSO_DATA, $UNIT_DESCRIPTION, $UNIT_DATA, $UNIT_NAME, $NEXT_TICK, $ACTUAL_TICK;
    global $ship_components;
    if (!isset($_POST['0'])) {
        $_POST['0'] = -1;
    }
    if (!isset($_POST['1'])) {
        $_POST['1'] = -1;
    }
    if (!isset($_POST['2'])) {
        $_POST['2'] = -1;
    }
    if (!isset($_POST['3'])) {
        $_POST['3'] = -1;
    }
    if (!isset($_POST['4'])) {
        $_POST['4'] = -1;
    }
    if (!isset($_POST['5'])) {
        $_POST['5'] = -1;
    }
    if (!isset($_POST['6'])) {
        $_POST['6'] = -1;
    }
    if (!isset($_POST['7'])) {
        $_POST['7'] = -1;
    }
    if (!isset($_POST['8'])) {
        $_POST['8'] = -1;
    }
    if (!isset($_POST['9'])) {
        $_POST['9'] = -1;
    }
    $_POST[0] = $_POST['0'] = (int) $_POST['0'];
    $_POST[1] = $_POST['1'] = (int) $_POST['1'];
    $_POST[2] = $_POST['2'] = (int) $_POST['2'];
    $_POST[3] = $_POST['3'] = (int) $_POST['3'];
    $_POST[4] = $_POST['4'] = (int) $_POST['4'];
    $_POST[5] = $_POST['5'] = (int) $_POST['5'];
    $_POST[6] = $_POST['6'] = (int) $_POST['6'];
    $_POST[7] = $_POST['7'] = (int) $_POST['7'];
    $_POST[8] = $_POST['8'] = (int) $_POST['8'];
    $_POST[9] = $_POST['9'] = (int) $_POST['9'];
    $_POST['ship_name'] = htmlspecialchars($_POST['ship_name']);
    $_POST['ship_description'] = htmlspecialchars($_POST['ship_description']);
    $_POST['ship_torso'] = (int) $_POST['ship_torso'];
    if (GlobalTorsoReq($_POST['ship_torso']) > $game->player['user_points']) {
        exit(0);
    }
    if (SpecialRequirements() != 1) {
        echo constant($game->sprache("TEXT70"));
        exit(0);
    }
    $game->out('
<table border=0 cellpadding=2 cellspacing=2 width=450 class="style_outer"><tr><td>

<span class="sub_caption">' . constant($game->sprache("TEXT1")) . ':</span>
<br><span class="sub_caption2">' . constant($game->sprache("TEXT71")) . '</span>
<br><table border=0 cellpadding=2 cellspacing=2 width=450 class="style_inner"><tr><td>
');
    $game->out('
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=25% valign=top><span class="text_large">' . constant($game->sprache("TEXT72")) . '</td>
<td width=75%><b>' . $_POST['ship_name'] . '</b><br><br></td>
</tr>
<tr>
<td width=25% valign=top><span class="text_large">' . constant($game->sprache("TEXT32")) . '</td>
<td>' . wordwrap(nl2br(stripslashes($_POST['ship_description'])), 40, "<br>", 1) . '<br><br></td>
</tr>
<tr>
<td width=25% valign=top><span class="text_large">' . constant($game->sprache("TEXT68")) . '</td>
<td width=75%><img src=' . FIXED_GFX_PATH . 'ship' . $game->player['user_race'] . '_' . $_POST['ship_torso'] . '.jpg></td>
</tr>
');
    for ($x = 0; $x < 15; $x++) {
        $value[$x] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][14 + $x];
    }
    $value[15] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][32];
    $value[16] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][33];
    $value[17] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][34];
    $price[0] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][0];
    $price[1] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][1];
    $price[2] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][2];
    $price[4] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][13];
    $price[5] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][3];
    $price[6] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][4];
    $price[7] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][5];
    $price[8] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][6];
    $price[9] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][11];
    $price[10] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][12];
    $price[3] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][30];
    $price[11] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][7];
    $price[12] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][8];
    $price[13] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][9];
    $price[14] = $SHIP_TORSO[$game->player['user_race']][$_POST['ship_torso']][10];
    for ($t = 0; $t < 10; $t++) {
        if ($_POST[$t] >= 0 && isset($ship_components[$game->player['user_race']][$t][$_POST[$t]]['name'])) {
            $comp = $ship_components[$game->player['user_race']][$t][$_POST[$t]];
            // Calculate the "values":
            for ($x = 0; $x < 18; $x++) {
                $value[$x] += $comp['value_' . ($x + 1)];
            }
            $price[0] += $comp['resource_1'];
            $price[1] += $comp['resource_2'];
            $price[2] += $comp['resource_3'];
            $price[3] += $comp['resource_4'];
            $price[4] += $comp['buildtime'];
            if ($comp['value_15'] != 1) {
                $price[5] += $comp['unit_1'];
                $price[6] += $comp['unit_2'];
                $price[7] += $comp['unit_3'];
                $price[8] += $comp['unit_4'];
                $price[11] += $comp['unit_1'];
                $price[12] += $comp['unit_2'];
                $price[13] += $comp['unit_3'];
                $price[14] += $comp['unit_4'];
            } else {
                $price[11] += $comp['unit_1'];
                $price[12] += $comp['unit_2'];
                $price[13] += $comp['unit_3'];
                $price[14] += $comp['unit_4'];
            }
            $price[9] += $comp['unit_5'];
            $price[10] += $comp['unit_6'];
        }
    }
    if ($value[4] == 0 || $price[4] == 0) {
        echo constant($game->sprache("TEXT73"));
        exit(0);
    }
    // Energieverbrauch checken:
    if ($value[13] > $value[12]) {
        exit(0);
    }
    if ($value[9] > 9.99) {
        $value[9] = 9.99;
    }
    //$value[15] = RoundsFire($game->player['user_race'], $_POST['ship_torso']); // this is rof on ship_templates DB
    //$value[16] = Torpedoes($game->player['user_race'], $_POST['ship_torso']); // this is max_torp on ship_templates DB
    $game->out('
</table>
<br>
<span class="sub_caption2">' . constant($game->sprache("TEXT74")) . '</span>
</td></tr></table><br>');
    $game->out('</td></tr></table>');
    // Insert:
    $db->query('INSERT INTO ship_templates
(owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10,
value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15,
resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, buildtime, rof, rof2, max_torp) VALUES
("' . $game->player['user_id'] . '","' . time() . '","' . $_POST['ship_name'] . '","' . $_POST['ship_description'] . '","' . $game->player['user_race'] . '","' . $_POST['ship_torso'] . '","' . GetShipClass($game->player['user_race'], $_POST['ship_torso']) . '","' . $_POST[0] . '","' . $_POST[1] . '","' . $_POST[2] . '","' . $_POST[3] . '","' . $_POST[4] . '","' . $_POST[5] . '","' . $_POST[6] . '","' . $_POST[7] . '","' . $_POST[8] . '","' . $_POST[9] . '",
"' . $value[0] . '","' . $value[1] . '","' . $value[2] . '","' . $value[3] . '","' . $value[4] . '","' . $value[5] . '","' . $value[6] . '","' . $value[7] . '","' . $value[8] . '","' . $value[9] . '","' . $value[10] . '","' . $value[11] . '","' . $value[12] . '","' . $value[13] . '","' . $value[14] . '",
"' . $price[0] . '","' . $price[1] . '","' . $price[2] . '","' . $price[3] . '","' . $price[9] . '","' . $price[10] . '","' . $price[5] . '","' . $price[6] . '","' . $price[7] . '","' . $price[8] . '","' . $price[11] . '","' . $price[12] . '","' . $price[13] . '","' . $price[14] . '","' . $price[4] . '","' . $value[15] . '","' . $value[16] . '","' . $value[17] . '")
');
}
示例#2
0
function TemplateMetRequirementsText($template)
{
    global $game;
    //global $ship_components;
    if ($game->player['user_points'] < GlobalTorsoReq($template['ship_torso'])) {
        $game->out('<tr><td>' . constant($game->sprache("TEXT0")) . ' ' . GlobalTorsoReq($template['ship_torso']) . ' ' . constant($game->sprache("TEXT1")) . '</td></tr>');
    }
    if ($game->planet['planet_points'] < LocalTorsoReq($template['ship_torso'])) {
        $game->out('<tr><td>' . constant($game->sprache("TEXT0")) . ' ' . LocalTorsoReq($template['ship_torso']) . ' ' . constant($game->sprache("TEXT2")) . '</td></tr>');
    }
    if (!ComponentMetRequirements(0, $template['component_1'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(1, $template['component_2'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(2, $template['component_3'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(3, $template['component_4'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(4, $template['component_5'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(5, $template['component_6'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(6, $template['component_7'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(7, $template['component_8'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(8, $template['component_9'], $template['ship_torso'])) {
    }
    if (!ComponentMetRequirements(9, $template['component_10'], $template['ship_torso'])) {
    }
    //if ($game->planet['planet_points']<TorsoRequirements($template['ship_torso'],0) || $game->player['user_points']<TorsoRequirements($template['ship_torso'],0)) return 0;
    //echo $template['ship_torso'];
    //return 1;
}