<?php
require($_SERVER['DOCUMENT_ROOT'] . "bad/shared/init.php");
$guild = get_blasc_data();
$opt = array(3, 8); # Guildranks for Alts or Twinks
foreach($guild['character'] as $char) {
$lupd = strtotime($char['lastupdate']);
$alim = 10;
if($lupd < (mktime()-60*60*24*$alim))
continue;
$gg[$char['class']]['name'] = $char['class'];
$gg[$char['class']]['character'][] = $char;
if(!in_array($char['guild_rank'], $opt)) {
$total++;
$class[$char['class']]++;
$race[$char['race']]++;
if($char['pvprank'])
$rank[$char['pvprank']]++;
if(is_array($char['skills']['Berufe'])) {
foreach($char['skills']['Berufe'] as $key => $sk) {
$skill[$key]++;
}
}
}
else {
$total_opt++;
$class_opt[$char['class']]++;
$race_opt[$char['race']]++;
if($char['pvprank'])
$rank_opt[$char['pvprank']]++;
if(is_array($char['skills']['Berufe'])) {
foreach($char['skills']['Berufe'] as $key => $sk) {
$skill_opt[$key]++;
}
}
}
}
ksort($rank);
ksort($gg);
?>
<table class="contenthead" align="center" cellpadding="0" cellspacing="1" width="100%" style="margin-bottom: 10px;">
<tbody>
<tr>
<td class="heads">
<table width="100%">
<tbody>
<tr>
<td nowrap="nowrap"><font class="heads"><b>Mitglieder <small>(<?= $total . ($total_opt ? " + " . $total_opt : ""); ?>)</small></b></font></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<TD CLASS="highlight">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr style="font-weight: bold;">
<th width="50%" style="padding: 2px; border-bottom: 1px solid black;" class="contenteven" align="center">Klassen</th>
<th width="50%" style="padding: 2px; border-bottom: 1px solid black;" class="contenteven" align="center">Rassen</th>
</tr>
<tr>
<td>
<table align="center">
<tr>
<?php foreach($class as $key => $cl) { ?>
<td width="10" style="padding: 3px;"><img src="bad/media/roster/class/<?= transuml($key); ?>.gif" title="<?= $key; ?>" /></td>
<td><?= $cl . ($class_opt[$key] ? " + " . $class_opt[$key] : ""); ?></td>
<?php } ?>
</tr>
</table>
</td>
<td>
<table align="center">
<tr>
<?php foreach($race as $key => $rl) { ?>
<td width="10" style="padding: 3px;"><img src="bad/media/roster/race/m<?= $key; ?>.gif" title="<?= $key; ?>" /></td>
<td><?= $rl . ($race_opt[$key] ? " + " . $race_opt[$key] : ""); ?></td>
<?php } ?>
</tr>
</table>
</td>
</tr>
<tr style="font-weight: bold;">
<th width="50%" style="padding: 2px; border-bottom: 1px solid black; border-top: 1px solid black;" class="contenteven" align="center">Ränge</th>
<th width="50%" style="padding: 2px; border-bottom: 1px solid black; border-top: 1px solid black;" class="contenteven" align="center">Berufe</th>
</tr>
<tr>
<td>
<table align="center">
<tr>
<?php foreach($rank as $key => $cl) { ?>
<td width="10" style="padding: 3px;"><?= pvprank($key); ?></td>
<td><?= $cl . ($rank_opt[$key] ? " + " . $rank_opt[$key] : ""); ?></td>
<?php } ?>
</tr>
</table>
</td>
<td>
<table align="center">
<tr>
<?php foreach($skill as $key => $rl) { ?>
<td width="10" style="padding: 3px;"><img src="bad/media/roster/job/<?= transuml($key); ?>.jpg" title="<?= $key; ?>" /></td>
<td><?= $rl . ($skill_opt[$key] ? " + " . $skill_opt[$key] : ""); ?></td>
<?php } ?>
</tr>
</table>
</td>
</tr>
</table>
</TD>
</tr>
</tbody>
</table>
<table class="contentbody" align="center" cellpadding="0" cellspacing="0" width="100%" style="margin-top: 4px; border: 1px solid black;">
<tbody>
<tr>
<td class="odd">
<table width="100%" border="0" cellspacing="0">
<?php
foreach($gg as $key => $rank) {
?>
<tr>
<td colspan="10" class="heads" style="padding-left: 3px; padding-bottom: 4px; color: #fc0; font-weight: bold; border-bottom: 1px solid black; <?php if($key) { ?>border-top: 1px solid black;<?php } ?>">
<?= ucwords($rank['name']); ?> <small>(<?= count($rank['character']); ?>)</small></td>
</tr>
<?php
usort($rank['character'], "cmp");
foreach($rank['character'] as $chr) { ?>
<tr style="color: white; font-weight: bold;" onMouseOver="this.style.backgroundColor = 'navy'" onMouseOut="this.style.backgroundColor = ''">
<td width="10"><img src="bad/media/roster/race/<?= $chr['sex'] . $chr['race']; ?>.gif"
alt="<?= $chr['race']; ?>" title="<?= $chr['race']; ?>" /></td>
<!--<td width="10"><img src="bad/media/roster/class/<?= transuml($chr['class']); ?>.gif"
alt="<?= $chr['class']; ?>" title="<?= $chr['class']; ?>" /></td>-->
<td><a href="http://www.blasc.de/?c=<?= $chr['id']; ?>" target="_blank"><?= $chr['name']; ?></a></td>
<td><?= $chr['guild_title']; ?></td>
<?php tradeskills($chr['skills']); ?>
<td width="10"><?= pvprank($chr['pvprank']); ?></td>
<td width="50" align="left">Stufe <?= $chr['level']; ?></td>
<td width='10' align="center" <?php if($groups[$_SESSION['USER']['group']]) echo 'style="background: #144984;"'; ?>>
<?php
$lupd = strtotime($chr['lastupdate']);
$wlim = 3; # Warning
$alim = 7; # Alert
# Alert
if($groups[$_SESSION['USER']['group']] && ($lupd < (mktime()-60*60*24*$alim))) {
echo "<img src='bad/media/roster/alert.gif' title='Daten älter als $alim Tage!'>";
}
# Warning
elseif($groups[$_SESSION['USER']['group']] && ($lupd < (mktime()-60*60*24*$wlim))) {
echo "<img src='bad/media/roster/warning.gif' title='Daten älter als $wlim Tage!'>";
}
elseif($groups[$_SESSION['USER']['group']]) {
echo "<img src='bad/media/roster/ok.gif' title='Daten aktuell.'>";
}
?>
</td>
</tr>
<?php } ?>
<tr><td colspan="9"><IMG BORDER="0" HEIGHT="3" WIDTH="2" ALT="" SRC="images/blank.gif" /></td></tr>
<?php } ?>
</table>
</td>
</tr>
</tbody>
</table>
<?php
function tradeskills($skil) {
if(!is_array($skil['Berufe'])) {
echo "<td colspan='4'></td>";
return true;
}
$trans = array("ä" => "ae", "ü" => "ue", "ö" => "oe");
ksort($skil['Berufe']);
if(sizeof($skil['Berufe']) < 2)
echo "<td colspan='2'></td>";
foreach($skil['Berufe'] as $key => $sk) {
echo '<td width="10"><img src="bad/media/roster/job/' . strtr($key, $trans) . '.jpg" alt="' . $key . '" title="' . $key . '" /></td>';
echo '<td width="60">' . $sk['value'] . " / " . $sk['max'] . '</td>';
}
}
function pvprank($rank) {
switch($rank) {
case 0: $bez = "Kein Rang"; break;
case 1: $bez = "Gefreiter"; break;
case 2: $bez = "Fußknecht"; break;
case 3: $bez = "Landsknecht"; break;
case 4: $bez = "Feldwebel"; break;
case 5: $bez = "Fähnrich"; break;
case 6: $bez = "Leutnat"; break;
case 7: $bez = "Hauptmann"; break;
case 8: $bez = "Kürassier"; break;
case 9: $bez = "Ritter der Allianz"; break;
case 10: $bez = "Feldkommandant"; break;
case 11: $bez = "Rittmeister"; break;
case 12: $bez = "Marschall"; break;
case 13: $bez = "Feldmarschall"; break;
case 14: $bez = "Großmarschall"; break;
}
return '<img src="bad/media/roster/pvp/rank' . $rank . '.gif" alt="' . $bez . '" title="' . $bez . '" />';
}
function cmp($a, $b) {
return strcmp($a['name'], $b['name']);
}
?>