function sn_tpl_parse_fleet_db($fleet, $index, $user_data = false, &$result) { global $lang, $user; if (!$user_data) { $user_data = $user; } if ($fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] == MT_AKS) { $aks = doquery("SELECT * FROM {{aks}} WHERE id={$fleet['fleet_group']} LIMIT 1;", true); } $spy_level = $user['id'] == $fleet['fleet_owner'] ? 100 : GetSpyLevel($user); $result['fleet'] = isset($result['fleet']) ? $result['fleet'] : array(); $result['fleet'] = array('NUMBER' => $index, 'ID' => $fleet['fleet_id'], 'OWNER' => $fleet['fleet_owner'], 'TARGET_OWNER' => $fleet['fleet_target_owner'], 'MESSAGE' => $fleet['fleet_mess'], 'MISSION' => $fleet['fleet_mission'], 'MISSION_NAME' => $lang['type_mission'][$fleet['fleet_mission']], 'ACS' => $aks['name'], 'AMOUNT' => $spy_level >= 4 ? pretty_number($fleet['fleet_amount']) . ($fleet['fleet_resource_metal'] + $fleet['fleet_resource_crystal'] + $fleet['fleet_resource_deuterium'] ? '+' : '') : '?', 'METAL' => $spy_level >= 8 ? $fleet['fleet_resource_metal'] : 0, 'CRYSTAL' => $spy_level >= 8 ? $fleet['fleet_resource_crystal'] : 0, 'DEUTERIUM' => $spy_level >= 8 ? $fleet['fleet_resource_deuterium'] : 0, 'START_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$fleet['fleet_start_type']], 'START_COORDS' => "[{$fleet['fleet_start_galaxy']}:{$fleet['fleet_start_system']}:{$fleet['fleet_start_planet']}]", 'START_TIME_TEXT' => date(FMT_DATE_TIME, $fleet['fleet_end_time'] + SN_CLIENT_TIME_DIFF), 'START_LEFT' => floor($fleet['fleet_end_time'] + 1 - SN_TIME_NOW), 'START_URL' => uni_render_coordinates_href($fleet, 'fleet_start_', 3), 'START_NAME' => $fleet['fleet_start_name'], 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$fleet['fleet_end_type']], 'END_COORDS' => "[{$fleet['fleet_end_galaxy']}:{$fleet['fleet_end_system']}:{$fleet['fleet_end_planet']}]", 'END_TIME_TEXT' => date(FMT_DATE_TIME, $fleet['fleet_start_time'] + SN_CLIENT_TIME_DIFF), 'END_LEFT' => floor($fleet['fleet_start_time'] + 1 - SN_TIME_NOW), 'END_URL' => uni_render_coordinates_href($fleet, 'fleet_end_', 3), 'END_NAME' => $fleet['fleet_end_name'], 'STAY_TIME' => date(FMT_DATE_TIME, $fleet['fleet_end_stay'] + SN_CLIENT_TIME_DIFF), 'STAY_LEFT' => floor($fleet['fleet_end_stay'] + 1 - SN_TIME_NOW), 'OV_LABEL' => $fleet['ov_label'], 'EVENT_TIME_TEXT' => date(FMT_DATE_TIME, $fleet['event_time'] + SN_CLIENT_TIME_DIFF), 'OV_LEFT' => floor($fleet['event_time'] + 1 - SN_TIME_NOW), 'OV_THIS_PLANET' => $fleet['ov_this_planet']); $ship_list = explode(';', $fleet['fleet_array']); if ($spy_level >= 6) { foreach ($ship_list as $ship_record) { if ($ship_record) { $ship_data = explode(',', $ship_record); if ($spy_level >= 10) { $single_ship_data = get_ship_data($ship_data[0], $user_data); $result['ships'][$ship_data[0]] = array('ID' => $ship_data[0], 'NAME' => $lang['tech'][$ship_data[0]], 'AMOUNT' => $ship_data[1], 'AMOUNT_TEXT' => pretty_number($ship_data[1]), 'CONSUMPTION' => $single_ship_data['consumption'], 'SPEED' => $single_ship_data['speed'], 'CAPACITY' => $single_ship_data['capacity']); } else { $result['ships'][$ship_data[0]] = array('ID' => $ship_id++, 'NAME' => $lang['tech'][UNIT_SHIPS], 'AMOUNT' => $ship_data[1], 'AMOUNT_TEXT' => pretty_number($ship_data[1]), 'CONSUMPTION' => 0, 'SPEED' => 0, 'CAPACITY' => 0); } } } } return $result; }
/** * flt_mission_transport.php * * @version 2.0 return cacher result * @version 1 * @copyright 2008 By Chlorel for XNova */ function flt_mission_transport(&$mission_data) { $fleet_row =& $mission_data['fleet']; $source_planet =& $mission_data['src_planet']; $destination_planet =& $mission_data['dst_planet']; if (!isset($destination_planet['id']) || !$destination_planet['id_owner']) { // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); flt_send_back($fleet_row); return CACHE_FLEET; } global $lang; $Message = sprintf($lang['sys_tran_mess_user'], $source_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']); msg_send_simple_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); if ($fleet_row['fleet_target_owner'] != $fleet_row['fleet_owner']) { msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); } /* $Message = sprintf( $lang['sys_tran_mess_owner'], $TargetName, uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium'] ); msg_send_simple_message ( $StartOwner, '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); */ return RestoreFleetToPlanet($fleet_row, false, true); }
/** * flt_mission_transport.php * * @version 2.0 return cacher result * @version 1 * @copyright 2008 By Chlorel for XNova */ function flt_mission_transport($mission_data) { $fleet_row = $mission_data['fleet']; $source_planet = $mission_data['src_planet']; $destination_planet = $mission_data['dst_planet']; if (!$destination_planet || !is_array($destination_planet) || !$destination_planet['id_owner']) { doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); return CACHE_FLEET; } /* // flt_mission_transport $Message = sprintf($lang['sys_tran_mess_back'], $StartName, GetStartAdressLink($fleet_row, '')); SendSimpleMessage($StartOwner, '', $fleet_row['fleet_end_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $Message); */ global $lang; $StartName = $source_planet['name']; $StartOwner = $fleet_row['fleet_owner']; $TargetName = $destination_planet['name']; $TargetOwner = $fleet_row['fleet_target_owner']; $Message = sprintf($lang['sys_tran_mess_owner'], $TargetName, uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']); msg_send_simple_message($StartOwner, '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); if ($TargetOwner != $StartOwner) { $Message = sprintf($lang['sys_tran_mess_user'], $StartName, uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $TargetName, uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']); msg_send_simple_message($TargetOwner, '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); } return RestoreFleetToPlanet($fleet_row, false, true); }
/** * MissionCaseStay.php * * version 2.0 returns results for new fleet handler * @version 1.1 * @copyright 2008 by Chlorel for XNova */ function flt_mission_relocate($mission_data) { $fleet_row =& $mission_data['fleet']; $destination_planet =& $mission_data['dst_planet']; if (!$destination_planet || !is_array($destination_planet)) { // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); flt_send_back($mission_data['fleet']); return CACHE_FLEET; } global $lang; $Message = sprintf($lang['sys_tran_mess_user'], $mission_data['src_planet']['name'], uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']) . '<br />' . $lang['sys_relocate_mess_user']; foreach (sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) { $Message .= $lang['tech'][$ship_id] . ' - ' . $ship_count . '<br />'; } msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_qg'], $lang['sys_stay_mess_stay'], $Message); return RestoreFleetToPlanet($fleet_row, false); }
$RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime); } sn_db_transaction_commit(); message($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); } else { $template = gettemplate('jumpgate', true); if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) { $Combo = ''; $MoonList = db_planet_list_moon_other($user['id'], $planetrow['id']); // while($CurMoon = db_fetch($MoonList)) foreach ($MoonList as $CurMoon) { if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) { $NextJumpTime = uni_get_time_to_jump($CurMoon); $template->assign_block_vars('moon', array('ID' => $CurMoon['id'], 'GALAXY' => $CurMoon['galaxy'], 'SYSTEM' => $CurMoon['system'], 'PLANET' => $CurMoon['planet'], 'NAME' => $CurMoon['name'], 'NEXT_JUMP_TIME' => $NextJumpTime ? pretty_time($NextJumpTime) : '')); } } foreach (sn_get_groups('fleet') as $Ship) { if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) { continue; } $template->assign_block_vars('fleet', array('SHIP_ID' => $Ship, 'SHIP_NAME' => $lang['tech'][$Ship], 'SHIP_COUNT' => $ship_count, 'SHIP_COUNT_TEXT' => pretty_number($ship_count))); } $template->assign_vars(array('GATE_JUMP_REST_TIME' => uni_get_time_to_jump($planetrow), 'gate_start_name' => $planetrow['name'], 'gate_start_link' => uni_render_coordinates_href($planetrow, '', 3))); display($template, $lang['tech'][STRUC_MOON_GATE]); } else { message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10); } } // ----------------------------------------------------------------------------------------------------------- // History version // 1.0 - Version from scrap .. y avait pas ... bin maintenant y a !!
function ShowBuildingInfoPage($CurrentUser, $CurrentPlanet, $BuildID) { global $dpath, $lang, $sn_data; $sn_groups =& $sn_data['groups']; $unit_data =& $sn_data[$BuildID]; lng_include('infos'); $GateTPL = ''; $DestroyTPL = ''; $TableHeadTPL = ''; $parse = $lang; // Données de base $parse['dpath'] = $dpath; $parse['name'] = $lang['tech'][$BuildID]; $parse['image'] = $BuildID; $parse['description'] = $lang['info'][$BuildID]['description']; if ($BuildID >= 1 && $BuildID <= 3) { // Cas des mines $PageTPL = gettemplate('info_buildings_table'); $DestroyTPL = gettemplate('info_buildings_destroy'); $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_p_hour}</td><td class=\"c\">{nfo_difference}</td><td class=\"c\">{nfo_used_energy}</td><td class=\"c\">{nfo_difference}</td></tr>"; $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th><th>{build_need}</th><th>{build_need_diff}</th></tr>"; } elseif ($BuildID == 4) { // Centrale Solaire $PageTPL = gettemplate('info_buildings_table'); $DestroyTPL = gettemplate('info_buildings_destroy'); $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_energy}</td><td class=\"c\">{nfo_difference}</td></tr>"; $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th></tr>"; } elseif ($BuildID == 12) { // Centrale Fusion $PageTPL = gettemplate('info_buildings_table'); $DestroyTPL = gettemplate('info_buildings_destroy'); $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_energy}</td><td class=\"c\">{nfo_difference}</td><td class=\"c\">{nfo_used_deuter}</td><td class=\"c\">{nfo_difference}</td></tr>"; $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th><th>{build_need}</th><th>{build_need_diff}</th></tr>"; } elseif ($BuildID >= 14 && $BuildID <= 32) { // Batiments Generaux $PageTPL = gettemplate('info_buildings_general'); $DestroyTPL = gettemplate('info_buildings_destroy'); } elseif ($BuildID == 33) { // Batiments Terraformer $PageTPL = gettemplate('info_buildings_general'); } elseif ($BuildID == 34) { // Dépot d'alliance $PageTPL = gettemplate('info_buildings_general'); $DestroyTPL = gettemplate('info_buildings_destroy'); } elseif ($BuildID == 35) { // nano $PageTPL = gettemplate('info_buildings_general'); $DestroyTPL = gettemplate('info_buildings_destroy'); } elseif ($BuildID == 44) { // Silo de missiles $PageTPL = gettemplate('info_buildings_general'); $DestroyTPL = gettemplate('info_buildings_destroy'); } elseif ($BuildID == 41) { // Batiments lunaires $PageTPL = gettemplate('info_buildings_general'); } elseif ($BuildID == 42) { // Phalange $PageTPL = gettemplate('info_buildings_table'); $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_range}</td></tr>"; $TableTPL = "<tr><th>{build_lvl}</th><th>{build_range}</th></tr>"; $DestroyTPL = gettemplate('info_buildings_destroy'); } elseif ($BuildID == 43) { // Porte de Saut $PageTPL = gettemplate('info_buildings_general'); $GateTPL = gettemplate('gate_fleet_table'); $DestroyTPL = gettemplate('info_buildings_destroy'); } elseif (in_array($BuildID, $sn_data['groups']['tech'])) { // Laboratoire $PageTPL = gettemplate('info_buildings_general'); } elseif (in_array($BuildID, $sn_data['groups']['fleet'])) { // Flotte $PageTPL = gettemplate('info_buildings_fleet'); $parse['element_typ'] = $lang['tech'][SHIP_FLEET]; $rapid_fire = eco_render_rapid_fire($BuildID); $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de $parse['hull_pt'] = pretty_number(($sn_data[$BuildID]['metal'] + $sn_data[$BuildID]['crystal']) / 10); // Points de Structure $parse['shield_pt'] = pretty_number($sn_data[$BuildID]['shield']); // Points de Bouclier $parse['attack_pt'] = pretty_number($sn_data[$BuildID]['attack']); // Points d'Attaque $parse['capacity_pt'] = pretty_number($sn_data[$BuildID]['capacity']); // Capacitée de fret $parse['base_speed'] = pretty_number($sn_data[$BuildID]['speed']); // Vitesse de base $parse['base_conso'] = pretty_number($sn_data[$BuildID]['consumption']); // Consommation de base if ($BuildID == SHIP_CARGO_SMALL) { $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($sn_data[$BuildID]['speed2']) . ")</font>"; // Vitesse rééquipée $parse['upd_conso'] = "<font color=\"yellow\">(" . pretty_number($sn_data[$BuildID]['consumption2']) . ")</font>"; // Consommation apres rééquipement } elseif ($BuildID == SHIP_BOMBER) { $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($sn_data[$BuildID]['speed2']) . ")</font>"; // Vitesse rééquipée } } elseif (in_array($BuildID, $sn_data['groups']['defense_active'])) { // Defenses $PageTPL = gettemplate('info_buildings_defense'); $parse['element_typ'] = $lang['tech'][400]; $rapid_fire = eco_render_rapid_fire($BuildID); $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de $parse['hull_pt'] = pretty_number(($sn_data[$BuildID]['metal'] + $sn_data[$BuildID]['crystal']) / 10); // Points de Structure $parse['shield_pt'] = pretty_number($sn_data[$BuildID]['shield']); // Points de Bouclier $parse['attack_pt'] = pretty_number($sn_data[$BuildID]['attack']); // Points d'Attaque } elseif ($BuildID >= 502 && $BuildID <= 503) { // Misilles $PageTPL = gettemplate('info_buildings_defense'); $parse['element_typ'] = $lang['tech'][400]; $parse['hull_pt'] = pretty_number($sn_data[$BuildID]['metal'] + $sn_data[$BuildID]['crystal']); // Points de Structure $parse['shield_pt'] = pretty_number($sn_data[$BuildID]['shield']); // Points de Bouclier $parse['attack_pt'] = pretty_number($sn_data[$BuildID]['attack']); // Points d'Attaque } elseif (in_array($BuildID, $sn_data['groups']['mercenaries'])) { // Officiers $PageTPL = gettemplate('info_officiers_general'); $mercenary = $sn_data[$BuildID]; $mercenary_bonus = $mercenary['bonus']; $mercenary_bonus = $mercenary_bonus >= 0 ? "+{$mercenary_bonus}" : "{$mercenary_bonus}"; switch ($mercenary['bonus_type']) { case BONUS_PERCENT: $mercenary_bonus = "{$mercenary_bonus}%"; break; case BONUS_ADD: break; case BONUS_ABILITY: $mercenary_bonus = ''; break; default: break; } $parse['EFFECT'] = $lang['info'][$BuildID]['effect']; $parse['mercenary_bonus'] = $mercenary_bonus; $parse['max_level'] = $mercenary['max']; } // ---- Tableau d'evolution if ($TableHeadTPL != '') { $parse['table_head'] = parsetemplate($TableHeadTPL, $lang); $parse['table_data'] = ShowProductionTable($CurrentUser, $CurrentPlanet, $BuildID, $TableTPL); } // La page principale $page = parsetemplate($PageTPL, $parse); if ($GateTPL != '') { if ($CurrentPlanet[$unit_data['name']] > 0) { $RestString = GetNextJumpWaitTime($CurrentPlanet); $parse['gate_start_link'] = uni_render_coordinates_href($CurrentPlanet, '', 3); if ($RestString['value'] != 0) { $parse['gate_time_script'] = InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], true); $parse['gate_wait_time'] = "<div id=\"bxx" . "Gate" . "1" . "\"></div>"; $parse['gate_script_go'] = InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], false); } else { $parse['gate_time_script'] = ""; $parse['gate_wait_time'] = ""; $parse['gate_script_go'] = ""; } $parse['gate_dest_moons'] = BuildJumpableMoonCombo($CurrentUser, $CurrentPlanet); $parse['gate_fleet_rows'] = BuildFleetListRows($CurrentPlanet); $page .= parsetemplate($GateTPL, $parse); } } if ($DestroyTPL != '') { if ($CurrentPlanet[$unit_data['name']] > 0) { // ---- Destruction $NeededRessources = GetBuildingPrice($CurrentUser, $CurrentPlanet, $BuildID, true, true); $DestroyTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $BuildID) / 2; $parse['destroyurl'] = "buildings.php?mode=" . QUE_STRUCTURES . "&action=destroy&unit_id={$BuildID}"; // Non balisé les balises sont dans le $parse['levelvalue'] = $CurrentPlanet[$unit_data['name']]; // Niveau du batiment a detruire $parse['nfo_metal'] = $lang['Metal']; $parse['nfo_crysta'] = $lang['Crystal']; $parse['nfo_deuter'] = $lang['Deuterium']; $parse['metal'] = pretty_number($NeededRessources['metal']); // Cout en metal de la destruction $parse['crystal'] = pretty_number($NeededRessources['crystal']); // Cout en cristal de la destruction $parse['deuterium'] = pretty_number($NeededRessources['deuterium']); // Cout en deuterium de la destruction $parse['destroytime'] = pretty_time($DestroyTime); // Durée de la destruction // L'insert de destruction $page .= parsetemplate($DestroyTPL, $parse); } } return $page; }
function flt_mission_spy(&$mission_data) { global $lang; $fleet_row =& $mission_data['fleet']; $target_user_row =& $mission_data['dst_user']; $target_planet_row =& $mission_data['dst_planet']; $spying_user_row =& $mission_data['src_user']; $spying_planet_row =& $mission_data['src_planet']; if (!isset($target_user_row['id']) || !isset($target_planet_row['id']) || !isset($spying_user_row['id'])) { doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); return; } $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']); if ($fleet_array[SHIP_SPY] > 0) { $TargetSpyLvl = GetSpyLevel($target_user_row); $CurrentSpyLvl = GetSpyLevel($spying_user_row); $spy_diff_empire = $CurrentSpyLvl - $TargetSpyLvl; $spy_probes = $fleet_array[SHIP_SPY]; $spy_diff = $spy_diff_empire + sqrt($spy_probes) - 1; $combat_pack[0] = array(RES_METAL => $target_planet_row['metal'], RES_CRYSTAL => $target_planet_row['crystal'], RES_DEUTERIUM => $target_planet_row['deuterium']); $spy_message = "<table width=\"440\" cellspacing = \"1\"><tr><td class=\"c\" colspan=\"4\">{$lang['sys_spy_maretials']} {$target_planet_row['name']} "; $spy_message .= uni_render_coordinates_href($target_planet_row, '', 3); $spy_message .= " ({$lang['Player_']} '{$target_user_row['username']}') {$lang['On_']} "; $spy_message .= date(FMT_DATE_TIME, $fleet_row['fleet_end_time']); $spy_message .= "</td></tr><tr>"; $spy_message .= "<td width=220>{$lang['sys_metal']}</td><td width=220 align=right>" . pretty_number($target_planet_row['metal']) . "</td>"; $spy_message .= "<td width=220>{$lang['sys_crystal']}</td></td><td width=220 align=right>" . pretty_number($target_planet_row['crystal']) . "</td>"; $spy_message .= "</tr><tr>"; $spy_message .= "<td width=220>{$lang['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>"; $spy_message .= "<td width=220>{$lang['sys_energy']}</td><td width=220 align=right>" . pretty_number($target_planet_row['energy_max']) . "</td>"; $spy_message .= "</tr>"; if ($spy_diff >= 2) { $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'fleet', $lang['tech'][UNIT_SHIPS], $target_user_row) . "</div>"; coe_compress_add_units(sn_get_groups('fleet'), $target_planet_row, $combat_pack[0]); } if ($spy_diff >= 3) { $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'defense', $lang['tech'][UNIT_DEFENCE], $target_user_row) . "</div>"; coe_compress_add_units(sn_get_groups('defense_active'), $target_planet_row, $combat_pack[0]); } if ($spy_diff >= 5) { $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'structures', $lang['tech'][UNIT_STRUCTURES], $target_user_row) . "</div>"; } if ($spy_diff_empire >= 0) { $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'tech', $lang['tech'][UNIT_TECHNOLOGIES], $target_user_row) . "</div>"; coe_compress_add_units(array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR), $target_planet_row, $combat_pack[0], $target_user_row); } // TODO: Наемники, губернаторы, артефакты и прочее имперское $simulator_link = sn_ube_simulator_encode_replay($combat_pack, 'D'); $target_unit_list = 0; foreach (sn_get_groups('fleet') as $unit_id) { $target_unit_list += max(0, mrc_get_level($target_user_row, $target_planet_row, $unit_id, false, true)); } $spy_detected = $spy_probes * $target_unit_list / 4 * pow(2, $TargetSpyLvl - $CurrentSpyLvl); if (mt_rand(0, 99) > $spy_detected) { $spy_outcome_str = sprintf($lang['sys_mess_spy_detect_chance'], $spy_detected); $spy_detected = false; } else { $spy_outcome_str = $lang['sys_mess_spy_destroyed']; $spy_detected = true; } $spy_message .= "<tr><th class=\"c_c\" colspan=4>"; $spy_message .= "{$spy_outcome_str}<br />"; $spy_message .= "<a href=\"fleet.php?target_mission=1&planet_type={$fleet_row['fleet_end_type']}&galaxy={$fleet_row['fleet_end_galaxy']}&system={$fleet_row['fleet_end_system']}&planet={$fleet_row['fleet_end_planet']} \">{$lang['type_mission'][1]}</a><br />"; $spy_message .= "<a href=\"simulator.php?replay={$simulator_link}\">{$lang['COE_combatSimulator']}</a><br />"; $spy_message .= "</th></tr></table>"; // End of link generation msg_send_simple_message($spying_user_row['id'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_mess_qg'], $lang['sys_mess_spy_report'], $spy_message); $target_message = "{$lang['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} " . uni_render_coordinates_href($spying_planet_row, '', 3); $target_message .= " {$lang['sys_mess_spy_seen_at']} {$target_planet_row['name']} " . uni_render_coordinates($target_planet_row); $target_user_id = $fleet_row['fleet_target_owner']; if ($spy_detected) { doquery("DELETE FROM {{fleets}} WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); $debris_planet_id = $target_planet_row['planet_type'] == PT_PLANET ? $target_planet_row['id'] : $target_planet_row['parent_planet']; $spy_cost = get_unit_param(SHIP_SPY, P_COST); db_planet_set_by_id($debris_planet_id, "`debris_metal` = `debris_metal` + " . floor($spy_probes * $spy_cost[RES_METAL] * 0.3) . ", `debris_crystal` = `debris_crystal` + " . floor($spy_probes * $spy_cost[RES_CRYSTAL] * 0.3)); $target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}"; $result = CACHE_FLEET | CACHE_PLANET_DST; } else { $result = CACHE_FLEET; } msg_send_simple_message($target_user_id, '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $target_message); } if (!$spy_detected) { doquery("UPDATE {{fleets}} SET `fleet_mess` = '1' WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); } return $result; }