$$openfile round_%%round.roundidx%%.html$$
$$include menu.include$$
$$loop row as roundvariable index as variableindex select * from roundvariables where roundidx='%%round.roundidx%%'$$
$$%%lowercase("round_",roundvariable.variable)%%=roundvariable.value$$
$$endloop roundvariable$$
<title>CoD2 Round Info</title>
<br>
<br>
<table class=nameplate align=center>
<td width=298 height=50 background="images/nameplate2.jpg"><div align="center">Round $$roundindex$$</div></td>
</table>
<br>
<table align=center cellspacing=0 border=0 width=800px class=style3>
$$loop row as temprow index as tempindex select count(*) from playerinround where roundindex='%%round.roundidx%%'$$
$$playercount=temprow.0$$
$$endloop temprow$$
$$loop row as temprow index as tempindex select count(*) from killdata where roundindex='%%round.roundidx%%' and killtype='KILL'$$
$$kills=temprow.0$$
$$endloop temprow$$
$$loop row as temprow index as tempindex select count(*) from killdata where roundindex='%%round.roundidx%%' and killtype='SUICIDE'$$
$$suicides=temprow.0$$
$$endloop temprow$$
$$loop row as temprow index as tempindex select count(*) from killdata where roundindex='%%round.roundidx%%' and killtype='TEAMKILL'$$
$$teamkills=temprow.0$$
$$endloop temprow$$
$$loop row as temprow index as tempindex select count(*) from actiondata where roundindex='%%round.roundidx%%'$$
$$objectivecount=temprow.0$$
$$endloop temprow$$
<tr>
<th colspan=4 align=center><font face=arial size=-1>Map</font></th>
<th colspan=2 align=center><font face=arial size=-1>$$gametype_%%round.gametype%%_realname$$</font></th>
</tr>
<tr>
<td colspan=4 align="center" valign=top><br>$$map_%%round.mapname%%_realname$$</font>
$$if (map_%%round.mapname%%_image !EQUALS "")$$<br><br><img src="maplarge/$$map_%%round.mapname%%_image$$" >
$$else$$<br><br><img src="maplarge/defaultmap.jpg" >
$$endif$$</td>
<th colspan=2 align=center>

<table align=left valign=top cellspacing=0 border=0  class=style3 width=100%>
$$if (gametype_%%round.gametype%%_image !EQUALS "")$$<tr align=left><td align="center" colspan=3><img src="gametypelarge/$$gametype_%%round.gametype%%_image$$"></td></tr>
$$else$$<tr align=left><td align="center" colspan=3><img src="gametypelarge/defaultgametype.jpg"></td></tr>  
$$endif$$
$$include roundvariables.include$$
<tr align=left><td colspan=2 height=27px>Time Played</td><td>$$formatduration("%M:%S",round.duration)$$</td></tr>
<tr align=left><td colspan=2 height=27px>Players</td><td>$$playercount$$</td></tr>
<tr align=left><td colspan=2 height=27px>Kills</td><td>$$kills$$</td></tr>
<tr align=left><td colspan=2 height=27px>Team Kills</td><td>$$teamkills$$</td>
<tr align=left><td colspan=2 height=27px>Suicides</td><td>$$suicides$$</td></tr>
$$if (objectivecount !EQUALS "0")$$
$$if (objectivecount < "4")$$
$$loop row as objectives index as objectiveindex select count(*),dropped,player.playerindex,name,actionidx from actiondata,player where player.playerindex=actiondata.playerindex and roundindex='%%round.roundidx%%' group by actiondata.playerindex,actionidx$$
<tr align=left>
<td align=center colspan=2 height=27px>
$$if (action_%%objectives.actionidx%%_image !EQUALS "")$$
<img src="$$action_%%objectives.actionidx%%_image$$">
<br>
$$endif$$
$$action_%%objectives.actionidx%%_realname$$
</td>
<td><font face=tahoma size=-2><a href="player_$$hash(objectives.name)$$.html">$$colouredtext2html(objectives.name)$$</a></font></td>
</tr>
$$endloop objectives$$
$$endif$$
$$endif$$
</table>
$$if (XPAVAILABLE EQUALS "Y")$$
<table align=center cellspacing=0 border=0  class=style3>
<tr align=center><th colspan=4>Experience</th></tr>
$$loop row as xp index as xpindex select distinct(pointsindex) as pointsindex from view_xppoints where roundindex='%%round.roundidx%%'$$
$$loop row as xppoints index as xppointsindex select * from view_xppoints where roundindex='%%round.roundidx%%' and pointsindex='%%xp.pointsindex%%' order by points desc limit 1$$
<tr align=left>
<td colspan=2 height=27px>Top $$xppoints.xpname$$</td>
<td><font face=tahoma><a href="player_$$hash(xppoints.playername)$$.html">$$colouredtext2html(xppoints.playername)$$</a></font></td>
<td>$$formatfloat("%.3f",xppoints.points)$$</td>
</tr>
$$endloop xp players$$
$$endloop xp points type$$
</table>
$$endif$$

