From 0f967c1c68400ce87863b7029113a00aa4b3d0fe Mon Sep 17 00:00:00 2001 From: hecht Date: Tue, 1 Sep 2015 22:03:33 +0000 Subject: [PATCH] adjusted mt_rand to mt_rand_wrapper --- cronjob/Turnier2.php | 3 +- cronjob/array.php | 5 ++- cronjob/delete.php | 59 +++++++++++++------------ cronjob/inclu/fruitdistribution.inc.php | 4 +- cronjob/inclu/messagefunctions.inc.php | 6 ++- cronjob/kampf/atk_wert.php | 10 +++-- cronjob/kampf/kampf_rechnung.php | 15 ++++--- cronjob/kampf/lose2.php | 6 ++- cronjob/kampf/tausch.php | 10 +++-- cronjob/kampf/tausch2.php | 7 ++- cronjob/liga1.php | 3 +- cronjob/liga_kampf.php | 21 +++++---- cronjob/pruf_turnier.php | 2 +- cronjob/turnier_kampf.php | 7 ++- cronjob/viertelstunde.php | 9 ++-- cronjob/wanted.php | 3 +- cronjob/wanted_kampf.php | 21 +++++---- 17 files changed, 113 insertions(+), 78 deletions(-) diff --git a/cronjob/Turnier2.php b/cronjob/Turnier2.php index aabadf5..e6a721c 100644 --- a/cronjob/Turnier2.php +++ b/cronjob/Turnier2.php @@ -12,6 +12,7 @@ include_once ('inclu/exp.inc.php'); include_once ('inclu/turnier.inc.php'); include_once ('inclu/char.inc.php'); +include_once(ROOT_PATH. "/include/random.inc.php"); // do the stuff for the whole exp and money distribution there ;) $results = generateTournamentResults('wochen', 15000, 0); @@ -21,7 +22,7 @@ insertIntoHallOfFame('Wochenturnier', $rang1['id'], $rang1['besitzer']); $xiu=5; -if($xiu >= mt_rand(1, 100)) { +if($xiu >= mt_random_wrapper(1, 100)) { ////////////////FRUCHT ARRAY //include "array.php"; distributeFruit($rang1['besitzer']); diff --git a/cronjob/array.php b/cronjob/array.php index 412c71a..41bfeb1 100644 --- a/cronjob/array.php +++ b/cronjob/array.php @@ -5,7 +5,10 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ -$frucht_rate = mt_rand(1,$natur_frucht); + +include_once(ROOT_PATH. "/include/random.inc.php"); + +$frucht_rate = mt_random_wrapper(1,$natur_frucht); if($frucht_rate == 1) { $frucht_name = 15; } /////////15=ID fuer Sand Frucht if($frucht_rate == 2) { $frucht_name = 8; } /////////8 = ID FueR Feuer Frucht diff --git a/cronjob/delete.php b/cronjob/delete.php index cef49c9..df9ec16 100644 --- a/cronjob/delete.php +++ b/cronjob/delete.php @@ -6,6 +6,9 @@ * */ include "db.php"; +include('path.inc.php'); + +include_once(ROOT_PATH. "/include/random.inc.php"); $mak_time = time(); $z_time = time() - 86400; @@ -95,14 +98,14 @@ $row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteid $new_hp = explode(",", $row[hp]); $new_mp = explode(",", $row[mp]); -$beste_mp = (($new_mp[1] / 100) * mt_rand(75, 130)) + 1000; -$beste_hp = (($new_hp[1] / 100) * mt_rand(80, 150)) + 3000; +$beste_mp = (($new_mp[1] / 100) * mt_random_wrapper(75, 130)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_random_wrapper(80, 150)) + 3000; -$beste_starke = ($row[starke] / 100) * mt_rand(75, 130); -$beste_speed = ($row[speed] / 100) * mt_rand(75, 110); -$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(75, 110); -$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(75, 130); -$beste_glueck = ($row[glueck] / 100) * mt_rand(75, 130); +$beste_starke = ($row[starke] / 100) * mt_random_wrapper(75, 130); +$beste_speed = ($row[speed] / 100) * mt_random_wrapper(75, 110); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(75, 110); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(75, 130); +$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(75, 130); mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$brolly' LIMIT 1"); @@ -113,14 +116,14 @@ $row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteid $new_hp = explode(",", $row[hp]); $new_mp = explode(",", $row[mp]); -$beste_mp = (($new_mp[1] / 100) * mt_rand(100, 150)) + 1000; -$beste_hp = (($new_hp[1] / 100) * mt_rand(120, 220)) + 3000; +$beste_mp = (($new_mp[1] / 100) * mt_random_wrapper(100, 150)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_random_wrapper(120, 220)) + 3000; -$beste_starke = ($row[starke] / 100) * mt_rand(60, 110); -$beste_speed = ($row[speed] / 100) * mt_rand(60, 100); -$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(100, 150); -$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(100, 200); -$beste_glueck = ($row[glueck] / 100) * mt_rand(80, 100); +$beste_starke = ($row[starke] / 100) * mt_random_wrapper(60, 110); +$beste_speed = ($row[speed] / 100) * mt_random_wrapper(60, 100); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(100, 150); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(100, 200); +$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(80, 100); mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$bebi' LIMIT 1"); @@ -131,14 +134,14 @@ $row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, $new_hp = explode(",", $row[hp]); $new_mp = explode(",", $row[mp]); -$beste_mp = (($new_mp[1] / 100) * mt_rand(150, 200)) + 1000; -$beste_hp = (($new_hp[1] / 100) * mt_rand(100, 200)) + 3000; +$beste_mp = (($new_mp[1] / 100) * mt_random_wrapper(150, 200)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_random_wrapper(100, 200)) + 3000; -$beste_starke = ($row[starke] / 100) * mt_rand(75, 120); -$beste_speed = ($row[speed] / 100) * mt_rand(75, 120); -$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(80, 100); -$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(60, 120); -$beste_glueck = ($row[glueck] / 100) * mt_rand(60, 200); +$beste_starke = ($row[starke] / 100) * mt_random_wrapper(75, 120); +$beste_speed = ($row[speed] / 100) * mt_random_wrapper(75, 120); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(80, 100); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(60, 120); +$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(60, 200); mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$flamingo' LIMIT 1"); @@ -148,14 +151,14 @@ $row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, $new_hp = explode(",", $row[hp]); $new_mp = explode(",", $row[mp]); -$beste_mp = (($new_mp[1] / 100) * mt_rand(80, 110)) + 1000; -$beste_hp = (($new_hp[1] / 100) * mt_rand(80, 250)) + 3000; +$beste_mp = (($new_mp[1] / 100) * mt_random_wrapper(80, 110)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_random_wrapper(80, 250)) + 3000; -$beste_starke = ($row[starke] / 100) * mt_rand(80, 120); -$beste_speed = ($row[speed] / 100) * mt_rand(80, 130); -$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(80, 120); -$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(80, 150); -$beste_glueck = ($row[glueck] / 100) * mt_rand(90, 100); +$beste_starke = ($row[starke] / 100) * mt_random_wrapper(80, 120); +$beste_speed = ($row[speed] / 100) * mt_random_wrapper(80, 130); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(80, 120); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(80, 150); +$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(90, 100); mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$mihawk' LIMIT 1"); ?> diff --git a/cronjob/inclu/fruitdistribution.inc.php b/cronjob/inclu/fruitdistribution.inc.php index 44dd29b..fc7ab3a 100644 --- a/cronjob/inclu/fruitdistribution.inc.php +++ b/cronjob/inclu/fruitdistribution.inc.php @@ -6,6 +6,8 @@ * */ +include_once(ROOT_PATH. "/include/random.inc.php"); + function distributeFruit($user_id) { $sql = 'SELECT id FROM wochen_markt WHERE art=\'natur\''; $qry = mysql_query($sql); @@ -14,7 +16,7 @@ function distributeFruit($user_id) { $fruits[] = $fruit; } - $choice = mt_rand(0,$amount-1); + $choice = mt_random_wrapper(0,$amount-1); $sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id; echo $sql . '
'; mysql_query($sql); diff --git a/cronjob/inclu/messagefunctions.inc.php b/cronjob/inclu/messagefunctions.inc.php index 0e8cb54..ae0d0c5 100644 --- a/cronjob/inclu/messagefunctions.inc.php +++ b/cronjob/inclu/messagefunctions.inc.php @@ -7,6 +7,8 @@ * */ +include_once(ROOT_PATH. "/include/random.inc.php"); + // + offset in Minuten function insertUserTickerMessage($userid, $message, $offset = 0){ if($offset == 0){ @@ -14,7 +16,7 @@ function insertUserTickerMessage($userid, $message, $offset = 0){ } else{ $timestamp = '\''.date('Y-m-d H:i:s', time() + $offset * 60).'\''; } - for($msgid = 0; $msgid < 100000; $msgid += mt_rand(1,1000)){ + for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ $sql = 'INSERT INTO user_ticker(userid, date, msgid, text) values('.$userid.', '.$timestamp.', '.$msgid.', \''.$message.'\')'; mysql_query($sql); if(mysql_affected_rows() == 1){ @@ -31,7 +33,7 @@ function insertClanTickerMessage($clanid, $message, $offset = 0){ } else{ $timestamp = '\''.date('Y-m-d H:i:s', time() + $offset * 60).'\''; } - for($msgid = 0; $msgid < 100000; $msgid += mt_rand(1,1000)){ + for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ $sql = 'INSERT INTO clan_ticker(clanid, date, msgid, text) values('.$clanid.', now(), '.$msgid.', \''.$message.'\')'; mysql_query($sql); if(mysql_affected_rows() == 1){ diff --git a/cronjob/kampf/atk_wert.php b/cronjob/kampf/atk_wert.php index f9acec1..f83e9bc 100644 --- a/cronjob/kampf/atk_wert.php +++ b/cronjob/kampf/atk_wert.php @@ -6,6 +6,8 @@ * */ +include_once(ROOT_PATH. "/include/random.inc.php"); + #####################################KAMPF SYSTEM // $zufall_pl1 = Attacke p1 @@ -17,11 +19,11 @@ // A1 (Attacke Spieler1) = 0.7 * S1 / SA + 0.3 * L1 / LA // P2 (Parade Spieler2) = 0.6 * S2 / SA + 0.4 * L2 / LA -$lucka1 = mt_rand(0,$k_glueck[0]); -$luckp1 = mt_rand(0,$k_glueck[0]); +$lucka1 = mt_random_wrapper(0,$k_glueck[0]); +$luckp1 = mt_random_wrapper(0,$k_glueck[0]); -$lucka2 = mt_rand(0,$k_glueck[1]); -$luckp2 = mt_rand(0,$k_glueck[1]); +$lucka2 = mt_random_wrapper(0,$k_glueck[1]); +$luckp2 = mt_random_wrapper(0,$k_glueck[1]); $speedsum = $speed_char1 + $speed_char2; $lucksum1 = $lucka1 + $luckp2; diff --git a/cronjob/kampf/kampf_rechnung.php b/cronjob/kampf/kampf_rechnung.php index aa13e35..e31fe02 100644 --- a/cronjob/kampf/kampf_rechnung.php +++ b/cronjob/kampf/kampf_rechnung.php @@ -5,6 +5,9 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ + +include_once(ROOT_PATH. "/include/random.inc.php"); + if(!$aktion_AV1[$x]) { if($zufall_pl1 > $play2_ausweich) { @@ -16,7 +19,7 @@ $charsa1_4_def = ($k_ver[1]+$technick2[verteidigung]) / 1.1; if($charsa1_def <= 2) { $charsa1_def = 2; } if($charsa1_4_def < 1) { $charsa1_4_def = 1; } -$charsa1_def = mt_rand($charsa1_4_def,$charsa1_def); +$charsa1_def = mt_random_wrapper($charsa1_4_def,$charsa1_def); $charsa1_str = $k_starke[0]*1.2+$technick1[starke]; $charsa1_4_str = ($k_starke[0]*1.2+$technick1[starke])+1; @@ -25,9 +28,9 @@ if($charsa1_str <= 2) { $charsa1_str = 2; } if($charsa1_4_str < 1) { $charsa1_4_str = 1; } -$charsa1_str = mt_rand($charsa1_4_str,$charsa1_str); +$charsa1_str = mt_random_wrapper($charsa1_4_str,$charsa1_str); -$k_hp[1] = round(($k_hp[1] + $charsa1_def - $charsa1_str + mt_rand(1,20))); +$k_hp[1] = round(($k_hp[1] + $charsa1_def - $charsa1_str + mt_random_wrapper(1,20))); $schaden_1 = $alt_hp - $k_hp[1]; if($alt_hp < $k_hp[1]) { $k_hp[1] = $alt_hp; $schaden_1 = 0; } } else { @@ -46,16 +49,16 @@ $charsa2_4_def = ($k_ver[0]+$technick1[verteidigung]) / 1.1; if($charsa2_def <= 2) { $charsa2_def = 2; } if($charsa2_4_def < 1) { $charsa2_4_def = 1; } -$charsa2_def = mt_rand($charsa2_4_def,$charsa2_def); +$charsa2_def = mt_random_wrapper($charsa2_4_def,$charsa2_def); $charsa2_str = $k_starke[1]*1.2+$technick2[starke]; $charsa2_4_str = ($k_starke[1] *1.2 +$technick2[starke]) +1; if($charsa1_str <= 2) { $charsa1_str = 2; } if($charsa2_4_str < 1) { $charsa2_4_str = 1; } -$charsa2_str = mt_rand($charsa2_4_str,$charsa2_str); +$charsa2_str = mt_random_wrapper($charsa2_4_str,$charsa2_str); -$k_hp[0] = round(($k_hp[0] + $charsa2_def - $charsa2_str + mt_rand(1,20))); +$k_hp[0] = round(($k_hp[0] + $charsa2_def - $charsa2_str + mt_random_wrapper(1,20))); $schaden_2 = $alt_hp - $k_hp[0]; if($alt_hp < $k_hp[0]) { $k_hp[0] = $alt_hp; $schaden_2 = 0; } } else { diff --git a/cronjob/kampf/lose2.php b/cronjob/kampf/lose2.php index d315939..56722b0 100644 --- a/cronjob/kampf/lose2.php +++ b/cronjob/kampf/lose2.php @@ -6,6 +6,8 @@ * */ +include_once(ROOT_PATH. "/include/random.inc.php"); + ####################KAIOKEN-LOSE SPIELER 1 if($technick1['type'] == 'lose2') { @@ -14,7 +16,7 @@ if($technick1['type'] == 'lose2') { $schaden_1 = 'Schwächen fehlgeschlagen'; $k_mp[0] = 0; } else { - if($technick1['starke'] >= mt_rand(1,100)) { + if($technick1['starke'] >= mt_random_wrapper(1,100)) { $schaden_1 = 'Schwächen'; $k_mp[1] -= $k_mp2[1] * ($technick1['speed'] / 100); if($k_mp[1] < 0) { @@ -35,7 +37,7 @@ if($technick2['type'] == 'lose2') { $k_mp[1] = 0; } else { - if($technick2['starke'] >= mt_rand(1,100)) { + if($technick2['starke'] >= mt_random_wrapper(1,100)) { $schaden_2 = 'Schwächen'; $k_mp[0] -= $k_mp1[1] * ($technick2['speed'] / 100); if($k_mp[0] < 0) { diff --git a/cronjob/kampf/tausch.php b/cronjob/kampf/tausch.php index 2214c91..1d0699f 100644 --- a/cronjob/kampf/tausch.php +++ b/cronjob/kampf/tausch.php @@ -6,12 +6,14 @@ * */ +include_once(ROOT_PATH. "/include/random.inc.php"); + if (!function_exists('getKTChance')) { function getKTChance($ktuser_luck, $ktvictim_luck) { $chance = 50; - $ktvictim_luck= mt_rand(0, $ktvictim_luck); - $ktuser_luck = mt_rand(0, $ktuser_luck); + $ktvictim_luck= mt_random_wrapper(0, $ktvictim_luck); + $ktuser_luck = mt_random_wrapper(0, $ktuser_luck); if($ktvictim_luck < ($ktuser_luck*0.25)) { $chance = 75; } @@ -25,7 +27,7 @@ if (!function_exists('getKTChance')) { ################### Spieler 1 $chance = getKTChance($k_glueck[0], $k_glueck[1]); -$random = mt_rand(0,100); +$random = mt_random_wrapper(0,100); if ($technick1['type'] == tausch) { if ($k_mp[0] >= $technick1['mp']) { @@ -74,7 +76,7 @@ if ($technick1['type'] == tausch) { ################### Spieler 2 $chance = getKTChance($k_glueck[1], $k_glueck[0]); -$random = mt_rand(0,100); +$random = mt_random_wrapper(0,100); if ($technick2['type'] == tausch) { if ($k_mp[1] >= $technick2['mp']) { diff --git a/cronjob/kampf/tausch2.php b/cronjob/kampf/tausch2.php index 837a8aa..751d899 100644 --- a/cronjob/kampf/tausch2.php +++ b/cronjob/kampf/tausch2.php @@ -5,6 +5,9 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ + +include_once(ROOT_PATH. "/include/random.inc.php"); + ################### Spieler 1 if($technick1[type] == "tausch2") { @@ -21,7 +24,7 @@ $technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik $speeds_char1 = ($k_speed[0] + $technick1[speed]); $speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } -$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); +$speed_char1 = mt_random_wrapper($speeds_char1_4,$speeds_char1); } else { @@ -47,7 +50,7 @@ $technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik $speeds_char2 = ($k_speed[1] + $technick2[speed]); $speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } -$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); +$speed_char2 = mt_random_wrapper($speeds_char2_4,$speeds_char2); } else { diff --git a/cronjob/liga1.php b/cronjob/liga1.php index d2f2088..18be574 100644 --- a/cronjob/liga1.php +++ b/cronjob/liga1.php @@ -10,6 +10,7 @@ include('db.php'); include('path.inc.php'); include_once(ROOT_PATH.'/include/char.inc.php'); include_once(ROOT_PATH.'/include/sqlwrapper.inc.php'); +include_once(ROOT_PATH. "/include/random.inc.php"); set_time_limit(0); function rand_array($array) @@ -18,7 +19,7 @@ function rand_array($array) mt_srand((double)microtime()*1000000); for($i=$maxarray; $i>=0; $i--) { - if($i>0) $zufall=mt_rand(0,$i); + if($i>0) $zufall=mt_random_wrapper(0,$i); else $zufall=0; $temp=$array[$i]; $array[$i]=$array[$zufall]; diff --git a/cronjob/liga_kampf.php b/cronjob/liga_kampf.php index 3730916..496e8c0 100644 --- a/cronjob/liga_kampf.php +++ b/cronjob/liga_kampf.php @@ -5,13 +5,16 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ -$uzze=0; -while($uzze < 10) { -$aktion_AV1[$uzze] = ""; -$aktion_AV2[$uzze] = ""; -$uzze++; -} -$ssj_tech_1=""; + +include_once(ROOT_PATH. "/include/random.inc.php"); + +$uzze = 0; +while ( $uzze < 10 ) { + $aktion_AV1 [$uzze] = ""; + $aktion_AV2 [$uzze] = ""; + $uzze ++; +} +$ssj_tech_1 = ""; $ssj_tech_2=""; $play1_ausweich=""; @@ -118,8 +121,8 @@ $speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } -$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); -$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); +$speed_char1 = mt_random_wrapper($speeds_char1_4,$speeds_char1); +$speed_char2 = mt_random_wrapper($speeds_char2_4,$speeds_char2); ///////rechnung selber diff --git a/cronjob/pruf_turnier.php b/cronjob/pruf_turnier.php index 13c3747..5679f7a 100644 --- a/cronjob/pruf_turnier.php +++ b/cronjob/pruf_turnier.php @@ -15,7 +15,7 @@ function rand_array($array) mt_srand((double)microtime()*1000000); for($i=$maxarray; $i>=0; $i--) { - if($i>0) $zufall=mt_rand(0,$i); + if($i>0) $zufall=mt_random_wrapper(0,$i); else $zufall=0; $temp=$array[$i]; $array[$i]=$array[$zufall]; diff --git a/cronjob/turnier_kampf.php b/cronjob/turnier_kampf.php index c75c432..ac47f34 100644 --- a/cronjob/turnier_kampf.php +++ b/cronjob/turnier_kampf.php @@ -5,6 +5,9 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ + +include_once(ROOT_PATH. "/include/random.inc.php"); + $uzze = 0; while ($uzze < 10) { $aktion_AV1[$uzze] = ""; @@ -127,8 +130,8 @@ while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { $speeds_char2_4 = 1; } - $speed_char1 = mt_rand($speeds_char1_4, $speeds_char1); - $speed_char2 = mt_rand($speeds_char2_4, $speeds_char2); + $speed_char1 = mt_random_wrapper($speeds_char1_4, $speeds_char1); + $speed_char2 = mt_random_wrapper($speeds_char2_4, $speeds_char2); include "kampf_include.php"; ////Rechnung diff --git a/cronjob/viertelstunde.php b/cronjob/viertelstunde.php index 1497388..e88ead9 100644 --- a/cronjob/viertelstunde.php +++ b/cronjob/viertelstunde.php @@ -11,6 +11,7 @@ ignore_user_abort(true); include "db.php"; include_once("path.inc.php"); include_once(ROOT_PATH. "/include/defines.inc.php"); +include_once(ROOT_PATH. "/include/random.inc.php"); // Da es wichtig ist, dass die Querys korrekt abgehandelt werden wurde folgender Code eingefuehrt @@ -112,7 +113,7 @@ function insertAuktionen(){ // Definiert wie hoch die Chance ist eine Niete zu bekommen. 0.5 = 50% defineIfNotDefined('GEHEIM_CHANCE_NIETE', 0.5); - $anzahl_auktionen = mt_rand(GEHEIM_ANZAHL_AUKTIONEN_MIN,GEHEIM_ANZAHL_AUKTIONEN_MAX); // anzahl der auktionen die gleichzeitig starten (ein oder zwei) + $anzahl_auktionen = mt_random_wrapper(GEHEIM_ANZAHL_AUKTIONEN_MIN,GEHEIM_ANZAHL_AUKTIONEN_MAX); // anzahl der auktionen die gleichzeitig starten (ein oder zwei) $anzahl_auktions_items = GEHEIM_ANZAHL_AUKTIONS_ITEMS; $chance_niete = GEHEIM_CHANCE_NIETE * 100; $startgebot = GEHEIM_START_GEBOT; @@ -140,17 +141,17 @@ function insertAuktionen(){ for($i = 0; $i<$anzahl_auktionen; $i++) { // Termin festlegen // Start Sonntag->0,Montag->1,Dienstag->2, Mittwoch->3, Donnerstag->4 - $off = mt_rand(0,4); + $off = mt_random_wrapper(0,4); $start = 'TIMESTAMPADD(Day,'.$off.',\''.$date[date].' 20:00:00\')'; $deadline = 'TIMESTAMPADD(Day,'.($off+3).',\''.$date[date].' 20:00:00\')'; for($t = 0; $t<$anzahl_auktions_items; $t++) { - if(mt_rand(1,100) <= $chance_niete) { + if(mt_random_wrapper(1,100) <= $chance_niete) { $item_table = 'sp_ware'; $item_id = $nieten_id; } else { $item_table = 'wochen_ware'; - $item_id = $frucht[mt_rand(0,$fruchtcount-1)]; + $item_id = $frucht[mt_random_wrapper(0,$fruchtcount-1)]; } $test = 'INSERT INTO auktion (itemid, itemname, tablename, anbieter, anzahl, deadline, startgebot, startdate) VALUES('.$item_id.',\'Geheim!\',\''.$item_table.'\',1,1,'.$deadline.','.$startgebot.','.$start.')'; // echo $test."
\n"; diff --git a/cronjob/wanted.php b/cronjob/wanted.php index c08b4fc..2659614 100644 --- a/cronjob/wanted.php +++ b/cronjob/wanted.php @@ -9,6 +9,7 @@ include('db.php'); include('path.inc.php'); include_once(ROOT_PATH.'/include/char.inc.php'); +include_once(ROOT_PATH. "/include/random.inc.php"); set_time_limit(0); @@ -18,7 +19,7 @@ function rand_array($array) mt_srand((double)microtime()*1000000); for($i=$maxarray; $i>=0; $i--) { - if($i>0) $zufall=mt_rand(0,$i); + if($i>0) $zufall=mt_random_wrapper(0,$i); else $zufall=0; $temp=$array[$i]; $array[$i]=$array[$zufall]; diff --git a/cronjob/wanted_kampf.php b/cronjob/wanted_kampf.php index eb28ccb..539bf52 100644 --- a/cronjob/wanted_kampf.php +++ b/cronjob/wanted_kampf.php @@ -5,13 +5,16 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ -$uzze=0; -while($uzze < 10) { -$aktion_AV1[$uzze] = ""; -$aktion_AV2[$uzze] = ""; -$uzze++; -} -$ssj_tech_1=""; + +include_once(ROOT_PATH. "/include/random.inc.php"); + +$uzze = 0; +while ( $uzze < 10 ) { + $aktion_AV1 [$uzze] = ""; + $aktion_AV2 [$uzze] = ""; + $uzze ++; +} +$ssj_tech_1 = ""; $ssj_tech_2=""; $play1_ausweich=""; @@ -118,8 +121,8 @@ $speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } -$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); -$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); +$speed_char1 = mt_random_wrapper($speeds_char1_4,$speeds_char1); +$speed_char2 = mt_random_wrapper($speeds_char2_4,$speeds_char2); include "kampf_include.php"; ////Rechnung