HofRC

Démarré par Shad, 16 Mars 2012, 20:15:07

« précédent - suivant »

nourz

Merci darknoon !
C'étais aussi bête que sa !

Shad

#16
Dudule remplace la fonction par
SELECT pt, gt, cle, clo, cr, vb, vc, rec, se, bmd, dst, edlm, tra, sat, lm, lleger, llourd, cg, ai, lp, pb, gb, player_att, player_def, ally, techno, detruit, ressources_piller_min, ressources_piller_max, pertes_fleet_def, seuil_pertes, seuil_pillage, seuil_cdr, pertes_min_att, pertes_max_att, pertes_min_def, pertes_max_def, debris_min, debris_max, renta_min, renta_max, pic_header, pic_round, pic_separator, pic_result, pic_background
FROM ogspy_hofrc_skin
WHERE title LIKE 'ogsteam'


Mais bon faut que je trouve une solution pour rendre compatible avec tout le monde -_-'

edit: be peut-être qu'avec cette fonction ce serait compatible pour tout le monde, faudrait la tester chez free

Dudule

Cool merci :)

Quel est le fichier ou se trouve la fonction ?
hébergeur : Free-h , ogspy 3.1.0, mod xtense 2.4.0 , Script GM xtense 2.4.0.4

Shad

Dans le dossier rchof/Pages/include.php ligne 254 si je dis pas de connerie

Dudule

J'ai retrouver cette fonction :

$query_RCcolor = $db->sql_query("SELECT pt, gt, cle, clo, cr, vb, vc, rec, se, bmd, dst, edlm, tra, sat, lm, lleger, llourd, cg, ai, lp, pb, gb, player_att, player_def, ally, techno, detruit, ressources_piller_min, ressources_piller_max, pertes_fleet_def, seuil_pertes, seuil_pillage, seuil_cdr, pertes_min_att, pertes_max_att, pertes_min_def, pertes_max_def, debris_min, debris_max, renta_min, renta_max, pic_header , pic_round, pic_separator, pic_result, pic_background FROM ".TABLE_HOFRC_SKIN." WHERE title LIKE CONVERT( _utf8 '".$skin."' USING latin1 ) COLLATE latin1_general_ci");


Dans la partie :
// La function pour convertir le rc
// On récupère la configuration par défaut


Es-ce bien toute la ligne que je doit remplacer ?
hébergeur : Free-h , ogspy 3.1.0, mod xtense 2.4.0 , Script GM xtense 2.4.0.4

Shad



$query_RCcolor = $db->sql_query("SELECT pt, gt, cle, clo, cr, vb, vc, rec, se, bmd, dst, edlm, tra, sat, lm, lleger, llourd, cg, ai, lp, pb, gb, player_att, player_def, ally, techno, detruit, ressources_piller_min, ressources_piller_max, pertes_fleet_def, seuil_pertes, seuil_pillage, seuil_cdr, pertes_min_att, pertes_max_att, pertes_min_def, pertes_max_def, debris_min, debris_max, renta_min, renta_max, pic_header, pic_round, pic_separator, pic_result, pic_background
FROM ogspy_hofrc_skin WHERE title LIKE '".$skin."');



remplace la ligne par sa, sa devrait être bon.

Dudule

#21
Désolé du retard.

Je fait donc le test desuite :)

Edit : Cela ne fonctionne apparement pas... J'ai cette erreur maintenant :
Database MySQL Error
ErrNo:1267: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_general_ci,EXPLICIT) for operation 'like'
Query:
SELECT pt, gt, cle, clo, cr, vb, vc, rec, se, bmd, dst, edlm, tra, sat, lm, lleger, llourd, cg, ai, lp, pb, gb, player_att, player_def, ally, techno, detruit, ressources_piller_min, ressources_piller_max, pertes_fleet_def, seuil_pertes, seuil_pillage, seuil_cdr, pertes_min_att, pertes_max_att, pertes_min_def, pertes_max_def, debris_min, debris_max, renta_min, renta_max, pic_header , pic_round, pic_separator, pic_result, pic_background FROM ogspy_hofrc_skin WHERE title LIKE CONVERT( _utf8 'ogsteam' USING latin1 ) COLLATE latin1_general_ci



J'ai aussi essayé avec le code de ta réponse #16 le: mars 23, 2012, 00:41:48 »
Et cela me donne la même erreur...
hébergeur : Free-h , ogspy 3.1.0, mod xtense 2.4.0 , Script GM xtense 2.4.0.4

kaplan

#22
Hello,
juste pour signaler une erreur dans le codage du fichier include.php:

ligne 761:
$query_ally_att = $db->sql_query ("SELECT ally FROM ".TABLE_UNIVERSE." WHERE player = '".$player_att."'");

Remplacer par:

$query_ally_att = $db->sql_query ("SELECT ally FROM ".TABLE_UNIVERSE." WHERE player = '".$player_def."'");

Sinon, l'alliance du défenseur n'est jamais trouvée.


PS: Possible d'ajouter dans les options les differentes balises bbcodes ? car j'ai du retoucher le code pour que le RC converti colle au forum phpbb.

Shad

bizarre l'histoire de la requête je regarderais sa pour demain.

Après pour les balises c'est plus délicat tellement de possiblité entre les divers forum. Celle a l'heure actuelle sont compatible avec le board ogame. Je vais réfléchir a une solution pour sa.

Shad

Ne serait-ce pas plutot a la ligne 381

kaplan

Si tu parles de mon changement, non c'est bien la ligne annoncée.

Shad

Je peux savoir avec quel logiciel tu as éditez??

Car ligne 761 il s'agit d'une boucle pour lister les images.

Essaye le fichier joint, car je n'ai plus de compte ogame pour tester ^^.

kaplan

#27
J'edite le fichier avec notepad++ et chose bisarre ton fichier correspond pas au fichier present dans le mod ...

je joins le fichier qui est dans l'archive du mod

[code]<?php

/**

* include.php

* @package HofRC

* @author Shad

* @link http://www.ogsteam.fr

* @version : 0.0.1

*/





// L'appel direct est interdit....

if (!defined('IN_SPYOGAME')) die("Hacking attempt");



//Définitions

global $db, $table_prefix, $prefixe;

//On vérifie que le mod est activé

$query = "SELECT `active` FROM `".TABLE_MOD."` WHERE `action`='hofrc' AND `active`='1' LIMIT 1";

if (!$db->sql_numrows($db->sql_query($query))) die("Hacking attempt");



/**************************************************************************/

