Beispiel #1
0
// Return want klaar met combat (alles leeg behalve eta en targetopties)
db_update('fleets', 'action = \'return\', eta = starteta', 'activated = \'1\' AND actiontime = 0 AND eta = 0 AND fleetname != \'0\' AND action IS NOT NULL');
// R & D //
if ('1' !== $GAMEPREFS['news_for_done_rd']) {
    db_update('planet_r_d', 'eta = eta-1', 'eta > 0');
}
// SKILL TRAINING //
db_update('skill_training', 'eta = eta-1', 'eta > 0');
db_update('planet_skills spp', 'value = value+1', '1 <= (SELECT COUNT(1) FROM skill_training WHERE skill_id = spp.skill_id AND planet_id = spp.planet_id AND eta = 0)');
db_delete('skill_training', 'eta <= 0');
db_update('planet_production', 'eta = eta-1 WHERE eta > 0');
## SHIPS ##
$arrProductions = db_fetch('SELECT p.planet_id, p.unit_id, SUM(p.amount) AS amount FROM planet_production p, d_all_units u WHERE u.id = p.unit_id AND u.T = \'ship\' GROUP BY planet_id, unit_id, eta HAVING eta = 0');
foreach ($arrProductions as $arrProd) {
    $iUnitId = (int) $arrProd['unit_id'];
    addShipsToFleet($iUnitId, (int) $arrProd['amount'], '0', (int) $arrProd['planet_id']);
    db_delete('planet_production', 'unit_id = ' . (int) $arrProd['unit_id'] . ' AND planet_id = ' . (int) $arrProd['planet_id'] . ' AND eta = 0');
}
## DEFENCES ##
$arrProductions = db_fetch('SELECT p.planet_id, p.unit_id, SUM(p.amount) AS amount FROM planet_production p, d_all_units u WHERE u.id = p.unit_id AND u.T = \'defence\' GROUP BY planet_id, unit_id, eta HAVING eta = 0');
foreach ($arrProductions as $arrProd) {
    $iUnitId = (int) $arrProd['unit_id'];
    if (!db_count('defence_on_planets', 'planet_id = ' . (int) $arrProd['planet_id'] . ' AND defence_id = ' . $iUnitId)) {
        db_insert('defence_on_planets', array('planet_id' => (int) $arrProd['planet_id'], 'defence_id' => $iUnitId, 'amount' => (int) $arrProd['amount']));
    } else {
        db_update('defence_on_planets', 'amount=amount+' . (int) $arrProd['amount'], 'planet_id = ' . (int) $arrProd['planet_id'] . ' AND defence_id = ' . $iUnitId . '');
    }
    db_delete('planet_production', 'unit_id = ' . (int) $arrProd['unit_id'] . ' AND planet_id = ' . (int) $arrProd['planet_id'] . ' AND eta = 0');
}
## WAVES / SCANS ##
$arrProductions = db_fetch('SELECT p.planet_id, p.unit_id, SUM(p.amount) AS amount FROM planet_production p, d_all_units u WHERE u.id = p.unit_id AND ( u.T = \'scan\' OR u.T = \'roidscan\' OR u.T = \'amp\' OR u.T = \'block\' ) GROUP BY planet_id, unit_id, eta HAVING eta = 0');
Beispiel #2
0
function moveShipsFromFleetToFleet($f_iShipId, $f_iAmount, $f_szFromFleet, $f_szToFleet, $f_iPlanetId = PLANET_ID)
{
    $iAmount = deleteShipsFromFleet($f_iShipId, $f_iAmount, $f_szFromFleet, $f_iPlanetId);
    addShipsToFleet($f_iShipId, $iAmount, $f_szToFleet, $f_iPlanetId);
}