class DLGFILTER_Score extends DialoguePlayerFilter;

var private transient float TopValue;
var private transient float TopValueTime; // lst time when TopValue was set

function float CalcPlayerValue(KF_PlayerDialogue Dialogue, int DlgIdx, PlayerReplicationInfo PRI)
{
	local Controller C;
	
	if ( TopValueTime != PRI.Level.TimeSeconds ) {
		TopValue = 0.0;
		TopValueTime = PRI.Level.TimeSeconds;
		for ( C = PRI.Level.ControllerList; C != None; C = C.NextController ) {
			if ( C.PlayerReplicationInfo != none )
				TopValue = fmax(TopValue, C.PlayerReplicationInfo.Score);
		}
	}
	
	if ( TopValue == 0.0 )
		return 0.0;
	return Value * PRI.Score / TopValue;
}

defaultproperties
{
}
