fixed tournament

main
hecht 7 years ago
parent abe8222b1c
commit 2f9b2ed4a3

@ -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 ();
@ -154,8 +158,12 @@ function retrieveParticipants($tournament_type) {
// echo $sql .'<br>';
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'].'<br>';
$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;

Loading…
Cancel
Save