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

Engine.StatLog


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
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
//=============================================================================
// Logs game events for stat collection
//
// ngLog, ngStats, and ngWorldStats are registered trademarks of 
// NetGames USA, Inc. at http://www.netgamesusa.com All rights reserved. A
// ny and all occurrences of code related to supporting their products and 
// services appears with their express permission.
//=============================================================================
class StatLog extends Info
    native;

// Internal
var int     Context;

// State
var bool    bWorld;

// Time
var float   TimeStamp;

// Log Variables
var() string LocalStandard;     // The standard this log is compliant to.
var() string WorldStandard;     // The standard this log is compliant to.
var() string LogVersion;        // Version of the log standard.
var() string LogInfoURL;        // URL to info on logging standard.
var() string GameName;          // Name of this game.
var() string GameCreator;       // Name of game creator.
var() string GameCreatorURL;    // URL to info on game creator.
var() string DecoderRingURL;    // URL to log format decoder ring.

// Directories
var() string LocalLogDir;
var() string WorldLogDir;

// Object
function BeginPlay()
{
    SetTimer(30.0, True);
}

function Timer()
{
    LogPings();
}

// Logging
function StartLog()
{
    // Implemented in subclass.
}

function StopLog()
{
    // Implemented in subclass.
}

function FlushLog()
{
    // Implemented in subclass.
}

function LogEventString( string EventString )
{
    Log( EventString );
}

// Time
native final function string GetGMTRef();

// Return absolute time.
function string GetAbsoluteTime()
{
    local string AbsoluteTime;
    local string GMTRef;

    AbsoluteTime = string(Level.Year);

    if (Level.Month < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Month;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Month;

    if (Level.Day < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Day;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Day;

    if (Level.Hour < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Hour;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Hour;

    if (Level.Minute < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Minute;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Minute;

    if (Level.Second < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Second;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Second;

    if (Level.Millisecond < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Millisecond;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Millisecond;

    GMTRef = GetGMTRef();

    AbsoluteTime = AbsoluteTime$"."$GMTRef;

    TimeStamp = 0;

    return AbsoluteTime;
}

// A less verbose version...
function string GetShortAbsoluteTime()
{
    local string AbsoluteTime;

    AbsoluteTime = string(Level.Year);

    if (Level.Month < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Month;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Month;

    if (Level.Day < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Day;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Day;

    if (Level.Hour < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Hour;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Hour;

    if (Level.Minute < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Minute;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Minute;

    if (Level.Second < 10)
        AbsoluteTime = AbsoluteTime$".0"$Level.Second;
    else
        AbsoluteTime = AbsoluteTime$"."$Level.Second;

    TimeStamp = 0;

    return AbsoluteTime;
}

// Return a timestamp relative to last absolute time.
function string GetTimeStamp()
{
    local string Time;
    local int Pos;

    Time = string(TimeStamp);
    Time = Left(Time, InStr(Time, ".") + 3);
    return Time;
}

// Return a logfile name if relevant.
function string GetLogFileName()
{
    return "";
}

// Track relative timestamps.
function Tick(float Delta)
{
    TimeStamp += Delta;
}

// Standard Log Entries
function LogStandardInfo()
{
    if (bWorld)
        LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Log_Standard"$Chr(9)$WorldStandard);
    else
        LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Log_Standard"$Chr(9)$LocalStandard);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Log_Version"$Chr(9)$LogVersion);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Log_Info_URL"$Chr(9)$LogInfoURL);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Game_Name"$Chr(9)$GameName);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Game_Version"$Chr(9)$Level.EngineVersion);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Game_Creator"$Chr(9)$GameCreator);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Game_Creator_URL"$Chr(9)$GameCreatorURL);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Game_Decoder_Ring_URL"$Chr(9)$DecoderRingURL);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Absolute_Time"$Chr(9)$GetAbsoluteTime());   
}

function LogServerInfo()
{
    local string NetworkNumber;

    NetworkNumber = Level.Game.GetNetworkNumber();

    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_ServerName"$Chr(9)$Level.Game.GameReplicationInfo.ServerName);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_AdminName"$Chr(9)$Level.Game.GameReplicationInfo.AdminName);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_AdminEmail"$Chr(9)$Level.Game.GameReplicationInfo.AdminEmail);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_Region"$Chr(9)$Level.Game.GameReplicationInfo.Region);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_MOTDLine1"$Chr(9)$Level.Game.GameReplicationInfo.MOTDLine1);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_MOTDLine2"$Chr(9)$Level.Game.GameReplicationInfo.MOTDLine2);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_MOTDLine3"$Chr(9)$Level.Game.GameReplicationInfo.MOTDLine3);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_MOTDLine4"$Chr(9)$Level.Game.GameReplicationInfo.MOTDLine4);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_IP"$Chr(9)$NetworkNumber);
    LogEventString(GetTimeStamp()$Chr(9)$"info"$Chr(9)$"Server_Port"$Chr(9)$Level.Game.GetServerPort());
}

native final function string GetMapFileName();

function LogMapParameters()
{
    local string MapName;

    MapName = GetMapFileName();

    LogEventString(GetTimeStamp()$Chr(9)$"map"$Chr(9)$"Name"$Chr(9)$MapName);
    LogEventString(GetTimeStamp()$Chr(9)$"map"$Chr(9)$"Title"$Chr(9)$Level.Title);
    LogEventString(GetTimeStamp()$Chr(9)$"map"$Chr(9)$"Author"$Chr(9)$Level.Author);
    LogEventString(GetTimeStamp()$Chr(9)$"map"$Chr(9)$"IdealPlayerCount"$Chr(9)$Level.IdealPlayerCount);
    LogEventString(GetTimeStamp()$Chr(9)$"map"$Chr(9)$"LevelEnterText"$Chr(9)$Level.LevelEnterText);
}

function LogPlayerConnect(Pawn Player)
{
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"Connect"$Chr(9)$Player.PlayerReplicationInfo.PlayerName$Chr(9)$Player.PlayerReplicationInfo.PlayerID);
    LogPlayerInfo(Player);
}

function LogPlayerInfo(Pawn Player)
{
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"TeamName"$Chr(9)$Player.PlayerReplicationInfo.PlayerID$Chr(9)$Player.PlayerReplicationInfo.TeamName);
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"Team"$Chr(9)$Player.PlayerReplicationInfo.PlayerID$Chr(9)$Player.PlayerReplicationInfo.Team);
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"TeamID"$Chr(9)$Player.PlayerReplicationInfo.PlayerID$Chr(9)$Player.PlayerReplicationInfo.TeamID);
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"Ping"$Chr(9)$Player.PlayerReplicationInfo.PlayerID$Chr(9)$Player.PlayerReplicationInfo.Ping);
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"IsABot"$Chr(9)$Player.PlayerReplicationInfo.PlayerID$Chr(9)$Player.PlayerReplicationInfo.bIsABot);
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"Skill"$Chr(9)$Player.PlayerReplicationInfo.PlayerID$Chr(9)$Player.Skill);
}

