diff --git a/cronjob/gross_Turnier2.php b/cronjob/gross_Turnier2.php index 654c645..f0fcb30 100644 --- a/cronjob/gross_Turnier2.php +++ b/cronjob/gross_Turnier2.php @@ -30,7 +30,10 @@ $row = mysql_fetch_assoc(mysql_query($sql2)); $dlevel = ceil($row['dlevel']); // do the stuff for the whole exp and money distribution there ;) -$results = generateTournamentResults('gross', 250000, 2000000); +//$results = generateTournamentResults('gross', 250000, 2000000); + +// Franky && Sinnes request no more money for rounds +$results = generateTournamentResults('gross', 250000, 0); $rang1 = getChar($results[0][0]); insertIntoHallOfFame('Weltturnier', $rang1['id'], $rang1['besitzer']); @@ -54,18 +57,18 @@ $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. +$prices[] = 4000000; // 1. +$prices[] = 3000000; // 2. +$prices[] = 2000000; // 3. + 4. $cprices[] = ceil($summe/2); $cprices[] = ceil($summe/4); $cprices[] = ceil($summe/8); -distributeShopPoints($prices, $results, 'Weltturnier'); +distributeUserPrices($prices, $results, 'Weltturnier'); + +#distributeShopPoints($prices, $results, 'Weltturnier'); // clan prices are not distributed anymore!! //distributeClanPrices($cprices, $results, 'Weltturnier'); -?> \ No newline at end of file +?> diff --git a/cronjob/inclu/turnier.inc.php b/cronjob/inclu/turnier.inc.php index 3f9dd65..5e0ef82 100644 --- a/cronjob/inclu/turnier.inc.php +++ b/cronjob/inclu/turnier.inc.php @@ -117,6 +117,22 @@ function distributeShopPoints(array $prices, array $winners, $reason) { } } +function distributeUserPrices(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 geld = geld + '.$points.' WHERE id = '. $userid; + echo $sql . '
'; + mysql_query($sql); + insertUserTickerMessage($userid, $points .' Preisgeld durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); + } + } +} + function distributeClanPrices(array $prices, array $results, $reason) { $n = min(count($prices), count($results)); @@ -139,4 +155,4 @@ function distributeClanPrices(array $prices, array $results, $reason) { -?> \ No newline at end of file +?> diff --git a/cronjob/kampf/SSJ.php b/cronjob/kampf/SSJ.php index 56fd738..531313d 100644 --- a/cronjob/kampf/SSJ.php +++ b/cronjob/kampf/SSJ.php @@ -1,52 +1,57 @@ - \ No newline at end of file diff --git a/cronjob/kampf_include.php b/cronjob/kampf_include.php index cc9d49a..79acf25 100644 --- a/cronjob/kampf_include.php +++ b/cronjob/kampf_include.php @@ -1,4 +1,7 @@ \ No newline at end of file +?> diff --git a/cronjob/turnier_kampf.php b/cronjob/turnier_kampf.php index 3d6151d..c3c1a39 100644 --- a/cronjob/turnier_kampf.php +++ b/cronjob/turnier_kampf.php @@ -160,12 +160,14 @@ while ($s < 2) { $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] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6); + //$k_geld[1] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6); $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] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6) * 2; + #$k_geld[0] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6) * 2; + $k_geld[0] = 0; + $k_geld[1] = 0; $sieger = $chara_1[id]; $verlierer = $chara_2[id]; @@ -180,13 +182,14 @@ while ($s < 2) { $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] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6) * 2; + //$k_geld[1] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6) * 2; + $k_geld[1] = 0; $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] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6); - + //$k_geld[0] = (getPowerLevelWithBuffs($chara_1['id']) + getPowerLevelWithBuffs($chara_2['id'])) * ($x / 6); + $k_geld[0] = 0; } if ($k_exp[0]) { @@ -200,4 +203,4 @@ while ($s < 2) { $dauer_Z = time(); mysql_query("UPDATE turnier_kampf SET art='$art_1', round='$round', exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); -?> \ No newline at end of file +?> diff --git a/cronjob/viertelstunde.php b/cronjob/viertelstunde.php index 23a74d4..13d734c 100644 --- a/cronjob/viertelstunde.php +++ b/cronjob/viertelstunde.php @@ -60,11 +60,18 @@ function bearbeiteAbgelaufeneAuktion($auktionsid){ $anzahl = $result['anzahl']; $item_row_name = 'item'; if($result['tablename'] == 'ware'){$item_row_name = 'item_id';} + + #database_query('DELETE FROM auktion WHERE auktionsid = '.$auktionsid); + while($anzahl-- > 0){ + + if($anzahl > 1000 && $anzahl % 1000 == 0) { + echo date("H:i:s").' Anzahl maxi Auktion '.$anzahl."\n"; + } database_query('INSERT INTO '.$result['tablename'].' ('.$item_row_name.', user) VALUES('.$result['itemid'].','.$itemreceiver.')'); } - database_query('DELETE FROM auktion WHERE auktionsid = '.$auktionsid); + database_query('DELETE FROM auktion WHERE auktionsid = '.$auktionsid); if($result['bieter'] == NULL){ database_query('INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$result['anbieter'].', \'Item nicht verkauft\', \' Tut mir leid, doch Sie sind das Item '.$result['itemname'].' mit dem Startgebot '.$result['startgebot'].' nicht losgeworden. Deadline war '.$result['deadline'].'\')'); @@ -155,11 +162,28 @@ function getAveragePrice($itemid, $tablename, $anzahl){ return round($row['average']*$anzahl); } -// Starten der Auktionsverteilung -$i = bearbeiteAlleAbgelaufenenAuktionen(); -//$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'GM-INFO\', 3735, \'Cronjob lief!\', \' Der Vierteilstunde-Cronjob wurde ausgefuehrt! Es wurden '.$i.' Anfragen bearbeitet!\')'; -//database_query($sql); -insertAuktionen(); -detectMultiAccounts(); - -?> \ No newline at end of file + + +// check if this cronjob is already busy!! +$array = array(); +exec('pgrep '.$argv[0], $array); + +$arrayCpy = array(); +foreach($array as $tmp) { + if($tmp != getmypid()) { + $arrayCpy[] = $tmp; + } +} + +if(count($arrayCpy)<=1) { + // Starten der Auktionsverteilung + $i = bearbeiteAlleAbgelaufenenAuktionen(); + //$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'GM-INFO\', 3735, \'Cronjob lief!\', \' Der Vierteilstunde-Cronjob wurde ausgefuehrt! Es wurden '.$i.' Anfragen bearbeitet!\')'; + //database_query($sql); + insertAuktionen(); + detectMultiAccounts(); +} + + + +?>