DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
PlayerStats.c
Go to the documentation of this file.
2{
4};
5
7{
10
11 //ref PlayerStatsPCO_current m_PCO = new PlayerStatsPCO_current();
13
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
37 {
38 //if( GetGame() && GetGame().IsDebugActions() ) GatherAllRecords();
39 }
40
41
43 {
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
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
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
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
138 {
139 GetPCO().ResetAllStats();
140 }
141}
override Widget Init()
Definition DayZGame.c:122
EPSstatsFlags
Definition PlayerStats.c:2
@ EMPTY
Definition PlayerStats.c:3
proto native int SaveVersion()
Returns actual storage version - saving.
PlayerStatsPCO_Base GetPCO(int version=-1)
ref array< ref StatDebugObject > m_PlayerStatsDebug
Definition PlayerStats.c:9
bool LoadStats(ParamsReadContext ctx, int version)
void GatherAllRecords()
Definition PlayerStats.c:81
void SetAllowLogs(bool enable)
Definition PlayerStats.c:61
void SaveStats(ParamsWriteContext ctx)
ref array< ref PlayerStatBase > m_PlayerStats
Definition PlayerStats.c:8
void ~PlayerStats()
Definition PlayerStats.c:36
void PlayerStats(Man player)
Definition PlayerStats.c:21
void GetDebugInfo(array< ref StatDebugObject > objects, int flags)
Definition PlayerStats.c:71
void Init(Man player)
Definition PlayerStats.c:26
string m_System
Definition PlayerStats.c:17
bool GetAllowLogs()
Definition PlayerStats.c:66
ref PCOHandlerStats m_PCOhandler
Definition PlayerStats.c:12
bool m_AllowLogs
Definition PlayerStats.c:16
ref Timer m_SyncTimer
Definition PlayerStats.c:14
void ResetAllStats()
PlayerStatsPCO_Base GetPCO(int version=-1)
Definition PlayerStats.c:31
PlayerStatBase GetStatObject(int id)
Definition PlayerStats.c:42
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()