<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" title="Default" href="main.css" type="text/css" />
</head>
<?
  $zone = $request->get("zone", "");
  @chars = $EQW->ListPlayers($zone);
#(
#   { character => "Joe", account => "yay", location_short => "arena", location_long => "Arena" },
#   { character => "Bob", account => "yay", location_short => "freportw", location_long => "West Freeport" },
#   { character => "Monkey", account => "notyay", location_short => "freportn", location_long => "North Freeport" }
#  );
?>
<body>
<h2 align="center">Online Player List</h2>
<hr/>
<?
if($zone eq "") {
	print "There are ".($#chars+1)." players logged in.";
} else {
	print "There are ".($#chars+1)." players in $zone.";
}
?>
<hr/>
<table width="100%"  border="1" cellspacing="2" cellpadding="3" class="zonelist">
  <tr>
    <th scope="col">Character</th>
    <th scope="col">Account Name</th>
    <th scope="col">Location</th>
    <th scope="col">Actions</th>
  </tr>
<?
foreach my $charname (@chars) {
	my $char = $EQW->GetPlayerDetails($charname);
	if(!$char) {
		$char->{character} = "ERROR: no char";
	} elsif($char->{error}) {
		$char->{character} = "ERROR: ".$char->{error};
	}
    print "<tr>";
	if($char->{character} eq "") {
		print "<td>Not Selected</td>";
	} else {
		print "<td>$char->{character}";
		if(defined($char->{guild_id}) && $char->{guild_id} > 0) {
			print " &lt;<a href='guild.html?id=$char->{guild_id}'>guild #$char->{guild_id}</a>&gt;";
		}
		print "<br>";
		print "$char->{level} $char->{race} $char->{class}";
		print "</td>";
	}
	print "<td><a href='account.html?name=$char->{account}'>$char->{account}</a>";
	if($char->{status} > 0) {
		print " (status $char->{status})";
	}
	print "<br>";
	print "    $char->{ip}</td>";
	print "<td>$char->{location_long} ($char->{location_short})</td>";
	print "<td>";
	print "<a href='char.html?name=$char->{character}&action=kick'>Kick</a>";
	print "</td>";
	print "</tr>";
}

?>
</table>
</body>
</html>
