From a07c9980364b2163d8ea64e752b6145f765166bd Mon Sep 17 00:00:00 2001 From: radiskull Date: Wed, 7 Dec 2011 21:37:24 +0000 Subject: [PATCH] --- ag/clan/kampf_anzeige.php | 107 ++++++++++++++++++++++---------------- ag/clan/kampf_info.php | 3 +- 2 files changed, 64 insertions(+), 46 deletions(-) diff --git a/ag/clan/kampf_anzeige.php b/ag/clan/kampf_anzeige.php index 4f9bd76..de37052 100644 --- a/ag/clan/kampf_anzeige.php +++ b/ag/clan/kampf_anzeige.php @@ -37,26 +37,22 @@ function getEventChars($challenge_id, $event_id) { } function getChallengeClans($challenge_id) { - $sql = 'SELECT ccc.id, c.clanname, c.id as clan_id FROM clan_challenge_clans ccc INNER JOIN clan c ON ccc.clan_id=c.id WHERE clan_challenge_id='.$challenge_id.';'; + $sql = 'SELECT ccc.id, c.clanname, ccc.elo_change, ccc.exp_change, c.id as clan_id, ccc.points FROM clan_challenge_clans ccc INNER JOIN clan c ON ccc.clan_id=c.id WHERE clan_challenge_id='.$challenge_id.';'; $qry = mysql_query($sql); $clans = array(); while($row = mysql_fetch_array($qry)) { - $clans[$row['id']] = array('name' => $row['clanname'], 'id' => $row['clan_id']); + $clans[$row['id']] = array('name' => $row['clanname'], 'id' => $row['clan_id'], 'elo' => $row['elo_change'], 'xp' => $row['exp_change'], 'points' => $row['points']); } return $clans; } function displayChar($char) { if($char['visible'] < time()) { - echo '
'; - echo '
'; - echo ''; - echo '
'; + echo '
'; + echo ''; if($char['event_char_id'] != $char['winner']) { - echo '
'; - echo ''; - echo '
'; + echo ''; } echo '
'; echo $char['char_name']; @@ -65,12 +61,11 @@ function displayChar($char) { } } -function displayHeader($top, $bottom, $challenge) { +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); - $clans = getChallengeClans($challenge_id); echo ''; echo ''; @@ -97,7 +92,7 @@ function displayHeader($top, $bottom, $challenge) { echo ''; } echo '
Clankampf am ...
'; - //Darstellen der Bilder auf der linken Seite + //Darstellen der Bilder auf der rechten Seite echo ''; $max = (count($chars)/2)+$top; $min = (count($chars)/2); @@ -126,7 +121,7 @@ function displayHeader($top, $bottom, $challenge) { echo ''; } echo '
'; - //Darstellen der Bilder auf der linken Seite + //Darstellen der Bilder auf der rechten Seite echo ''; $min = (count($chars)/2)+$top; $max = count($chars); @@ -153,9 +148,16 @@ function getColor($row) { return $color; } -function displayBody($event_id) { +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) { @@ -176,37 +178,57 @@ function displayBody($event_id) { $host_char = getEventChar($event_id, $host_char_id); $guest_char = getEventChar($event_id, $guest_char_id); - // TODO: Check if the fight is already "visible" + // Check if the fight is already "visible" + if($event_fight['visible'] < time()) { + echo ''; + echo ''; + echo ''; + $row++; + } else if($event_fight['starting'] < time()) { + //has it started? + echo ''; + echo ''; + echo ''; + } + } - echo ''; - echo ''; - echo ''; - $row++; + if($challenge['enddate'] < time()) { + //sieger rausfinden + if($clans[0]['points'] > $clans[0]['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'].'
'; - echo ''; - echo $host_char['char_name'].''; - echo 'vs'; - echo ''; - echo $guest_char['char_name'].''; - echo '
Gewinner: '.$winner.'
Clan-EXP: '.$clans[$i]['xp'].'
ELO-Punkte: '.$clans[$i]['elo'].'
'; } - echo ' '; - echo 'Clan-EXP:'; - echo ''; - echo ' 1337'; - echo 'Clan-Geld: '; - echo ''; - echo ' 1337'; - echo 'ELO-Punkte: '; - echo ' '; - echo ' 1337'; - echo ''; } function displayOverview($challenge_id, $user) { $user_clan = getClan($user['clan']); $challenge = getChallenge($challenge_id); - $clans = getParticipatingClanIDs($challenge_id); - if(!in_array($user['clan'] , $clans)) { + $clan_ids = getParticipatingClanIDs($challenge_id); + $clans = getChallengeClans($challenge_id); + + if(!in_array($user['clan'] , $clan_ids)) { displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink()); return; } @@ -221,10 +243,6 @@ function displayOverview($challenge_id, $user) { displayErrorMessage(NULL, 'Das Event is garkein Clan-Kampf!!', displayHistoryBackLink()); return; } - //TODO: Kampfbeteiligte ermitteln - //$participating_chars = getEventChars($event_id); - - $number_participants = count($participating_chars) / 2; switch ($challenge['anzahl_chars']) { case 3: @@ -234,11 +252,10 @@ function displayOverview($challenge_id, $user) { //not implemented yet!! break; case 5: - displayHeader(2, 3, $challenge); + displayHeader(2, 3, $challenge, $clans); break; } - - displayBody($event_id); + displayBody($challenge, $clans, $user); } switch ($action) { diff --git a/ag/clan/kampf_info.php b/ag/clan/kampf_info.php index 6fb2bd1..fffcb0c 100644 --- a/ag/clan/kampf_info.php +++ b/ag/clan/kampf_info.php @@ -533,7 +533,8 @@ function displayClanFightMenu($user) { $challenged_clan = getClan($pci); echo ' '.$challenged_clan['clanname'].''; //TODO: hier muss javascript fenster aufgerufen werden - echo ''.anzeigen.''; + //echo ''.anzeigen.''; + echo ''.anzeigen.''; } } }