From c327197f69ace565f9ffe99ae61eac0cfdf5496d Mon Sep 17 00:00:00 2001 From: hecht Date: Sun, 4 Sep 2011 17:16:37 +0000 Subject: [PATCH] changes on the way of calculating exp and money at generic_tournaments. Also the processing of the results is now cleaned up :) --- cronjob/Turnier2.php | 135 +++-------------------- cronjob/db.php | 25 +++++ cronjob/gross_Turnier2.php | 195 +++++----------------------------- cronjob/gross_turnier.php | 114 -------------------- cronjob/inclu/exp.inc.php | 39 +++---- cronjob/inclu/turnier.inc.php | 142 +++++++++++++++++++++++++ cronjob/klein_Turnier2.php | 122 +++------------------ cronjob/klein_turnier.php | 127 ---------------------- cronjob/turnier.php | 124 --------------------- cronjob/turnier_kampf.php | 22 ++-- 10 files changed, 253 insertions(+), 792 deletions(-) create mode 100644 cronjob/db.php delete mode 100644 cronjob/gross_turnier.php create mode 100644 cronjob/inclu/turnier.inc.php delete mode 100644 cronjob/klein_turnier.php delete mode 100644 cronjob/turnier.php diff --git a/cronjob/Turnier2.php b/cronjob/Turnier2.php index 536aaf7..abd8790 100644 --- a/cronjob/Turnier2.php +++ b/cronjob/Turnier2.php @@ -6,144 +6,33 @@ * */ include "db.php"; -include_once ('inclu/messagefunctions.inc.php'); include_once ('inclu/halloffame.inc.php'); include_once ('inclu/fruitdistribution.inc.php'); include_once ('inclu/exp.inc.php'); +include_once ('inclu/turnier.inc.php'); +include_once ('inclu/char.inc.php'); -$row2 = mysql_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld, -i1.id AS i1id, i2.id AS i2id FROM turnier_kampf u LEFT JOIN chars c1 ON(c1.id=u.char1) LEFT JOIN user i1 ON(i1.id=c1.besitzer) LEFT JOIN chars c2 ON(c2.id=u.char2) LEFT JOIN user i2 ON(i2.id=c2.besitzer) WHERE u.art='wochen' ORDER BY u.round ASC"); +// do the stuff for the whole exp and money distribution there ;) +$results = generateTournamentResults('wochen', 15000, 20000); +$rang1 = getChar($results[0][0]); -$x=0; -while($row = mysql_fetch_array($row2)) { - - $new_hp = explode(",",$row[hp1]); - $or_hp1 = explode(",",$row[c1hp]); - $new_hp2 = count($new_hp) - 1; - - $new_mp = explode(",",$row[mp1]); - $or_mp1 = explode(",",$row[c1mp]); - $new_mp2 = count($new_mp) - 1; - - $or_exp1 = explode(",",$row[c1exp]); - $add_exp1 = ($row[round] * 3000); - $new_exp = $or_exp1[0] + ($row[round] * 3000); - - - $new_lernpunkte1 = $row[c1lern] + (($row[round] * $row[round] / 4)); - $new_lernpunkte2 = $row[c2lern] + (($row[round] * $row[round] / 4)); - - $new_geld1 = $row[i1geld] + ($row[round] * 3000); - $new_geld2 = $row[i2geld] + ($row[round] * 3000); - - $trainings_points1 = $row[round] * 1; - $trainings_points2 = $row[round] * 1; - - if($row[round] == 6 AND $row[win] == $row[c1id]) { - $new_exp += 15000; - $add_exp1 += 15000; - $new_lernpunkte1 += 15; - $new_geld1 += 20000; - $trainings_points1 += 10; - $char_id1 = $row[win]; - } - - $new_hp_2 = explode(",",$row[hp2]); - $or_hp1_2 = explode(",",$row[c2hp]); - $new_hp2_2 = count($new_hp_2) - 1; - - $new_mp_2 = explode(",",$row[mp2]); - $or_mp1_2 = explode(",",$row[c2mp]); - $new_mp2_2 = count($new_mp_2) - 1; - - $or_exp1_2 = explode(",",$row[c2exp]); - $add_exp2 = ($row[round] * 3000); - $new_exp_2 = $or_exp1_2[0] + ($row[round] * 3000); - - if($row[round] == 6 AND $row[win] == $row[c2id]) { - $new_exp_2 += 15000; - $add_exp2 += 15000; - $new_lernpunkte2 += 15; - $new_geld2 += 20000; - $trainings_points2 += 10; - $char_id1 = $row[win]; - } - $old_win = $row[win]; - - //mysql_query("UPDATE chars SET status='Frei', training_points=training_points+'$trainings_points1', lernpunkte='$new_lernpunkte1', hp='$new_hp[$new_hp2],$or_hp1[1]', mp='$new_mp[$new_mp2],$or_mp1[1]', exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'"); - //mysql_query("UPDATE chars SET status='Frei', training_points=training_points+'$trainings_points2', lernpunkte='$new_lernpunkte2', hp='$new_hp_2[$new_hp2_2],$or_hp1_2[1]', mp='$new_mp_2[$new_mp2_2],$or_mp1_2[1]', exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'"); -// mysql_query("UPDATE chars SET status='Frei', exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'"); -// mysql_query("UPDATE chars SET status='Frei', exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'"); - - addExpToChar($row['c1id'],$add_exp1); - addExpToChar($row['c2id'],$add_exp2); - - mysql_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1"); - mysql_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1"); - -} - -$win_user = mysql_Fetch_array(mysql_Query("SELECT name, besitzer FROM chars WHERE id='$old_win' LIMIT 1")); -$win_name = mysql_fetch_Array(mysql_query("SELECT nickname FROM user WHERE id='$win_user[besitzer]' LIMIT 1")); -$win_online = mysql_fetch_array(mysql_query("SELECT turnier FROM online LIMIT 1")); -mysql_query("UPDATE online SET turnier='$win_online[turnier],$win_user[name],$win_name[nickname]' WHERE id='1'"); -// insertIntoHallOfFame($title, $charid, $userid); -insertIntoHallOfFame('Wochenturnier', $old_win, $win_user['besitzer']); - -mysql_query("UPDATE wochen_markt SET anzahl='1'"); +insertIntoHallOfFame('Wochenturnier', $rang1['id'], $rang1['besitzer']); $xiu=5; if($xiu >= mt_rand(1, 100)) { ////////////////FRUCHT ARRAY //include "array.php"; - distributeFruit($win_user['besitzer']); + distributeFruit($rang1['besitzer']); } -$sql5 = 'Select count(win), win from turnier_kampf where art = \'wochen\' group by win order by count(win) desc'; -$qry5 = mysql_query($sql5); - -$rang1 = mysql_fetch_assoc($qry5); -$rang2 = mysql_fetch_assoc($qry5); -$rang3 = mysql_fetch_assoc($qry5); -$rang4 = mysql_fetch_assoc($qry5); -$rang5 = mysql_fetch_assoc($qry5); -$rang6 = mysql_fetch_assoc($qry5); -$rang7 = mysql_fetch_assoc($qry5); -$rang8 = mysql_fetch_assoc($qry5); - -$sql = 'select u.clan, c.id, u.id as userid from chars c inner join user u on c.besitzer = u.id where c.id IN ('.$rang1['win'].','.$rang2['win'].','.$rang3['win'].','.$rang4['win'].','.$rang5['win'].','.$rang6['win'].','.$rang7['win'].','.$rang8['win'].')'; +$prices[] = 50; // 1. +$prices[] = 40; // 2. +$prices[] = 30; // 3. + 4. +$prices[] = 20; // 5. - 8. -echo $sql.'
'; -$qry = mysql_query($sql); - -while($row = mysql_fetch_assoc($qry)){ - switch($row['id']){ - case $rang1['win']: - mysql_query('UPDATE user set pkt = pkt + 50 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '50 IP von Wochenturnier Sieg erhalten!'); - break; - case $rang2['win']: - mysql_query('UPDATE user set pkt = pkt + 40 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '40 IP von Wochenturnier 2.Platz erhalten!'); - break; - case $rang3['win']: - case $rang4['win']: - mysql_query('UPDATE user set pkt = pkt + 30 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '30 IP von Wochenturnier 3. oder 4. Platz erhalten!'); - break; - case $rang5['win']: - case $rang6['win']: - case $rang7['win']: - case $rang8['win']: - mysql_query('UPDATE user set pkt = pkt + 20 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '20 IP von Wochenturnier 5-8. Platz erhalten!'); - break; - default: - break; - } -} +distributeShopPoints($prices, $results, 'Wochenturnier'); ?> \ No newline at end of file diff --git a/cronjob/db.php b/cronjob/db.php new file mode 100644 index 0000000..84dd818 --- /dev/null +++ b/cronjob/db.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/cronjob/gross_Turnier2.php b/cronjob/gross_Turnier2.php index 20f66c1..895ebee 100644 --- a/cronjob/gross_Turnier2.php +++ b/cronjob/gross_Turnier2.php @@ -11,200 +11,59 @@ include_once ('inclu/halloffame.inc.php'); include_once ('inclu/fruitdistribution.inc.php'); include_once ('inclu/exp.inc.php'); include_once ('include/usergroup.inc.php'); +include_once ('inclu/turnier.inc.php'); +include_once ('inclu/char.inc.php'); -$sql1 = 'select distinct(char1) from turnier_kampf where art = \'gross\' order by char1'; -$sql2 = 'select distinct(char2) from turnier_kampf where art = \'gross\' order by char1'; +// calculate the avg level of the chars participating +$sql = '(Select distinct(char1) as x from turnier_kampf where art = \'gross\' ) union (Select distinct(char2) as x from turnier_kampf where art = \'gross\' )'; $charids = array(); -$qry1 = mysql_query($sql1); +$qry1 = mysql_query($sql); while($row = mysql_fetch_assoc($qry1)){ - $charids[] = $row['char1']; -} -$qry2 = mysql_query($sql2); -while($row = mysql_fetch_assoc($qry2)){ - $charids[] = $row['char2']; + $charids[] = $row['x']; } -$sql3 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')'; -$row = mysql_fetch_assoc(mysql_query($sql3)); +$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')'; +$row = mysql_fetch_assoc(mysql_query($sql2)); $dlevel = ceil($row['dlevel']); -echo 'Das Durchschnittslevel betraegt: '.$dlevel.'
'; - -$row2 = mysql_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld, -i1.id AS i1id, i2.id AS i2id FROM turnier_kampf u LEFT JOIN chars c1 ON(c1.id=u.char1) LEFT JOIN user i1 ON(i1.id=c1.besitzer) LEFT JOIN chars c2 ON(c2.id=u.char2) LEFT JOIN user i2 ON(i2.id=c2.besitzer) WHERE u.art='gross' ORDER BY u.round ASC"); - -$x=0; -while($row = mysql_fetch_array($row2)) { - - $new_hp = explode(",",$row['hp1']); - $or_hp1 = explode(",",$row['c1hp']); - $new_hp2 = count($new_hp) - 1; - - $new_mp = explode(",",$row['mp1']); - $or_mp1 = explode(",",$row['c1mp']); - $new_mp2 = count($new_mp) - 1; - - $or_exp1 = explode(",",$row['c1exp']); - $new_exp = $or_exp1[0] + ($row['round'] * 10000); - $add_exp1 = ($row['round'] * 10000); - - - $new_lernpunkte1 = $row['c1lern'] + (($row['round'] * $row['round'] / 2)); - $new_lernpunkte2 = $row['c2lern'] + (($row['round'] * $row['round'] / 2)); - - $new_geld1 = $row['i1geld'] + ($row['round'] * 10000); - $new_geld2 = $row['i2geld'] + ($row['round'] * 10000); - - $trainings_points1 = $row['round'] * 2; - $trainings_points2 = $row['round'] * 2; - - if($row['round'] == 9 AND $row['win'] == $row['c1id']) { - $new_exp += 250000; - $add_exp1 += 250000; - $new_lernpunkte1 += 30; - $trainings_points1 += 50; - $new_geld1 += 2000000; - } - - $new_hp_2 = explode(",",$row['hp2']); - $or_hp1_2 = explode(",",$row['c2hp']); - $new_hp2_2 = count($new_hp_2) - 1; - - $new_mp_2 = explode(",",$row['mp2']); - $or_mp1_2 = explode(",",$row['c2mp']); - $new_mp2_2 = count($new_mp_2) - 1; +// do the stuff for the whole exp and money distribution there ;) +$results = generateTournamentResults('gross', 250000, 2000000); +$rang1 = getChar($results[0][0]); - $or_exp1_2 = explode(",",$row['c2exp']); - $new_exp_2 = $or_exp1_2[0] + ($row['round'] * 3000); - $add_exp2 = ($row['round'] * 10000); - - if($row['round'] == 9 AND $row['win'] == $row['c2id']) { - $new_exp_2 += 250000; - $add_exp2 += 250000; - $new_lernpunkte2 += 30; - $trainings_points2 += 50; - $new_geld2 += 2000000; - } - $old_win = $row['win']; - - //mysql_query("UPDATE chars SET training_points=training_points+'$trainings_points1', lernpunkte='$new_lernpunkte1', hp='$new_hp[$new_hp2],$or_hp1[1]', mp='$new_mp[$new_mp2],$or_mp1[1]', exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'"); - //mysql_query("UPDATE chars SET training_points=training_points+'$trainings_points2',lernpunkte='$new_lernpunkte2', hp='$new_hp_2[$new_hp2_2],$or_hp1_2[1]', mp='$new_mp_2[$new_mp2_2],$or_mp1_2[1]', exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'"); - //mysql_query("UPDATE chars SET exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'"); - //mysql_query("UPDATE chars SET exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'"); - - addExpToChar($row['c1id'],$add_exp1); - addExpToChar($row['c2id'],$add_exp2); - - mysql_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1"); - mysql_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1"); - -} - -$win_user = mysql_Fetch_array(mysql_Query("SELECT id, name, besitzer FROM chars WHERE id='$old_win' LIMIT 1")); -$win_name = mysql_fetch_Array(mysql_query("SELECT id, nickname, clan FROM user WHERE id='$win_user[besitzer]' LIMIT 1")); -$win_online = mysql_fetch_array(mysql_query("SELECT turnier_gross FROM online LIMIT 1")); -mysql_query("UPDATE online SET turnier_gross='$win_online[turnier_gross],$win_user[name],$win_name[nickname]' WHERE id='1'"); -// insertIntoHallOfFame($title, $charid, $userid); -insertIntoHallOfFame('Weltturnier', $old_win, $win_user['besitzer']); +insertIntoHallOfFame('Weltturnier', $rang1['id'], $rang1['besitzer']); //$natur_frucht = mysql_num_rows(mysql_query("SELECT id FROM wochen_markt WHERE art='natur'")); ///wieviel TF gibt es?. ////////////////FRUCHT ARRAY //include "array.php"; -distributeFruit($win_user['besitzer']); +distributeFruit($rang1['besitzer']); //Schutz vor automatischem löschen hinzufügen für den sieger :) -$usergroups = getUserGroups($win_user['besitzer']); +$usergroups = getUserGroups($rang1['besitzer']); if(!isUserInGroup($usergroups, INAKTIV_LOESCHSCHUTZ) && !isUserInGroup($usergroups, AKTIV_LOESCHSCHUTZ)) { - addUserToGroup($win_user['besitzer'], INAKTIV_LOESCHSCHUTZ); + addUserToGroup($rang1['besitzer'], INAKTIV_LOESCHSCHUTZ); } // Durchschnittslevel -$sql5 = 'Select count(win), win from turnier_kampf where art = \'gross\' group by win order by count(win) desc'; -$qry5 = mysql_query($sql5); - - -$rang1 = mysql_fetch_assoc($qry5); -$rang2 = mysql_fetch_assoc($qry5); -$rang3 = mysql_fetch_assoc($qry5); -$rang4 = mysql_fetch_assoc($qry5); -$rang5 = mysql_fetch_assoc($qry5); -$rang6 = mysql_fetch_assoc($qry5); -$rang7 = mysql_fetch_assoc($qry5); -$rang8 = mysql_fetch_assoc($qry5); -$rang9 = mysql_fetch_assoc($qry5); -$rang10 = mysql_fetch_assoc($qry5); -$rang11 = mysql_fetch_assoc($qry5); -$rang12 = mysql_fetch_assoc($qry5); -$rang13 = mysql_fetch_assoc($qry5); -$rang14 = mysql_fetch_assoc($qry5); -$rang15 = mysql_fetch_assoc($qry5); -$rang16 = mysql_fetch_assoc($qry5); - $summe = 20000000/(1+exp(5-$dlevel/14)); +// Now distribute the shop points ;) +$prices[] = 100; // 1. +$prices[] = 90; // 2. +$prices[] = 75; // 3. + 4. +$prices[] = 50; // 5. - 8. +$prices[] = 25; // 9. - 16. -$sql = 'select u.clan, c.id, u.id as userid from chars c inner join user u on c.besitzer = u.id where c.id IN ('.$rang1['win'].','.$rang2['win'].','.$rang3['win'].','.$rang4['win'].','.$rang5['win'].','.$rang6['win'].','.$rang7['win'].','.$rang8['win'].','.$rang9['win'].','.$rang10['win'].','.$rang11['win'].','.$rang12['win'].','.$rang13['win'].','.$rang14['win'].','.$rang15['win'].','.$rang16['win'].')'; - -echo $sql.'
'; -$qry = mysql_query($sql); - -while($row = mysql_fetch_assoc($qry)){ - switch($row['id']){ - case $rang1['win']: - $sql = 'UPDATE clan SET geld=geld+'.ceil($summe/2).' WHERE id='.$row['clan']; - echo $sql.'
'; - mysql_query($sql); - insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.ceil($summe/2).' für den 1. Platz im Welttunier erhalten!'); - mysql_query('UPDATE user set pkt = pkt + 100 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '100 IP von Welttunier Sieg erhalten!'); - break; - case $rang2['win']: - $sql = 'UPDATE clan SET geld=geld+'.ceil($summe/4).' WHERE id='.$row['clan']; - echo $sql.'
'; - mysql_query($sql); - insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.ceil($summe/4).' für den 2. Platz im Welttunier erhalten!'); - mysql_query('UPDATE user set pkt = pkt + 90 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '90 IP von Welttunier 2.Platz erhalten!'); - break; - case $rang3['win']: - case $rang4['win']: - $sql = 'UPDATE clan SET geld=geld+'.ceil($summe/8).' WHERE id='.$row['clan']; - echo $sql.'
'; - mysql_query($sql); - mysql_query('UPDATE user set pkt = pkt + 75 WHERE id = '.$row['userid']); - insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.ceil($summe/8).' für den 3-4. Platz im Welttunier erhalten!'); - insertUserTickerMessage($row['userid'], '75 IP von Welttunier 3. oder 4. Platz erhalten!'); - break; - case $rang5['win']: - case $rang6['win']: - case $rang7['win']: - case $rang8['win']: - mysql_query('UPDATE user set pkt = pkt + 50 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '50 IP von Welttunier 5-8. Platz erhalten!'); - break; - - case $rang9['win']: - case $rang10['win']: - case $rang11['win']: - case $rang12['win']: - case $rang13['win']: - case $rang14['win']: - case $rang15['win']: - case $rang16['win']: - mysql_query('UPDATE user set pkt = pkt + 25 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '25 IP von Welttunier 9-16. Platz erhalten!'); - break; - - default: - break; - } -} -//mysql_query('UPDATE clan SET geld=geld+\'20000000\' WHERE id='$win_name[clan]' LIMIT 1'); +$cprices[] = ceil($summe/2); +$cprices[] = ceil($summe/4); +$cprices[] = ceil($summe/8); + +distributeShopPoints($prices, $results, 'Weltturnier'); +distributeClanPrices($cprices, $results, 'Weltturnier'); ?> \ No newline at end of file diff --git a/cronjob/gross_turnier.php b/cronjob/gross_turnier.php deleted file mode 100644 index d6d2faf..0000000 --- a/cronjob/gross_turnier.php +++ /dev/null @@ -1,114 +0,0 @@ -=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'"); -?> \ No newline at end of file diff --git a/cronjob/inclu/exp.inc.php b/cronjob/inclu/exp.inc.php index 25ce60b..cd6fcb4 100644 --- a/cronjob/inclu/exp.inc.php +++ b/cronjob/inclu/exp.inc.php @@ -13,7 +13,7 @@ function beautifyNumericValue($value, $step){ // RUNDEN(POTENZ(10;ABRUNDEN(MAX(LOG(I3;10);2)))/4;0) $tmp = round(pow(10,floor(max(log($value,10),2)))/$step); return round($value / $tmp) * $tmp; - + } function calculateRequiredExpChars($level){ @@ -28,7 +28,7 @@ function calculateRequiredExpChars($level){ $g08 = pow($level*$level,8) * pow(10,-26); $g09 = pow($level*$level,9) * pow(10,-30); $g10 = pow($level*$level,10) * pow(10,-33); - + return beautifyNumericValue($g01 + $g02 + $g03 + $g04 + $g06 + $g07 + $g08 + $g09 + $g10, 8); // return $g01 + $g02 + $g03 + $g04 + $g06 + $g07 + $g08 + $g09 + $g10; } @@ -46,13 +46,13 @@ function calculateRequiredExpArena($level){ return beautifyNumericValue($g00 + $g01 + $g02 + $g03 + $g04, 8); } /** - * + * * @param $attacken array of 10 arrays with entry (anzahl and a_name) * @return unknown_type */ function addAttackUsageToChar($char_id, $attacken){ $char = getChar($char_id, false); // We really want the actual char!! - + // Erstmal die Attacken vermerken! for($i=0;$i'; mysql_query($sql); } - + // Sooo und nun gehts darum ob wir neue Attacken lernen können - + // Ersma die ganzen Infos laden - $sql = 'SELECT * FROM lernen where besitzer = '.$char_id; + $sql = 'SELECT * FROM lernen where besitzer = '.$char_id; $qry = mysql_query($sql); while($row = mysql_fetch_assoc($qry)){ $lern[$row['at_id']] = $row; // Zum späteren Check ob die Reqs erfüllt sind @@ -76,24 +76,24 @@ function addAttackUsageToChar($char_id, $attacken){ $zusatz = ' AND id NOT IN('.join($atkid,',').')'; } - // Lernbare Attacken auswählen + // Lernbare Attacken auswählen if(!is_null($char['frucht'])){ $sql = 'select * from attacken where (Frucht is NULL or Frucht = (Select id from wochen_markt where item = \''.$char['frucht'].'\')) and (rassen != \'\' and rassen != \'0\') and level <= '.$char['level'].$zusatz; } else { $sql = 'select * from attacken where (Frucht is NULL) and (rassen != \'\' and rassen != \'0\') and level <= '.$char['level'].$zusatz; } - + // echo $sql.'
'; - + $qry = mysql_query($sql); - + // Das geht leider nicht mit dieser Datenstruktur direkt auszuwählen $raceid[] = getCharRaceId($char_id); if(!is_null(getFusionRaceId($char_id))){ $raceid[] = getFusionRaceId($char_id); } - - // So und nun arbeite jede Attacke durch die nur im geringsten Lernbar sein könnte ... + + // So und nun arbeite jede Attacke durch die nur im geringsten Lernbar sein könnte ... while($row = mysql_fetch_assoc($qry)) { // Erstmal checken ob es eine Fruchtattacke ist (durch die SQL-Anweisung werden alle nicht zutreffenden Früchte ausgeblockt) $learnable = false; @@ -114,7 +114,7 @@ function addAttackUsageToChar($char_id, $attacken){ } } } - + if($learnable){ // Haben wir die benötigten Attacken auch oft genug genutzt?? $r_atck = preg_split('#,#', $row['req_atk']); @@ -122,20 +122,21 @@ function addAttackUsageToChar($char_id, $attacken){ if($r_atck[$u] != '0' && $lern[$r_atck[$u]]['benutzt'] < $row['geld']){ // Passt nicht? dann brauchen wir garnich weiter machen // echo 'Der Char kann '.$row['name'].' nicht lernen, weil er die Attacke '.$lern[$r_atck[$u]]['name'].' nur '.$lern[$r_atck[$u]]['benutzt'].' mal eingesetzt hat und nicht '.$row['geld'].'
'; - $learnable = false; + $learnable = false; break; } } } - + if($learnable){ mysql_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\''); echo ''; } - } + } } function addExpToChar($char_id, $n_exp){ + // TODO: Optimize so only one update is required ;) $char = getChar($char_id, false); // We really want the actual char!! $char_exp = explode(',', $char['exp']); $char_exp[0] += $n_exp; @@ -146,7 +147,7 @@ function addExpToChar($char_id, $n_exp){ // Level UP!! $lvls++; $char['level']++; - + $char_exp[0] -= $char_exp[1]; $char_exp[1] = calculateRequiredExpChars($char['level']); $tp += calculateTrainingPoints($char['level']); @@ -180,7 +181,7 @@ function addExpToArena($user_id, $n_exp){ // Level UP!! $lvls++; $arena['level']++; - + $arena_exp[0] -= $arena_exp[1]; $arena_exp[1] = calculateRequiredExpArena($arena['level']); } diff --git a/cronjob/inclu/turnier.inc.php b/cronjob/inclu/turnier.inc.php new file mode 100644 index 0000000..3f9dd65 --- /dev/null +++ b/cronjob/inclu/turnier.inc.php @@ -0,0 +1,142 @@ + 0, 'money' => 0); + $charids[$fight['char1']] = 1; + } + $charArray[$fight['char1']]['exp'] += $fight['exp1']; + $charArray[$fight['char1']]['money'] += $fight['geld1']; + + if(!isset($charArray[$fight['char2']])) { + $charArray[$fight['char2']] = array('exp' => 0, 'money' => 0); + $charids[$fight['char2']] = 1; + } + $charArray[$fight['char2']]['exp'] += $fight['exp2']; + $charArray[$fight['char2']]['money'] += $fight['geld2']; + } + + $returnArray = array(); + + // Now calculate the money and exp the char gets just for proceeding in the tournament (in this case ... order the chars right away ;)) + $qry = mysql_query('Select count(win) as anzahl, win from turnier_kampf where art = \''.$name.'\' group by win order by count(win) desc'); + $maxRank = -1; + while ($participant = mysql_fetch_assoc($qry)) { + $charids[$participant['win']] = 0; // okay we already proceeded this one :) + // okay, first add experience the the $charArray !! + $charArray[$participant['win']]['exp'] += $additionalExpPerRound * $participant['anzahl']; + $charArray[$participant['win']]['money'] += $additionalMoneyPerRound * $participant['anzahl']; + if($maxRank == -1) { + $maxRank = $participant['anzahl']; + } + $returnArray[$maxRank - $participant['anzahl']][] = $participant['win']; + // add all the experience collected in this tournament at once ;) + addExpToChar($participant['win'], $charArray[$participant['win']]['exp']); + // the char is now already buffered, so no problem with that ;) + $char = getChar($participant['win']); + $sql = 'UPDATE user set geld = geld + ' . $charArray[$participant['win']]['money'] . ' WHERE id = ' . $char['besitzer']; + echo $sql . '
'; + mysql_query($sql); + } + + foreach ($charids as $key => $value) { + if($value === 1) { // we did not have processed this id when processing the winners -> it is a ultimate loser! + $returnArray[$maxRank][] = $key; + + addExpToChar($key, $charArray[$key]['exp']); + // the char is now already buffered, so no problem with that ;) + $char = getChar($key); + $sql = 'UPDATE user set geld = geld + ' . $charArray[$key]['money'] . ' WHERE id = ' . $char['besitzer']; + echo $sql . '
'; + mysql_query($sql); + + } + } + + echo 'The results!
'; + print_r($returnArray); + + return $returnArray; // return the array for further investigations like giving out a nature fruit ;), preventing from deletion etc. +} + +/** + * Generates the Rank of a char using the depth of the charid in the ranking array. E.g. 0 is for 1., 1 is for 2., 2 is for 3.-4., ... + * @param int $depth the depth + */ +function generateRanglistString($depth) { + if(!is_numeric($depth) || $depth < 0) { + return 'NaN.'; + } + if($depth <= 1) { + return ($depth + 1).'.'; // 1. and 2. + } else { + return (pow(2, $depth - 1) + 1) . '. - '.(pow(2, $depth)).'.'; + } +} + +function distributeShopPoints(array $prices, array $winners, $reason) { + $n = min(count($prices), count($winners)); + for($i = 0; $i<$n; $i++) { + $points = $prices[$i]; + foreach($winners[$i] as $winner) { +// echo $winner . '
'; + $char = getChar($winner); // buffered so will not cause in a sql statement all the time! + $userid = $char['besitzer']; + $sql = 'UPDATE user set pkt = pkt + '.$points.' WHERE id = '. $userid; + echo $sql . '
'; + mysql_query($sql); + insertUserTickerMessage($userid, $points .' IP durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); + } + } +} + + +function distributeClanPrices(array $prices, array $results, $reason) { + $n = min(count($prices), count($results)); + + for($i = 0; $i<$n; $i++) { + $points = $prices[$i]; + foreach($results[$i] as $winner) { + $char = getChar($winner); // buffered so will not cause in a sql statement all the time! + $userid = $char['besitzer']; + $data = mysql_fetch_assoc(mysql_query('Select clan from user where id = ' .$userid )); + if(is_numeric($data['clan'])) { + $sql = 'UPDATE clan SET geld = geld + ' . $points . ' WHERE id = ' . $data['clan']; + echo $sql . '
'; + mysql_query($sql); + insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.$points.' für den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); + } + } + } +} + + + +?> \ No newline at end of file diff --git a/cronjob/klein_Turnier2.php b/cronjob/klein_Turnier2.php index ab9da46..9663d3e 100644 --- a/cronjob/klein_Turnier2.php +++ b/cronjob/klein_Turnier2.php @@ -6,125 +6,31 @@ * */ include "db.php"; -include_once ('inclu/messagefunctions.inc.php'); include_once ('inclu/halloffame.inc.php'); -include_once ('inclu/exp.inc.php'); +include_once ('inclu/turnier.inc.php'); +include_once ('inclu/char.inc.php'); -$row2 = mysql_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld, -i1.id AS i1id, i2.id AS i2id FROM turnier_kampf u LEFT JOIN chars c1 ON(c1.id=u.char1) LEFT JOIN user i1 ON(i1.id=c1.besitzer) LEFT JOIN chars c2 ON(c2.id=u.char2) LEFT JOIN user i2 ON(i2.id=c2.besitzer) WHERE u.art='klein' ORDER BY u.round ASC"); +// do the stuff for the whole exp and money distribution there ;) +$results = generateTournamentResults($name, 10000, 15000); -$x=0; -while($row = mysql_fetch_array($row2)) { +$rang1 = getChar($results[0][0]); -$new_hp = explode(",",$row[hp1]); -$or_hp1 = explode(",",$row[c1hp]); -$new_hp2 = count($new_hp) - 1; +// Hall of fame! -$new_mp = explode(",",$row[mp1]); -$or_mp1 = explode(",",$row[c1mp]); -$new_mp2 = count($new_mp) - 1; - -$or_exp1 = explode(",",$row[c1exp]); -$new_exp = $or_exp1[0] + ($row[round] * 2000); -$add_exp1 = ($row[round] * 2000); - - -$new_lernpunkte1 = 0; -$new_lernpunkte2 = 0; - -$new_geld1 = $row[i1geld] + ($row[round] * 2000); -$new_geld2 = $row[i2geld] + ($row[round] * 2000); - -$trainings_points1 = $row[round] * 1; -$trainings_points2 = $row[round] * 1; - - -if($row[round] == 5 AND $row[win] == $row[c1id]) { -$new_exp += 10000; -$add_exp1 += 10000; -$new_geld1 += 15000; -$trainings_points1 += 5; - -} - -$new_hp_2 = explode(",",$row[hp2]); -$or_hp1_2 = explode(",",$row[c2hp]); -$new_hp2_2 = count($new_hp_2) - 1; - -$new_mp_2 = explode(",",$row[mp2]); -$or_mp1_2 = explode(",",$row[c2mp]); -$new_mp2_2 = count($new_mp_2) - 1; - -$or_exp1_2 = explode(",",$row[c2exp]); -$new_exp_2 = $or_exp1_2[0] + ($row[round] * 2000); -$add_exp2 = ($row[round] * 2000); - - -if($row[round] == 5 AND $row[win] == $row[c2id]) { - -$new_exp_2 += 10000; -$add_exp2 += 10000; -$trainings_points2 += 5; -$new_geld2 += 15000; -} -$old_win = $row[win]; - -//mysql_query("UPDATE chars SET status='Frei', training_points=training_points+'$trainings_points1', hp='$new_hp[$new_hp2],$or_hp1[1]', mp='$new_mp[$new_mp2],$or_mp1[1]', exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'"); -//mysql_query("UPDATE chars SET status='Frei', training_points=training_points+'$trainings_points2', hp='$new_hp_2[$new_hp2_2],$or_hp1_2[1]', mp='$new_mp_2[$new_mp2_2],$or_mp1_2[1]', exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'"); -//mysql_query("UPDATE chars SET status='Frei', exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'"); -//mysql_query("UPDATE chars SET status='Frei', exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'"); - -addExpToChar($row['c1id'],$add_exp1); -addExpToChar($row['c2id'],$add_exp2); - -mysql_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1"); -mysql_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1"); - -} - -$win_user = mysql_Fetch_array(mysql_Query("SELECT name, besitzer FROM chars WHERE id='$old_win' LIMIT 1")); -$win_name = mysql_fetch_Array(mysql_query("SELECT nickname FROM user WHERE id='$win_user[besitzer]' LIMIT 1")); -$win_online = mysql_fetch_array(mysql_query("SELECT turnier_klein FROM online LIMIT 1")); -mysql_query("UPDATE online SET turnier_klein='$win_online[turnier_klein],$win_user[name],$win_name[nickname]' WHERE id='1'"); // insertIntoHallOfFame($title, $charid, $userid); -insertIntoHallOfFame('Anfängerturnier', $old_win, $win_user['besitzer']); +insertIntoHallOfFame('Anfängerturnier', $rang1['id'], $rang1['besitzer']); -if(getHallOfFame('Anfängerturnier', $win_user['besitzer']) >= 2) { +if(getHallOfFame('Anfängerturnier', $rang1['id']) >= 2) { // remove all chars that are registered - mysql_query('delete from turnier1 where art = \'klein\' and besitzer = '.$win_user['besitzer']); + mysql_query('DELETE FROM turnier1 WHERE art = \'klein\' AND besitzer = '.$rang1['besitzer']); } -$sql5 = 'Select count(win), win from turnier_kampf where art = \'klein\' group by win order by count(win) desc'; -$qry5 = mysql_query($sql5); - -$rang1 = mysql_fetch_assoc($qry5); -$rang2 = mysql_fetch_assoc($qry5); -$rang3 = mysql_fetch_assoc($qry5); -$rang4 = mysql_fetch_assoc($qry5); +// Now distribute the shop points ;) - -$sql = 'select u.clan, c.id, u.id as userid from chars c inner join user u on c.besitzer = u.id where c.id IN ('.$rang1['win'].','.$rang2['win'].','.$rang3['win'].','.$rang4['win'].')'; +$prices[] = 25; // 1. (max win) +$prices[] = 20; // 2. (max win - 1) +$prices[] = 15; // 3. + 4. (max win -2) -echo $sql.'
'; -$qry = mysql_query($sql); +distributeShopPoints($prices, $results, 'Anfängerturnier'); -while($row = mysql_fetch_assoc($qry)){ - switch($row['id']){ - case $rang1['win']: - mysql_query('UPDATE user set pkt = pkt + 25 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '25 IP von Anfänger Turnier Sieg erhalten!'); - break; - case $rang2['win']: - mysql_query('UPDATE user set pkt = pkt + 20 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '20 IP von Anfänger Turnier 2.Platz erhalten!'); - break; - case $rang3['win']: - case $rang4['win']: - mysql_query('UPDATE user set pkt = pkt + 15 WHERE id = '.$row['userid']); - insertUserTickerMessage($row['userid'], '15 IP von Anfänger Turnier 3. oder 4. Platz erhalten!'); - break; - default: - break; - } -} ?> \ No newline at end of file diff --git a/cronjob/klein_turnier.php b/cronjob/klein_turnier.php deleted file mode 100644 index 9331bab..0000000 --- a/cronjob/klein_turnier.php +++ /dev/null @@ -1,127 +0,0 @@ -=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"; - -$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE level<='25' and fusion='nein' AND char_type = '' LIMIT 32")); - -if($max_charakter<32) { -exit; -} -mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'"); - - - -$char1 = mysql_query("SELECT charakter FROM turnier1 WHERE art='$art_1'"); -while($row=mysql_fetch_array($char1)) -{ - $test2[]=$row['charakter']; -} - -do -{ - - if(count($test2)<32) - { // WHERE status='Frei' - list($count) = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM chars WHERE level<='25' and fusion='nein' AND char_type = '' ")); - - if(($count+count($test2))>=32) - { - $result = mysql_query("SELECT id FROM chars WHERE level<='25' AND char_type = '' and fusion='nein' ORDER BY RAND() LIMIT ".(32-count($test2))); - while($char_name2=mysql_fetch_array($result)) - { - $test2[]=$char_name2['id']; - } - } - } - $test2 = rand_array($test2); - $test2 = array_unique($test2); -} - - -while(count($test2)<32); - -$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 32"); -while($row=mysql_fetch_array($result)) -{ - - $charas[$row['id']]=$row; -} - -$a8=0; -$b8=1; - -$round = 1; -while($a8 < 32) -{ - $chara_1 = $charas[$test2[$a8]]; - $chara_2 = $charas[$test2[$b8]]; - include "turnier_kampf.php"; - $a8+=2; - $b8+=2; -} - - - -while($round < 5) -{ - 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'"); -?> \ No newline at end of file diff --git a/cronjob/turnier.php b/cronjob/turnier.php deleted file mode 100644 index de66901..0000000 --- a/cronjob/turnier.php +++ /dev/null @@ -1,124 +0,0 @@ -=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"; - -$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars LIMIT 64")); - -if($max_charakter<64) { -exit; -} -mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'"); - -$char1 = mysql_query("SELECT charakter FROM turnier1 WHERE art='$art_1'"); -while($row=mysql_fetch_array($char1)) -{ - $test2[]=$row['charakter']; -} - -do -{ - - if(count($test2)<64) - { // WHERE status='Frei' - list($count) = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM chars")); - - if(($count+count($test2))>=64) - { - $result = mysql_query("SELECT id FROM chars WHERE status='Frei' AND rasse !='NPC' ORDER BY RAND() LIMIT ".(64-count($test2))); - while($char_name2=mysql_fetch_array($result)) - { - $test2[]=$char_name2['id']; - } - } - } - $test2 = rand_array($test2); - $test2 = array_unique($test2); -} - - -while(count($test2)<64); - -$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 64"); -while($row=mysql_fetch_array($result)) -{ - - $charas[$row['id']]=$row; -} - -$a8=0; -$b8=1; - -$round = 1; -while($a8 < 64) -{ - $chara_1 = $charas[$test2[$a8]]; - $chara_2 = $charas[$test2[$b8]]; - include "turnier_kampf.php"; - $a8+=2; - $b8+=2; -} - - - -while($round < 6) -{ - 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' "); -?> diff --git a/cronjob/turnier_kampf.php b/cronjob/turnier_kampf.php index f3647d9..3d6151d 100644 --- a/cronjob/turnier_kampf.php +++ b/cronjob/turnier_kampf.php @@ -119,7 +119,7 @@ while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { $sql = "SELECT * FROM turnier_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"; - + if(($qry = mysql_query($sql)) === false){ echo $sql.' Failed!!
'; } @@ -157,13 +157,15 @@ while ($s < 2) { } if ($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { - $k_exp[1] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; + $k_exp[1] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])); +// $k_exp[1] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; - $k_geld[1] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) / 2) * 2; + $k_geld[1] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6); - $k_exp[0] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; + $k_exp[0] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * 2.2; +// $k_exp[0] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; - $k_geld[0] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) * 2; + $k_geld[0] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6) * 2; $sieger = $chara_1[id]; $verlierer = $chara_2[id]; @@ -175,13 +177,15 @@ while ($s < 2) { $sieger = $chara_2[id]; $verlierer = $chara_1[id]; - $k_exp[1] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; + $k_exp[1] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * 2.2; +// $k_exp[1] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; - $k_geld[1] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) * 2; + $k_geld[1] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6) * 2; - $k_exp[0] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; + $k_exp[0] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])); +// $k_exp[0] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; - $k_geld[0] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) / 2) * 2; + $k_geld[0] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6); }