// Fonction pour traiter le post de configuration de l'historique

   function set_historique($font_historique, $font_size, $largeur_historique, $hauteur_historique, $pos_horiz_historique_1, $pos_horiz_historique_2, $pos_horiz_historique_3, $pos_horiz_historique_4, $pos_horiz_historique_5, $color_txt_historique_1, $color_txt_historique_2, $color_txt_historique_3, $color_txt_historique_4, $color_txt_historique_5, $pos_verti_historique, $angle_historique)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_CONFIG',$table_prefix.'hofrc_config');

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$font_historique."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'font_historique'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$font_size."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'font_size_historique'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$largeur_historique."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'largeur_historique'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$hauteur_historique."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'hauteur_historique'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$pos_horiz_historique_1."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'pos_horiz_historique_1'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$pos_horiz_historique_2."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'pos_horiz_historique_2'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$pos_horiz_historique_3."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'pos_horiz_historique_3'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$pos_horiz_historique_4."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'pos_horiz_historique_4'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$pos_horiz_historique_5."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'pos_horiz_historique_5'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$color_txt_historique_1."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'color_txt_historique_1'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$color_txt_historique_2."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'color_txt_historique_2'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$color_txt_historique_3."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'color_txt_historique_3'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$color_txt_historique_4."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'color_txt_historique_4'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$color_txt_historique_5."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'color_txt_historique_5'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$pos_verti_historique."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'pos_verti_historique'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$angle_historique."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'angle_historique'");

      }





/**************************************************************************/

// Fonction pour traiter le post de la configuration de l'univers

   function post_config ($new_start_universe, $config_size_initial, $config_size_courant, $config_size_basic, $config_size_normal, $config_size_avance, $config_size_stratege, $config_size_expert, $config_size_guerrier, $config_size_devastateur, $config_size_champion, $config_size_legendaire, $new_end_initial_solo, $new_end_initial_groupe, $new_end_courant_solo, $new_end_courant_groupe, $new_end_basic_solo, $new_end_basic_groupe, $new_end_normal_solo, $new_end_normal_groupe, $new_end_avance_solo, $new_end_avance_groupe, $new_end_stratege_solo, $new_end_stratege_groupe)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_CONFIG',$table_prefix.'hofrc_config');

         

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_start_universe."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'start_universe'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_initial."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_initial'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_courant."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_courant'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_basic."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_basic'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_normal."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_normal'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_avance."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_avance'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_stratege."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_stratege'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_expert."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_expert'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_guerrier."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'guerrier'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_devastateur."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'devastateur'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_champion."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_champion'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$config_size_legendaire."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'size_legendaire'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_initial_solo."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_initial_solo'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_initial_groupe."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_initial_groupe'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_courant_solo."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_courant_solo'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_courant_groupe."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_courant_groupe'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_basic_solo."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_basic_solo'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_basic_groupe."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_basic_groupe'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_normal_solo."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_normal_solo'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_normal_groupe."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_normal_groupe'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_avance_solo."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_avance_solo'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_avance_groupe."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_avance_groupe'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_stratege_solo."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_stratege_solo'");

         $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_end_stratege_groupe."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'end_stratege_groupe'");

      }



   



/**************************************************************************/



// Fonction pour afficher texte ou images

   function select_picture($type, $skin, $picture, $historique, $round)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_TITLE',$table_prefix.'hofrc_title');

                  

         $filename = "mod/hofrc/Skin/".$skin.'/'.$picture;

         $file_historique = "mod/hofrc/Output/historique.php";

         if (file_exists($filename) && $historique == "0")

            {

               if ($type == "preview")

                  {

                     return "

 <img src=".$filename.">

";

                  }

               elseif ($type == "bbcode")

                  {

                     return "";

                  }

            }

         elseif ($historique == "1")

            {   

               if ($type == "bbcode")

                  {

                     $historique_picture .= "
[spoiler]";

                  }

               $query_historique = $db->sql_query("SELECT * FROM ".TABLE_HOFRC_TITLE);

               while ($historique_title = $db->sql_fetch_assoc($query_historique))

                  {

                     $picture_title = "mod/hofrc/Output/".$historique_title['id'].".png";

                     if (!empty($historique_title['board_url']))

                        {

                           if ($type == "preview")

                              {

                                 $historique_picture .= "<a href=".$historique_title['board_url']."><img src=".$picture_title."></a><br>";

                              }

                           elseif ($type == "bbcode")

                              {

                                 $historique_picture .= "<br>";

                              }

                        }

                  }

                  if ($type == "bbcode")

                     {

                        $historique_picture .= "[/spoiler]";

                     }

               echo $historique_picture;

            }

         else

            {

               if ($type == "preview")

                  {

                     return "<img src=".$filename.">";

                  }

               elseif ($type == "bbcode")

                  {

                     return "";

                  }

            }

      }



/**************************************************************************/



// Fonction servant a sélectionner le skin ou le changer dans la configuration

   function select_skin ($value)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_CONFIG',$table_prefix.'hofrc_config');

         if ($value === 0)

            {

               $query_skin = $db->sql_query("SELECT `config_value` FROM ".TABLE_HOFRC_CONFIG." WHERE `config_name` = 'hofrc_skin'");

               list($skin) = $db->sql_fetch_row($query_skin);

               return $skin;

            }

         else

            {

               $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$value."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'hofrc_skin'");

            }

      }   



/**************************************************************************/



// Function pour creer un nouveau skin

   function new_skin ($new_skin)

         {

            global $db, $table_prefix;

            define('TABLE_HOFRC_CONFIG',$table_prefix.'hofrc_config');

            define('TABLE_HOFRC_SKIN',$table_prefix.'hofrc_skin');

            $folder = "mod/hofrc/Skin/".$new_skin;

            if (!file_exists($folder))

               {

                  mkdir($folder, 0777);         

                  $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$new_skin."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'hofrc_skin'");   

                  $db->sql_query("INSERT INTO `".TABLE_HOFRC_SKIN."` (`title`) VALUES('".$new_skin."')");            

               }

            else

               {

                  echo "Un dossier ".$new_skin." existe déjà.";

               }

         }



/**************************************************************************/



// Function pour formater le RC

   function format_number($color_min,$color_max,$ressource,$quota,$type)

      {

         if ($type == "preview")

            {

               if ($ressource < $quota)

                  {

                     return "<span style='color:".$color_min.";'>".number_format($ressource,0,',','.')."</span>";

                  }

               else

                  {

                     return "<span style='color:".$color_max.";'>".number_format($ressource,0,',','.')."</span>";

                  }

            }

         elseif ($type == "bbcode")

            {

               if ($ressource < $quota)

                  {

                     return "[color=".$color_min."]".number_format($ressource,0,',','.');

                  }

               else

                  {

                     return "[color=".$color_max."]".number_format($ressource,0,',','.');

                  }

            }

      }



