'.PHP_EOL; $challenge = getChallenge($id); $clan_ids = getParticipatingClanIDs($id); $clan1 = getClan($clan_ids[0]); $clan2 = getClan($clan_ids[1]); $c_clan_data1 = getParticipatingClanData($id, $clan_ids[0]); $c_clan_data2 = getParticipatingClanData($id, $clan_ids[1]); if($c_clan_data1['points'] > $c_clan_data2['points']) { $winner = $clan1['id']; } else { $winner = $clan2['id']; } $expClan1 = calculateClanExperience($clan1, $clan2, $winner); $expClan2 = calculateClanExperience($clan2, $clan1, $winner); $newEloClan1 = calculateElo($c_clan_data1['elo'], $c_clan_data2['elo'], $c_clan_data1['points'] - $c_clan_data2['points'], $challenge['anzahl_chars']); $newEloClan2 = calculateElo($c_clan_data2['elo'], $c_clan_data1['elo'], $c_clan_data2['points'] - $c_clan_data1['points'], $challenge['anzahl_chars']); $eloClan1 = ($newEloClan1 - $c_clan_data1['elo']); $eloClan2 = ($newEloClan2 - $c_clan_data2['elo']); if($_clan_data1['elo_change'] == null) { $sql = 'UPDATE clan_challenge_clans SET elo_change = ' .$eloClan1 . ', exp_change = ' . $expClan1 . ' WHERE clan_challenge_id = ' . $id . ' AND clan_id = ' . $clan1['id']; // echo $sql . '
'; db_query($sql); addClanExp($clan1['id'], $expClan1); $appendum = null; if($winner == $clan1['id']) { $appendum = ', siege = siege + 1'; } else { $appendum = ', niederlagen = niederlagen + 1'; } db_query('UPDATE clan SET elo = elo + ' .$eloClan1 . $appendum . ' WHERE id = ' . $clan1['id']); } if($_clan_data2['elo_change'] == null) { $sql = 'UPDATE clan_challenge_clans SET elo_change = ' .$eloClan2 . ', exp_change = ' . $expClan2 . ' WHERE clan_challenge_id = ' . $id . ' AND clan_id = ' . $clan2['id']; // echo $sql . '
'; db_query($sql); addClanExp($clan2['id'], $expClan2); $appendum = null; if($winner == $clan2['id']) { $appendum = ', siege = siege + 1'; } else { $appendum = ', niederlagen = niederlagen + 1'; } db_query('UPDATE clan SET elo = elo + ' .$eloClan2 . $appendum . ' WHERE id = ' . $clan2['id']); } } semaphoreDown($ressource); }