Esempio n. 1
0
  * @var array Research level of defense_tech for the defender and military_tech for attacker
  */
 $fighterTech = Legacies_Database::getInstance()->fetchAll($sql);
 if ($targetPlanet && $fighterTech) {
     $defenderTech = (int) $fighterTech[0]['defenderTech'];
     $attackerTech = (int) $fighterTech[1]['defenderTech'];
     /**
      * @var array List of defense on the target planet.
      */
     foreach ($reslist[Legacies_Empire::TYPE_DEFENSE] as $id) {
         $targetDef[$id] = $targetPlanet[$resource[$id]];
     }
     /**
      * @see raketenangriff (includes/raketenangriff.php)
      */
     $irak = raketenangriff($defenderTech, $attackerTech, $missile['anzahl'], $targetDef, (int) $missile['primaer']);
     $message = '';
     foreach ($irak['destroyDefense'] as $id => $quantity) {
         if ($quantity != 0) {
             $message .= $lang['info'][$id]['name'] . " : {$quantity} <br>";
         }
     }
     $stayingDefense = array();
     foreach ($irak['stayingDefense'] as $id => $quantity) {
         $stayingDefense[$resource[$id]] = $quantity;
     }
     Legacies_Database::getInstance()->update(Legacies_Database::getTable('deprecated/planets'), $stayingDefense, array('id=?' => $targetPlanet['id']));
     $reciepient = array('zielid', 'owner');
     foreach ($reciepient as $name) {
         $data = array('message_owner' => $missile[$name], 'message_sender' => '', 'message_time' => new Zend_Db_Expr('UNIX_TIMESTAMP()'), 'message_type' => '0', 'message_from' => $lang['Missile_MessageFrom'], 'message_subject' => $lang['Missile_Attack'], 'message_text' => $lang['Missile_AttackMessage'][$name] . $message);
         Legacies_Database::getInstance()->insert(Legacies_Database::getTable('deprecated/messages'), $data);
Esempio n. 2
0
 } else {
     $n = "n";
 }
 $message = '';
 $abgeschossenenAR = $selected_row['anzahl'];
 if ($planet['interceptor_misil'] >= $selected_row['anzahl']) {
     $message = str_replace('##mips##', $abgeschossenenAR, $lang['RAK_INTERCEPTED']);
     $x = $planet['interceptor_misil'] - $selected_row['anzahl'];
     doquery("UPDATE {{table}} SET `interceptor_misil` = '" . $x . "' WHERE id = " . $planet['id'], 'planets');
 } else {
     if ($planet['interceptor_misil'] > 0) {
         doquery("UPDATE {{table}} SET `interceptor_misil` = '0' WHERE id = " . $planet['id'], 'planets');
         $message = str_replace('##mips##', $planet['interceptor_misil'], $lang['RAK_REDUCED']) . "<br />";
         $selected_row['anzahl'] = $selected_row['anzahl'] - $planet['interceptor_misil'];
     }
     $irak = raketenangriff($Defender['defence_tech'], $Attacker['military_tech'], $selected_row['anzahl'], $def, $selected_row['primaer']);
     foreach ($irak['zerstoert'] as $id => $anzahl) {
         if (!empty($anzahl) && $id < 10) {
             if ($id != 9) {
                 $message .= $lang[$id] . " (- " . $anzahl . ")<br>";
             }
             $x = $resource[$ids[$id]];
             doquery("UPDATE {{table}} SET " . $x . " = " . $x . "-" . $anzahl . " WHERE id = " . $planet['id'], 'planets');
         }
     }
 }
 $planet_1 = doquery("SELECT * FROM {{table}} WHERE\r\n\t\t\t\t\t\tgalaxy = '" . $selected_row['galaxy_angreifer'] . "' AND\r\n\t\t\t\t\t\tsystem = '" . $selected_row['system_angreifer'] . "' AND\r\n\t\t\t\t\t\tplanet = '" . $selected_row['planet_angreifer'] . "' AND\r\n\t\t\t\t\t\tplanet_type ='1'", 'planets');
 if (mysql_num_rows($planet_1) == 1) {
     $array = mysql_fetch_array($planet_1);
     $name = $array['name'];
 }
Esempio n. 3
0
 $iraks = doquery("SELECT * FROM {{table}} WHERE zeit <= '" . time() . "'", 'iraks');
 while ($selected_row = mysql_fetch_array($iraks)) {
     if ($selected_row['zeit'] != '' && $selected_row['galaxy'] != '' && $selected_row['system'] != '' && $selected_row['planet'] != '' && is_numeric($selected_row['owner']) && is_numeric($selected_row['zielid']) && is_numeric($selected_row['anzahl']) && !empty($selected_row['anzahl'])) {
         $planetrow = doquery("SELECT * FROM {{table}} WHERE\r\n\t\t\t\t\t\t\t\tgalaxy = '" . $selected_row['galaxy'] . "' AND\r\n\t\t\t\t\t\t\t\tsystem = '" . $selected_row['system'] . "' AND\r\n\t\t\t\t\t\t\t\tplanet = '" . $selected_row['planet'] . "'", 'planets');
         $select_ziel = doquery("SELECT defence_tech FROM {{table}} WHERE\r\n\t\t\t\t\t\t\t\tid = '" . $selected_row['zielid'] . "'", 'users');
         $select_owner = doquery("SELECT military_tech FROM {{table}} WHERE\r\n\t\t\t\t\t\t\t\tid = '" . $selected_row['owner'] . "'", 'users');
         if (mysql_num_rows($planetrow) != 1 or mysql_num_rows($select_ziel) != 1) {
             doquery("DELETE FROM {{table}} WHERE id = '" . $selected_row['id'] . "'", 'iraks');
         } else {
             $verteidiger = mysql_fetch_array($select_ziel);
             $angreifer = mysql_fetch_array($select_owner);
             $planet = mysql_fetch_array($planetrow);
             $ids = array(0 => 401, 1 => 402, 2 => 403, 3 => 404, 4 => 405, 5 => 406, 6 => 407, 7 => 408, 8 => 502, 9 => 503);
             $def = array(0 => $planet['misil_launcher'], 1 => $planet['small_laser'], 2 => $planet['big_laser'], 3 => $planet['gauss_canyon'], 4 => $planet['ionic_canyon'], 5 => $planet['buster_canyon'], 6 => $planet['small_protection_shield'], 7 => $planet['big_protection_shield'], 8 => $planet['interplanetary_misil'], 9 => $planet['interceptor_misil']);
             $lang = array(0 => "Lanceur Missile", 1 => "Canon Magn&eacute;tique", 2 => "Batterie Electromagn&eacute;tique", 3 => "Canon de Gauss", 4 => "Lanceur Ionique", 5 => "Lanceur de plasma", 6 => "Petit bouclier", 7 => "Grand bouclier", 8 => "Missiles Intercepteur", 9 => "Missiles Interplanetaire", 10 => "Missiles Intercepteur");
             $irak = raketenangriff($verteidiger['defence_tech'], $angreifer['military_tech'], $selected_row['anzahl'], $def, $selected_row['primaer']);
             $message = '';
             if ($planet['interceptor_misil'] >= $selected_row['anzahl']) {
                 $message = 'Les Missiles Intercepteur adverses ont d&eacute;truit vos missiles Interplanetaire<br>';
                 $x = $resource[$ids[9]];
                 doquery("UPDATE {{table}} SET " . $x . " = " . $x . "-" . $selected_row['anzahl'] . " WHERE id = " . $planet['id'], 'planets');
             } else {
                 if ($planet['interceptor_misil'] > 0) {
                     $x = $resource[$ids[9]];
                     doquery("UPDATE {{table}} SET " . $x . " = '0' WHERE id = " . $planet['id'], 'planets');
                     $message = $planet['interceptor_misil'] . " missiles Interplanetaire ont &eacute;t&eacute; intercept&eacute;s par vos missiles.<br>";
                 }
                 foreach ($irak['zerstoert'] as $id => $anzahl) {
                     if (!empty($anzahl) && $id < 10) {
                         if ($id != 9) {
                             $message .= $lang[$id] . " (- " . $anzahl . ")<br>";
Esempio n. 4
0
function MissionCaseMIP($FleetRow)
{
    global $user, $phpEx, $ugamella_root_path, $pricelist, $lang, $resource, $CombatCaps;
    if ($FleetRow['fleet_start_time'] <= time()) {
        if ($FleetRow['fleet_mess'] == 0) {
            if (!isset($CombatCaps[202]['sd'])) {
                message("<font color=\"red\">" . $lang['sys_no_vars'] . "</font>", $lang['sys_error'], "fleet." . $phpEx, 2);
            }
            includelang('tech');
            includelang('system');
            $QryTargetPlanet = "SELECT * FROM {{table}} ";
            $QryTargetPlanet .= "WHERE ";
            $QryTargetPlanet .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
            $QryTargetPlanet .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
            $QryTargetPlanet .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
            $QryTargetPlanet .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "';";
            $planet = doquery($QryTargetPlanet, 'planets', true);
            $QrySelect = "SELECT defence_tech,military_tech FROM {{table}} ";
            $QrySelect .= "WHERE ";
            $QrySelect .= "`id` = '" . $FleetRow['fleet_owner'] . "';";
            $UserFleet = doquery($QrySelect, 'users', true);
            // selected_row es la flota del atakante cambiar por FleetRow
            $verteidiger = $UserFleet["defence_tech"];
            $angreifer = $UserFleet["military_tech"];
            $ids = array(0 => 401, 1 => 402, 2 => 403, 3 => 404, 4 => 405, 5 => 406, 6 => 407, 7 => 408, 8 => 502, 9 => 503);
            $def = array(0 => $planet['misil_launcher'], 1 => $planet['small_laser'], 2 => $planet['big_laser'], 3 => $planet['gauss_canyon'], 4 => $planet['ionic_canyon'], 5 => $planet['buster_canyon'], 6 => $planet['small_protection_shield'], 7 => $planet['big_protection_shield'], 8 => $planet['interceptor_misil'], 9 => $planet['interplanetary_misil']);
            $DefenseLabel = array(0 => $lang['tech'][401], 1 => $lang['tech'][402], 2 => $lang['tech'][403], 3 => $lang['tech'][404], 4 => $lang['tech'][405], 5 => $lang['tech'][406], 6 => $lang['tech'][407], 7 => $lang['tech'][408], 8 => $lang['tech'][502], 9 => $lang['tech'][503]);
            $irak = raketenangriff($verteidiger, $angreifer, $FleetRow['fleet_amount'], $def, $FleetRow['fleet_target_obj']);
            $message = '';
            if ($planet['interceptor_misil'] >= $FleetRow['fleet_amount']) {
                $message = 'Tus misiles de intersepci&oacute;n destruyeron los misiles interplanetarios<br>';
                $x = $resource[$ids[8]];
                doquery("UPDATE {{table}} SET " . $x . " = " . $x . "-" . $FleetRow['fleet_amount'] . " WHERE id = " . $planet['id'], 'planets');
            } else {
                if ($planet['interceptor_misil'] > 0) {
                    $x = $resource[$ids[8]];
                    doquery("UPDATE {{table}} SET " . $x . " = '0' WHERE id = " . $planet['id'], 'planets');
                    $message = $planet['interceptor_misil'] . " misiles de intercepci&oacute;n fueron destruidos por misiles interplanetarios.<br>";
                }
                foreach ($irak['zerstoert'] as $id => $anzahl) {
                    if (!empty($anzahl) && $id < 10) {
                        if ($id != 8) {
                            $message .= $DefenseLabel[$id] . " (- " . $anzahl . ")<br>";
                        }
                        $x = $resource[$ids[$id]];
                        doquery("UPDATE {{table}} SET " . $x . " = " . $x . "-" . $anzahl . " WHERE id = " . $planet['id'], 'planets');
                    }
                }
            }
            $UserPlanet = doquery("SELECT name FROM {{table}} WHERE id = '" . $FleetRow['fleet_owner'] . "'", 'planets', true);
            $name = $UserPlanet['name'];
            $name_deffer = ${$QryTargetPlanet}['name'];
            $message_vorlage = 'Un ataque con misiles (' . $FleetRow['fleet_amount'] . ') de ' . $name . ' ';
            $message_vorlage .= 'al planeta ' . $name_deffer . '<br><br>';
            if (empty($message)) {
                $message = "Tu planeta no tenia defensa !";
            }
            doquery("INSERT INTO {{table}} SET\r\n                  `message_owner`='" . $FleetRow['fleet_target_owner'] . "',\r\n                  `message_sender`='',\r\n                  `message_time`= " . $FleetRow['fleet_start_time'] . ",\r\n                  `message_type`='0',\r\n                  `message_from`='Torre de Control',\r\n                  `message_subject`='Ataque con misiles',\r\n                  `message_text`='" . $message_vorlage . $message . "'", 'messages');
            doquery("UPDATE {{table}} SET new_message=new_message+1 WHERE id='" . $FleetRow['fleet_target_owner'] . "'", 'users');
            doquery("DELETE FROM {{table}} WHERE fleet_id = '" . $FleetRow['fleet_id'] . "'", 'fleets');
        }
    }
    // END $FleetRow['fleet_start_time'] <= time()
}