summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XStaticSecurityStatistics.cs
blob: 384cd439c6771f512bf90ca3efdc158846959600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
using System;
using System.Collections.Generic;
using XUtliPoolLib;

namespace XMainClient
{
	internal sealed class XStaticSecurityStatistics
	{
		public static XSecurityHPInfo _BossHPInfo = new XSecurityHPInfo();

		public static XSecurityHPInfo _MonsterHPInfo = new XSecurityHPInfo();

		public static XSecurityDamageInfo _BossDamageInfo = new XSecurityDamageInfo();

		public static XSecurityDamageInfo _MonsterDamageInfo = new XSecurityDamageInfo();

		public static XSecurityAIInfo _BossAIInfo = new XSecurityAIInfo();

		public static XSecurityAIInfo _MonsterAIInfo = new XSecurityAIInfo();

		public static float _BossMoveDistance;

		public static float _MonsterMoveDistance;

		public static DateTime _StartTime;

		private static bool _Inited = false;

		private static List<string> _KeyList;

		private static List<string> _ValueList;

		public static void Reset()
		{
			XStaticSecurityStatistics._MonsterDamageInfo.Reset();
			XStaticSecurityStatistics._BossDamageInfo.Reset();
			XStaticSecurityStatistics._BossHPInfo.Reset();
			XStaticSecurityStatistics._MonsterHPInfo.Reset();
			XStaticSecurityStatistics._BossAIInfo.Reset();
			XStaticSecurityStatistics._MonsterAIInfo.Reset();
			XStaticSecurityStatistics._BossMoveDistance = 0f;
			XStaticSecurityStatistics._MonsterMoveDistance = 0f;
			XStaticSecurityStatistics._StartTime = DateTime.Now;
			XStaticSecurityStatistics._Inited = true;
		}

		public static void OnEnd()
		{
			bool flag = !XStaticSecurityStatistics._Inited;
			if (!flag)
			{
				XStaticSecurityStatistics._Inited = false;
				bool flag2 = XSingleton<XGame>.singleton.CurrentStage.Stage != EXStage.World || XSingleton<XScene>.singleton.bSpectator;
				if (!flag2)
				{
					List<XEntity> all = XSingleton<XEntityMgr>.singleton.GetAll();
					XSecurityStatistics xsecurityStatistics;
					for (int i = 0; i < all.Count; i++)
					{
						xsecurityStatistics = XSecurityStatistics.TryGetStatistics(all[i]);
						bool flag3 = xsecurityStatistics == null;
						if (!flag3)
						{
							xsecurityStatistics.Dump();
						}
					}
					bool flag4 = XSingleton<XEntityMgr>.singleton.Player != null;
					if (flag4)
					{
						XBattleEndArgs @event = XEventPool<XBattleEndArgs>.GetEvent();
						@event.Firer = XSingleton<XEntityMgr>.singleton.Player;
						XSingleton<XEventMgr>.singleton.FireEvent(@event);
					}
					xsecurityStatistics = XSingleton<XAttributeMgr>.singleton.XPlayerData.SecurityStatistics;
					bool flag5 = xsecurityStatistics != null;
					if (flag5)
					{
						xsecurityStatistics.OnEnd();
					}
					XStaticSecurityStatistics._SendBattleStartData();
					XStaticSecurityStatistics._SendBattleFinishMainData();
					XStaticSecurityStatistics._SendBattleFinishOtherData();
				}
			}
		}

		public static void Append(string key, string value, List<string> keyList, List<string> valueList)
		{
			keyList.Add(key);
			valueList.Add(value);
		}

		public static void Append(string key, string value)
		{
			XStaticSecurityStatistics.Append(key, value, XStaticSecurityStatistics._KeyList, XStaticSecurityStatistics._ValueList);
		}

		public static void Append(string key, double value, List<string> keyList, List<string> valueList)
		{
			XStaticSecurityStatistics.Append(key, ((long)value).ToString(), keyList, valueList);
		}

		public static void Append(string key, double value)
		{
			bool flag = value == 0.0 || value == double.MaxValue;
			if (!flag)
			{
				XStaticSecurityStatistics.Append(key, value, XStaticSecurityStatistics._KeyList, XStaticSecurityStatistics._ValueList);
			}
		}

		public static void Append(string key, float value, List<string> keyList, List<string> valueList)
		{
			XStaticSecurityStatistics.Append(key, ((long)value).ToString(), keyList, valueList);
		}

		public static void Append(string key, float value)
		{
			bool flag = value == 0f || value == float.MaxValue;
			if (!flag)
			{
				XStaticSecurityStatistics.Append(key, value, XStaticSecurityStatistics._KeyList, XStaticSecurityStatistics._ValueList);
			}
		}

		private static void _SendBattleStartData()
		{
			PtcC2G_BattleLogReport ptcC2G_BattleLogReport = new PtcC2G_BattleLogReport();
			XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
			ptcC2G_BattleLogReport.Data.roleid = xplayerData.RoleID;
			XStaticSecurityStatistics._KeyList = ptcC2G_BattleLogReport.Data.key;
			XStaticSecurityStatistics._ValueList = ptcC2G_BattleLogReport.Data.value;
			ptcC2G_BattleLogReport.Data.type = 1u;
			XStaticSecurityStatistics.Append("ClientStartTime", XStaticSecurityStatistics._StartTime.ToString("yyyy-MM-dd HH:mm:ss"));
			XSingleton<XClientNetwork>.singleton.Send(ptcC2G_BattleLogReport);
			XStaticSecurityStatistics._KeyList = null;
			XStaticSecurityStatistics._ValueList = null;
		}

