Affiche les techno dans l'arbre des technos (la disruption) #6

Merged
nemunaire merged 12 commits from show_tech_description into master 2020-11-22 17:01:17 +00:00
2 changed files with 45 additions and 19 deletions
Showing only changes of commit e40d3ad3ba - Show all commits

View File

@ -43,19 +43,40 @@ if (SURFACE == "asteroide") {
$template->assign('batiments', $TEMP_liste);
}
/*
$TEMP_technologies = array();
$nb = count($technolo);
for ($id=0 ; $id<$nb ; $id++) {
if (!empty($technolo[$id])) $TEMP_technologies[] = array(
'id' => $id,
'nom' => $technolo[$id],
'niveau' => $planete->technologies[$id],
'etat' => readDeblok($technoloTECH[$id], $planete)
);
}
$template->assign('technologies',$TEMP_technologies);
*/
function traiterBrancheTechnologie($TEMP_liste, $branche, $i)
{
global $LANG, $planete;
foreach ($i as $key => $id) {
if (is_array($id)) {
$TEMP_liste = traiterBrancheTechnologie($TEMP_liste, $branche, $id);
} else {
$niveau = dTechnologies::niveau_du_joueur($branche, $id, $planete);
$niveau_max = dTechnologies::niveau_max($branche, $id, $planete, $LANG);
$object = array($branche, $id);
$TEMP_liste[$branche][$id] = array(
'id' => $id,
'branche' => $branche,
'niveau' => $niveau,
'niveau_max' => $niveau_max,
'etat' => dTechnologies::needed($object, $planete, true)
);
}
}
return $TEMP_liste;
}
$TEMP_liste = array();
$branche = 0;
while ($branche < 9) {
$TEMP_liste[$branche] = array();
$TEMP_liste = traiterBrancheTechnologie($TEMP_liste, $branche, dTechnologies::type($branche, $planete->race));
$branche++;
}
$template->assign('technologies', $TEMP_liste);
$TEMP_liste = array();
foreach ($planete->casernes as $id => $unite) {
if (!empty($LANG[$race]["caserne"]["noms_sing"][$id])) {

View File

@ -18,15 +18,20 @@
</tbody></table></div>
</div>
{*} <div{if $defaut == 'technologies'} class="hightlight"{/if}><a href="{$menu.arbre}&amp;q=technologies&amp;r={$raceAff}">Technologies</a>
<div{if $defaut == 'technologies'} class="hightlight"{/if}><a href="{$menu.arbre}&amp;q=technologies&amp;r={$raceAff}">Technologies</a>
<div><table><thead>
<tr><th>Technologies (niveau)</th><th>Technologies nécessaires (niveau actuel)</th></tr>
</thead><tbody>
<tr><th>Branche</th><th>Technologies (niveau)</th><th>Technologies nécessaires (niveau actuel)</th></tr>
</thead><tbody>
{counter start=0 assign=branche print=false}
{foreach from=$technologies item=technologie}
<tr><td><a href="?p=description&amp;t={$technologie.id}&amp;r={$raceAff}#menu">{$technologie.nom}</a> ({$technologie.niveau}) :</td><td>{$technologie.etat}</td></tr>
{foreach from=$technologies[$branche] item=technologie}
{assign var="id" value=$technologie.id}
<tr><td>{$LANG[$raceAff].technologies.branches.$branche|ucfirst}</td><td><a href="?p=description&amp;b={$branche}&amp;t={$id}&amp;r={$raceAff}#menu">{$LANG[$raceAff].technologies.noms_sing.$branche.$id|ucfirst}</a> ({$technologie.niveau}/{$technologie.niveau_max}) :</td><td>{$technologie.etat}</td></tr>
{/foreach}
{counter}
{/foreach}
</tbody></table></div>
</div>{/*}
</div>
<div{if $defaut == 'caserne'} class="hightlight"{/if}><a href="{$menu.arbre}&amp;q=caserne&amp;r={$raceAff}">{$LANG[$raceAff].batiments.noms_sing.9|ucfirst}</a>
<div><table><thead>