/**************************************************************************/



// Fonction pour avoir des infobulle

   function infobulle($txt_contenu, $titre = 'Aide', $largeur = 200) {

      // vérification de $largeur

      if (!is_numeric($largeur))

         $largeur = 200;



      $infobulle = '<img style="cursor: pointer;" title="" alt="tooltip" src="images/help_2.png" onMouseOver="this.T_WIDTH=210;this.T_TEMP=0;return escape('<table width=&quot;'

      .$largeur.'&quot;><tr><td align=&quot;center&quot; class=&quot;c&quot;>'

      .jsspecialchars($titre).'</td></tr><tr><th align=&quot;center&quot;>'.jsspecialchars($txt_contenu).'</th></tr></table>')">';

      // retourne l'infobulle

      return $infobulle;

}



/**************************************************************************/



// Fonction en attente

/**

* Escapes strings to be included in javascript

*

* @param string $s

* @return string

*/

function jsspecialchars($s) {

   // ajout de ce petit replace car le masque ne prend pas correctement le double quote...

   $s = str_replace('"','&quot;',$s);



   return preg_replace('/([^ !#$%@()*+,-.x30-x5bx5d-x7e])/e',

      "'\x'.(ord('\1')<16? '0': '').dechex(ord('\1'))",$s);

}



/**************************************************************************/



