set_filenames(array('ressourcestpl' => 'ressources.tpl')); $template->assign_vars( array('RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => $NOM_METAL, 'NOM_CRISTAL' => $NOM_CRISTAL, 'NOM_HYDROGENE' => $NOM_HYDROGENE, 'NOM_ENERGIE' => $NOM_ENERGIE, 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'ERREUR' => $ERREUR, 'HEADER' => $HEADER, 'PUB' => $PUB)); for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i])); } function tableauProd($ibat,$nivo){ $dejadefi = 1; require('common.php'); $return = ''; $c = $nivo-2 < 1 ? 1 : $nivo-2; $a = $c + 7; if ($ibat == 0) { for ($c;$c<$a;$c++) { $b=floor((ceil(((($c*32)+(pow(1.41,$c)*exp(0.066*$c)))/0.36)*3600)/10000)*3.7 + 0.011*3600); $h=ceil((ceil(((($c*32)+(pow(1.41,$c)*exp(0.066*$c)))/0.36)*3600)/10000)*3.7 + 0.011*3600) - ceil((ceil((((($c-1)*32)+(pow(1.41,$c-1)*exp(0.066*($c-1))))/0.36)*3600)/10000)*3.7 + 0.011*3600); $p=ceil((exp($c*0.28)*10)); $g=ceil((exp($c*0.28)*10)) - ceil((exp(($c-1)*0.28)*10)); if ($c == $nivo) $return .= ''.$c.''.$b.' (+ '.$h.')'.$p.' (+ '.$g.')'; else $return .= ''.$c.''.$b.' (+ '.$h.')'.$p.' (+ '.$g.')'; } } elseif ($ibat == 1) { for ($c;$c<$a;$c++) { $b=floor(((ceil(((($c*13)+(pow(1.36,$c)*exp(0.0675*$c)))/0.36)*3600)/10000)*7) + 0.0055*3600); $h=floor(((ceil(((($c*13)+(pow(1.36,$c)*exp(0.0675*$c)))/0.36)*3600)/10000)*7) + 0.0055*3600) - floor(((ceil((((($c-1)*13)+(pow(1.36,($c-1))*exp(0.0675*($c-1))))/0.36)*3600)/10000)*7) + 0.0055*3600); $p=ceil((exp($c*0.28)*10)); $g=ceil((exp($c*0.28)*10)) - ceil((exp(($c-1)*0.28)*10)); if ($c == $nivo) $return .= ''.$c.''.$b.' (+ '.$h.')'.$p.' (+ '.$g.')'; else $return .= ''.$c.''.$b.' (+ '.$h.')'.$p.' (+ '.$g.')'; } } elseif ($ibat == 2) { for ($c;$c<$a;$c++) { $b=floor((floor(((($c*12)+(pow(1.394,$c)*exp(0.072*$c)))/0.36)*3600)/10000)*5); $h=ceil((floor(((($c*12)+(pow(1.394,$c)*exp(0.072*$c)))/0.36)*3600)/10000)*5) - ceil((floor((((($c-1)*12)+(pow(1.394,$c-1)*exp(0.072*($c-1))))/0.36)*3600)/10000)*5); $p=ceil((exp($c*0.31)*10)); $g=ceil((exp($c*0.31)*10)) - ceil((exp(($c-1)*0.31)*10)); if ($c == $nivo) $return .= ''.$c.''.$b.' (+ '.$h.')'.$p.' (+ '.$g.')'; else $return .= ''.$c.''.$b.' (+ '.$h.')'.$p.' (+ '.$g.')'; } } elseif ($ibat == 3) { for ($c;$c<$a;$c++) { $b=ceil($c*20+(exp($c*0.3)*10)); $h=ceil($c*20+(exp($c*0.3)*10)) - ceil(($c-1)*20+(exp(($c-1)*0.3)*10)); if ($c == $nivo) $return .= ''.$c.''.$b.' (+ '.$h.')'; else $return .= ''.$c.''.$b.' (+ '.$h.')'; } } elseif ($ibat == 4) { for ($c;$c<$a;$c++) { $b=ceil($c*80+(exp($c*0.38)*11)); $h=ceil($c*80+(exp($c*0.38)*11)) - ceil(($c-1)*80+(exp(($c-1)*0.38)*11)); if ($c == $nivo) $return .= ''.$c.''.$b.' (+ '.$h.')'; else $return .= ''.$c.''.$b.' (+ '.$h.')'; } } else $return = ''; if ($return == '') return '
Référence du batiment invalide

'; else return $return; } function niveauBat($bat){ if ($bat == 0) return 'mine_m'; elseif ($bat == 1) return 'mine_c'; elseif ($bat == 2) return 'mine_h'; elseif ($bat == 3) return 'centrale_s'; elseif ($bat == 4) return 'centrale_f'; elseif ($bat == 5) return 'radar'; elseif ($bat == 6) return 'labo'; elseif ($bat == 7) return 'chantier_terrestre'; elseif ($bat == 8) return 'chantier_spatial'; elseif ($bat == 9) return 'caserne'; elseif ($bat == 10) return 'silo'; elseif ($bat == 11) return 'centre_info'; else return '#Erreur, batiment invalide'; } function niveauTec($tec){ if ($tec == 0) return 'informatique'; elseif ($tec == 1) return 'detection'; elseif ($tec == 2) return 'armement'; elseif ($tec == 3) return 'energie_t'; elseif ($tec == 4) return 'reacteur'; elseif ($tec == 5) return 'reacteur_f'; elseif ($tec == 6) return 'reacteur_ff'; elseif ($tec == 7) return 'medecine'; elseif ($tec == 8) return 'tactique'; elseif ($tec == 9) return 'spartan'; elseif ($tec == 10) return 'blindage'; else return '#Erreur, technologie invalide'; } function niveauVai($vai){ return 'vaisseau_'.$vai; } if (isset($_GET['bat'])) { $i = intval($_GET['bat']); $CONTENU = ''; if (empty($batiment[$i])) $CONTENU = '
Batiment inexistant
'; else { if ($i <= 2) $CONTENU = '
'.$batiment[$i].' niveau '.${niveauBat($i)}.'
'.$batimede[$i].'
'.tableauProd($i,${niveauBat($i)}).'
NiveauProduction par heureConsommation énergie
'; elseif ($i <= 4) $CONTENU = '
'.$batiment[$i].' niveau '.${niveauBat($i)}.'
'.$batimede[$i].'
'.tableauProd($i,${niveauBat($i)}).'
NiveauProduction par heure
'; else $CONTENU = '
'.$batiment[$i].' niveau '.${niveauBat($i)}.'

'.$batimede[$i].'
'; } $template->set_filenames(array('defaut' => 'defaut.tpl')); $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); $template->assign_vars( array('PAGE' => $CONTENU, 'PUB' => $PUB)); $template->pparse('defaut'); } elseif (isset($_GET['tec'])) { $i = intval($_GET['tec']); if (empty($technolo[$i])) $CONTENU = '
Technologie inexistante
'; else $CONTENU = '
'.$technolo[$i].' niveau '.${niveauTec($i)}.'

'.$technode[$i].'
'; $template->set_filenames(array('defaut' => 'defaut.tpl')); $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); $template->assign_vars( array('PAGE' => $CONTENU, 'PUB' => $PUB)); $template->pparse('defaut'); } elseif (isset($_GET['vai'])) { $i = intval($_GET['vai']); if (empty($nomvaisn[$i])) $CONTENU = '
Vaisseau inexistant
'; else $CONTENU = '
'.$nomvaisn[$i].' ('.${niveauVai($i)}.' en attente)

'.$nomvaisd[$i].'
'; $template->set_filenames(array('defaut' => 'defaut.tpl')); $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); $template->assign_vars( array('PAGE' => $CONTENU, 'PUB' => $PUB)); $template->pparse('defaut'); } elseif (isset($_GET['def'])) { $i = intval($_GET['def']); if (empty($nomterrn[$i])) $CONTENU = '
Défense inexistante
'; else $CONTENU = '
'.$nomterrn[$i].' ('.${niveauVai($i)}.' prêt(e)s)

'.$nomterde[$i].'
'; $template->set_filenames(array('defaut' => 'defaut.tpl')); $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); $template->assign_vars( array('PAGE' => $CONTENU, 'PUB' => $PUB)); $template->pparse('defaut'); } ?>