Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
playerstats.c
Go to the documentation of this file.
2 {
4 };
5 
7 {
8  ref array<ref PlayerStatBase> m_PlayerStats;
9  ref array<ref StatDebugObject> m_PlayerStatsDebug;
10 
11  //ref PlayerStatsPCO_current m_PCO = new PlayerStatsPCO_current();
12  ref PCOHandlerStats m_PCOhandler = new PCOHandlerStats();
13 
14  ref Timer m_SyncTimer;
15  Man m_Player;
16  bool m_AllowLogs;
17  string m_System = "Stats"; //debuging tag
18 
19  //int m_SystemVersion = 101;
20 
21  void PlayerStats(Man player)
22  {
23  Init(player);
24  }
25 
26  void Init(Man player)
27  {
28  m_Player = player;
29  }
30 
31  PlayerStatsPCO_Base GetPCO(int version = -1 )
32  {
33  return m_PCOhandler.GetPCO(version);
34  }
35 
36  void ~PlayerStats()
37  {
38  //if( GetGame() && GetGame().IsDebugActions() ) GatherAllRecords();
39  }
40 
41 
42  PlayerStatBase GetStatObject(int id)
43  {
44  PlayerStatsPCO_Base pco = GetPCO();
45  if ( pco )
46  {
47  return pco.GetStatObject(id);
48  }
49  else
50  {
51  return null;
52  }
53  }
54 
55 /*
56  array<ref PlayerStatBase> Get()
57  {
58  return m_PlayerStats;
59  }
60 */
61  void SetAllowLogs(bool enable)
62  {
63  m_AllowLogs = enable;
64  }
65 
66  bool GetAllowLogs()
67  {
68  return m_AllowLogs;
69  }
70 
71  void GetDebugInfo( array<ref StatDebugObject> objects, int flags )
72  {
73  /*
74  for(int i = 0; i < m_PlayerStats.Count(); i++)
75  {
76  m_PlayerStats.Get(i).SerializeValue(objects, flags);
77  }
78  */
79  }
80 
81  void GatherAllRecords()
82  {
83  /*
84  FileHandle file = OpenFile("$profile:StatRecords.log", FileMode.WRITE);
85 
86  FPrintln(file, "================================================================");
87  FPrintln(file," ================== " + m_Player.ToString() +" ================== ");
88  FPrintln(file, "================================================================");
89 
90  for(int i = 0; i < m_PlayerStats.Count(); i++)
91  {
92  array<PlayerStatRecord> records = m_PlayerStats.Get(i).GetRecords();
93 
94  FPrintln(file, m_PlayerStats.Get(i).GetLabel() );
95 
96  for(int z = 0; z < records.Count(); z++)
97  {
98  PlayerStatRecord record = records.Get(z);
99  string output = record.GetStringOutput();
100  FPrintln(file, output);
101  }
102  }
103  */
104  }
105 
106  void SaveStats( ParamsWriteContext ctx )
107  {
108  int current_version = GetGame().SaveVersion();
109  PlayerStatsPCO_Base pco = GetPCO(current_version);
110 
111  if ( pco )
112  {
113  pco.OnStoreSave(ctx);
114  //Print("Saving stats in version: "+ pco.GetVersion());
115  }
116  else
117  {
118  return;
119  }
120  }
121 
122  bool LoadStats( ParamsReadContext ctx, int version )
123  {
124  PlayerStatsPCO_Base pco = GetPCO(version);
125  if (pco && pco.OnStoreLoad(ctx))
126  {
127  //Print("********* LoadStats loading version: " + pco.GetVersion());
128  return true;
129  }
130  else
131  {
132  return false;
133  }
134 
135  }
136 
137  void ResetAllStats()
138  {
139  GetPCO().ResetAllStats();
140  }
141 }
GetGame
proto native CGame GetGame()
PlayerStatBase
Definition: playerstatbase.c:1
EPSstatsFlags
EPSstatsFlags
Definition: playerstats.c:1
PlayerStatsPCO_Base
Definition: playerstatspco.c:135
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
PCOHandlerStats
void PCOHandlerStats()
Definition: playerstatspco.c:5
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
array< ref PlayerStatBase >
PlayerStats
Definition: playerstats.c:6
EMPTY
@ EMPTY
Definition: playerstats.c:3
Timer
Definition: dayzplayerimplement.c:62
PCOHandlerStats
Definition: playerstatspco.c:3