vue [TUTO] Laboratoire amélioré (réduit le temps de recherche)
Kommunauty
Connexion
Inscription

[TUTO] Laboratoire amélioré (réduit le temps de recherche)


Mizur Messages : 6615

Pour créer un laboratoire amelioré, tuto trouvé sur le forum officiel de XNova.

Il permet de reduire le temps de recherche suivant son niveau.

Copyright 2008 By Chlorel for XNova

D'abord dans vars.php

Trouver

34 => "ally_deposit",

puis ajouter en dessous

35 => "laboratorio",

Trouver

33 => array(  15 =>   1, 113 =>  12),

puis ajouter

35 => array( 31 => 25, 123 => 16),

Trouver

34 => array ( 'metal' =>   20000, 'crystal' =>   40000, 'deuterium' =>       0, 'energy' =>    0, 'factor' =>   2),

puis ajouter

35 => array ( 'metal' => 15000000000, 'crystal' =>  70000050000, 'deuterium' =>  1500000000000,  'energy' =>    0, 'factor' =>   2),

Trouver

$reslist['build']    = array (   1,   2,   3,   4,  5, 6, 7, 8, 9, 10,  12,  14,  15, 16, 17, 21,  22,  23,  24,  25, 31,  33,  34, 36, 44,  41,  42,  43 );

puis ajouter

35,

Enregistrez-le

Allez dans BatimentBuildingPage.php

Trouver

$Allowed['1'] = array(  1,  2,  3,  4, 5, 6, 7,8,9,10, 12, 14, 16, 15, 17, 21, 22, 23, 24, 25, 31, 33, 34, 44, 36);

puis ajouter

35,

Enregistrez-le

Allez dans GetBuildingTime.php

Changer avec GetBuildingTime

?php

/**
* GetBuildingTime
*
* @version 1.0
* @copyright 2008 By Chlorel for XNova
*/

// Calcul du temps de construction d'un Element (Batiment / Recherche / Defense / Vaisseau )
// $user       -> Le Joueur lui meme
// $planet     -> La planete sur laquelle l'Element doit etre construit
// $Element    -> L'Element que l'on convoite
function GetBuildingTime ($user, $planet, $Element) {
    global $pricelist, $resource, $reslist, $game_config;


    $level = ($planet[$resource[$Element]]) ? $planet[$resource[$Element]] : $user[$resource[$Element]];
    if       (in_array($Element, $reslist['build'])) {
        // Pour un batiment ...
        $cost_metal   = floor($pricelist[$Element]['metal']   * pow($pricelist[$Element]['factor'], $level));
        $cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
        $time         = ((($cost_crystal) + ($cost_metal)) / $game_config['game_speed']) * (1 / ($planet[$resource['14']] + 1)) * pow(0.5, $planet[$resource['15']]);
        $time         = floor(($time * 60 * 60) * (1 - (($user['rpg_constructeur']) * 0.1)));
    } elseif (in_array($Element, $reslist['tech'])) {
        // Pour une recherche
        $cost_metal   = floor($pricelist[$Element]['metal']   * pow($pricelist[$Element]['factor'], $level));
        $cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
        $intergal_lab = $user[$resource[123]];
        if       ( $intergal_lab < "1" ) {
            $lablevel = $planet&#91;$resource&#91;'31'&#93;&#93;;
        } elseif ( $intergal_lab >= "1" ) {
            $empire = doquery("SELECT * FROM {{table}} WHERE id_owner='"&#46; $user&#91;id&#93; &#46;"';", 'planets');
            $NbLabs = 0;
            while ($colonie = mysql_fetch_array($empire)) {
                $techlevel&#91;$NbLabs&#93; = $colonie&#91;$resource&#91;'31'&#93;&#93;;
                $NbLabs++;
            }
            if ($intergal_lab >= "1") {
                $lablevel = 0;
                for ($lab = 1; $lab <= $intergal_lab; $lab++) {
                    asort($techlevel);
                    $lablevel += $techlevel&#91;$lab - 1&#93;;
                }
            }
        }
        $time         = (($cost_metal + $cost_crystal) / $game_config&#91;'game_speed'&#93;) / (($lablevel + 1) * 2) * pow(0&#46;5, $planet&#91;$resource&#91;'35'&#93;&#93;);
        $time         = floor(($time * 60 * 60) * (1 - (($user&#91;'rpg_scientifique'&#93;) * 0&#46;1)));
    } elseif (in_array($Element, $reslist&#91;'defense'&#93;)) {
        // Pour les defenses ou la flotte 'tarif fixe' durée adaptée a u niveau nanite et usine robot
        $time         = (($pricelist&#91;$Element&#93;&#91;'metal'&#93; + $pricelist&#91;$Element&#93;&#91;'crystal'&#93;) / $game_config&#91;'game_speed'&#93;) * (1 / ($planet&#91;$resource&#91;'21'&#93;&#93; + 1)) * pow(1 / 2, $planet&#91;$resource&#91;'15'&#93;&#93;);
        $time         = floor(($time * 60 * 60) * (1 - (($user&#91;'rpg_defenseur'&#93;)   * 0&#46;375)));
    } elseif (in_array($Element, $reslist&#91;'fleet'&#93;)) {
        $time         = (($pricelist&#91;$Element&#93;&#91;'metal'&#93; + $pricelist&#91;$Element&#93;&#91;'crystal'&#93;) / $game_config&#91;'game_speed'&#93;) * (1 / ($planet&#91;$resource&#91;'21'&#93;&#93; + 1)) * pow(1 / 2, $planet&#91;$resource&#91;'15'&#93;&#93;);
        $time         = floor(($time * 60 * 60) * (1 - (($user&#91;'rpg_technocrate'&#93;) * 0&#46;05)));
    }


    return $time;
}
?>

Enregistrez le.

Ensuite, entrer dans tech.mo

Ajouter

  35 => " Advanced laboratoire",
  35 => " Advanced laboratoire bla bla bla…&#46;&#46;",

Enregistrez le.

Ensuite, entrer dans infos.mo

Ajouter

    $lang&#91;'info'&#93;&#91;35&#93;&#91;'name'&#93; = 'Advanced laboratoire';
$lang&#91;'info'&#93;&#91;35&#93;&#91;'description'&#93; = 'Advanced laboratoire bla bla bla&#46;';

Enregistrez le.

Dans infos.php a la racine, cherchez ça:

    } elseif ($BuildID ==  34) {
        // Dépot d'alliance
        $PageTPL              = gettemplate('info_buildings_general');
        $DestroyTPL           = gettemplate('info_buildings_destroy');
    }

Et rajoutez ça après:

  }    elseif ($BuildID ==  35) {
        // Labo amélioré
        $PageTPL              = gettemplate('info_buildings_general');
        $DestroyTPL           = gettemplate('info_buildings_destroy');
    }

Enregistrez le et envoyez infos.php sur votre ftp.

Pour finir, créez ceci dans votre base de donnée MySQL:

ALTER TABLE `game_planets` ADD `laboratorio` INT( 11 ) NOT NULL;
lundi 28 juin 2010

Répondre Pour répondre, tu dois d'abord t'inscrire rapidement sur Kommunauty. Rejoins-nous vite !