From 2f9b2ed4a31487a3f15f769e8438e3c1d804a249 Mon Sep 17 00:00:00 2001 From: hecht Date: Sat, 23 Sep 2017 06:44:06 +0000 Subject: [PATCH] fixed tournament --- ag/include/tournament.inc.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/ag/include/tournament.inc.php b/ag/include/tournament.inc.php index a0cade8..c210078 100644 --- a/ag/include/tournament.inc.php +++ b/ag/include/tournament.inc.php @@ -6,12 +6,16 @@ */ include_once(ROOT_PATH.'/include/sqlwrapper.inc.php'); - +include_once(ROOT_PATH.'/include/defines.inc.php'); define ( TOURNAMENT_GAIN_ANMELDUNG, 0 ); define ( TOURNAMENT_GAIN_PL, 1 ); define ( TOURNAMENT_GAIN_LEVEL, 2 ); +defineIfNotDefined( TOURNAMENT_FIGHT_DURATION, 5); +defineIfNotDefined( ATTACK_SET_TOURNAMENT, 1); + + function getTournamentTypes() { $qry = db_query ( 'SELECT * from tournament_types' ); $types = array (); @@ -153,9 +157,13 @@ function retrieveParticipants($tournament_type) { $sql = 'DELETE FROM tournament_registration WHERE type = '.$tournament_type['id']; // echo $sql .'
'; db_query($sql); // Lösche die Anmeldungsliste - + + if ( count($cid) == 0 ) { + $sql = 'SELECT id FROM chars c where '.$filter_sql.' ORDER BY RAND()'; + } else { + $sql = 'SELECT id FROM chars c where '.$filter_sql.' AND id NOT IN ('.join(',', $cid).') ORDER BY RAND()'; + } // In case the tournament is not full - $sql = 'SELECT id FROM chars c where '.$filter_sql.' ORDER BY RAND()'; } else if($gain == TOURNAMENT_GAIN_PL){ // Die Buffs werden nicht zur PL gezählt ;) $sql = 'SELECT c.id FROM chars c where '.$filter_sql.' ORDER BY starke+verteidigung+speed+ausdauer+glueck desc'; @@ -176,11 +184,19 @@ function retrieveParticipants($tournament_type) { $char_array = array(); foreach ($cid as $char_id) { // echo $row['id'].'
'; + $char_data = NULL; if($itemless == 1) { - $char_array[] = getChar($char_id); // ohne Equip für Turniere!! + $char_data = getChar($char_id); // ohne Equip für Turniere!! } else { - $char_array[] = getCharWithBuffs($char_id); // Equip für Turniere!! + $char_data = getCharWithBuffs($char_id); // Equip für Turniere!! } + $hp = explode(',', $char_data['hp']); + $hp_max = $hp[1]; + $mp = explode(',', $char_data['mp']); + $mp_max = $mp[1]; + $char_data['hp'] = join(',', array($hp_max, $hp_max)); + $char_data['mp'] = join(',', array($mp_max, $mp_max)); + $char_array[] = $char_data; } return $char_array;