function getMaxFleets($player_id) {
	global $table, $BASIC_FLEETCONTROL, $ADV_FLEETCONTROL, $NG_FLEETCONTROL;
	if (checkItem($player_id, $NG_FLEETCONTROL)) { return 3; }
	elseif (checkItem($player_id, $ADV_FLEETCONTROL)) { return 2; }
	elseif (checkItem($player_id, $BASIC_FLEETCONTROL)) { return 1; }
	else { return 0; }
	return 0;
}
		$crystal_res['factory_prod'] = 0;
		$crystal_res['asteroids'] = 0;
		if (checkItem($id, $CRYSTAL_ADV_REF)) {
			$crystal_res['planet'] = $RES_FROM_ADV_REF;
			$crystal_res['asteroids'] = $p['roid_crystal'] * $RES_FROM_CRYSTAL_ROID;
		} elseif (checkItem($id, $CRYSTAL_REFINERY)) {
			$crystal_res['planet'] = $RES_FROM_REFINERY;
		}

		$erbium_res['planet'] = 0;
		$erbium_res['factory_prod'] = 0;
		$erbium_res['asteroids'] = 0;
		if (checkItem($id, $ERBIUM_ADV_REF)) {
			$erbium_res['planet'] = $RES_FROM_ADV_REF;
			$erbium_res['asteroids'] = $p['roid_erbium'] * $RES_FROM_ERBIUM_ROID;
		} elseif (checkItem($id, $ERBIUM_REFINERY)) {
			$erbium_res['planet'] = $RES_FROM_REFINERY;
		}

		if ($factory_id > 0) {
			if (($steel_investment == 0) || ($crystal_investment == 0) || ($erbium_investment == 0)) {
				$steel_res['factory_prod'] = 0;
				$crystal_res['factory_prod'] = 0;
				$erbium_res['factory_prod'] = 0;
				$titanium_production = 0;
			} else {
				$steel_res['factory_prod'] = (($steel_res['asteroids'] + $steel_res['planet'])/100)*$steel_investment;
				$crystal_res['factory_prod'] = (($crystal_res['asteroids'] + $crystal_res['planet'])/100)*$crystal_investment;
				$erbium_res['factory_prod'] = (($erbium_res['asteroids'] + $erbium_res['planet'])/100)*$erbium_investment;
				$total_cost = $steel_res['factory_prod'] + $crystal_res['factory_prod'] + $erbium_res['factory_prod'];
				$titanium_production = ($total_cost / 3.14879);
                        <tr>
                            <td  background="img/bg_balk.jpg"><b>Ship name</b></td>
                            <td  background="img/bg_balk.jpg" align="center"><b>Amount at base</b></td>
                            <td width="177" background="img/bg_balk.jpg" align="center"></td>
                            <td width="103" background="img/bg_balk.jpg" align="center"><b>Amount to sell</b></td>
                            <td width="95" background="img/bg_balk.jpg" align="center"></td>
                        </tr>
                        <tr>
                        	<td>
                    		<select name="ship_id" onChange="submitEditFleet()">
                    			<option value="0"<?if ($ship_id == 0) { echo 'selected'; }?>>-</option>
                    			<?
                    			
                    			for ($j = 0; $j < count($shipdata); $j++) {
                    			
                    				if (checkItem($playerdata['id'], $shipdata[$j]['depends']) && (!inFleet($fleet_id, $shipdata[$j]['id']) || ($edit_submit && inFleetShipCheck($fleet_id, $shipdata[$j]['id'], $ship_id)))) {
                    			?>
                    					<option value="<?php 
echo $shipdata[$j]['id'];
?>
"<?if ($ship_id == $shipdata[$j]['id']) { echo 'selected'; }?>><?php 
echo $shipdata[$j]['name'];
?>
</option>
                    			<?
                    				}
                    			}
                    			?>
                    		</select>
                        	</td>
                        	<td align="center"><?if (!$baseships) { echo 0; } else { echo $baseships; }?></td>
							<tr>
								<td width="800" colspan="2" align="center"><input type="submit" name="newsscan" value="  News-scan target  "></td>
							</tr>
						</table>
						</form>
					<?
					} else {
					?>
						<table border="0" width="800">
							<tr>
								<td width="800" align="center">You need to build the Next-Generation intelligence unit construction to enable newsscan possibilities.</td>
							</tr>
						</table>
					<?
					}
					if (checkItem($playerdata['id'], $UNI_INTELLIGENCE)) {
						if (empty($minscore)) { $minscore = 0; }
						if (empty($maxscore)) { $maxscore = $playerdata['score']; }
						if (empty($minasteroids)) { $minasteroids = 0; }
						if (empty($maxasteroids)) { $maxasteroids = $playerdata['roids_steel'] + $playerdata['roids_crystal'] + $playerdata['roids_erbium'] + $playerdata['roids_unused']; }
					?>
						<form method="POST" action="main.php?mod=office&act=intelligence&do=uniscan">
						<table border="0" width="800">
							<tr>
								<td width="800" background="img/bg_balk.jpg" colspan="2"><b>Universe scans</b></td>
							</tr>
							<tr>
								<td width="150">Search in cluster:</td>
								<td width="650">
									<select name="findcluster">
										<option value="0"<?if (($findcluster == 0) || (empty($findcluster))) echo ' selected="selected"';?>>All clusters</option>
					<td valign="top">
						<table border="0" width="800">
							<tr>
								<td width="350" background="img/bg_balk.jpg"><b><? echo $res_getitemtype['type']; ?> name</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Steel</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Crystal</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Erbium</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>Titanium</b></td>
								<td width="50" background="img/bg_balk.jpg"><b>ETA</b></td>
								<td width="96" background="img/bg_balk.jpg">&nbsp;</td>
							</tr>
							<?
							while ($res = mysql_fetch_array($rec_getitems)) {
								$eta = null;
								if (!checkitem($playerdata['id'], $res['depends'])) { continue; }
								if (!checkItem($playerdata['id'], $res['id'])) {
									if (!checkProduction($playerdata['id'], $type_id, $res['id'])) {
										$line = '<a href="main.php?mod=production&act=item&do=build&type='.$type_id.'&item='.$res[id].'"><b>'.$res_getitemtype['build_text'].'</b></a>';
									} else {
										$eta  = getProductionEta($playerdata['id'], $type_id, $res['id']);
										$line = $res_getitemtype['building_text'];
									}
								} else {
									$line = 'Completed';
								}
								if (!$eta) { $eta = $res['eta']; }
							?>
							<tr>
								<td><?php 
echo $res['name'];
?>
						</table>
						</form>
					</td>
				</tr>
			</table>
		</td>
		<td width="3%" background="img/border/R.gif">&nbsp;</td>
	</tr>
	<tr>
		<td width="2%" valign="top"><img border="0" src="img/border/L_O.gif" width="20" height="15"></td>
		<td width="100%" background="img/border/O.gif" colspan="2">&nbsp;</td>
		<td width="3%" valign="top"><img border="0" src="img/border/R_O.gif" width="20" height="15"></td>
	</tr>
</table>
<?
if (checkItem($playerdata['id'], $TITANIUM_FACTORY)) {
?>
<br><br>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td width="2%" valign="bottom"><img border="0" src="img/border/L_B.gif" width="20" height="15"></td>
		<td width="30%">Titanium factory control</td>
		<td width="65%" background="img/border/B.gif"><img border="0" src="img/border/B.gif" width="16" height="15"></td>
		<td width="3%" valign="bottom"><img border="0" src="img/border/R_B.gif" width="20" height="15"></td>
	</tr>
	<tr>
		<td width="2%" background="img/border/L.gif">&nbsp;</td>
		<td width="95%" height="100%" valign="top" colspan="2">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td valign="top">
function tryShipDefenseProductionAdd($player_id, $type_id, $item_table, $item_id, $amount) {
	global $table;
	$sql_getitemdata = "SELECT * FROM $item_table WHERE `id` = '$item_id'";
	$res_getitemdata = mysql_fetch_array(mysql_query($sql_getitemdata));
	if (!checkItem($player_id, $res_getitemdata['depends'])) { return 1; } /* 1; Depencies are incorrect */
	$cost_steel = $amount * $res_getitemdata['cost_steel'];
	$cost_crystal = $amount * $res_getitemdata['cost_crystal'];
	$cost_erbium = $amount * $res_getitemdata['cost_erbium'];
	$cost_titanium = $amount * $res_getitemdata['cost_titanium'];
	if (checkSteelResource($player_id, $cost_steel) && checkCrystalResource($player_id, $cost_crystal) && checkErbiumResource($player_id, $cost_erbium) && checkTitaniumResource($player_id, $cost_titanium)) {
		$currenttick = getCurrentTick();
		$ready_tick = $currenttick + $res_getitemdata['eta'];
		$sql_addprod = "INSERT INTO `$table[productions]` (`id`, `player_id`, `type_id`, `item_id`, `ready_tick`, `amount`)
					VALUES ('', '$player_id', '$type_id', '$item_id', '$ready_tick', '$amount')";
		mysql_query($sql_addprod);
		decreaseCurrentResources($player_id, $cost_steel, $cost_crystal, $cost_erbium, $cost_titanium);
	} else {
		return 2; /* Not enough resources to build */
	}
	return 0; /* Succesfull executed! */
}
Beispiel #8
0
/**
 * Iterator function
 * 
 * @global array $releasesHistory
 * @global array $updatesStat
 * @param string $item 
 */
function checkItem($item)
{
    // Globals
    global $releasesHistory;
    global $updatesStat;
    // File or directory?
    if (strtolower(substr($item, -4)) == '.php') {
        // Update count
        $updatesStat[0]++;
        // Get filename
        $fileName = substr($item, strlen(__DIR__ . DIRECTORY_SEPARATOR));
        echo "\nChecking " . $fileName . '... ';
        // Tracked file?
        if (isset($releasesHistory[$fileName])) {
            // Changed file?
            if (md5_file($item) != $releasesHistory[$fileName] || substr($fileName, -18) == 'Pirx' . DIRECTORY_SEPARATOR . 'Framework.php') {
                $releasesHistory[$fileName] = updateFileKeywords($item);
                $updatesStat[2]++;
                echo "updated.";
            } else {
                $updatesStat[3]++;
                echo "unchanged.";
            }
        } else {
            $releasesHistory[$fileName] = updateFileKeywords($item);
            $updatesStat[1]++;
            echo "added.";
        }
    } else {
        if (is_dir($item)) {
            // Loop directories
            foreach (new DirectoryIterator($item) as $directory) {
                if (!$directory->isDot()) {
                    checkItem($item . DIRECTORY_SEPARATOR . $directory->getFilename());
                }
            }
        }
    }
}
<table border="0" cellpadding="0" cellspacing="0" width="800">
        <tr>
                <td width="4" valign="bottom"><img border="0" src="img/border/L_B.gif" width="20" height="15"></td>
                <td width="180">Status</td>
                <td width="612" background="img/border/B.gif"><img border="0" src="img/border/B.gif" width="16" height="15"></td>
                <td width="4" valign="bottom"><img border="0" src="img/border/R_B.gif" width="20" height="15"></td>
        </tr>
        <tr>
                <td width="4" background="img/border/L.gif">&nbsp;</td>
                <td width="696" height="100%" valign="top" colspan="2">
                        <table border="0" cellpadding="0" cellspacing="0" width="800">
                                <tr>
                                        <td valign="top">
                                                <table border="0" width="800">
                                                	<?
                                                	if (checkItem($playerdata['id'], $GALACTIC_INTELLIGENCE)) {
													?>
                                                        <tr>
                                                        	<td height="15" align="left" colspan="3">Incoming fleets</td>
                                                        </tr>
                                                        <tr>
                                                        	<td background="img/bg_balk.jpg" width="50"><b>Type</b></td>
                                                        	<td background="img/bg_balk.jpg" width="350"><b>From</b></td>
                                                        	<td background="img/bg_balk.jpg" width="350"><b>To</b></td>
                                                        	<td background="img/bg_balk.jpg" width="50"><b>ETA</b></td>
                                                        </tr>
                                                        <?
                                                        $sql_inc = "SELECT $table[playerfleet].player_id, $table[playerfleet].target_id,
                                                        					$table[playerfleet].action, $table[playerfleet].action_start
                                                        			FROM $table[playerfleet]
                                                        			INNER JOIN $table[players] ON $table[players].id = $table[playerfleet].target_id
<table border="0" cellpadding="0" cellspacing="0" width="800">
        <tr>
                <td width="4" valign="bottom"><img border="0" src="img/border/L_B.gif" width="20" height="15"></td>
                <td width="180">Status</td>
                <td width="612" background="img/border/B.gif"><img border="0" src="img/border/B.gif" width="16" height="15"></td>
                <td width="4" valign="bottom"><img border="0" src="img/border/R_B.gif" width="20" height="15"></td>
        </tr>
        <tr>
                <td width="4" background="img/border/L.gif">&nbsp;</td>
                <td width="696" height="100%" valign="top" colspan="2">
                        <table border="0" cellpadding="0" cellspacing="0" width="800">
                                <tr>
                                        <td valign="top">
                                                <table border="0" width="800">
                                                <?
                                                if (checkItem($playerdata['id'], $ALLIANCE_COMMUNICATION)) {
                                                ?>
                                                        <tr>
                                                        	<td height="15" align="left" colspan="3">Incoming fleets</td>
                                                        </tr>
                                                        <tr>
                                                        	<td background="img/bg_balk.jpg" width="50"><b>Type</b></td>
                                                        	<td background="img/bg_balk.jpg" width="350"><b>From</b></td>
                                                        	<td background="img/bg_balk.jpg" width="350"><b>To</b></td>
                                                        	<td background="img/bg_balk.jpg" width="50"><b>ETA</b></td>
                                                        </tr>
                                                        <?
                                                        $sql_inc = "SELECT $table[playerfleet].player_id, $table[playerfleet].target_id,
                                                        					$table[playerfleet].action, $table[playerfleet].action_start
                                                        			FROM $table[playerfleet]
                                                        			INNER JOIN $table[players] ON $table[players].id = $table[playerfleet].target_id