added fixes of live cronjobs

main
hecht 7 years ago
parent 1049e7b620
commit 2e96486cc1

@ -18,17 +18,15 @@ function getClanRanking() {
function distributeClanPrices(array $prices, array $results) { function distributeClanPrices(array $prices, array $results) {
$n = min(count($prices), count($results)); $n = min(count($prices), count($results));
echo "Resultate"; echo "Resultate: ";
print_r($results); print_r($results);
for($i = 0; $i<$n; $i++) { for($i = 0; $i<$n; $i++) {
$points = $prices[$i]; $points = $prices[$i];
foreach($results[$i] as $winner) { $winner = $results[$i][0]; // second index is the elo value!
$clan = getClan($winner); // buffered so will not cause in a sql statement all the time! $clan = getClan($winner); // buffered so will not cause in a sql statement all the time!
$sql = 'UPDATE clan SET elo = 1000, geld = geld + ' . $points . ' WHERE id = ' . $clan['id']; $sql = 'UPDATE clan SET elo = 1000, geld = geld + ' . $points . ' WHERE id = ' . $clan['id'];
echo $sql . ' <br>'; db_query($sql);
db_query($sql); insertClanTickerMessage($clan['id'], 'Das Preisgeld von '.$points.' f&uuml;r den '.$i.' Platz in der Clanliga erhalten!');
insertClanTickerMessage($clan['id'], 'Das Preisgeld von '.$points.' f&uuml;r den '.$i.' Platz in der Clanliga erhalten!');
}
} }
db_query('UPDATE clan SET elo = 1000'); db_query('UPDATE clan SET elo = 1000');
} }

@ -25,7 +25,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$charids = array(); $charids = array();
// First calculate the money and exp the char gets just for doing good at fights ;) // First calculate the money and exp the char gets just for doing good at fights ;)
$qry = db_query('select char1, char2, exp1, exp2, geld1, geld2, round from turnier_kampf where art = \''.$name.'\' order by round asc'); $qry = silent_query('select char1, char2, exp1, exp2, geld1, geld2, round from turnier_kampf where art = \''.$name.'\' order by round asc');
while($fight = mysqli_fetch_assoc($qry)) { while($fight = mysqli_fetch_assoc($qry)) {
if(!isset($charArray[$fight['char1']])) { if(!isset($charArray[$fight['char1']])) {
@ -46,7 +46,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$returnArray = array(); $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 ;)) // Now calculate the money and exp the char gets just for proceeding in the tournament (in this case ... order the chars right away ;))
$qry = db_query('Select count(win) as anzahl, win from turnier_kampf where art = \''.$name.'\' group by win order by count(win) desc'); $qry = silent_query('Select count(win) as anzahl, win from turnier_kampf where art = \''.$name.'\' group by win order by count(win) desc');
$maxRank = -1; $maxRank = -1;
while ($participant = mysqli_fetch_assoc($qry)) { while ($participant = mysqli_fetch_assoc($qry)) {
$charids[$participant['win']] = 0; // okay we already proceeded this one :) $charids[$participant['win']] = 0; // okay we already proceeded this one :)
@ -63,7 +63,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($participant['win']); $char = getChar($participant['win']);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$participant['win']]['money'] . ' WHERE id = ' . $char['besitzer']; $sql = 'UPDATE user set geld = geld + ' . $charArray[$participant['win']]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . ' <br>'; echo $sql . ' <br>';
db_query($sql); silent_query($sql);
} }
foreach ($charids as $key => $value) { foreach ($charids as $key => $value) {
@ -75,7 +75,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($key); $char = getChar($key);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$key]['money'] . ' WHERE id = ' . $char['besitzer']; $sql = 'UPDATE user set geld = geld + ' . $charArray[$key]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . ' <br>'; echo $sql . ' <br>';
db_query($sql); silent_query($sql);
} }
} }
@ -111,7 +111,7 @@ function distributeShopPoints(array $prices, array $winners, $reason) {
$userid = $char['besitzer']; $userid = $char['besitzer'];
$sql = 'UPDATE user set pkt = pkt + '.$points.' WHERE id = '. $userid; $sql = 'UPDATE user set pkt = pkt + '.$points.' WHERE id = '. $userid;
echo $sql . ' <br>'; echo $sql . ' <br>';
db_query($sql); silent_query($sql);
insertUserTickerMessage($userid, $points .' IP durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); insertUserTickerMessage($userid, $points .' IP durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
} }
} }
@ -127,7 +127,7 @@ function distributeUserPrices(array $prices, array $winners, $reason) {
$userid = $char['besitzer']; $userid = $char['besitzer'];
$sql = 'UPDATE user set geld = geld + '.$points.' WHERE id = '. $userid; $sql = 'UPDATE user set geld = geld + '.$points.' WHERE id = '. $userid;
echo $sql . ' <br>'; echo $sql . ' <br>';
db_query($sql); silent_query($sql);
insertUserTickerMessage($userid, $points .' Preisgeld durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); insertUserTickerMessage($userid, $points .' Preisgeld durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
} }
} }
@ -142,11 +142,11 @@ function distributeClanPrices(array $prices, array $results, $reason) {
foreach($results[$i] as $winner) { foreach($results[$i] as $winner) {
$char = getChar($winner); // buffered so will not cause in a sql statement all the time! $char = getChar($winner); // buffered so will not cause in a sql statement all the time!
$userid = $char['besitzer']; $userid = $char['besitzer'];
$data = mysqli_fetch_assoc(db_query('Select clan from user where id = ' .$userid )); $data = mysqli_fetch_assoc(silent_query('Select clan from user where id = ' .$userid ));
if(is_numeric($data['clan'])) { if(is_numeric($data['clan'])) {
$sql = 'UPDATE clan SET geld = geld + ' . $points . ' WHERE id = ' . $data['clan']; $sql = 'UPDATE clan SET geld = geld + ' . $points . ' WHERE id = ' . $data['clan'];
echo $sql . ' <br>'; echo $sql . ' <br>';
db_query($sql); silent_query($sql);
insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.$points.' f&uuml;r den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.$points.' f&uuml;r den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
} }
} }

@ -237,15 +237,17 @@ if (mysqli_num_rows($u_qry) != 0) {
while ($row = mysqli_fetch_assoc($c_qry)) { while ($row = mysqli_fetch_assoc($c_qry)) {
$char[] = $char['id']; $char[] = $char['id'];
} }
$chars = join(',', $char); if ( count($char) > 0 ) {
db_query('Delete from chars where id IN (' . $chars . ')'); $chars = join(',', $char);
db_query('Delete from lernen where besitzer IN (' . $chars . ')'); db_query('Delete from chars where id IN (' . $chars . ')');
db_query('Delete from quests where charid IN (' . $chars . ')'); db_query('Delete from lernen where besitzer IN (' . $chars . ')');
db_query('Delete from quests_fights where charid IN (' . $chars . ')'); db_query('Delete from quests where charid IN (' . $chars . ')');
db_query('Delete from quests_rounds where charid IN (' . $chars . ')'); db_query('Delete from quests_fights where charid IN (' . $chars . ')');
db_query('Delete from kampf where dbsatz IN (' . $chars . ')'); db_query('Delete from quests_rounds where charid IN (' . $chars . ')');
db_query('Delete from kampf_list where charakter IN (' . $chars . ')'); db_query('Delete from kampf where dbsatz IN (' . $chars . ')');
db_query('Delete from char_abholcodes where charid IN (' . $chars . ')'); db_query('Delete from kampf_list where charakter IN (' . $chars . ')');
db_query('Delete from char_abholcodes where charid IN (' . $chars . ')');
}
} }

