$class = array(
"drd" => "Druid",
"hnt" => "Hunter",
"mag" => "Mage",
"pal" => "Paladin",
"pri" => "Priest",
"rog" => "Rogue",
"sha" => "Shaman",
"wrl" => "Warlock",
"war" => "Warrior",
);
if ($dir = opendir(".")) {
while (($file = readdir($dir)) !== false) {
if (preg_match("/^sws/", $file) && ! preg_match("/overall/", $file)) {
$parser = xml_parser_create();
xml_set_element_handler($parser, "start_tag", "end_tag");
if (!($fp = fopen($file . "/data.xml", "r"))) { echo("cannot open".$filename); }
while ($data = fread($fp, 4096)){
if (!xml_parse($parser, $data, feof($fp))) {
$reason = xml_error_string(xml_get_error_code($parser));
$reason .= xml_get_current_line_number($parser);
die($reason);
}
}
}
}
}
ksort($players);
foreach ($players as $name => $value) {
echo "";
echo "| " . $name . " | ";
echo "" . $value['raids'] . " | ";
echo "" . sprintf("%d", $value['dout'] / $value['rtime'] * 100) . "% | ";
echo "" . sprintf("%d", $value['damage'] / $value['rtime']) . " | ";
echo "" . sprintf("%d", $value['dtime'] / $value['rtime'] * 100) . "% | ";
echo "" . sprintf("%d", $value['din'] / $value['rtime'] * 100) . "% | ";
echo "" . $value['deaths'] . " | ";
echo "" . sprintf("%.1f", $value['deaths'] / $value['raids']) . " | ";
echo "" . sprintf("%d", $value['eheal'] / $value['rtime'] * 100) . "% | ";
echo "" . sprintf("%d", $value['oheal'] / $value['rtime'] * 100) . "% | ";
echo "" . sprintf("%.1f", $value['decurses'] / $value['raids']) . " | ";
echo "";
}
function start_tag($parser, $name, $attribs) {
global $players;
global $rtime;
if ($name == "RAID") {
$rtime = $attribs['LG'] / 1000;
}
if ($name == "PLAYER") {
$players[$attribs['NAME']]['raids']++;
$players[$attribs['NAME']]['deaths'] += $attribs['DEATH'];
$players[$attribs['NAME']]['decurses'] += $attribs['DECURSE'];
$players[$attribs['NAME']]['damage'] += $rtime * $attribs['DPS'];
$players[$attribs['NAME']]['dtime'] += $rtime * ($attribs['DPSTIME'] / 100);
$players[$attribs['NAME']]['eheal'] += $rtime * ($attribs['HEAL'] / 100);
$players[$attribs['NAME']]['oheal'] += $rtime * ($attribs['OVH'] / 100);
$players[$attribs['NAME']]['din'] += $rtime * ($attribs['DMGIN'] / 100);
$players[$attribs['NAME']]['dout'] += $rtime * ($attribs['DMGOUT'] / 100);
$players[$attribs['NAME']]['rtime'] += $rtime;
$players[$attribs['NAME']]['class'] = $attribs['CLASSE'];
}
}
function end_tag($parser, $name) {
global $players;
}
?>