// La function pour convertir le rc

   function convert($id_RC,$type,$hof,$pillage)

      {

         global $db,$table_prefix;

         define('TABLE_HOFRC_SKIN',$table_prefix.'hofrc_skin');

         // On définie le skin

         $skin = select_skin(0);

      

         // On récupère la configuration par défaut

         $query_RCcolor = $db->sql_query("SELECT pt, gt, cle, clo, cr, vb, vc, rec, se, bmd, dst, edlm, tra, sat, lm, lleger, llourd, cg, ai, lp, pb, gb, player_att, player_def, ally, techno, detruit, ressources_piller_min, ressources_piller_max, pertes_fleet_def, seuil_pertes, seuil_pillage, seuil_cdr, pertes_min_att, pertes_max_att, pertes_min_def, pertes_max_def, debris_min, debris_max, renta_min, renta_max, pic_header , pic_round, pic_separator, pic_result, pic_background FROM ".TABLE_HOFRC_SKIN." WHERE title LIKE CONVERT( _utf8 '".$skin."' USING latin1 ) COLLATE latin1_general_ci");

         list($color_PT, $color_GT, $color_CLE, $color_CLO, $color_CR, $color_VB, $color_VC, $color_REC, $color_SE, $color_BMD, $color_DST, $color_EDLM, $color_TRA, $color_SAT, $color_LM, $color_LLEGER, $color_LLOURD, $color_CG, $color_AI, $color_LP, $color_PB, $color_GB, $color_PLAYER_ATT, $color_PLAYER_DEF, $color_ALLY, $color_TECHNO, $color_DETRUIT, $color_RESSOURCES_PILLER_MIN, $color_RESSOURCES_PILLER_MAX, $color_PERTES_FLEET_DEF, $color_SEUIL_PERTES, $color_SEUIL_PILLAGE, $color_SEUIL_CDR,$color_PERTES_MIN_ATT, $color_PERTES_MAX_ATT, $color_PERTES_MIN_DEF, $color_PERTES_MAX_DEF, $color_DEBRIS_MIN, $color_DEBRIS_MAX, $color_RENTA_MIN, $color_RENTA_MAX, $color_PIC_HEADER , $color_PIC_ROUND, $color_PIC_SEPARATOR, $color_PIC_RESULT, $color_PIC_BACKGROUND) = $db->sql_fetch_row($query_RCcolor);

            

         $query_RCRound = $db->sql_query("SELECT id_rcround FROM ".TABLE_PARSEDRCROUND." WHERE id_rc=".$id_RC." AND numround=1");

         list($id_rcround) = $db->sql_fetch_row($query_RCRound);

      

         // On choisis si c'est pour visualiser le RC ou pour le convertir en BBCode

         if ($type == "preview")

            {

               $color_pertes_min_att = $color_PERTES_MIN_ATT;

               $color_pertes_max_att = $color_PERTES_MAX_ATT;

               $color_pertes_min_def = $color_PERTES_MIN_DEF;

               $color_pertes_max_def = $color_PERTES_MAX_DEF;

               $color_debris_min = $color_DEBRIS_MIN;

               $color_debris_max = $color_DEBRIS_MAX;

               $color_renta_min = $color_RENTA_MIN;

               $color_renta_max = $color_RENTA_MAX;

               $color_seuil_pertes = $color_SEUIL_PERTES;

               $color_seuil_pillage = $color_SEUIL_PILLAGE;

               $color_seuil_cdr = $color_SEUIL_CDR;

               $color_ressources_piller_min = $color_RESSOURCES_PILLER_MIN;

               $color_ressources_piller_max = $color_RESSOURCES_PILLER_MAX;

               $color_perte_fleet_def = "<span style='color:".$color_PERTES_FLEET_DEF."'>";

               $color_detruit = "<span style='color:".$color_DETRUIT."'>";

               $color_player_att = "<span style='color:".$color_PLAYER_ATT."'>";

               $color_player_def = "<span style='color:".$color_PLAYER_DEF."'>";

               $color_alliance = "<span style='color:".$color_ALLY."'>";

               $color_techno = "<span style='color:".$color_TECHNO."'>";

               $color_bal = "</span>";

               $key_ships = array('PT' => "<span style='color:".$color_PT."'>P.transp.", 'GT' => "<span style='color:".$color_GT."'>G.transp.", 'CLE' => "<span style='color:".$color_CLE."'>Ch.léger", 'CLO' => "<span style='color:".$color_CLO."'>Ch.lourd", 'CR' => "<span style='color:".$color_CR."'>Croiseur", 'VB' => "<span style='color:".$color_VB."'>V.bataille", 'VC' => "<span style='color:".$color_VC."'>V.colonisation", 'REC' => "<span style='color:".$color_REC."'>Recycleur", 'SE' => "<span style='color:".$color_SE."'>Sonde", 'BMD' => "<span style='color:".$color_BMD."'>Bombardier", 'DST' => "<span style='color:".$color_DST."'>Destr.", 'EDLM' => "<span style='color:".$color_EDLM."'>Rip", 'TRA' => "<span style='color:".$color_TRA."'>Traqueur");

               $key_defs = array( 'SAT' => "<span style='color:".$color_SAT."'>Sat.sol.",'LM' => "<span style='color:".$color_LM."'>Missile", 'LLE' => "<span style='color:".$color_LLEGER."'>L.léger.", 'LLO' => "<span style='color:".$color_LLOURD."'>L.lourd", 'CG' => "<span style='color:".$color_CG."'>Can.Gauss", 'AI' => "<span style='color:".$color_AI."'>Art.ions", 'LP' => "<span style='color:".$color_LP."'>Lanc.plasma", 'PB' => "<span style='color:".$color_PB."'>P.bouclier", 'GB' => "<span style='color:".$color_GB."'>G.bouclier");

            }

         elseif ($type == "bbcode")

            {

               $color_pertes_min_att = $color_PERTES_MIN_ATT;

               $color_pertes_max_att = $color_PERTES_MAX_ATT;

               $color_pertes_min_def = $color_PERTES_MIN_DEF;

               $color_pertes_max_def = $color_PERTES_MAX_DEF;

               $color_debris_min = $color_DEBRIS_MIN;

               $color_debris_max = $color_DEBRIS_MAX;

               $color_renta_min = $color_RENTA_MIN;

               $color_renta_max = $color_RENTA_MAX;

               $color_seuil_pertes = $color_SEUIL_PERTES;

               $color_seuil_pillage = $color_SEUIL_PILLAGE;

               $color_seuil_cdr = $color_SEUIL_CDR;

               $color_ressources_piller_min = $color_RESSOURCES_PILLER_MIN;

               $color_ressources_piller_max = $color_RESSOURCES_PILLER_MAX;

               $color_perte_fleet_def = "[color=".$color_PERTES_FLEET_DEF."]";

               $color_detruit = "[color=".$color_DETRUIT."]";

               $color_player_att = "[color=".$color_PLAYER_ATT."]";

               $color_player_def = "[color=".$color_PLAYER_DEF."]";

               $color_alliance = "[color=".$color_ALLY."]";

               $color_techno = "[color=".$color_TECHNO."]";

               $color_bal = "[/color]";

               $key_ships = array('PT' => "[color=".$color_PT."]P.transp.", 'GT' => "[color=".$color_GT."]G.transp.", 'CLE' => "[color=".$color_CLE."]Ch.léger", 'CLO' => "[color=".$color_CLO."]Ch.lourd", 'CR' => "[color=".$color_CR."]Croiseur", 'VB' => "[color=".$color_VB."]V.bataille", 'VC' => "[color=".$color_VC."]V.colonisation", 'REC' => "[color=".$color_REC."]Recycleur", 'SE' => "[color=".$color_SE."]Sonde", 'BMD' => "[color=".$color_BMD."]Bombardier", 'DST' => "[color=".$color_DST."]Destr.", 'EDLM' => "[color=".$color_EDLM."]Rip", 'TRA' => "[color=".$color_TRA."]Traqueur");

               $key_defs = array( 'SAT' => "[color=".$color_SAT."]Sat.sol.",'LM' => "[color=".$color_LM."]Missile", 'LLE' => "[color=".$color_LLEGER."]L.léger.", 'LLO' => "[color=".$color_LLOURD."]L.lourd", 'CG' => "[color=".$color_CG."]Can.Gauss", 'AI' => "[color=".$color_AI."]Art.ions", 'LP' => "[color=".$color_LP."]Lanc.plasma", 'PB' => "[color=".$color_PB."]P.bouclier", 'GB' => "[color=".$color_GB."]G.bouclier");

            }

      

         // On récupère les informations générales du RC

         $query_RC = $db->sql_query("SELECT dateRC, coordinates, nb_rounds, victoire, pertes_A, pertes_D, gain_M, gain_C, gain_D, debris_M, debris_C, lune FROM ".TABLE_PARSEDRC." WHERE id_rc = ".$id_RC);

         list($dateRC, $coordinates, $nb_rounds, $victoire, $pertes_A, $pertes_D, $gain_M,$gain_C, $gain_D, $debris_M, $debris_C, $lune) = $db->sql_fetch_row($query_RC);

         $dateRC = date('d.m.Y H:i:s', $dateRC);

         

         // Début du la variable de concaténation

         if ($type == "bbcode")

            {

               $template.= "
Citation[align=center]";

            }   

         // Si hof on affiche l'historique

         if ($hof == "1")

            {

         $template .= select_picture($type, $skin, $color_PIC_HEADER, "1", "")."
";

            }

         

         

         $template .= select_picture($type, $skin, $color_PIC_HEADER, "0", "")."
";

         if ($type == "bbcode")

            {

               $template.= "
"."";

            }         

         $template .= 'Les flottes suivantes se sont affrontées le: '.$dateRC."

";



         

         

         

         // On récupère la flotte attaquante du premier round

         $query_round_attack_first = $db->sql_query("SELECT player, coordinates, Armes, Bouclier, Protection, SUM(PT), SUM(GT), SUM(CLE), SUM(CLO), SUM(CR), SUM(VB), SUM(VC), SUM(REC), SUM(SE), SUM(BMD), SUM(DST), SUM(EDLM), SUM(TRA) FROM ".TABLE_ROUND_ATTACK." WHERE id_rcround=".$id_rcround." GROUP BY player");

         WHILE (list($player_att, $coordinates_att, $Armes_att, $Bouclier_att, $Protection_att, $PT, $GT, $CLE, $CLO, $CR, $VB, $VC, $REC, $SE, $BMD, $DST, $EDLM, $TRA) = $db->sql_fetch_row($query_round_attack_first))

            {

               // On récupère les alliances des attaquants

               $query_ally_att = $db->sql_query ("SELECT ally FROM ".TABLE_UNIVERSE." WHERE player = '".$player_att."'");

               list($result_ally_att) = $db->sql_fetch_row($query_ally_att);

               if (empty($result_ally_att))

                  {

                     $ally_att = "NO ALLY";

                  }

               else

                  {

                     $ally_att = $result_ally_att;

                  }

               // On récupérère tout les informations coté attaque du premier round

               $key_att_first = '';

               $ship_att_first = 0;

               

               // Variable de concaténation pour les attaquants et techno

               $template_type_att .= "^/".$player_att."^$";

               $template .= "
".'Attaquant '.$color_player_att . $player_att . $color_bal . $color_alliance. ' ['.$ally_att.']'. $color_bal . "
";

               $template .= 'Armes: '. $color_techno. $Armes_att. ' % '. $color_bal. ' Bouclier: '. $color_techno .$Bouclier_att. ' % '. $color_bal. ' Coque: '. $color_techno. $Protection_att. ' % ' . $color_bal . "
";

               foreach ($key_ships as $key_att_first => $ship_att_first)

                  {

                     if (isset($$key_att_first) && $$key_att_first > 0 )

                        {

                           // Variable de concaténation de toute les flottes de la partie attaque

                           

                           $template .= "   " . $ship_att_first ." ". number_format($$key_att_first,0,',','.').$color_bal."
";

                           $template_type_att .= ", ".$key_att_first;

                        }

                  }

               $template_type_att .= "---";

      

            }

               

         // On récupère la flotte défensive du premier round

         $query_round_defense_first = $db->sql_query("SELECT player, coordinates, Armes, Bouclier, Protection, SUM(PT), SUM(GT), SUM(CLE), SUM(CLO), SUM(CR), SUM(VB), SUM(VC), SUM(REC), SUM(SE), SUM(BMD), SAT, SUM(DST), SUM(EDLM), SUM(TRA), LM, LLE, LLO, CG, AI, LP, PB, GB FROM ".TABLE_ROUND_DEFENSE." WHERE id_rcround=".$id_rcround." GROUP BY player");

         WHILE (list($player_def, $coordinates_def, $Armes_def, $Bouclier_def, $Protection_def, $PT, $GT, $CLE, $CLO, $CR, $VB, $VC, $REC, $SE, $BMD, $SAT, $DST, $EDLM, $TRA, $LM, $LLE, $LLO, $CG, $AI, $LP, $PB, $GB) = $db->sql_fetch_row($query_round_defense_first))

            {

               // On récupère les alliances de la défence

               $query_ally_att = $db->sql_query ("SELECT ally FROM ".TABLE_UNIVERSE." WHERE player = '".$player_def."'");

               list($result_ally_att) = $db->sql_fetch_row($query_ally_att);

               if (empty($result_ally_att))

                  {

                     $ally_def = 'NO ALLY';

                  }

               else

                  {

                     $ally_def = $result_ally_att;

                  }

               

               // Variable ce concaténation pour les défenseurs et techno

               $template_type_def .= "^/".$player_def."^$";

               $template .= "
".'Défenseur '. $color_player_def. $player_def. $color_bal. $color_alliance.' ['.$ally_def.']'. $color_bal. "
";

               $template .=  'Armes: '. $color_techno. $Armes_def.' % '. $color_bal. ' Bouclier: '. $color_techno. $Bouclier_def. ' % '. $color_bal. ' Coque: '. $color_techno. $Protection_def. ' % '. $color_bal. "
";

            

               $key_def_first = '';

               $ship_def_first = 0;

               $vivant_def_first_round = false;

               foreach ($key_ships as $key_def_first => $ship_def_first)

                  {

                     if (isset($$key_def_first) && $$key_def_first > 0)

                        {

                           $vivant_def_first_round = true;

                           // Variable de concaténation de toute les flottes de la partie défence

                           $template .= "   " . $ship_def_first ." ". number_format($$key_def_first,0,',','.').$color_bal."
";

                           $template_type_def .= ", ".$key_def_first;

                        }

                  }

               

               foreach ($key_defs as $key_def_first => $def_def_first)

                  {

                     if (isset($$key_def_first) && $$key_def_first > 0)

                        {

                           $vivant_def_first_round = true;

                           // Variable de concaténation de toute les défences du défenceur

                           $template .= "   " . $def_def_first ." ". number_format($$key_def_first,0,',','.').$color_bal."
";

                           $template_type_def .= ", ".$key_def_first;

                        }

                  }

               if ($vivant_def_first_round == false)

                     {

                        // Variable de concaténation si le défenseur détruit

                        $template .= $color_detruit . 'Vide' . $color_bal . "
";

                     }

               $template_type_def .= "---";

            }

            

         // On détermine le dernier round

         $query_last_RCRound = $db->sql_query("SELECT id_rcround FROM ".TABLE_PARSEDRCROUND." WHERE id_rc=".$id_RC." AND numround=".$nb_rounds);

         list($id_last_rcround_attack) = $db->sql_fetch_row($query_last_RCRound);

         $id_last_rcround=$id_last_rcround_attack;

         $id_last_rcround=$id_rcround+$nb_rounds-1;

      

         

         // Variable de concaténation du nombre de round

         if ($type == "bbcode")

            {

               $template.= "

";

            }

         $template .= select_picture($type, $skin, $color_PIC_ROUND, "0", "
".'Après '. ($nb_rounds - 1) .' rounds'."

");

         if ($type == "bbcode")

            {

               $template.= "

";

            }





         // On récupère les flottes après le combat

            $query_player_attack_last = $db->sql_query ("SELECT player FROM ".TABLE_ROUND_ATTACK." WHERE id_rcround=".$id_last_rcround." GROUP BY player" );

            WHILE (list($player_attack_list) = $db->sql_fetch_row($query_player_attack_last))

               {   

                  // On nettoie les noms des joueurs des metacaractère et nous voila partie dans un beau bordel -_-'

                  $player_attack_list_format = preg_replace('#((|)|#|!|^|$|(|)|[|]|{|}|?|+|*|.|\||)#', 'Xespace_symboleX$1', $player_attack_list);

                  // Ogspy n'accepte pas le $1 à cause du  donc j'ai mis un espace que l'on supprime

                  $player_attack_list_format2 = preg_replace('#(Xespace_symboleX)#', '\', $player_attack_list_format);

                  // Obligé d'utilisé le preg_match_all pour trouver les flottes du joueurs, on part dans les array. Super je m'éclate.

                  preg_match_all('#^/('.$player_attack_list_format2.')^$,(.+)---#isU', $template_type_att, $select_fleet_attack);

                  

                       

                  $query_round_attack_last = $db->sql_query("SELECT player, SUM(PT), SUM(GT), SUM(CLE), SUM(CLO), SUM(CR), SUM(VB), SUM(VC), SUM(REC), SUM(SE), SUM(BMD), SUM(DST), SUM(EDLM), SUM(TRA) FROM ".TABLE_ROUND_ATTACK." WHERE id_rcround=".$id_last_rcround." AND player='".$player_attack_list."'  GROUP BY player");

                  WHILE (list($player_att, $PT, $GT, $CLE, $CLO, $CR, $VB, $VC, $REC, $SE, $BMD, $DST, $EDLM, $TRA) = $db->sql_fetch_row($query_round_attack_last))

                     {

                        // Variable de concaténation pour les attaquants

                        $template .= "
".'Attaquant '.$color_player_att . $player_att . $color_bal. "
";

                        $key_att_last = '';

                        $ship_att_last = 0;

                        $vivant_att = false;

                        //on controle qu'il reste un vaisseaux

                        $sum_att = $PT + $GT + $CLE + $CLO + $CR + $VB + $VC + $REC + $SE + $BMD + $DST + $EDLM + $TRA;

                        

                        foreach ($key_ships as $key_att_last => $ship_att_last)

                           {

                              if (isset($sum_att) && $sum_att > 0)

                                 {

                                    $vivant_att = true;

                                    if(preg_match("#".$key_att_last."#",$select_fleet_attack[2][0]))

                                    {

                                    $lost_units = lost_unit ($player_att, $$key_att_last, $key_att_last, $id_rcround, "att");

                                    // Variable de concaténation pour des flottes

                                    $template .= "   " . $ship_att_last ." ". number_format($$key_att_last,0,',','.').$color_bal." ".$color_perte_fleet_def.$lost_units.$color_bal."
";

                                    }

                                 }

                           }

                        // Si la variable revient false il affichera détruit.

                        if ($vivant_att == false)

                           {

                           // Variable de concaténation si l'attaquant détruit

                           $template .= $color_detruit . 'Détruit' . $color_bal . "

";                        

                           }

                     }

               }

            // On recupère les flottes de défenses après le combat

            $query_player_def_last = $db->sql_query ("SELECT player FROM ".TABLE_ROUND_DEFENSE." WHERE id_rcround=".$id_last_rcround." GROUP BY player" );

            WHILE (list($player_def_list) = $db->sql_fetch_row($query_player_def_last))

               {   

                  // On nettoie les noms des joueurs des metacaractère et nous voila partie dans un beau bordel -_-'

                  $player_def_list_format = preg_replace('#((|)|#|!|^|$|(|)|[|]|{|}|?|+|*|.|\||)#', 'Xespace_symboleX$1', $player_def_list);

                  // Ogspy n'accepte pas le $1 à cause du  donc j'ai mis un espace que l'on supprime

                  $player_def_list_format2 = preg_replace('#(Xespace_symboleX)#', '\', $player_def_list_format);

                  // Obligé d'utilisé le preg_match_all pour trouver les flottes du joueurs, on part dans les array. Super je m'éclate.

                  preg_match_all('#^/('.$player_def_list_format2.')^$,(.+)---#isU', $template_type_def, $select_fleet_def);

                  

                  $query_round_defense_last = $db->sql_query("SELECT player, SUM(PT), SUM(GT), SUM(CLE), SUM(CLO), SUM(CR), SUM(VB), SUM(VC), SUM(REC), SUM(SE), SUM(BMD), SAT, SUM(DST), SUM(EDLM), SUM(TRA), LM, LLE, LLO, CG, AI, LP, PB, GB FROM ".TABLE_ROUND_DEFENSE." WHERE id_rcround=".$id_last_rcround." AND player='".$player_def_list."'  GROUP BY player");

                  WHILE (list($player_def, $PT, $GT, $CLE, $CLO, $CR, $VB, $VC, $REC, $SE, $BMD, $SAT, $DST, $EDLM, $TRA, $LM, $LLE, $LLO, $CG, $AI, $LP, $PB, $GB) = $db->sql_fetch_row($query_round_defense_last))

                     {

                        // Variable de concaténation pour les défenseurs

                        $template .= "
".'Défenseur '. $color_player_def. $player_def. $color_bal."
";

                        $key_def_last = '';

                        $ship_def_last = 0;

                        $vivant_def_fleet = false;

                        $vivant_def = false;

                        $sum_def_fleet = $PT + $GT + $CLE + $CLO + $CR + $VB + $VC + $REC + $SE + $BMD + $SAT + $DST + $EDLM + $TRA;

                        $sum_def = $LM + $LLE + $LLO + $CG + $AI + $LP + $PB + $GB;

            

                        foreach ($key_ships as $key_def_last => $ship_def_last)

                           {

                              if (isset($sum_def_fleet) && $sum_def_fleet > 0)

                                 {

                                    $vivant_def_fleet = true;

                                    

                                    if(preg_match("#".$key_def_last."#",$select_fleet_def[2][0]))

                                       {

                                          $lost_units = lost_unit ($player_def, $$key_def_last, $key_def_last, $id_rcround, "def");

                                          // Variable de concaténation pour les flottes des défenseurs

                                          $template .= "   " . $ship_def_last ." ". number_format($$key_def_last,0,',','.').$color_bal." ".$color_perte_fleet_def.$lost_units.$color_bal."
";

                                       }

                                 }

                           }

                        foreach ($key_defs as $key_def_last => $def_def_last)

                           {

                              if (isset($sum_def) && $sum_def > 0)

                                 {

                                    $vivant_def = true;

                                    if(preg_match("#".$key_def_last."#",$select_fleet_def[2][0]))

                                       {

                                          // Variable de concaténation pour la défense du défenseur

                                          $template .= "   " . $def_def_last ." ". number_format($$key_def_last,0,',','.').$color_bal."
";

                                       }

                                 }

                        }

                     }

                  if ($vivant_def_fleet == false && $vivant_def == false)

                     {

                        // Variable de concaténation si le défenseur détruit

                        $template .= $color_detruit . 'Détruit' . $color_bal . "
";

                     }

                  

               }

         // Variable de concaténation pour afficher une séparation

         if ($type == "bbcode")

            {

               $template.= "

";

            }

         $template .= select_picture($type, $skin, $color_PIC_SEPARATOR, "0", "");

         if ($type == "bbcode")

            {

               $template.= "

";

            }

         

         if ($victoire == "A")

            {   

               // Variable de concaténation si le défenseur gagne la bataille

               $template .= "
". 'L'attaquant a remporté la battaille ! Il emporte '.format_number($color_ressources_piller_min,$color_ressources_piller_max,$gain_M,$color_seuil_pillage,$type).$color_bal.' unités de métal, '.format_number($color_ressources_piller_min,$color_ressources_piller_max,$gain_C,$color_seuil_pillage,$type).$color_bal.' unités de cristal et '.format_number($color_ressources_piller_min,$color_ressources_piller_max,$gain_D,$color_seuil_pillage,$type).$color_bal.' de deutérium.'."
";

            }

          elseif ($victoire == "D")

            {

               // Variable de concaténation si le défenseur gagne la bataille

               $template .= "
".'Le défenseur a remporté la bataille !'."
";

            

            }

         elseif ($victoire == "N")

            {

               // Variable de concaténation si match nul

               $template .= "
".'La bataille se termine par un match nul, les deux flottes rentrent vers leurs planètes respectives.'."
";

            }      

      

         // Variable de concaténation pour afficher une séparation

         if ($type == "bbcode")

            {

               $template.= "

";

            }

         $template .= select_picture($type, $skin, $color_PIC_RESULT, "0", "");

         if ($type == "bbcode")

            {

               $template.= "

";

            }

      

         // On véréfie si une lune a été créée

         if ($lune == 1)

            {

               // Variable de concaténation si une lune a été créée

               $template .= "

".' Une lune se forme dans l'orbite de la planète!'."
";

            }

         

         // On récupère les pillage

         if (!empty($pillage))

            {

               $pillage_unit_perdu_att = 0;

               $pillage_unit_perdu_att = 0;

               $pillage_metal = 0;

               $pillage_cristal = 0;

               $pillage_deuterium = 0;

               $pillage_cdr_M = 0;

               $pillage_cdr_C = 0;

               $id_pillage = explode("P",$pillage);

               $nb_pillage = count($id_pillage) - 1;

               for ($i=1; $i<=$nb_pillage; $i++)

                  {

                     $query_pillage = $db->sql_query("SELECT pertes_A, pertes_D, gain_M, gain_C, gain_D, debris_M, debris_C FROM ".TABLE_PARSEDRC." WHERE id_rc=".$id_pillage[$i]);

                     list($pillage_pertes_att,$pillage_pertes_def, $pillage_gain_M, $pillage_gain_C, $pillage_gain_D, $pillage_debris_M, $pillage_debris_C) = $db->sql_fetch_row($query_pillage);

                     

                     $template .= 'Il emporte '.format_number($color_ressources_piller_min,$color_ressources_piller_max,$pillage_gain_M,$color_seuil_pillage,$type).$color_bal.' unités de métal, '.format_number($color_ressources_piller_min,$color_ressources_piller_max,$pillage_gain_C,$color_seuil_pillage,$type).$color_bal.' unités de cristal et '.format_number($color_ressources_piller_min,$color_ressources_piller_max,$pillage_gain_D,$color_seuil_pillage,$type).$color_bal.' de deutérium.'."
";

               $pillage_metal = $pillage_metal + $pillage_gain_M;

               $pillage_cristal = $pillage_cristal + $pillage_gain_C;

               $pillage_deuterium = $pillage_deuterium + $pillage_gain_D;

               $pillage_cdr_M = $pillage_cdr_M + $pillage_debris_M;

               $pillage_cdr_C = $pillage_cdr_C + $pillage_debris_C;

               $pillage_unit_perdu_att = $pillage_unit_perdu_att + $pillage_pertes_att;

               $pillage_unit_perdu_def = $pillage_unit_perdu_def + $pillage_pertes_def;

                  }

            }

         

      

         //on fais le bilan du rc

         $renta_Att_cdr = $gain_M + $pillage_metal + $gain_C + $pillage_cristal + $gain_D + $pillage_deuterium + $debris_M + $pillage_cdr_M + $debris_C +$pillage_cdr_C - $pertes_A - $pillage_unit_perdu_att;

         $renta_Att =$gain_M + $pillage_metal + $gain_C + $pillage_cristal + $gain_D + $pillage_deuterium - $pertes_A - $pillage_unit_perdu_att;

         $renta_Def_cdr = $debris_M + $pillage_cdr_M + $debris_C +$pillage_cdr_C - $pertes_D - $pillage_unit_perdu_def;

         $renta_Def = -$pertes_D + $pillage_unit_perdu_def;

      

      

         // Variable de concaténation du résultat du combat et de la rentabilité

         $template .= "
".'L'attaquant a perdu au total '.format_number($color_pertes_min_att,$color_pertes_max_att,$pertes_A,$color_seuil_pertes,$type).$color_bal.' unités.'."
";

         $template .= 'Le défenseur a perdu au total '.format_number($color_pertes_min_def,$color_pertes_max_def,$pertes_D,$color_seuil_pertes,$type).$color_bal.' unités.'. "
";      

         $template .= 'Un champ de débris contenant '.format_number($color_debris_min,$color_debris_max,$debris_M,$color_seuil_cdr,$type).$color_bal.' unités de métal et '.format_number($color_debris_min,$color_debris_max,$debris_C,$color_seuil_cdr,$type).$color_bal.' unités de cristal.'."

";

         $template .= 'Rentabilité'."
";

         $template .= 'Attaquant avec/sans recyclage : '.format_number($color_renta_min,$color_renta_max,$renta_Att_cdr,$renta_Att_cdr,$type).$color_bal.' / '.format_number($color_renta_min,$color_renta_max,$renta_Att,$renta_Att_cdr,$type).$color_bal."
";

         $template .= 'Défenseur avec/sans recyclage : '.format_number($color_renta_min,$color_renta_max,$renta_Def_cdr,0,$type).$color_bal.' / '.format_number($color_renta_min,$color_renta_max,$renta_Def,0,$type).$color_bal."
";

         if ($type == "bbcode")

            {

               $template.= "

"."Mod HofRC by Shad (OGSteam)[/align]
";

            }



         return $template;

         

   }



/**************************************************************************/

   

   function lost_unit ($player_name, $alive_unit, $key, $id_rcround, $cat)

      {

         global $db, $table_prefix;

         if ($cat == "att")

            {

               $table_cat = TABLE_ROUND_ATTACK;

            }

         elseif ($cat == "def")

            {

               $table_cat = TABLE_ROUND_DEFENSE;

            }

         $query_round_key = $db->sql_query("SELECT SUM(".$key.") FROM ".$table_cat." WHERE id_rcround=".$id_rcround." AND player='".$player_name."' GROUP BY player");

         WHILE (list($result_key) = $db->sql_fetch_row($query_round_key))

         $lost_unit = $result_key - $alive_unit;

         

         $result_lost_unit = "( -".number_format($lost_unit,0,',','.')." )";

   

      return $result_lost_unit;

      }

/**************************************************************************/

   

   function set_color_fleet ($PT, $GT, $CLE, $CLO, $CR, $VB, $VC, $REC, $SE, $BMD, $SAT, $DEST, $EDLM, $TRA)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_SKIN',$table_prefix.'hofrc_skin');

         $set_id = $_GET['id'];

         $db->sql_query("UPDATE `".TABLE_HOFRC_SKIN."` SET `pt` = '".$PT."', `gt` = '".$GT."', `cle` = '".$CLE."', `clo` = '".$CLO."', `cr` = '".$CR."', `vb` = '".$VB."', `vc` = '".$VC."', `rec` = '".$REC."', `se` = '".$SE."', `bmd` = '".$BMD."', `sat` = '".$SAT."', `dst` = '".$DEST."', `edlm` = '".$EDLM."', `tra` = '".$TRA."'   WHERE `".TABLE_HOFRC_SKIN."`.`id`  =  ".$set_id);

      }



/**************************************************************************/

   

   function set_color_def ($LM, $LLEGER, $LLOURD, $CG, $AI, $LP, $PB, $GB)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_SKIN',$table_prefix.'hofrc_skin');

         $set_id = $_GET['id'];

         $db->sql_query("UPDATE `".TABLE_HOFRC_SKIN."` SET `lm` = '".$LM."', `lleger` = '".$LLEGER."', `llourd` = '".$LLOURD."', `cg` = '".$CG."', `ai` = '".$AI."', `lp` = '".$LP."', `pb` = '".$PB."', `gb` = '".$GB."'   WHERE `".TABLE_HOFRC_SKIN."`.`id`  =  ".$set_id);

      }



/**************************************************************************/

      

   function set_color_general ($title, $ALLY, $PLAYER_ATT, $PLAYER_DEF, $TECHNO, $DETRUIT)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_SKIN',$table_prefix.'hofrc_skin');

         $set_id = $_GET['id'];

         $db->sql_query("UPDATE `".TABLE_HOFRC_SKIN."` SET `title` = '".$title."', `ally` = '".$ALLY."', `player_att` = '".$PLAYER_ATT."', `player_def` = '".$PLAYER_DEF."', `techno` = '".$TECHNO."', `detruit` = '".$DETRUIT."'   WHERE `".TABLE_HOFRC_SKIN."`.`id`  =  ".$set_id);

      }



