$row['clanname'], 'id' => $row['clan_id'], 'elo' => $row['elo_change'], 'xp' => $row['exp_change'], 'points' => $row['points']); } return $clans; } function validatePicture($picture) { if($picture[0] == 'd') { return '../'.$picture; } else { return $picture; } } function displayChar($char) { if(strtotime($char['starting']) < time()) { if(strtotime($char['visible']) < time()) { echo '
'; if($char['event_char_id'] != $char['winner']) { echo ''; echo ''; } else { echo ''; } echo '
'; } else { echo '
'; echo ''; echo '
'; } echo $char['char_name']; } else { echo '
'; echo ''; echo '
'; echo '???'; } } function displayHeader($top, $bottom, $challenge, $clans) { $border = 0; $challenge_id = $challenge['clan_challenge_id']; $event_id = $challenge['event_id']; $chars = getEventChars($challenge_id, $event_id); $number_chars = count($chars); $left = $clans[0]['id']; $right = $clans[1]['id']; echo ''; echo ''; echo ''; //erste spalte echo ''; //zweite spalte echo ''; //dritte spalte echo ''; echo ''; //obere Teil echo ''; //Darstellen der Bilder auf der linken Seite echo ''; //Darstellen der Bilder auf der rechten Seite echo ''; echo ''; //untere Teil echo ''; //Darstellen der Bilder auf der linken Seite echo ''; //Darstellen der Bilder auf der rechten Seite echo ''; echo ''; echo '
Clankampf
'.$clans[0]['name'].'VS.'.$clans[1]['name'].'
'; $width = 100 / $top; $max = 0; for ($i = 0; $max != $top && $i <= $number_chars; $i++) { if($chars[$i]['clan_id'] == $left) { echo ''; $max++; } } echo '
'; displayChar($chars[$i]); echo '
'; $max = 0; $i = 0; for ($i = 0; $max != $top && $i <= $number_chars; $i++) { if($chars[$i]['clan_id'] == $right) { echo ''; $max++; } } echo '
'; displayChar($chars[$i]); echo '
'; $showed = $top; $max = 0; $i = 0; $width = 100 / $bottom; for ($i = 0; $max != ($bottom+$showed) && $i <= $number_chars; $i++) { if($chars[$i]['clan_id'] == $left) { if($max >= $showed) { echo ''; } $max++; } } echo '
'; displayChar($chars[$i]); echo '
'; $max = 0; $i = 0; for ($i = 0; $max != ($bottom+$showed) && $i <= $number_chars; $i++) { if($chars[$i]['clan_id'] == $right) { if($max >= $showed) { echo ''; } $max++; } } echo '
'; displayChar($chars[$i]); echo '
'; } function getColor($row) { if($row % 2 == 0) { $color = '#018B8B'; //$color = '#FFFFFF'; } else { $color = '#029393'; //$color = '#FF00FF'; } return $color; } function displayBody($challenge, $clans, $user) { $event_id = $challenge['event_id']; $fight_ids = getEventFightIds($event_id); $row = 0; //checken in welchem clan nun der User sitzt, für die Anzeige von EXP, ELO usw. if($user['clan'] == $clans[0]['id']) { $i = 0; } else { $i = 1; } echo ''; foreach($fight_ids as $fight_id) { $event_fight = getEventFight($event_id, $fight_id); $round_data = getEventFightRoundData($event_id, $event_fight['event_fight_id'], 0); // get participants of fight $host_char_id = NULL; $guest_char_id = NULL; foreach($round_data as $key => $value) { if($event_fight['host'] == $key) { $host_char_id = $key; } else { $guest_char_id = $key; } } // Key now lets read out the event_chars ... $host_char = getEventChar($event_id, $host_char_id); $guest_char = getEventChar($event_id, $guest_char_id); // Check if the fight is already "visible" if(strtotime($event_fight['visible']) < time()) { echo ''; echo ''; echo ''; $row++; } else if(strtotime($event_fight['starting']) < time()) { //has it started? echo ''; echo ''; echo ''; } } if(strtotime($challenge['enddate']) < time() ) { //sieger rausfinden if($clans[0]['points'] > $clans[1]['points']) { $winner = $clans[0]['name']; } else { $winner = $clans[1]['name']; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo ''; echo $host_char['char_name'].''; echo 'vs'; echo ''; echo $guest_char['char_name'].''; echo '
'; echo $host_char['char_name'].'vs'; echo $guest_char['char_name'].'
Gewinner: '.$winner.'
Clan-EXP: '.$clans[$i]['xp'].'
ELO-Punkte: '.$clans[$i]['elo'].'
'; } } function displayOverview($challenge_id, $user) { $user_clan = getClan($user['clan']); $challenge = getChallenge($challenge_id); $clan_ids = getParticipatingClanIDs($challenge_id); $clans = getChallengeClans($challenge_id); if(!in_array($user['clan'] , $clan_ids)) { displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink()); return; } if($challenge['calculated'] == FALSE) { displayErrorMessage(NULL, 'Der Clankampf ist noch nicht soweit!!', displayHistoryBackLink()); return; } $event_id = $challenge['event_id']; $event = getEvent($event_id); if($event['event_type'] != EVENT_CLAN_FIGHT) { displayErrorMessage(NULL, 'Das Event is garkein Clan-Kampf!!', displayHistoryBackLink()); return; } switch ($challenge['anzahl_chars']) { case 3: //not implemented yet!! break; case 4: //not implemented yet!! break; case 5: displayHeader(2, 3, $challenge, $clans); break; } displayBody($challenge, $clans, $user); } switch ($action) { case 'showsomething': break; default: displayOverview($challenge_id, $user_ida); break; } ?>