Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

XWebAdmin.UTServerAdminSpectator


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
class UTServerAdminSpectator extends MessagingSpectator
	config;

struct PlayerMessage
{
	var PlayerReplicationInfo 	PRI;
	var String					Text;
	var Name					Type;
	var PlayerMessage 			Next;	// pointer to next message
};

var array<string>	Messages;

var byte NextMsg, LastMsg;
var config byte ReceivedMsgMax;

var config bool bClientMessages;
var config bool bTeamMessages;
var config bool bVoiceMessages;
var config bool bLocalizedMessages;
var UTServerAdmin Server;

function bool SetPause( BOOL bPause )
{
	log("Webadmin spectator executing SetPause:"$bPause);
	return Super.SetPause(bPause);
}

/* Pause()
Command to try to pause the game.
*/
function ServerPause()
{
	log("Webadmin spectator executing pause command!");
	Super.Pause();
}

event Destroyed()
{
	Server.Spectator = None;
	Super.Destroyed();
}

event PreBeginPlay()
{
	Super.PreBeginPlay();
	NextMsg = 0;
	LastMsg = 0;
	if (ReceivedMsgMax < 10)
		ReceivedMsgMax = 10;

	Messages.Length = ReceivedMsgMax;
}

function int LastMessage()
{
	return LastMsg;
}

function string NextMessage(out int msg)
{
local string str;

	if (msg == NextMsg)
		return "";

	str = Messages[msg];
	msg++;

	if (msg >= ReceivedMsgMax)
		msg = 0;

	return str;
}

// Implemented Rotating
function AddMessage(PlayerReplicationInfo PRI, String S, name Type)
{
	// Add the message to the array
	Messages[NextMsg] = FormatMessage(PRI, S, Type);
	NextMsg++;

	if (NextMsg >= ReceivedMsgMax)
		NextMsg = 0;

	if (NextMsg == LastMsg)
		LastMsg++;

	if (LastMsg >= ReceivedMsgMax)
		LastMsg = 0;
}

function Dump()
{
	Log("----Begin Dump----");
	if (PlayerReplicationInfo == None)
		Log("NO PLAYER REPLICATION INFO");
	if (Pawn == None)
		Log("NO PAWN");
	Log("NextMsg:"@NextMsg);
	Log("LastMsg:"@LastMsg);
	Log("ReceivedMsgMax:"@ReceivedMsgMax);
	Log("Msg[0]"@Messages[0]);
	Log("Msg[1]"@Messages[1]);
	Log("Msg[2]"@Messages[2]);
	Log("Msg[3]"@Messages[3]);
	Log("Msg[4]"@Messages[4]);
	Log("Msg[5]"@Messages[5]);
}

function String FormatMessage(PlayerReplicationInfo PRI, String Text, name Type)
{
	local String Message;

	// format Say and TeamSay messages
	if (PRI != None) {
		if (Type == 'Say' && PRI == PlayerReplicationInfo)
			Message = Text;
		else if (Type == 'Say')
			Message = PRI.PlayerName$": "$Text;
		else if (Type == 'TeamSay')
			Message = "["$PRI.PlayerName$"]: "$Text;
		else
			Message = "("$Type$") "$Text;
	}
	else if (Type == 'Console')
		Message = "WebAdmin:"@Text;
	else
		Message = "("$Type$") "$Text;

	return Message;
}

event ClientMessage( coerce string S, optional Name Type )
{
	//Log("Admin Received a ClientMessage");
	if (bClientMessages)
		AddMessage(None, S, Type);
}

function TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type)
{
	//Log("Admin Received a TeamMessage");
	if (bTeamMessages)
		AddMessage(PRI, S, Type);
}

function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
{
	//Log("Admin Received a ClientVoiceMessage");
	// do nothing?
}

function ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
{
	//Log("Admin Received a LocalizedMessage");
	// do nothing?
}

// A couple of functions that should not do anything
function ClientGameEnded() {}

// Report end game in log
function GameHasEnded()
{
	AddMessage(None, "GAME HAS ENDED", 'Console');
}

exec function DumpMaplists( string GameType )
{
	local int i;
	local int GameIndex;
	local StringArray ExcludeMaps, IncludeMaps;

	if ( GameType == "" )
		GameType = string(Level.Game.Class);

	GameIndex = Level.Game.MaplistHandler.GetGameIndex(GameType);
	ExcludeMaps = Server.ReloadExcludeMaps(GameType);
	IncludeMaps = Server.ReloadIncludeMaps(ExcludeMaps, GameIndex, Level.Game.MaplistHandler.GetActiveList(GameIndex));

	for ( i = 0; i < ExcludeMaps.Count(); i++ )
	{
		log("  ExcludeMaps["$i$"]:  Item '"$ExcludeMaps.GetItem(i)$"' Tag '"$ExcludeMaps.GetTag(i)$"'");
	}

	for ( i = 0; i < IncludeMaps.Count(); i++ )
	{
		log("  IncludeMaps["$i$"]:  Item '"$IncludeMaps.GetItem(i)$"' Tag '"$IncludeMaps.GetTag(i)$"'");
	}
}

defaultproperties
{
     ReceivedMsgMax=32
     bClientMessages=True
     bTeamMessages=True
     bLocalizedMessages=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:52.000 - Creation time: sk 18-3-2018 09:50:25.614 - Created with UnCodeX