/**************************************************************************/

      

   function set_end_rc ($PILLER_MIN, $PILLER_MAX, $PERTES_FLEET_DEF, $SEUIL_PERTES, $SEUIL_PILLAGE, $SEUIL_CDR, $PERTES_MIN_ATT, $PERTES_MAX_ATT, $PERTES_MIN_DEF, $PERTES_MAX_DEF, $DEBRIS_MIN, $DEBRIS_MAX, $RENTA_MIN, $RENTA_MAX)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_SKIN',$table_prefix.'hofrc_skin');

         $set_id = $_GET['id'];

         $db->sql_query("UPDATE `".TABLE_HOFRC_SKIN."` SET `ressources_piller_min` =  '".$PILLER_MIN."', `ressources_piller_max` =  '".$PILLER_MAX."', `pertes_fleet_def` =  '".$PERTES_FLEET_DEF."', `seuil_pertes` =  '".$SEUIL_PERTES."', `seuil_pillage` =  '".$SEUIL_PILLAGE."', `seuil_cdr` =  '".$SEUIL_CDR."', `pertes_min_att` =  '".$PERTES_MIN_ATT."', `pertes_max_att` =  '".$PERTES_MAX_ATT."', `pertes_min_def` =  '".$PERTES_MIN_DEF."', `pertes_max_def` =  '".$PERTES_MAX_DEF."', `debris_min` =  '".$DEBRIS_MIN."', `debris_max` =  '".$DEBRIS_MAX."', `renta_min` =  '".$RENTA_MIN."', `renta_max` =  '".$RENTA_MAX."'    WHERE `".TABLE_HOFRC_SKIN."`.`id`  =  ".$set_id);

      }   



