<?php

define('INSIDE' , true);
define('INSTALL' , false);
define('DISABLE_IDENTITY_CHECK', true);
require_once dirname(dirname(__FILE__)) .'/common.php';

/**
	POUR LA VERSION 2009.1 RC3
	---------------------------------------------------------------------------------------------------------
		CORRIGER L'ERREUR DES STATS:
			Les stats ne peut pas etre exécuter tant qu'il n'y pas de données existants dans la table.
	---------------------------------------------------------------------------------------------------------
		1. Executer ce fichier corrstats.php
		2. Executer le fichier admin/statbuilder.php
*/
	//Vider la table stats; ca évite des duplicatiosn par la suite
	doquery("TRUNCATE {{table}}","statpoints");
	
	
	//Joueurs
	$GameUsers = doquery("SELECT * FROM {{table}}", 'users');
	
	while($u = mysql_fetch_assoc($GameUsers)) {
		doquery("INSERT INTO {{table}} SET `id_owner`='".$u['id']."', `id_ally`='".$u['ally_id']."', `stat_type`='1', `stat_code`='1'", 'statpoints');
	}

	
	//Alliances
	$GameAlly = doquery("SELECT * FROM {{table}}", 'alliance');
	
	while($a = mysql_fetch_assoc($GameAlly)) {
		doquery("INSERT INTO {{table}} SET `id_owner`='".$a['id']."', `id_ally`='0', `stat_type`='1', `stat_code`='2'", 'statpoints');
	}
	
	
	AdminMessage("Termine");