		private static void _SendBattleFinishMainData()
		{
			XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
			XSecurityStatistics securityStatistics = xplayerData.SecurityStatistics;
			bool flag = securityStatistics == null;
			if (!flag)
			{
				PtcC2G_BattleLogReport ptcC2G_BattleLogReport = new PtcC2G_BattleLogReport();
				ptcC2G_BattleLogReport.Data.roleid = xplayerData.RoleID;
				XStaticSecurityStatistics._KeyList = ptcC2G_BattleLogReport.Data.key;
				XStaticSecurityStatistics._ValueList = ptcC2G_BattleLogReport.Data.value;
				ptcC2G_BattleLogReport.Data.type = 2u;
				XStaticSecurityStatistics.Append("ClientEndTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
				XBattleSkillDocument specificDocument = XDocuments.GetSpecificDocument<XBattleSkillDocument>(XBattleSkillDocument.uuID);
				int num = 0;
				while ((long)num < (long)((ulong)XBattleSkillDocument.Total_skill_slot))
				{
					XStaticSecurityStatistics.Append("ButtonClickCount" + (num + 1), specificDocument.GetSlotClicked(num));
					num++;
				}
				bool syncMode = XSingleton<XGame>.singleton.SyncMode;
				if (syncMode)
				{
					bool flag2 = securityStatistics.AttributeStatistics != null;
					if (flag2)
					{
						securityStatistics.AttributeStatistics.SendPlayerInitData();
					}
				}
				else
				{
					XStaticSecurityStatistics.Append("PlayerInitHP", securityStatistics._InitHp);
					XStaticSecurityStatistics.Append("PlayerInitMP", securityStatistics._InitMp);
					XStaticSecurityStatistics.Append("PlayerEndHP", securityStatistics._FinalHp);
					XStaticSecurityStatistics.Append("PlayerEndMP", securityStatistics._FinalMp);
					XStaticSecurityStatistics.Append("MoveTotal", securityStatistics._Distance);
					bool flag3 = securityStatistics.AttributeStatistics != null;
					if (flag3)
					{
						securityStatistics.AttributeStatistics.SendData();
					}
					bool flag4 = securityStatistics.DamageStatistics != null;
					if (flag4)
					{
						XSecurityDamageInfo.SendPlayerData(securityStatistics.DamageStatistics);
					}
					bool flag5 = securityStatistics.SkillStatistics != null;
					if (flag5)
					{
						XSecuritySkillInfo.SendPlayerData(XSingleton<XEntityMgr>.singleton.Player, securityStatistics.SkillStatistics);
					}
					XSecurityHPInfo.SendData(XStaticSecurityStatistics._BossHPInfo, "Boss");
					XSecurityHPInfo.SendData(XStaticSecurityStatistics._MonsterHPInfo, "Monster");
					XSecurityDamageInfo.SendEnemyData(XStaticSecurityStatistics._BossDamageInfo, "Boss");
					XSecurityDamageInfo.SendEnemyData(XStaticSecurityStatistics._MonsterDamageInfo, "Monster");
					XSecurityAIInfo.SendBossData(XStaticSecurityStatistics._BossAIInfo, "Boss");
					XSecurityAIInfo.SendEnemyData(XStaticSecurityStatistics._MonsterAIInfo, "Monster");
					XStaticSecurityStatistics.Append("BossMoveTotal", XStaticSecurityStatistics._BossMoveDistance);
					XStaticSecurityStatistics.Append("MonsterMoveTotal", XStaticSecurityStatistics._MonsterMoveDistance);
					XSingleton<XLevelStatistics>.singleton.SendData();
				}
				XSingleton<XClientNetwork>.singleton.Send(ptcC2G_BattleLogReport);
				XStaticSecurityStatistics._KeyList = null;
				XStaticSecurityStatistics._ValueList = null;
			}
		}

		private static void _SendBattleFinishOtherData()
		{
			bool syncMode = XSingleton<XGame>.singleton.SyncMode;
			if (!syncMode)
			{
				XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
				XSecurityStatistics securityStatistics = xplayerData.SecurityStatistics;
				bool flag = securityStatistics == null;
				if (!flag)
				{
					PtcC2G_BattleLogReport ptcC2G_BattleLogReport = new PtcC2G_BattleLogReport();
					ptcC2G_BattleLogReport.Data.roleid = xplayerData.RoleID;
					XStaticSecurityStatistics._KeyList = ptcC2G_BattleLogReport.Data.key;
					XStaticSecurityStatistics._ValueList = ptcC2G_BattleLogReport.Data.value;
					ptcC2G_BattleLogReport.Data.type = 3u;
					XSecurityBuffInfo.SendPlayerData(securityStatistics.BuffStatistics);
					XSingleton<XClientNetwork>.singleton.Send(ptcC2G_BattleLogReport);
					XStaticSecurityStatistics._KeyList = null;
					XStaticSecurityStatistics._ValueList = null;
				}
			}
		}
	}
}