/**************************************************************************/

   

   function rate_resizing($percent)

      {

         global $db, $table_prefix;

         define('TABLE_HOFRC_CONFIG',$table_prefix.'hofrc_config');

         if ($percent === 0)

            {

               $query_rate = $db->sql_query("SELECT `config_value` FROM ".TABLE_HOFRC_CONFIG." WHERE `config_name` = 'hofrc_percent_resizing'");

               list($rate_resize) = $db->sql_fetch_row($query_rate);

               return $rate_resize;

            }

         else

            {

               $db->sql_query("UPDATE `".TABLE_HOFRC_CONFIG."` SET `config_value` = '".$percent."' WHERE ".TABLE_HOFRC_CONFIG.".`config_name`  = 'hofrc_percent_resizing'");

            }

      }



/**************************************************************************/

      

   function image_resizing($size)

      {

         global $db;

         // On récupère le ratio des images

         $query_percent_size = $db->sql_query("SELECT `config_value` FROM ".TABLE_HOFRC_CONFIG." WHERE `config_name` = 'hofrc_percent_resizing'");

         list($percent_resizing) = $db->sql_fetch_row($query_percent_size);

         

         $new_size = round((($percent_resizing/100)*$size));

         

         return $new_size;

      }

      

/**************************************************************************/



   function get_background_tab($folder)

      {

         // Liste tous les fichiers .jpg du dossier des fonds disponibles   

         $background = array();

         $dossier = @opendir ("mod/hofrc/Skin/".$folder);

         while ($fichier = readdir ($dossier))

            if ((substr($fichier, -4) == ".jpg")||(substr($fichier, -4) == ".png")||(substr($fichier, -4) == ".gif"))

            $background[] = $fichier;

         

         return $background;

      }



