## Engine
Class PlayerStats

source: C:\XIII\Engine\Classes\PlayerStats.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Info
             |
             +--Engine.PlayerStats

Direct Known Subclasses:None

class PlayerStats
extends Engine.Info

    //-----------------------------------------------------------
    // Server class used to store player stats and updating rank/ladder at logout
    //-----------------------------------------------------------

Variables
`float` | `EnterTimeSeconds` Number of matches played
`float` | `LeaveTimeSeconds` Number of matches played
`int` | `StatDeaths` Number of deaths (ALL)
`int` | `StatFlagsR` Flags Returned (CTF)
`int` | `StatFlagsS` Flags Scored (CTF)
`int` | `StatKills` Number of kills (ALL)
`int` | `StatMatchesPlayed` Number of matches played
`int` | `StatMinutes` Minutes Played (ALL)
`int` | `StatSuicides` Number of suicides (ALL)

Function Summary
`void` | `LogStats()`
    //_____________________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	// Server class used to store player stats and updating rank/ladder at logout
    00003	//-----------------------------------------------------------
    00004	class PlayerStats extends Info
    00005	    native;
    00006
    00007	var int StatKills;          // Number of kills (ALL)
    00008	var int StatDeaths;         // Number of deaths (ALL)
    00009	var int StatSuicides;       // Number of suicides (ALL)
    00010	var int StatMinutes;        // Minutes Played (ALL)
    00011	var int StatFlagsS;         // Flags Scored (CTF)
    00012	var int StatFlagsR;         // Flags Returned (CTF)
    00013	var int StatMatchesPlayed;  // Number of matches played
    00014
    00015	var float EnterTimeSeconds;
    00016	var float LeaveTimeSeconds;
    00017
    00018	//var XboxLiveManager xboxlive; // ELR Useless as the controller will do the update (must be made on clients, this don't exists elsewhere than server
    00019	//StatsUpdateMyStats(kills, deaths, suicides, minutes, games, gameswon, flagscapt, flagsret)
    00020
    00021	//_____________________________________________________________________________
    00022	event PostBeginPlay()
    00023	{
    00024	    Super.PostBeginPlay();
    00025	    SetTimer(50.0 + frand()*20, false); // client update timer, stats will be updated on clients in this timer
    00026	}
    00027
    00028	/*
    00029	//_____________________________________________________________________________
    00030	function LogStats()
    00031	{
    00032	    StatMinutes = int((LeaveTimeSeconds - EnterTimeSeconds)/60.0);
    00033	    Log("STATS for"@Owner@"::");
    00034	    Log("  Kills +="@StatKills);
    00035	    Log("  Deaths +="@StatDeaths);
    00036	    Log("  Suicides +="@StatSuicides);
    00037	    Log("  Minutes +="@StatMinutes);
    00038	    Log("  Flags Scored +="@StatFlagsS);
    00039	    Log("  Flags Returned +="@StatFlagsR);
    00040	//    Log("  Matchs Won +="@StatMatchWon);
    00041	//    Log("  Matchs Losed +="@StatMatchLost);
    00042
    00043	    // ELR Don't use line below, system changed (see StatUpdate in XIIIMPPlayercontroller.uc
    00044	    //xboxlive.StatsUpdateMyStats(StatKills, StatDeaths, StatSuicides, StatMinutes, 1, StatMatchWon, StatFlagsS, StatFlagsR);
    00045	}
    00046	*/
    00047
    00048	//_____________________________________________________________________________
    00049	event Timer()
    00050	{ // Send stats to client playercontroller
    00051	    Local string StatStr;
    00052
    00053	    // the string that will be parsed on client for update
    00054	    StatMinutes = int((Level.TimeSeconds - EnterTimeSeconds)/60.0);
    00055	    StatStr = "?KI="$StatKills
    00056	      $"?DE="$StatDeaths
    00057	      $"?SU="$StatSuicides
    00058	      $"?MI="$StatMinutes
    00059	      $"?FS="$StatFlagsS
    00060	      $"?FR="$StatFlagsR
    00061	      $"?MP="$StatMatchesPlayed;
    00062	    // Send message to store stats
    00063	//    Log("STATS Sending update '"$StatStr$"'");
    00064	    PlayerController(Owner).ClientMessage(StatStr, 'STATS');
    00065
    00066	    SetTimer(50.0 + frand()*20, false); // Next update
    00067	}
    00068
    00069	defaultproperties
    00070	{
    00071	     RemoteRole=ROLE_None
    00072	}

End Source Code