@ -130,7 +130,7 @@ function bearbeiteAbgelaufeneAuktion($auktionsid){
if($anzahl > 1000 && $anzahl % 1000 == 0) { if($anzahl > 1000 && $anzahl % 1000 == 0) {
echo date("H:i:s").' Anzahl maxi Auktion '.$anzahl."\n"; echo date("H:i:s").' Anzahl maxi Auktion '.$anzahl."\n";
} }
database_query('INSERT INTO '.$result['tablename'].' ('.$item_row_name.', user) VALUES('.$result['itemid'].','.$itemreceiver.')'); silent_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);
@ -230,7 +230,7 @@ function detectMultiAccounts(){
while($tmp = mysqli_fetch_assoc($qry)){ while($tmp = mysqli_fetch_assoc($qry)){
$otime = min($tmp['o2'], $tmp['o1']); $otime = min($tmp['o2'], $tmp['o1']);
$sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $tmp['uid1'] . '\', \''.$tmp['uid2'].'\',\''.$otime.'\', \'IP_'.$tmp['ip1'].'\')'; $sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $tmp['uid1'] . '\', \''.$tmp['uid2'].'\',\''.$otime.'\', \'IP_'.$tmp['ip1'].'\')';
db_query($sql); silent_query($sql);
} }
} }

Loading…
Cancel
Save