From 27e83049c1c035b58b6a0b03fa4b1c4d744d2c79 Mon Sep 17 00:00:00 2001 From: hecht Date: Sat, 23 Sep 2017 13:34:54 +0000 Subject: [PATCH] Minor fixes on tournament --- ag/include/sqlwrapper.inc.php | 2 ++ ag/include/tournament.inc.php | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ag/include/sqlwrapper.inc.php b/ag/include/sqlwrapper.inc.php index 9af694a..138b4bd 100755 --- a/ag/include/sqlwrapper.inc.php +++ b/ag/include/sqlwrapper.inc.php @@ -6,6 +6,8 @@ * @author hecht */ +include_once(ROOT_PATH . '/include/config/server.inc.php'); + function send_report($report) { $backtrace = debug_backtrace(); diff --git a/ag/include/tournament.inc.php b/ag/include/tournament.inc.php index c210078..1ece3c3 100644 --- a/ag/include/tournament.inc.php +++ b/ag/include/tournament.inc.php @@ -131,7 +131,7 @@ function retrieveParticipants($tournament_type) { $anzahl = $tournament_type['competitors']; // Anzahl (benötigt) $gain = $tournament_type['gain']; // ('Anmeldung', 'PL', 'Level') - $itemless = !$_GET['without_equip']; // gibt an ob das turnier die items ingorieren soll (standard sind items aktiv) + $itemless = $_GET['without_equip']; // gibt an ob das turnier die items ingorieren soll (standard sind items aktiv) $sql = 'SELECT count(*) as anzahl from chars c where '.$filter_sql; @@ -185,7 +185,7 @@ function retrieveParticipants($tournament_type) { foreach ($cid as $char_id) { // echo $row['id'].'
'; $char_data = NULL; - if($itemless == 1) { + if ($itemless == 1) { $char_data = getChar($char_id); // ohne Equip für Turniere!! } else { $char_data = getCharWithBuffs($char_id); // Equip für Turniere!! @@ -294,3 +294,24 @@ function calculateTournament($tournament, $participants) { } } + +function getFruitItem( $fruit_type, $drop_chance ) { + $item_hash = NULL; + if ( $drop_chance == 0 ) { + return NULL; + } else if($drop_chance >= 100 || $drop_chance >= mt_random_wrapper(1, 100)) { + if ($fruit_type == 'natur') { + $sql = 'SELECT id FROM wochen_markt WHERE art=\''.$fruit_type.'\' order by rand() LIMIT 1'; + } else { + $sql = 'SELECT id FROM wochen_markt WHERE kategorie=\''.$fruit_type.'\' order by rand() LIMIT 1'; + } + + $qry = db_query($sql); + $id = mysqli_fetch_row($qry)[0]; + + $item_hash = item2Value(array('id' => $id, 'table_name' => 'wochen_markt')); + } + return $item_hash; +} + +