$parse['ACTUAL_WEAPON'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_info['attack'])); $ship_data = get_ship_data($unit_id, $user); $parse['ACTUAL_CAPACITY'] = pretty_number($ship_data['capacity']); $parse['ACTUAL_SPEED'] = pretty_number($ship_data['speed']); $parse['ACTUAL_CONSUMPTION'] = pretty_number($ship_data['consumption']); if (count($unit_info['engine']) > 1) { $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['speed']) . ")</font>"; // Vitesse rééquipée $parse['upd_conso'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['consumption']) . ")</font>"; // Consommation apres rééquipement } } elseif (in_array($unit_id, sn_get_groups('defense_active'))) { // Defenses $PageTPL = gettemplate('info_buildings_defense'); $parse['element_typ'] = $lang['tech'][UNIT_DEFENCE]; $rapid_fire = eco_render_rapid_fire($unit_id); $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(($unit_info['metal'] + $unit_info['crystal']) / 10); // Points de Structure $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque } elseif (in_array($unit_id, sn_get_groups('missile'))) { // Misilles $PageTPL = gettemplate('info_buildings_defense'); $parse['element_typ'] = $lang['tech'][UNIT_DEFENCE]; $parse['hull_pt'] = pretty_number($unit_info['metal'] + $unit_info['crystal']);
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; }