You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.0 KiB

<?php
/*
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
//set_time_limit(0);
$art_1 ="gross";
function rand_array($array)
{
$maxarray=count($array)-1;
mt_srand((double)microtime()*1000000);
for($i=$maxarray; $i>=0; $i--)
{
if($i>0) $zufall=mt_rand(0,$i);
else $zufall=0;
$temp=$array[$i];
$array[$i]=$array[$zufall];
$array[$zufall]=$temp;
$newarray[]=$array[$i];
array_pop($array);
}
return $newarray;
}
include "db.php";
$chars_max = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE rasse !='NPC' ORDER BY level DESC LIMIT 512"));
if($chars_max<512) {
echo "keine 512 spieler.";
exit;
}
mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'");
$char1 = mysql_query("SELECT id FROM chars WHERE rasse !='NPC' ORDER BY level DESC LIMIT 512");
while($row=mysql_fetch_array($char1))
{
$test2[]=$row['id'];
}
do
{
$test2 = rand_array($test2);
$test2 = array_unique($test2);
}
while(count($test2)<512);
$test3=$test2;
reset($test3);
while(current($test3)!=end($test2))
{
if(empty($list)) $list=current($test3);
else $list.=','.next($test3);
}
$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 512");
while($row=mysql_fetch_array($result))
{
$charas[$row['id']]=$row;
}
$a8=0;
$b8=1;
$round = 1;
while($a8 < 512)
{
$chara_1 = $charas[$test2[$a8]];
$chara_2 = $charas[$test2[$b8]];
include "turnier_kampf.php";
$a8+=2;
$b8+=2;
}
while($round < 9)
{
unset($test9);
$chars_win = mysql_Query("SELECT win FROM turnier_kampf WHERE round='$round' AND art='$art_1'");
while($row9 = mysql_fetch_array($chars_win))
{
$test9[]=$row9['win'];
}
$round++;
$k9=0;
$l9=1;
while($k9 < count($test9))
{
$chara_1 = $charas[$test9[$k9]];
$chara_2 = $charas[$test9[$l9]];
include "turnier_kampf.php";
$k9+=2;
$l9+=2;
}
}
mysql_query("DELETE FROM turnier1 WHERE art='$art_1'");
?>