diff --git a/onyx2/include/Class/Donnees/technologies.php b/onyx2/include/Class/Donnees/technologies.php index 2612938..7b23ba8 100644 --- a/onyx2/include/Class/Donnees/technologies.php +++ b/onyx2/include/Class/Donnees/technologies.php @@ -1442,6 +1442,42 @@ class dTechnologies implements Donnees } } + public static function niveau_du_joueur($branche, $id, surface $planete) + { + $niveau = 0; + // Si jamais cette techno a été recherchée au niveau 2 ou 3, aditionne les niveaux des trois technos + if (($niv = self::niveau($branche, $id)) > 0 && (self::idToBit($id) & $planete->technologies[$branche])) { + if ((self::idToBit($id+1) & $planete->technologies[$branche])) { + $niveau += $niv; + } + $niveau += $niv; + } + if (self::idToBit($id) & $planete->technologies[$branche]) { + // Gère les technos qui n'ont qu'un seul niveau + $ret = self::niveau($branche, $id); + if ($ret == 0) { + $niv = 1; + } else { + $niv = $ret; + } + $niveau += $niv; + } + return $niveau; + } + + + public static function niveau_max($branche, $id, surface $planete, $LANG) + { + $niveau_max = 1; + if ((self::idToBit($id) & $planete->technologies[$branche]) && isset($LANG[$planete->race]["technologies"]["noms_sing"][$branche][$id+1]) && $LANG[$planete->race]["technologies"]["noms_sing"][$branche][$id] == $LANG[$planete->race]["technologies"]["noms_sing"][$branche][$id+1]) { + if (isset($LANG[$planete->race]["technologies"]["noms_sing"][$branche][$id+2]) && $LANG[$planete->race]["technologies"]["noms_sing"][$branche][$id+1] == $LANG[$planete->race]["technologies"]["noms_sing"][$branche][$id+2]) { + $niveau_max = 3; + } else { + $niveau_max = 2; + } + } + return $niveau_max; + } /* Fonction qui transpforme l'id d'une technologie en son équivalent en bit dans la liste */ public static function idToBit($id)