supernova-ws /
SuperNova
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * infos.php |
||
| 5 | * |
||
| 6 | * Information about every aspect of in-game objects: buildings, officiers, techs etc |
||
| 7 | * |
||
| 8 | * @version 1.1st Security checks & tests by Gorlum for http://supernova.ws |
||
| 9 | * @version 1.1 |
||
| 10 | * @copyright 2008 By Chlorel for XNova |
||
| 11 | */ |
||
| 12 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
||
| 13 | |||
| 14 | $unit_id = sys_get_param_id('gid'); |
||
| 15 | if($unit_id == RES_DARK_MATTER) { |
||
| 16 | sys_redirect('dark_matter.php'); |
||
| 17 | } |
||
| 18 | |||
| 19 | if($unit_id == RES_METAMATTER) { |
||
| 20 | sys_redirect('metamatter.php'); |
||
| 21 | } |
||
| 22 | |||
| 23 | lng_include('infos'); |
||
| 24 | if(!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) { |
||
| 25 | sys_redirect('index.php?page=techtree'); |
||
| 26 | } |
||
| 27 | |||
| 28 | $template = gettemplate('novapedia', true); |
||
| 29 | |||
| 30 | $unit_data = get_unit_param($unit_id); |
||
| 31 | $unit_type = $unit_data['type']; |
||
| 32 | |||
| 33 | if($unit_type == UNIT_SHIPS) { |
||
| 34 | $template_result['UNIT_IS_SHIP'] = true; |
||
| 35 | |||
| 36 | $ship_data = get_ship_data($unit_id, $user); |
||
| 37 | |||
| 38 | $template_result += array( |
||
| 39 | 'BASE_SPEED' => pretty_number($ship_data['speed_base']), |
||
| 40 | 'ACTUAL_SPEED' => pretty_number($ship_data['speed']), |
||
| 41 | 'BASE_CONSUMPTION' => pretty_number($ship_data['consumption_base']), |
||
| 42 | 'ACTUAL_CONSUMPTION' => pretty_number($ship_data['consumption']), |
||
| 43 | |||
| 44 | 'BASE_CAPACITY' => pretty_number($unit_data['capacity']), |
||
| 45 | 'ACTUAL_CAPACITY' => pretty_number($ship_data['capacity']), |
||
| 46 | ); |
||
| 47 | |||
| 48 | $engine_template_info = array(); |
||
| 49 | foreach($unit_data['engine'] as $unit_engine_data) { |
||
| 50 | $unit_engine_data = get_engine_data($user, $unit_engine_data); |
||
| 51 | |||
| 52 | $engine_template_info[] = array( |
||
| 53 | 'NAME' => classLocale::$lang['tech'][$unit_engine_data['tech']], |
||
| 54 | 'MIN_LEVEL' => $unit_engine_data['min_level'], |
||
| 55 | 'USER_TECH_LEVEL' => mrc_get_level($user, null, $unit_engine_data['tech']), |
||
| 56 | 'BASE_SPEED' => pretty_number($unit_engine_data['speed_base']), |
||
| 57 | 'BASE_CONSUMPTION' => pretty_number($unit_engine_data['consumption_base']), |
||
| 58 | 'ACTUAL_SPEED' => pretty_number($unit_engine_data['speed']), |
||
| 59 | 'ACTUAL_CONSUMPTION' => pretty_number($unit_engine_data['consumption']), |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | $template_result['.']['engine'] = $engine_template_info; |
||
| 63 | |||
| 64 | } |
||
| 65 | |||
| 66 | |||
| 67 | $sn_data_group_combat = sn_get_groups('combat'); |
||
| 68 | if(in_array($unit_id, $sn_data_group_combat)) { |
||
| 69 | $template_result['UNIT_IS_COMBAT'] = true; |
||
| 70 | |||
| 71 | $unit_durability = $unit_data['shield'] + $unit_data['armor']; |
||
| 72 | |||
| 73 | $volley_arr = $rapid_to = $rapid_from = array(); |
||
| 74 | $str_rapid_from = ''; |
||
| 75 | $str_rapid_to = ''; |
||
| 76 | foreach($sn_data_group_combat as $enemy_id) { |
||
| 77 | $enemy_data = get_unit_param($enemy_id); |
||
| 78 | $enemy_durability = $enemy_data['shield'] + $enemy_data['armor']; |
||
| 79 | |||
| 80 | $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability; |
||
| 81 | if($rapid >= 1) { |
||
| 82 | $volley_arr[$enemy_id]['TO'] = floor($rapid); |
||
| 83 | } |
||
| 84 | |||
| 85 | $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability; |
||
| 86 | if($rapid >= 1) { |
||
| 87 | $volley_arr[$enemy_id]['FROM'] = floor($rapid); |
||
| 88 | } |
||
| 89 | } |
||
| 90 | foreach($volley_arr as $enemy_id => &$rapid) { |
||
| 91 | $rapid['ENEMY_ID'] = $enemy_id; |
||
| 92 | $rapid['ENEMY_NAME'] = classLocale::$lang['tech'][$enemy_id]; |
||
| 93 | } |
||
| 94 | $template_result['.']['volley'] = $volley_arr; |
||
| 95 | |||
| 96 | $template_result += array( |
||
| 97 | 'BASE_ARMOR' => pretty_number($unit_data['armor']), |
||
| 98 | 'BASE_SHIELD' => pretty_number($unit_data['shield']), |
||
| 99 | 'BASE_WEAPON' => pretty_number($unit_data['attack']), |
||
| 100 | |||
| 101 | 'ACTUAL_ARMOR' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), $unit_data['armor'])), |
||
| 102 | 'ACTUAL_SHIELD' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_data['shield'])), |
||
| 103 | 'ACTUAL_WEAPON' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_data['attack'])), |
||
| 104 | ); |
||
| 105 | |||
| 106 | } |
||
| 107 | |||
| 108 | if(classLocale::$lang['info'][$unit_id]['effect']) { |
||
| 109 | $template_result['UNIT_EFFECT'] = classLocale::$lang['info'][$unit_id]['effect']; |
||
| 110 | } |
||
| 111 | |||
| 112 | if($unit_data['bonus']) { |
||
| 113 | $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : ( |
||
| 114 | ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '') |
||
| 115 | ); |
||
| 116 | $template_result['UNIT_BONUS'] = $unit_bonus; |
||
| 117 | } |
||
| 118 | |||
| 119 | $template_result += array( |
||
| 120 | 'PAGE_HEADER' => classLocale::$lang['wiki_title'], |
||
| 121 | |||
| 122 | 'UNIT_ID' => $unit_id, |
||
| 123 | 'UNIT_NAME' => classLocale::$lang['tech'][$unit_id], |
||
| 124 | 'UNIT_TYPE' => $unit_type, |
||
| 125 | 'UNIT_TYPE_NAME' => classLocale::$lang['tech'][$unit_type], |
||
| 126 | 'UNIT_DESCRIPTION' => classLocale::$lang['info'][$unit_id]['description'], |
||
| 127 | ); |
||
| 128 | |||
| 129 | $template_result['.']['require'] = unit_requirements_render($user, $planetrow, $unit_id); |
||
| 130 | |||
| 131 | |||
| 132 | $template->assign_recursive($template_result); |
||
| 133 | display($template); |
||
| 134 | |||
| 135 | |||
| 136 | // ---------------------------------------------------------------------------------------------------------- |
||
| 137 | // Creation du tableau de production de ressources |
||
| 138 | // Tient compte du parametrage de la planete (si la production n'est pas affectée a 100% par exemple |
||
| 139 | // Tient compte aussi du multiplicateur de ressources |
||
| 140 | // |
||
| 141 | function ShowProductionTable($CurrentUser, $CurrentPlanet, $BuildID, $Template) { |
||
| 142 | $config_resource_multiplier = game_resource_multiplier(); |
||
| 143 | $config_resource_multiplier_plain = game_resource_multiplier(true); |
||
| 144 | |||
| 145 | $CurrentBuildtLvl = mrc_get_level($CurrentUser, $CurrentPlanet, $BuildID); |
||
| 146 | |||
| 147 | $BuildLevel = ($CurrentBuildtLvl > 0) ? $CurrentBuildtLvl : 1; |
||
| 148 | |||
| 149 | $modifiers = sn_get_groups('modifiers'); |
||
| 150 | |||
| 151 | $Prod[STRUC_MINE_METAL] = floor(mrc_modify_value( |
||
| 152 | $CurrentUser, |
||
| 153 | $CurrentPlanet, |
||
| 154 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 155 | $config_resource_multiplier * $unit_data[P_UNIT_PRODUCTION][RES_METAL]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 156 | )); |
||
| 157 | $Prod[STRUC_MINE_CRYSTAL] = floor(mrc_modify_value( |
||
| 158 | $CurrentUser, |
||
| 159 | $CurrentPlanet, |
||
| 160 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 161 | $config_resource_multiplier * $unit_data[P_UNIT_PRODUCTION][RES_CRYSTAL]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 162 | )); |
||
| 163 | $Prod[STRUC_MINE_DEUTERIUM] = floor(mrc_modify_value( |
||
| 164 | $CurrentUser, |
||
| 165 | $CurrentPlanet, |
||
| 166 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 167 | $config_resource_multiplier * $unit_data[P_UNIT_PRODUCTION][RES_DEUTERIUM]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 168 | )); |
||
| 169 | $Prod[STRUC_MINE_SOLAR] = floor(mrc_modify_value( |
||
| 170 | $CurrentUser, |
||
| 171 | $CurrentPlanet, |
||
| 172 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 173 | $config_resource_multiplier_plain * $unit_data[P_UNIT_PRODUCTION][RES_ENERGY]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 174 | )); |
||
| 175 | |||
| 176 | $ActualProd = floor($Prod[$BuildID]); |
||
| 177 | View Code Duplication | if($BuildID != STRUC_MINE_FUSION) { |
|
| 178 | $ActualNeed = floor($Prod[STRUC_MINE_SOLAR]); |
||
| 179 | } else { |
||
| 180 | $ActualNeed = floor($Prod[STRUC_MINE_DEUTERIUM]); |
||
| 181 | } |
||
| 182 | |||
| 183 | $BuildStartLvl = $CurrentBuildtLvl - 2; |
||
| 184 | if($BuildStartLvl < 1) { |
||
| 185 | $BuildStartLvl = 1; |
||
| 186 | } |
||
| 187 | $Table = ''; |
||
| 188 | $ProdFirst = 0; |
||
| 189 | for($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) { |
||
| 190 | if($BuildID != STRUC_MOON_PHALANX) { |
||
| 191 | $Prod[STRUC_MINE_METAL] = floor(mrc_modify_value( |
||
| 192 | $CurrentUser, |
||
| 193 | $CurrentPlanet, |
||
| 194 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 195 | $config_resource_multiplier * $unit_data[P_UNIT_PRODUCTION][RES_METAL]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 196 | )); |
||
| 197 | $Prod[STRUC_MINE_CRYSTAL] = floor(mrc_modify_value( |
||
| 198 | $CurrentUser, |
||
| 199 | $CurrentPlanet, |
||
| 200 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 201 | $config_resource_multiplier * $unit_data[P_UNIT_PRODUCTION][RES_CRYSTAL]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 202 | )); |
||
| 203 | $Prod[STRUC_MINE_DEUTERIUM] = floor(mrc_modify_value( |
||
| 204 | $CurrentUser, |
||
| 205 | $CurrentPlanet, |
||
| 206 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 207 | $config_resource_multiplier * $unit_data[P_UNIT_PRODUCTION][RES_DEUTERIUM]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 208 | )); |
||
| 209 | $Prod[STRUC_MINE_SOLAR] = floor(mrc_modify_value( |
||
| 210 | $CurrentUser, |
||
| 211 | $CurrentPlanet, |
||
| 212 | $modifiers[MODIFIER_RESOURCE_PRODUCTION], |
||
| 213 | $config_resource_multiplier_plain * $unit_data[P_UNIT_PRODUCTION][RES_ENERGY]($BuildLevel, 100, $CurrentUser, $CurrentPlanet) |
||
| 214 | )); |
||
| 215 | |||
| 216 | $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel; |
||
| 217 | if($ProdFirst > 0) { |
||
| 218 | if($BuildID != STRUC_MINE_FUSION) { |
||
| 219 | $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[$BuildID] - $ProdFirst)) . ")</font>"; |
||
| 220 | } else { |
||
| 221 | $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ProdFirst)) . ")</font>"; |
||
| 222 | } |
||
| 223 | } else { |
||
| 224 | $bloc['build_gain'] = ''; |
||
| 225 | } |
||
| 226 | if($BuildID != STRUC_MINE_FUSION) { |
||
| 227 | $bloc['build_prod'] = pretty_number(floor($Prod[$BuildID])); |
||
| 228 | $bloc['build_prod_diff'] = pretty_number(floor($Prod[$BuildID] - $ActualProd), true, true); |
||
| 229 | $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR]), true, true); |
||
| 230 | $bloc['build_need_diff'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ActualNeed), true, true); |
||
| 231 | } else { |
||
| 232 | $bloc['build_prod'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR])); |
||
| 233 | $bloc['build_prod_diff'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ActualProd), true, true); |
||
| 234 | $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM]), true, true); |
||
| 235 | $bloc['build_need_diff'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM] - $ActualNeed), true, true); |
||
| 236 | } |
||
| 237 | View Code Duplication | if($ProdFirst == 0) { |
|
| 238 | if($BuildID != STRUC_MINE_FUSION) { |
||
| 239 | $ProdFirst = floor($Prod[$BuildID]); |
||
| 240 | } else { |
||
| 241 | $ProdFirst = floor($Prod[STRUC_MINE_SOLAR]); |
||
| 242 | } |
||
| 243 | } |
||
| 244 | } else { |
||
| 245 | // Cas particulier de la phalange |
||
| 246 | $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel; |
||
| 247 | $bloc['build_range'] = ($BuildLevel * $BuildLevel) - 1; |
||
| 248 | } |
||
| 249 | $Table .= parsetemplate($Template, $bloc); |
||
| 250 | } |
||
| 251 | |||
| 252 | return $Table; |
||
| 253 | } |
||
| 254 | |||
| 255 | function eco_render_rapid_fire($unit_id) { |
||
| 256 | global $lang; |
||
| 257 | |||
| 258 | $unit_data = get_unit_param($unit_id); |
||
| 259 | $unit_durability = $unit_data['shield'] + $unit_data['armor']; |
||
| 260 | |||
| 261 | $str_rapid_from = ''; |
||
| 262 | $str_rapid_to = ''; |
||
| 263 | foreach(sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) { |
||
| 264 | $enemy_data = get_unit_param($enemy_id); |
||
| 265 | $enemy_durability = $enemy_data['shield'] + $enemy_data['armor']; |
||
| 266 | |||
| 267 | $rapid = floor($unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability); |
||
| 268 | if($rapid >= 1) { |
||
| 269 | $str_rapid_to .= "{$lang['nfo_rf_again']} {$lang['tech'][$enemy_id]} <font color=\"#00ff00\">{$rapid}</font><br>"; |
||
| 270 | } |
||
| 271 | |||
| 272 | $rapid = floor($enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability); |
||
| 273 | if($rapid >= 1) { |
||
| 274 | $str_rapid_from .= "{$lang['tech'][$enemy_id]} {$lang['nfo_rf_from']} <font color=\"#ff0000\">{$rapid}</font><br>"; |
||
| 275 | } |
||
| 276 | } |
||
| 277 | |||
| 278 | if($str_rapid_to && $str_rapid_from) { |
||
| 279 | $str_rapid_to .= '<hr>'; |
||
| 280 | } |
||
| 281 | |||
| 282 | return array('to' => $str_rapid_to, 'from' => $str_rapid_from); |
||
| 283 | } |
||
| 284 | |||
| 285 | // ---------------------------------------------------------------------------------------------------------- |
||
| 286 | // Construit la page par rapport a l'information demandée ... |
||
| 287 | // Permet de faire la differance entre les divers types et les pages speciales |
||
| 288 | // |
||
| 289 | $unit_id = sys_get_param_int('gid'); |
||
| 290 | |||
| 291 | $unit_data = get_unit_param($unit_id); |
||
| 292 | |||
| 293 | lng_include('infos'); |
||
| 294 | |||
| 295 | $DestroyTPL = ''; |
||
| 296 | $TableHeadTPL = ''; |
||
| 297 | |||
| 298 | $parse = classLocale::$lang; |
||
| 299 | // Données de base |
||
| 300 | $parse['dpath'] = $dpath; |
||
| 301 | $parse['name'] = classLocale::$lang['tech'][$unit_id]; |
||
| 302 | $parse['image'] = $unit_id; |
||
| 303 | $parse['description'] = classLocale::$lang['info'][$unit_id]['description']; |
||
| 304 | |||
| 305 | $unit_info = get_unit_param($unit_id); |
||
| 306 | |||
| 307 | if($unit_id >= 1 && $unit_id <= 3) { |
||
| 308 | // Cas des mines |
||
| 309 | $PageTPL = gettemplate('info_buildings_table'); |
||
| 310 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 311 | $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>"; |
||
| 312 | $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>"; |
||
| 313 | View Code Duplication | } elseif($unit_id == 4) { |
|
| 314 | // Centrale Solaire |
||
| 315 | $PageTPL = gettemplate('info_buildings_table'); |
||
| 316 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 317 | $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_energy}</td><td class=\"c\">{nfo_difference}</td></tr>"; |
||
| 318 | $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th></tr>"; |
||
| 319 | } elseif($unit_id == STRUC_MINE_FUSION) { |
||
| 320 | // Centrale Fusion |
||
| 321 | $PageTPL = gettemplate('info_buildings_table'); |
||
| 322 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 323 | $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>"; |
||
| 324 | $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>"; |
||
| 325 | } elseif($unit_id >= STRUC_FACTORY_ROBOT && $unit_id <= 32) { |
||
| 326 | // Batiments Generaux |
||
| 327 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 328 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 329 | } elseif($unit_id == STRUC_TERRAFORMER) { |
||
| 330 | // Batiments Terraformer |
||
| 331 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 332 | } elseif($unit_id == STRUC_ALLY_DEPOSIT) { |
||
| 333 | // Dépot d'alliance |
||
| 334 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 335 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 336 | } elseif($unit_id == STRUC_LABORATORY_NANO) { |
||
| 337 | // nano |
||
| 338 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 339 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 340 | } elseif($unit_id == STRUC_SILO) { |
||
| 341 | // Silo de missiles |
||
| 342 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 343 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 344 | } elseif($unit_id == STRUC_MOON_STATION) { |
||
| 345 | // Batiments lunaires |
||
| 346 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 347 | View Code Duplication | } elseif($unit_id == STRUC_MOON_PHALANX) { |
|
| 348 | // Phalange |
||
| 349 | $PageTPL = gettemplate('info_buildings_table'); |
||
| 350 | $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_range}</td></tr>"; |
||
| 351 | $TableTPL = "<tr><th>{build_lvl}</th><th>{build_range}</th></tr>"; |
||
| 352 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 353 | } elseif($unit_id == STRUC_MOON_GATE) { |
||
| 354 | // Porte de Saut |
||
| 355 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 356 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
||
| 357 | } elseif(in_array($unit_id, sn_get_groups('tech'))) { |
||
| 358 | // Laboratoire |
||
| 359 | $PageTPL = gettemplate('info_buildings_general'); |
||
| 360 | } elseif(in_array($unit_id, sn_get_groups('fleet'))) { |
||
| 361 | // Flotte |
||
| 362 | |||
| 363 | $PageTPL = gettemplate('info_buildings_fleet'); |
||
| 364 | |||
| 365 | $parse['element_typ'] = classLocale::$lang['tech'][UNIT_SHIPS]; |
||
| 366 | $rapid_fire = eco_render_rapid_fire($unit_id); |
||
| 367 | $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers |
||
| 368 | $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de |
||
| 369 | |||
| 370 | $parse['hull_pt'] = pretty_number(($unit_info['metal'] + $unit_info['crystal']) / 10); // Points de Structure |
||
| 371 | $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
||
| 372 | $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
||
| 373 | $parse['capacity_pt'] = pretty_number($unit_info['capacity']); // Capacitée de fret |
||
| 374 | $parse['base_speed'] = pretty_number($unit_info['engine'][0]['speed']); // Vitesse de base |
||
| 375 | $parse['base_conso'] = pretty_number($unit_info['engine'][0]['consumption']); // Consommation de base |
||
| 376 | |||
| 377 | $parse['ACTUAL_ARMOR'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), ($unit_info['metal'] + $unit_info['crystal']) / 10)); |
||
| 378 | $parse['ACTUAL_SHIELD'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])); |
||
| 379 | $parse['ACTUAL_WEAPON'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_info['attack'])); |
||
| 380 | |||
| 381 | $ship_data = get_ship_data($unit_id, $user); |
||
| 382 | $parse['ACTUAL_CAPACITY'] = pretty_number($ship_data['capacity']); |
||
| 383 | $parse['ACTUAL_SPEED'] = pretty_number($ship_data['speed']); |
||
| 384 | $parse['ACTUAL_CONSUMPTION'] = pretty_number($ship_data['consumption']); |
||
| 385 | if(count($unit_info['engine']) > 1) { |
||
| 386 | $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['speed']) . ")</font>"; // Vitesse rééquipée |
||
| 387 | $parse['upd_conso'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['consumption']) . ")</font>"; // Consommation apres rééquipement |
||
| 388 | } |
||
| 389 | } elseif(in_array($unit_id, sn_get_groups('defense_active'))) { |
||
| 390 | // Defenses |
||
| 391 | $PageTPL = gettemplate('info_buildings_defense'); |
||
| 392 | $parse['element_typ'] = classLocale::$lang['tech'][UNIT_DEFENCE]; |
||
| 393 | |||
| 394 | $rapid_fire = eco_render_rapid_fire($unit_id); |
||
| 395 | $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers |
||
| 396 | $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de |
||
| 397 | |||
| 398 | $parse['hull_pt'] = pretty_number(($unit_info['metal'] + $unit_info['crystal']) / 10); // Points de Structure |
||
| 399 | $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
||
| 400 | $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
||
| 401 | } elseif(in_array($unit_id, sn_get_groups('missile'))) { |
||
| 402 | // Misilles |
||
| 403 | $PageTPL = gettemplate('info_buildings_defense'); |
||
| 404 | $parse['element_typ'] = classLocale::$lang['tech'][UNIT_DEFENCE]; |
||
| 405 | $parse['hull_pt'] = pretty_number($unit_info['metal'] + $unit_info['crystal']); // Points de Structure |
||
| 406 | $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
||
| 407 | $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
||
| 408 | } elseif(in_array($unit_id, sn_get_groups(array('mercenaries', 'governors', 'artifacts', 'resources_all')))) { |
||
| 409 | // Officiers |
||
| 410 | $PageTPL = gettemplate('info_officiers_general'); |
||
| 411 | |||
| 412 | $mercenary = $unit_info; |
||
| 413 | $mercenary_bonus = $mercenary['bonus']; |
||
| 414 | $mercenary_bonus = $mercenary_bonus >= 0 ? "+{$mercenary_bonus}" : "{$mercenary_bonus}"; |
||
| 415 | View Code Duplication | switch($mercenary['bonus_type']) { |
|
| 416 | case BONUS_PERCENT: |
||
| 417 | $mercenary_bonus = "{$mercenary_bonus}%"; |
||
| 418 | break; |
||
| 419 | |||
| 420 | case BONUS_ADD: |
||
| 421 | break; |
||
| 422 | |||
| 423 | case BONUS_ABILITY: |
||
| 424 | $mercenary_bonus = ''; |
||
| 425 | break; |
||
| 426 | |||
| 427 | default: |
||
| 428 | break; |
||
| 429 | } |
||
| 430 | |||
| 431 | $parse['EFFECT'] = classLocale::$lang['info'][$unit_id]['effect']; |
||
| 432 | $parse['mercenary_bonus'] = $mercenary_bonus; |
||
| 433 | if(!in_array($unit_id, sn_get_groups(array('artifacts', 'resources_all')))) { |
||
| 434 | $parse['max_level'] = classLocale::$lang['sys_level'] . ' ' . |
||
| 435 | (in_array($unit_id, sn_get_groups('mercenaries')) ? mrc_get_level($user, $planetrow, $unit_id) : ($mercenary['location'] == LOC_USER ? mrc_get_level($user, null, $unit_id) : ($planetrow['PLANET_GOVERNOR_ID'] == $unit_id ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0))) |
||
| 436 | . (isset($mercenary['max']) ? "/{$mercenary['max']}" : ''); |
||
| 437 | } |
||
| 438 | } |
||
| 439 | |||
| 440 | // ---- Tableau d'evolution |
||
| 441 | if($TableHeadTPL != '') { |
||
| 442 | $parse['table_head'] = parsetemplate($TableHeadTPL, classLocale::$lang); |
||
|
0 ignored issues
–
show
|
|||
| 443 | $parse['table_data'] = ShowProductionTable($user, $planetrow, $unit_id, $TableTPL); |
||
| 444 | } |
||
| 445 | |||
| 446 | // La page principale |
||
| 447 | $page = parsetemplate($PageTPL, $parse); |
||
|
0 ignored issues
–
show
$parse is of type object<classLocale>, but the function expects a array|boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 448 | |||
| 449 | display($page, classLocale::$lang['nfo_page_title']); |
||
| 450 | |||
| 451 | // ----------------------------------------------------------------------------------------------------------- |
||
| 452 | // History version |
||
| 453 | // 2.0 - Using sn_timer instead of script generated by InsertScriptChronoApplet |
||
| 454 | // 1.1 - Ajout JumpGate pour la porte de saut comme la présente OGame ... Enfin un peu mieux quand meme ! |
||
| 455 | // 1.0 - Réécriture (réinventation de l'eau tiède) |
||
| 456 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: