vue [Tuto] Création des races
Kommunauty
Connexion
Inscription

[Tuto] Création des races


tyson93170 Messages : 96

Salut,

Voici un tutoriel complet pour créer et implémenter les races sur votre version de Xnova.

----------------------------------------------------------------------------------------------------------

On va commencer par modifier la page d'inscription pour permettre aux futurs membres de choisir leurs races.

----------------------------------------------------------------------------------------------------------

Fichier templates/OpenGame/registry_form.tpl

Rechercher :

<tr>

<th>{Sex}</th>

<th><select name="sex">

<option value="">{Undefined}</option>

<option value="M">{Male}</option>

<option value="F">{Female}</option>

</select></th>

</tr>

Ajouter après :

<tr>

<th>{Race}</th>

<th><select name="race">

<option value="humain">{id_race_1}</option>

<option value="tokra">{id_race_2}</option>

<option value="goauld">{id_race_3}</option>

<option value="asgard">{id_race_4}</option>

</select></th>

</tr>

Fichier language/fr/reg.mo

Rechercher :

$lang&#91;'neededpass'&#93;        = 'Mot de passe';

Ajouter après :

$lang&#91;'Race'&#93;               = 'Choisissez votre race';
$lang&#91;'id_race_1'&#93;           = 'Humain';
$lang&#91;'id_race_2'&#93;           = 'Tok'ra';
$lang&#91;'id_race_3'&#93;           = 'Goa'uld';
$lang&#91;'id_race_4'&#93;           = 'Asgard';

Fichier Includes/functions/CreateOnePlanetRecord.php

Rechercher :

$QryInsertPlanet  = "INSERT INTO {{table}} SET ";
        $QryInsertPlanet &#46;= "`name` = '"&#46;              $planet&#91;'name'&#93;              &#46;"', ";
        $QryInsertPlanet &#46;= "`id_owner` = '"&#46;          $planet&#91;'id_owner'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`galaxy` = '"&#46;            $planet&#91;'galaxy'&#93;            &#46;"', ";
        $QryInsertPlanet &#46;= "`system` = '"&#46;            $planet&#91;'system'&#93;            &#46;"', ";
        $QryInsertPlanet &#46;= "`planet` = '"&#46;            $planet&#91;'planet'&#93;            &#46;"', ";
        $QryInsertPlanet &#46;= "`last_update` = '"&#46;       $planet&#91;'last_update'&#93;       &#46;"', ";
        $QryInsertPlanet &#46;= "`planet_type` = '"&#46;       $planet&#91;'planet_type'&#93;       &#46;"', ";
        $QryInsertPlanet &#46;= "`image` = '"&#46;             $planet&#91;'image'&#93;             &#46;"', ";
        $QryInsertPlanet &#46;= "`diameter` = '"&#46;          $planet&#91;'diameter'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`field_max` = '"&#46;         $planet&#91;'field_max'&#93;         &#46;"', ";
        $QryInsertPlanet &#46;= "`temp_min` = '"&#46;          $planet&#91;'temp_min'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`temp_max` = '"&#46;          $planet&#91;'temp_max'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`metal` = '"&#46;             $planet&#91;'metal'&#93;             &#46;"', ";
        $QryInsertPlanet &#46;= "`metal_perhour` = '"&#46;     $planet&#91;'metal_perhour'&#93;     &#46;"', ";
        $QryInsertPlanet &#46;= "`metal_max` = '"&#46;         $planet&#91;'metal_max'&#93;         &#46;"', ";
        $QryInsertPlanet &#46;= "`crystal` = '"&#46;           $planet&#91;'crystal'&#93;           &#46;"', ";
        $QryInsertPlanet &#46;= "`crystal_perhour` = '"&#46;   $planet&#91;'crystal_perhour'&#93;   &#46;"', ";
        $QryInsertPlanet &#46;= "`crystal_max` = '"&#46;       $planet&#91;'crystal_max'&#93;       &#46;"', ";
        $QryInsertPlanet &#46;= "`deuterium` = '"&#46;         $planet&#91;'deuterium'&#93;         &#46;"', ";
        $QryInsertPlanet &#46;= "`deuterium_perhour` = '"&#46; $planet&#91;'deuterium_perhour'&#93; &#46;"', ";
        $QryInsertPlanet &#46;= "`deuterium_max` = '"&#46;     $planet&#91;'deuterium_max'&#93;     &#46;"';";

Remplacer par :

$QryInsertPlanet  = "INSERT INTO {{table}} SET ";
        $QryInsertPlanet &#46;= "`name` = '"&#46;              $planet&#91;'name'&#93;              &#46;"', ";
        $QryInsertPlanet &#46;= "`id_owner` = '"&#46;          $planet&#91;'id_owner'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`galaxy` = '"&#46;            $planet&#91;'galaxy'&#93;            &#46;"', ";
        $QryInsertPlanet &#46;= "`system` = '"&#46;            $planet&#91;'system'&#93;            &#46;"', ";
        $QryInsertPlanet &#46;= "`planet` = '"&#46;            $planet&#91;'planet'&#93;            &#46;"', ";
        $QryInsertPlanet &#46;= "`"&#46;$_POST&#91;'race'&#93;&#46;"` = '1', ";
        $QryInsertPlanet &#46;= "`last_update` = '"&#46;       $planet&#91;'last_update'&#93;       &#46;"', ";
        $QryInsertPlanet &#46;= "`planet_type` = '"&#46;       $planet&#91;'planet_type'&#93;       &#46;"', ";
        $QryInsertPlanet &#46;= "`image` = '"&#46;             $planet&#91;'image'&#93;             &#46;"', ";
        $QryInsertPlanet &#46;= "`diameter` = '"&#46;          $planet&#91;'diameter'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`field_max` = '"&#46;         $planet&#91;'field_max'&#93;         &#46;"', ";
        $QryInsertPlanet &#46;= "`temp_min` = '"&#46;          $planet&#91;'temp_min'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`temp_max` = '"&#46;          $planet&#91;'temp_max'&#93;          &#46;"', ";
        $QryInsertPlanet &#46;= "`metal` = '"&#46;             $planet&#91;'metal'&#93;             &#46;"', ";
        $QryInsertPlanet &#46;= "`metal_perhour` = '"&#46;     $planet&#91;'metal_perhour'&#93;     &#46;"', ";
        $QryInsertPlanet &#46;= "`metal_max` = '"&#46;         $planet&#91;'metal_max'&#93;         &#46;"', ";
        $QryInsertPlanet &#46;= "`crystal` = '"&#46;           $planet&#91;'crystal'&#93;           &#46;"', ";
        $QryInsertPlanet &#46;= "`crystal_perhour` = '"&#46;   $planet&#91;'crystal_perhour'&#93;   &#46;"', ";
        $QryInsertPlanet &#46;= "`crystal_max` = '"&#46;       $planet&#91;'crystal_max'&#93;       &#46;"', ";
        $QryInsertPlanet &#46;= "`deuterium` = '"&#46;         $planet&#91;'deuterium'&#93;         &#46;"', ";
        $QryInsertPlanet &#46;= "`deuterium_perhour` = '"&#46; $planet&#91;'deuterium_perhour'&#93; &#46;"', ";
        $QryInsertPlanet &#46;= "`deuterium_max` = '"&#46;     $planet&#91;'deuterium_max'&#93;     &#46;"';";

Fichier includes/functions/CreateOneMoonRecord.php

Rechercher :

$QryInsertMoonInPlanet  = "INSERT INTO {{table}} SET ";
            $QryInsertMoonInPlanet &#46;= "`name` = '" &#46;$lang&#91;'sys_moon'&#93; &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`id_owner` = '"&#46; $Owner &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`galaxy` = '"&#46; $Galaxy &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`system` = '"&#46; $System &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`planet` = '"&#46; $Planet &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`last_update` = '"&#46; time() &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`planet_type` = '3', ";
            $QryInsertMoonInPlanet &#46;= "`image` = 'mond', ";
            $QryInsertMoonInPlanet &#46;= "`diameter` = '"&#46; $size &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`field_max` = '1', ";
            $QryInsertMoonInPlanet &#46;= "`temp_min` = '"&#46; $maxtemp &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`temp_max` = '"&#46; $mintemp &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`metal` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`metal_perhour` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`metal_max` = '"&#46;BASE_STORAGE_SIZE&#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`crystal` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`crystal_perhour` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`crystal_max` = '"&#46;BASE_STORAGE_SIZE&#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`deuterium` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`deuterium_perhour` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`deuterium_max` = '"&#46;BASE_STORAGE_SIZE&#46;"';";

Remplacer par :

$QryInsertMoonInPlanet  = "INSERT INTO {{table}} SET ";
            $QryInsertMoonInPlanet &#46;= "`name` = '" &#46;$lang&#91;'sys_moon'&#93; &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`id_owner` = '"&#46; $Owner &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`galaxy` = '"&#46; $Galaxy &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`system` = '"&#46; $System &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`planet` = '"&#46; $Planet &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`"&#46;$_POST&#91;'race'&#93;&#46;"` = '1', ";
            $QryInsertMoonInPlanet &#46;= "`last_update` = '"&#46; time() &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`planet_type` = '3', ";
            $QryInsertMoonInPlanet &#46;= "`image` = 'mond', ";
            $QryInsertMoonInPlanet &#46;= "`diameter` = '"&#46; $size &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`field_max` = '1', ";
            $QryInsertMoonInPlanet &#46;= "`temp_min` = '"&#46; $maxtemp &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`temp_max` = '"&#46; $mintemp &#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`metal` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`metal_perhour` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`metal_max` = '"&#46;BASE_STORAGE_SIZE&#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`crystal` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`crystal_perhour` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`crystal_max` = '"&#46;BASE_STORAGE_SIZE&#46;"', ";
            $QryInsertMoonInPlanet &#46;= "`deuterium` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`deuterium_perhour` = '0', ";
            $QryInsertMoonInPlanet &#46;= "`deuterium_max` = '"&#46;BASE_STORAGE_SIZE&#46;"';";

----------------------------------------------------------------------------------------------------------

Faire reconnaître les différentes races par le jeu

----------------------------------------------------------------------------------------------------------

Fichier includes/vars.php

Trouver :

615 => "rpg_empereur"

Ajouter après :

1000 => "humain",
    1001 => "tokra",
    1002 => "goauld",
    1003 => "asgard",

Fichier language/fr/tech.mo

Trouver :

615 => "Empereur"

Remplacer par :

615 => "Empereur",

1000 => "Humain",
1001 => "Tok'ra",
1002 => "Goa'uld",
1003 => "Asgard"

----------------------------------------------------------------------------------------------------------

Affichage de la race pour le joueur

----------------------------------------------------------------------------------------------------------

Fichier overview.php

Trouver :

$parse&#91;'planet_name'&#93; = $planetrow&#91;'name'&#93;;
            $parse&#91;'planet_diameter'&#93; = pretty_number($planetrow&#91;'diameter'&#93;);
            $parse&#91;'planet_field_current'&#93; = $planetrow&#91;'field_current'&#93;;
            $parse&#91;'planet_field_max'&#93; = CalculateMaxPlanetFields($planetrow);
            $parse&#91;'planet_temp_min'&#93; = $planetrow&#91;'temp_min'&#93;;
            $parse&#91;'planet_temp_max'&#93; = $planetrow&#91;'temp_max'&#93;;
            $parse&#91;'galaxy_galaxy'&#93; = $planetrow&#91;'galaxy'&#93;;
            $parse&#91;'galaxy_planet'&#93; = $planetrow&#91;'planet'&#93;;
            $parse&#91;'galaxy_system'&#93; = $planetrow&#91;'system'&#93;;

Ajouter après :

if ($planetrow&#91;'humain'&#93; == 0 && $planetrow&#91;'tokra'&#93; == 0 && $planetrow&#91;'goauld'&#93; == 0 && $planetrow&#91;'asgard'&#93; == 0)
                $parse&#91;'race'&#93; = 'Race &#58; Inconnue | Contactez votre administrateur';
            if ($planetrow&#91;'humain'&#93; == 1)
                $parse&#91;'race'&#93; = 'Race &#58; Humain';
            if ($planetrow&#91;'tokra'&#93; == 1)
                $parse&#91;'race'&#93; = 'Race &#58; Tok'ra';
            if ($planetrow&#91;'goauld'&#93; == 1)
                $parse&#91;'race'&#93; = 'Race &#58; Goa'uld';
            if ($planetrow&#91;'asgard'&#93; == 1)
                $parse&#91;'race'&#93; = 'Race &#58; Asgard';

Fichier templates/OpenGame/overview_body.tpl

Trouver :

<tr><td class="c" colspan="4"><a href="overview&#46;php?mode=renameplanet" title="{Planet_menu}">{Planet} "{planet_name}"</a> ({user_username})</td></tr>

Ajouter après :

<tr><td class="c" colspan="4">{race}</td></tr>

----------------------------------------------------------------------------------------------------------

Préparation de la base de données

----------------------------------------------------------------------------------------------------------

Ajouter dans la table game_planets, les 4 champs suivants : humain, tokra, goauld, asgard

Requêtes SQL :

ALTER TABLE game_planets ADD humain INT(11) not null AFTER planet;
ALTER TABLE game_planets ADD tokra INT(11) not null AFTER humain;
ALTER TABLE game_planets ADD goauld INT(11) not null AFTER tokra;
ALTER TABLE game_planets ADD asgard INT(11) not null AFTER goauld;

Pour les futurs membres ainsi que les futurs planètes, lunes et colonies, l'appartenance à une race se fera automatiquement. Pour celles qui existent, il faudra mettre le champ humain, tokra, goauld ou asgard à 1 (dépend du choix du membre existant) et les autres races à 0 pour le même membre.

----------------------------------------------------------------------------------------------------------

Démonstration

----------------------------------------------------------------------------------------------------------

Par exemple, pour que le Terraformeur ne soit disponible seulement pour les Tok'ra ( --> 1001) : il faut modifier la ligne suivante :

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

comme ceci :

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

----------------------------------------------------------------------------------------------------------

A ce stade, les races sont normalement opérationnelles sur votre version de Xnova. Si vous

rencontrez le moindre problème, n'hésitez pas à me contacter.

----------------------------------------------------------------------------------------------------------

Sources : Xnova Next Gen

mercredi 27 mai 2009

lucky Messages : 1

Bonjour,

J'ai suivi votre tutoriel et je suis face a un probleme: Après installation de la base de donnée, je crée les 4 tables puis m'inscrit comme administrateur. Je supprime le dossier instal et je fait continuer.

C'est la qu'apparait mon probleme: La page frames.php se charge ... en une feuille blanche.

Et donc je sui bloqué, a chaque fois que j'essaye de me connecter en tant qu'administrateur par cette fuille blanche.

Merci d'avance de l'aide que vous pourrez apportez.

Mais si le probleme ne se résout pas, ce n'est pas grave.

lucky

PS: je suis sur la version 9c

samedi 6 juin 2009

tyson93170 Messages : 96

slt a mon avis tu t'es tromper

je pense que tu a creer un nouvelle table

alors quil faut mettre les champs

ALTER TABLE game_planets ADD humain INT(11) not null AFTER planet;
ALTER TABLE game_planets ADD tokra INT(11) not null AFTER humain;
ALTER TABLE game_planets ADD goauld INT(11) not null AFTER tokra;
ALTER TABLE game_planets ADD asgard INT(11) not null AFTER goauld;

dans la table "game_planets"

voila tu me dit si sa marche

cordialement

dimanche 7 juin 2009

Midionos Messages : 74

Est ce que quelqu'un aurait une idée de comment faire pour que la race apparaisse sur les rapports d'espionnage ?

Sinon, je suis aussi preneur d'une astuce pour qu'elle apparaisse directement dans la vue galaxie...

Merci.

mercredi 8 juillet 2009

clem33125 Messages : 26

je sui bloque quand je mais ds game_planet il me disent eror et de lenglais

vendredi 10 juillet 2009

Midionos Messages : 74

J'imagine le problème que cause l'anglais vu le français...

Tu as bien mis le texte dans une requête SQL puis fait exécuter ?

samedi 11 juillet 2009

thevirgins Messages : 254

excusez moi

mais sa veut dire quoi création des races  :?:  :?:  :?:

samedi 14 novembre 2009

zoidberg Messages : 19

bonjour tout le monde.Thevirgins je vais tenter de te répondre

alors d'après moi il parle des race ex:

les humains sont une race

et après les autre ils les ont inventer ou repris.

moi perso je mettrais

Humain

cyborg

Alien

Prédator

bref voilà

lundi 11 janvier 2010

Anonyme Messages : 0

en gros c'est un petit plus !!!

mais sa sert pas a grand chose

samedi 5 juin 2010

stylus512 Messages : 3

slt tout le monde moi également j'ai une page blanche après avoir fait tout se que tu disait je crois que cela vient du tech.mo et var.php si je l'ai enlève cela fonctionne avec quelque erreur mais cela est normal il n'y a pas tech et var merci de votre réponse ..

mercredi 9 juin 2010

Page suivante »