radiskull 13 years ago
parent 52931ed83a
commit a07c998036

@ -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 '<div style "position:relative; top:0px; left:0px">';
echo '<div style "position:relative; top:0px; left:0px">';
echo '<img src="../'.$char['char_bild'].'" width="75" height="75" border="0">';
echo '</div>';
echo '<div style="position:relative; top:0px; left:0px;width:75;">';
echo '<img src="../'.$char['char_bild'].'" style="position:absolute; top:0px; left:0px; z-index:1; width:75px;height:75px;border:0px">';
if($char['event_char_id'] != $char['winner']) {
echo '<div style="position:absolute; top:0px; left:0px; z-index:1">';
echo '<img src="../design/bilder/avatare/Char.gif" width="75" height="75" border="0">';
echo '</div>';
echo '<img src="../design/bilder/avatare/Char.gif" style="position:relative; top:0px; left:0px; z-index:2;width:75px;height:75px;border:0px">';
}
echo '</div>';
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 '<table cellpadding="0" cellspacing="0" width="913" height="0" border="'.$border.'">';
echo '<tr><th valign="top" height="32" colspan="9" align="center">Clankampf am ...</th></tr>';
@ -97,7 +92,7 @@ function displayHeader($top, $bottom, $challenge) {
echo '</td>';
}
echo '</tr></table></td>';
//Darstellen der Bilder auf der linken Seite
//Darstellen der Bilder auf der rechten Seite
echo '<td><table width="100%" height="100%" cellpadding="0" cellspacing="0" border="'.$border.'"><tr>';
$max = (count($chars)/2)+$top;
$min = (count($chars)/2);
@ -126,7 +121,7 @@ function displayHeader($top, $bottom, $challenge) {
echo '</td>';
}
echo '</tr></table></td>';
//Darstellen der Bilder auf der linken Seite
//Darstellen der Bilder auf der rechten Seite
echo '<td><table width="100%" height="100%" cellpadding="0" cellspacing="0" border="'.$border.'"><tr>';
$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 '<table cellpadding="0" cellspacing="0" width="913" height="83" border="0">';
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 '<tr><td width="45%" height="15" valign="middle" bgcolor="'.getColor($row).'" align="right">';
echo '<a href="../event_kampf_anzeige.php?event_id='.$event_id.'&event_fight_id='.$event_fight['event_fight_id'].'">';
echo $host_char['char_name'].'</a>';
echo '</td>';
echo '<td width="5%" valign="middle" bgcolor="'.getColor($row).'" align="center">vs</td>';
echo '<td width="45%" valign="middle" bgcolor="'.getColor($row).'" align="left">';
echo '<a href="../event_kampf_anzeige.php?event_id='.$event_id.'&event_fight_id='.$event_fight['event_fight_id'].'">';
echo $guest_char['char_name'].'</a>';
echo '</td></tr>';
$row++;
} else if($event_fight['starting'] < time()) {
//has it started?
echo '<tr><td width="45%" height="15" valign="middle" bgcolor="'.getColor($row).'" align="right">';
echo $host_char['char_name'].'</td>';
echo '<td width="5%" valign="middle" bgcolor="'.getColor($row).'" align="center">vs</td>';
echo '<td width="45%" valign="middle" bgcolor="'.getColor($row).'" align="left">';
echo $guest_char['char_name'].'</td></tr>';
}
}
echo '<tr><td width="45%" height="15" valign="middle" bgcolor="'.getColor($row).'" align="right">';
echo '<a href="../event_kampf_anzeige.php?event_id='.$event_id.'&event_fight_id='.$event_fight['event_fight_id'].'">';
echo $host_char['char_name'].'</a>';
echo '</td>';
echo '<td width="5%" valign="middle" bgcolor="'.getColor($row).'" align="center">vs</td>';
echo '<td width="45%" valign="middle" bgcolor="'.getColor($row).'" align="left">';
echo '<a href="../event_kampf_anzeige.php?event_id='.$event_id.'&event_fight_id='.$event_fight['event_fight_id'].'">';
echo $guest_char['char_name'].'</a>';
echo '</td></tr>';
$row++;
if($challenge['enddate'] < time()) {
//sieger rausfinden
if($clans[0]['points'] > $clans[0]['points']) {
$winner = $clans[0]['name'];
} else {
$winner = $clans[1]['name'];
}
echo '<tr><td height="15" bgcolor="'.getColor($row++).'" colspan="3"> </td></tr>';
echo '<tr><td width="45%" height="15" valign="middle" align="right" bgcolor="'.getColor($row).'">Gewinner: </td>';
echo '<td width="5%" valign="middle" align="left" bgcolor="'.getColor($row).'"></td>';
echo '<td width="45%" valign="middle" align="left" bgcolor="'.getColor($row++).'">'.$winner.'</td></tr>';
echo '<tr><td width="45%" height="15" valign="middle" align="right" bgcolor="'.getColor($row).'">Clan-EXP:</td>';
echo '<td width="5%" valign="middle" align="left" bgcolor="'.getColor($row).'"></td>';
echo '<td width="45%" valign="middle" align="left" bgcolor="'.getColor($row++).'"> '.$clans[$i]['xp'].'</td></tr>';
echo '<tr><td width="45%" height="15" valign="middle" align="right" bgcolor="'.getColor($row).'">ELO-Punkte: </td>';
echo '<td width="5%" valign="middle" align="left" bgcolor="'.getColor($row).'"> </td>';
echo '<td width="45%" valign="middle" align="left" bgcolor="'.getColor($row).'"> '.$clans[$i]['elo'].'</td></tr>';
echo '</table>';
}
echo '<tr><td height="15" bgcolor="'.getColor($row++).'" colspan="3"> </td></tr>';
echo '<tr><td width="45%" height="15" valign="middle" align="right" bgcolor="'.getColor($row).'">Clan-EXP:</td>';
echo '<td width="5%" valign="middle" align="left" bgcolor="'.getColor($row).'"></td>';
echo '<td width="45%" valign="middle" align="left" bgcolor="'.getColor($row++).'"> 1337</td></tr>';
echo '<tr><td width="45%" height="15" valign="middle" align="right" bgcolor="'.getColor($row).'">Clan-Geld: </td>';
echo '<td width="5%" valign="middle" align="left" bgcolor="'.getColor($row).'"></td>';
echo '<td width="45%" valign="middle" align="left" bgcolor="'.getColor($row++).'"> 1337</td></tr>';
echo '<tr><td width="45%" height="15" valign="middle" align="right" bgcolor="'.getColor($row).'">ELO-Punkte: </td>';
echo '<td width="5%" valign="middle" align="left" bgcolor="'.getColor($row).'"> </td>';
echo '<td width="45%" valign="middle" align="left" bgcolor="'.getColor($row).'"> 1337</td></tr>';
echo '</table>';
}
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) {

@ -533,7 +533,8 @@ function displayClanFightMenu($user) {
$challenged_clan = getClan($pci);
echo '<tr><td align="center" colspan="2"> '.$challenged_clan['clanname'].'</td>';
//TODO: hier muss javascript fenster aufgerufen werden
echo '<td align="center" colspan="3"><a href="index.php?as=clan/kampf_info&action=showoldchallenge&challenge='.$acci.'">'.anzeigen.'</a></td></tr>';
//echo '<td align="center" colspan="3"><a href="index.php?as=clan/kampf_info&action=showoldchallenge&challenge='.$acci.'">'.anzeigen.'</a></td></tr>';
echo '<td align="center" colspan="3"><a href=\'javascript:showFight('.$acci.');\'>'.anzeigen.'</a></td></tr>';
}
}
}

Loading…
Cancel
Save