//*****************************************************************************
//
// SCOREBOARD BLOCK
//
//*****************************************************************************

Scoreboard
{
	MainHeader
	{
		MultiLineBlock( horizontalalign = center )
		{
			DrawString( value = "The Board...", font = "BigFont", overridefont = false, textcolor = "BloodyMess", bottompadding = 6 )

			// [AK] Draw the name of the server if we're in an online game.
			IfOnlineGame( true )
			{
				DrawString( value = cvar( sv_hostname ), textcolor = "DiamondStash", bottompadding = 3, gapsize = 3 )
			}

			// [AK] Draw the name of the current game mode and level.
			DrawString( value = gamemode + " - " + levellump + ": " + levelname, textcolor = "GunMetal", bottompadding = 3, gapsize = 3 )

			// [JS] Intermission countdown display.
			IfIntermission( true )
			{
				IfOnlineGame( true ) && IfCVar( cl_intermissiontimer == true )
				{
					DrawString( value = "Entering " + nextlevellump + ": " + nextlevelname + pluralize( " in # second{s}", intermissiontimeleft ), textcolor = "Green", bottompadding = 3, gapsize = 3 )
				}
			}
			Else
			{
				// Draw the time, frags, points, or kills we have left until the level ends.
				DrawString( value = limitstrings, textcolor = "Meteallic", bottompadding = 3, gapsize = 3 )

				// [AK] Draw the damage factor in cooperative games when it isn't set to its default value.
				IfGameType( Cooperative ) && IfCVar( sv_coop_damagefactor != 1.0 )
				{
					DrawString( value = "\nDamage factor is " + cvar( sv_coop_damagefactor, 2 ), textcolor = "Grey", bottompadding = 3, gapsize = 3 )
				}
			}

			IfEarnType( Frags, Points, Wins )
			{
				// Draw the team scores and their relation (tied, red leads, etc).
				IfPlayersOnTeams( true )
				{
					DrawString( value = "\n" + pointstring, textcolor = "Contrast", bottompadding = 3, gapsize = 3 )
				}
				// [AK] Draw whoever's leading during intermissions or when we're a true spectator looking at ourselves.
				Else IfIntermission( true ) || IfSpectator( true ) && IfDeadSpectator( false ) && IfSpying( false )
				{
					// [AK] Include the champion string in duel when there's a duel limit.
					IfIntermission( false ) && IfGameMode( Duel ) && IfCVar( duellimit > 0 )
					{
						DrawString( value = "\n" + championstring + "\n" + playerleadstring, textcolor = "Grey", bottompadding = 3, gapsize = 3 )
					}
					Else
					{
						DrawString( value = "\n" + playerleadstring, textcolor = "Grey", bottompadding = 3, gapsize = 3 )
					}
				}
				// Draw my rank and my frags, points, etc. Don't draw it if we're in the intermission.
				Else IfShouldShowRank( true )
				{
					// [AK] Include the champion string in duel when there's a duel limit.
					IfIntermission( false ) && IfGameMode( Duel ) && IfCVar( duellimit > 0 )
					{
						DrawString( value = "\n" + championstring + "\n" + placestring, textcolor = "Grey", bottompadding = 3, gapsize = 3 )
					}
					Else
					{
						DrawString( value = "\n" + placestring, textcolor = "Grey", bottompadding = 3, gapsize = 3 )
					}
				}
			}
		}
	}

	SpectatorHeader
	{
		MultiLineBlock( verticalalign = center )
		{
			DrawString( value = "Spectators (" + spectatorcount + ")", textcolor = "StickPile", bottompadding = 1 )

			// [AK] Use a width of INT_MAX to ensure this color box stretches across the entire margin.
			IfCVar( sb_customizeborders == false ) || IfCVar( sb_noborders == false )
			{
				DrawColor( value = "DD DD DD", width = 2147483648, height = 1, bottompadding = 3 )
			}
		}
	}

	HeaderTextColor = "AutumnCrunch"
	RowTextColor = "AutumnCrunch"
	LocalRowTextColor = "Green"
	LocalRowDemoTextColor = "Gold"
	BackgroundColor = "00 00 00"
	LightRowBackgroundColor = "92 34 0B"
	DarkRowBackgroundColor = "75 2A 09"
	LocalRowBackgroundColor = "80 80 80"
	ColumnOrder = "BotSkillIcon", "Index", "ReadyToGoAndStatusIcons", "ArtifactIcon", "PlayerIcon", "Player", "Vote", "Handicap", "Points", "Frags", "Kills", "Damage", "Secrets", "Wins", "Ping", "ConnectionStrength", "Time"
	RankOrder = "Points", "Frags", "Kills", "Damage", "Secrets"
	
	AddFlag UseTeamTextColors
	AddFlag DontUseLocalRowBackgroundColor
}