function LogPlayerDisconnect(Pawn Player)
{
    LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"Disconnect"$Chr(9)$Player.PlayerReplicationInfo.PlayerID);
}

function LogKill( int KillerID, int VictimID, string KillerWeaponName, string VictimWeaponName, name DamageType )
{
    LogEventString(GetTimeStamp()$Chr(9)$"kill"$Chr(9)$KillerID$Chr(9)$KillerWeaponName$Chr(9)$VictimID$Chr(9)$VictimWeaponName$Chr(9)$DamageType);
}

function LogTeamKill( int KillerID, int VictimID, string KillerWeaponName, string VictimWeaponName, name DamageType )
{
    LogEventString(GetTimeStamp()$Chr(9)$"teamkill"$Chr(9)$KillerID$Chr(9)$KillerWeaponName$Chr(9)$VictimID$Chr(9)$VictimWeaponName$Chr(9)$DamageType);
}

function LogSuicide(Pawn Killed, name DamageType)
{
    local int KilledID;

    if (Killed == None)
        return;

    KilledID = Killed.PlayerReplicationInfo.PlayerID;

    if (Killed.Weapon != None)
        LogEventString(GetTimeStamp()$Chr(9)$"suicide"$Chr(9)$KilledID$Chr(9)$Killed.Weapon.ItemName$Chr(9)$DamageType);
    else
        LogEventString(GetTimeStamp()$Chr(9)$"suicide"$Chr(9)$KilledID$Chr(9)$"None"$Chr(9)$DamageType);
}

function LogTypingEvent(bool bTyping, Pawn Other)
{
    LogEventString(GetTimeStamp()$Chr(9)$"typing"$Chr(9)$bTyping$Chr(9)$Other.PlayerReplicationInfo.PlayerID);
}

function LogPickup(Inventory Item, Pawn Other)
{
    LogEventString(GetTimeStamp()$Chr(9)$"item_get"$Chr(9)$Item.ItemName$Chr(9)$Other.PlayerReplicationInfo.PlayerID);
}

function LogItemActivate(Inventory Item, Pawn Other)
{
    LogEventString(GetTimeStamp()$Chr(9)$"item_activate"$Chr(9)$Item.ItemName$Chr(9)$Other.PlayerReplicationInfo.PlayerID);
}

function LogItemDeactivate(Inventory Item, Pawn Other)
{
    LogEventString(GetTimeStamp()$Chr(9)$"item_deactivate"$Chr(9)$Item.ItemName$Chr(9)$Other.PlayerReplicationInfo.PlayerID);
}

function LogSpecialEvent(string EventType, optional coerce string Arg1, optional coerce string Arg2, optional coerce string Arg3, optional coerce string Arg4)
{
    local string Event;

    Event = EventType;
    if (Arg1 != "")
        Event = Event$Chr(9)$Arg1;
    if (Arg2 != "")
        Event = Event$Chr(9)$Arg2;
    if (Arg3 != "")
        Event = Event$Chr(9)$Arg3;
    if (Arg4 != "")
        Event = Event$Chr(9)$Arg4;

    LogEventString(GetTimeStamp()$Chr(9)$Event);
}

function LogPings()
{
    local PlayerReplicationInfo PRI;

    foreach AllActors(class'PlayerReplicationInfo', PRI)
        LogEventString(GetTimeStamp()$Chr(9)$"player"$Chr(9)$"Ping"$Chr(9)$PRI.PlayerID$Chr(9)$PRI.Ping);
}

function LogGameStart()
{
    LogEventString(GetTimeStamp()$Chr(9)$"game_start");
}

function LogGameEnd( string Reason )
{
    LogEventString(GetTimeStamp()$Chr(9)$"game_end"$Chr(9)$Reason);
}

defaultproperties
{
     LocalStandard="ngLog"
     WorldStandard="ngLog"
     LogVersion="1.2"
     LogInfoURL="http://www.netgamesusa.com/ngLog/"
     GameName="Unreal"
     GameCreator="Epic MegaGames, Inc."
     GameCreatorURL="http://www.epicgames.com/"
     DecoderRingURL="http://unreal.epicgames.com/Unreal_Log_Decoder_Ring.html"
     LocalLogDir="..\Logs"
     WorldLogDir="..\NetGamesUSA.com\ngWorldStats\logs"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: za 22-4-2006 13:00:12.000 - Creation time: za 22-4-2006 13:01:34.062 - Created with UnCodeX