/**************************************************************************/



   function get_image_tab($folder)

      {

         // Liste tous les fichier .jpg et .png du dossier des images disponible (fusion avec les polices et les fonds...?)

         $images = array();

         $dossier = @opendir ("mod/hofrc/Skin/".$folder);

         while ($fichier = readdir ($dossier))

            if ((substr($fichier, -4) == ".jpg")||(substr($fichier, -4) == ".png"))

         $images[] = $fichier;

      

         return $images;

      }



/**************************************************************************/



   function upload_picture($pic)

      {

         preg_match ('#^w+#',$_FILES['picture']['name'],$pic_name);

         $erreur = "Le nom du fichier n'est pas écrit correctement, il devrait ce nommer ";

         if ($pic == "PIC_HEADER")

            {

               if ($pic_name[0] == "header")

                  {

                     upload("pictures");

                  }

               else

                  {

                     echo $erreur."header.xxx";

                  }

            }

      

         elseif ($pic == "PIC_ROUND")

            {

               if ($pic_name[0] == "round")

               {

                  upload("pictures");

               }

            else

               {

                  echo $erreur."round.xxx";

               }

         

            }

      

         elseif ($pic == "PIC_SEPARATOR")

            {

               if ($pic_name[0] == "separator")

               {

                  upload("pictures");

               }

            else

               {

                  echo $erreur."separator.xxx";

               }

            }

      

         elseif ($pic == "PIC_RESULT")

            {

               if ($pic_name[0] == "result")

               {

                  upload("pictures");

               }

            else

               {

                  echo $erreur."result.xxx";

               }

            }

      

         elseif ($pic == "PIC_BACKGROUND")

            {

DarkNoon

Juste parce que je n'ai pas eu de demande pour publier la maj :-)
Héberger votre OGSpy : Hébergement

Shad

#29
Be je n'ai fais aucune maj -_-'. je vais regarder pour checker tout sa et faire la maj du mod.

PS: Si vous avez des idées d'amélioration postez les et je regarderais sa dès que j'ai le temps ;).
edit: Bon en fait, lors du tag il a dur ajouter des sauts de ligne entre chaque ligne de code. Va comprendre pourquoi -_-'