/** * @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); } Legacies_Database::getInstance()->update(Legacies_Database::getTable('deprecated/users'), array('new_message' => 'new_message + 1'), array('id=?' => $missile['zielid'])); Legacies_Database::getInstance()->update(Legacies_Database::getTable('deprecated/users'), array('new_message' => 'new_message + 1'), array('id=?' => $missile['owner'])); Legacies_Database::getInstance()->delete(Legacies_Database::getTable('deprecated/iraks'), array('id=?' => $missile['id'])); } }
// Suppression de l'ancien enregistrement $db->delete(Legacies_Database::getTable('deprecated/statpoints'), array('stat_code =?' => '2', 'id_owner =?' => $CurAlly['id'])); } else { $OldTotalRank = 0; $OldTechRank = 0; $OldBuildRank = 0; $OldDefsRank = 0; $OldFleetRank = 0; } // Total des unitées consommée pour la recherche $SUM_Array = array(new Zend_Db_Expr('SUM(`tech_points`) AS `TechPoint`'), new Zend_Db_Expr('SUM(`tech_count`) AS `TechCount`'), new Zend_Db_Expr('SUM(`build_points`) AS `BuildPoint`'), new Zend_Db_Expr('SUM(`build_count`) AS `BuildCount`'), new Zend_Db_Expr('SUM(`defs_points`) AS `DefsPoint`'), new Zend_Db_Expr('SUM(`defs_count`) AS `DefsCount`'), new Zend_Db_Expr('SUM(`fleet_points`) AS `FleetPoint`'), new Zend_Db_Expr('SUM(`fleet_count`) AS `FleetCount`'), new Zend_Db_Expr('SUM(`total_points`) AS `TotalPoint`'), new Zend_Db_Expr('SUM(`total_count`) AS `TotalCount`')); $Points = $db->select()->from(Legacies_Database::getTable('deprecated/statpoints'), $SUM_Array)->where('stat_type=?', '2')->where('id_ally=?', $CurAlly['id'])->query()->fetch(); //array('thecolumn' => new Zend_Db_Expr('SUM(amount)')) $TTechCount = $Points['TechCount']; $TTechPoints = $Points['TechPoint']; $TBuildCount = $Points['BuildCount']; $TBuildPoints = $Points['BuildPoint']; $TDefsCount = $Points['DefsCount']; $TDefsPoints = $Points['DefsPoint']; $TFleetCount = $Points['FleetCount']; $TFleetPoints = $Points['FleetPoint']; $GCount = $Points['TotalCount']; $GPoints = $Points['TotalPoint']; $QryInsertStats = array('id_owner' => $CurAlly['id'], 'id_ally' => '0', 'stat_type' => '2', 'stat_code' => '1', 'tech_points' => $TTechPoints, 'tech_count' => $TTechCount, 'tech_old_rank' => $OldTechRank, 'build_points' => $TBuildPoints, 'build_count' => $TBuildCount, 'build_old_rank' => $OldBuildRank, 'defs_points' => $TDefsPoints, 'defs_count' => $TDefsCount, 'defs_old_rank' => $OldDefsRank, 'fleet_points' => $TFleetPoints, 'fleet_count' => $TFleetCount, 'fleet_old_rank' => $OldFleetRank, 'total_points' => $GPoints, 'total_count' => $GCount, 'total_old_rank' => $OldTotalRank, 'stat_date' => new Zend_Db_Expr('UNIX_TIMESTAMP()')); //@todo Suite indentation $db->insert(Legacies_Database::getTable('deprecated/statpoints'), $QryInsertStats); } AdminMessage($lang['adm_done'], $lang['adm_stat_title']); } else { AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']); }