</th>
</tr>
$$if (objectivecount > "3")$$
<tr><td colspan=6>
<table cellspacing=1 border=1 align=left width=100% class=style3>
<tr><td align=center colspan=3><font face=arial size=-1>Objectives</font></td></tr>
$$loop row as objectives index as objectiveindex select count(*),* from view_actiondata where roundindex='%%round.roundidx%%' group by playerindex,actionidx$$
<tr align=left>
<td align=center colspan=2 height=27px>$$objectives.actionname$$</td>
<td><font face=tahoma><a href="player_$$hash(objectives.playername)$$.html">$$colouredtext2html(objectives.playername)$$</a></font></td>
</tr>
$$endloop objectives$$
</table>
</td></tr>
$$endif$$
$$teamlosscount="0"$$
$$teamwincount="0"$$
$$awolcount="0"$$

$$loop row as temprow index as tempindex select count(*),teamwinidx from teamwindata where roundindex='%%round.roundidx%%'$$
$$teamwincount=temprow.0$$
$$endloop$$

$$loop row as temprow index as tempindex select count(*),teamlossidx from teamlossdata where roundindex='%%round.roundidx%%'$$
$$teamlosscount=temprow.0$$
$$endloop$$

$$loop row as temprow index as tempindex select count(*) from playerinround where roundindex='%%roundindex%%' and playerindex not in (select playerindex from teamwindata where roundindex='%%round.roundidx%%') and playerindex not in (select playerindex from teamlossdata where roundindex='%%round.roundidx%%')$$
$$awolcount=temprow.0$$
$$endloop$$
<tr></tr>
$$if ((teamwincount EQUALS "0") AND (teamlosscount EQUALS "0"))$$
$$if (awolcount !EQUALS "0")$$
	$$teamtype="awol"$$
	$$teamtitle="Players"$$
	<tr><th colspan=6>
	$$include roundteam.include$$
	</th></tr>
$$endif$$
$$else$$
$$if (teamwincount !EQUALS "0")$$
	$$teamtype="win"$$
	$$teamtitle="VICTORS"$$
		<tr><th colspan=6>
		$$include roundteam.include$$
		</th></tr>
		<tr></tr>
	$$endif$$
	$$if (teamlosscount !EQUALS "0")$$
		$$teamtype="loss"$$
		$$teamtitle="VANQUISHED"$$
		<tr><th colspan=6>
		$$include roundteam.include$$
		</th></tr>
		<tr></tr>
	$$endif$$
	$$if (awolcount !EQUALS "0")$$
		$$teamtype="awol"$$
		$$teamtitle="Leaving The Battlefield Early Soldiers?"$$
		<tr><th colspan=6>
		$$include roundteam.include$$
		</th></tr>
	$$endif$$
$$endif$$

</table>
$$closefile$$

