From 20773426edf9a22ec67b518c5be9f8d06b571094 Mon Sep 17 00:00:00 2001 From: hecht Date: Wed, 20 Aug 2014 19:37:41 +0000 Subject: [PATCH] Ausschliessen der NPC in Liga und Wanted funktionierte nicht mehr. --- cronjob/Turnier2.php | 2 +- cronjob/klein_Turnier2.php | 4 ++-- cronjob/liga1.php | 13 ++++++++++--- cronjob/wanted.php | 12 ++++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/cronjob/Turnier2.php b/cronjob/Turnier2.php index 922e49c..aabadf5 100644 --- a/cronjob/Turnier2.php +++ b/cronjob/Turnier2.php @@ -14,7 +14,7 @@ include_once ('inclu/turnier.inc.php'); include_once ('inclu/char.inc.php'); // do the stuff for the whole exp and money distribution there ;) -$results = generateTournamentResults('wochen', 15000, 20000); +$results = generateTournamentResults('wochen', 15000, 0); $rang1 = getChar($results[0][0]); insertIntoHallOfFame('Wochenturnier', $rang1['id'], $rang1['besitzer']); diff --git a/cronjob/klein_Turnier2.php b/cronjob/klein_Turnier2.php index fd0da3e..893fa1b 100644 --- a/cronjob/klein_Turnier2.php +++ b/cronjob/klein_Turnier2.php @@ -13,7 +13,7 @@ include_once ('inclu/char.inc.php'); $name = 'klein'; // do the stuff for the whole exp and money distribution there ;) -$results = generateTournamentResults($name, 10000, 15000); +$results = generateTournamentResults($name, 10000, 0); $rang1 = getChar($results[0][0]); @@ -39,4 +39,4 @@ $prices[] = 15; // 3. + 4. (max win -2) distributeShopPoints($prices, $results, 'Anfängerturnier'); -?> \ No newline at end of file +?> diff --git a/cronjob/liga1.php b/cronjob/liga1.php index 0178796..0757b80 100644 --- a/cronjob/liga1.php +++ b/cronjob/liga1.php @@ -29,13 +29,20 @@ function rand_array($array) } include "db.php"; -$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE rasse!='NPC' LIMIT 250")); + +$npc_race = getRaceTypeName('NPC'); // do not remove npc (there is a separate setting for this) +$races = getRacesByType($npc_race); // remove all NPC +foreach($races as $race) { + $exclude_race_ids[] = '\''.$race['id'].'\''; +} + +$max_charakter = mysql_num_rows(mysql_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 250')); if($max_charakter<250) { exit; } -$charakter = mysql_query("SELECT name, id FROM chars WHERE rasse!='NPC' ORDER BY level DESC LIMIT $max_charakter"); +$charakter = mysql_query('SELECT name, id FROM chars WHERE rasse NOT IN '.implode(',', $exclude_race_ids).' ORDER BY level DESC LIMIT '.$max_charakter); @@ -82,4 +89,4 @@ while($a8 < $max_charakter) -?> \ No newline at end of file +?> diff --git a/cronjob/wanted.php b/cronjob/wanted.php index 7f28104..aaa7e5a 100644 --- a/cronjob/wanted.php +++ b/cronjob/wanted.php @@ -30,13 +30,21 @@ function rand_array($array) } include "db.php"; -$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE rasse!='NPC' LIMIT 500")); + +$npc_race = getRaceTypeName('NPC'); // do not remove npc (there is a separate setting for this) +$races = getRacesByType($npc_race); // remove all NPC +foreach($races as $race) { + $exclude_race_ids[] = '\''.$race['id'].'\''; +} + +$max_charakter = mysql_num_rows(mysql_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 500')); if($max_charakter<500) { exit; } -$charakter = mysql_query("SELECT name, id FROM chars WHERE rasse!='NPC' ORDER BY level DESC LIMIT $max_charakter"); +$charakter = mysql_query('SELECT name, id FROM chars WHERE rasse NOT IN '.implode(',', $exclude_race_ids).' ORDER BY level DESC LIMIT '.$max_charakter); + while($row=mysql_fetch_array($charakter))