<?php require_once 'inc.config.php'; logincheck(); if (isset($_POST['order_units'])) { addProductions('ship,defence', $_POST['order_units']); $arrJson = array(array('eval', "\$('f_order_units').reset();"), array('html', 'div_productionlist', getProductionList('ship,defence')), array('msg', 'Productions added!')); foreach (db_select_fields('planet_resources', 'resource_id,amount', 'planet_id = ' . PLANET_ID) as $iResourceId => $iAmount) { $arrJson[] = array('html', 'res_amount_' . $iResourceId, nummertje($iAmount)); } exit(json::encode($arrJson)); } _header(); ?> <div class="header">Production<?php if ((int) $GAMEPREFS['havoc_production']) { echo ' (<b style="color:red;">HAVOC!</b>)'; } ?> </div> <br /> <?php echo getProductionForm('ship,defence'); ?> <br /> <div id="div_productionlist"> <?php
<?php require_once 'inc.config.php'; logincheck(); // ORDER UNITS // if (isset($_POST['order_units']) && is_array($_POST['order_units']) && 0 < count($_POST['order_units'])) { addProductions('roidscan,scan,amp,block', $_POST['order_units']); $arrJson = array(array('eval', "\$('f_order_units').reset();"), array('html', 'div_productionlist', getProductionList('roidscan,scan,amp,block')), array('msg', 'Productions added!')); foreach (db_select_fields('planet_resources', 'resource_id,amount', 'planet_id = ' . PLANET_ID) as $iResourceId => $iAmount) { $arrJson[] = array('html', 'res_amount_' . $iResourceId, nummertje($iAmount)); } exit(json::encode($arrJson)); } else { if (isset($_POST['number_of_asteroid_scans'], $_POST['roid_scan_id'])) { $iTotalAsteroidScans = (int) db_select_one('d_all_units u, d_waves w, waves_on_planets p', 'IFNULL(SUM(amount),0)', 'u.id = ' . (int) $_POST['roid_scan_id'] . ' AND u.id = w.id AND w.id = p.wave_id AND p.planet_id = ' . PLANET_ID . ' AND u.T = \'roidscan\' AND u.r_d_required_id IN (SELECT r_d_id FROM planet_r_d WHERE planet_id = ' . PLANET_ID . ' AND eta = 0)'); $a = (int) min($_POST['number_of_asteroid_scans'], $iTotalAsteroidScans); if (0 >= $a) { exit(json::encode(array(array('msg', 'Invalid amount!')))); } $iTotalWaveAmps = (int) db_select_one('d_all_units u, d_waves w, waves_on_planets p', 'IFNULL(SUM(amount),0)', 'u.id = w.id AND w.id = p.wave_id AND p.planet_id = ' . PLANET_ID . ' AND u.T = \'amp\' AND u.r_d_required_id IN (SELECT r_d_id FROM planet_r_d WHERE planet_id = ' . PLANET_ID . ' AND eta = 0)'); $iAsteroids = $g_arrUser['inactive_asteroids']; foreach ($g_arrResources as $r) { $iAsteroids += $r['asteroids']; } $iAsteroidsFound = calcres($a, $iAsteroids, $iTotalWaveAmps); if (db_update('waves_on_planets', 'amount = amount-' . $a, 'planet_id = ' . PLANET_ID . ' AND wave_id = ' . (int) $_POST['roid_scan_id'] . '') && 0 < db_affected_rows()) { db_update('planets', 'inactive_asteroids = inactive_asteroids+' . $iAsteroidsFound, 'id = ' . PLANET_ID); } $iScansLefs = db_select_one('waves_on_planets', 'amount', 'planet_id = ' . PLANET_ID . ' AND wave_id = ' . (int) $_POST['roid_scan_id'] . ''); exit(json::encode(array(array('html', 'unit_amount_' . (int) $_POST['roid_scan_id'], nummertje($iScansLefs)), array('msg', 'Your ' . nummertje($a) . ' scans found ' . nummertje($iAsteroidsFound) . ' Asteroids!')))); } else {