summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XCombatStatisticsInfo.cs
blob: 790bcb65c402e961c33b0e191db313e6eefe19b0 (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
using System;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XCombatStatisticsInfo : XDataBase, IComparable<XCombatStatisticsInfo>
	{
		public uint id;

		public string name;

		public int count;

		public double value;

		public float percent;

		public void CutName()
		{
			bool flag = this.name != null && this.name.Length > 5;
			if (flag)
			{
				this.name = this.name.Substring(0, 4) + "..";
			}
		}

		public bool Set(XSecuritySkillInfo.SkillInfo skillInfo, XEntity entity, XSecuritySkillInfo.SkillInfo resetInfo)
		{
			return this.Set(skillInfo._SkillID, skillInfo._CastCount, (double)skillInfo._AttackTotal, entity, resetInfo);
		}

		public bool Set(uint _id, int _count, double _value, XEntity entity, XSecuritySkillInfo.SkillInfo resetInfo)
		{
			this.id = _id;
			this.value = _value;
			this.count = _count;
			bool flag = resetInfo != null && resetInfo._SkillID == this.id;
			if (flag)
			{
				this.value -= (double)resetInfo._AttackTotal;
				this.count -= resetInfo._CastCount;
			}
			bool flag2 = this.value < 0.0010000000474974513;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				uint preSkill = XSingleton<XSkillEffectMgr>.singleton.GetPreSkill(this.id, entity.SkillCasterTypeID);
				bool flag3 = preSkill > 0u;
				if (flag3)
				{
					this.id = preSkill;
				}
				SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(this.id, 1u, entity.SkillCasterTypeID);
				bool flag4 = skillConfig != null;
				if (flag4)
				{
					this.name = skillConfig.ScriptName;
				}
				this.CutName();
				result = true;
			}
			return result;
		}

		public bool Set(XSecurityMobInfo.MobInfo mobInfo, XEntity entity, XSecurityMobInfo.MobInfo resetInfo)
		{
			return this.Set(mobInfo._TemplateID, mobInfo._CastCount, (double)mobInfo._AttackTotal, entity, resetInfo);
		}

		public bool Set(uint _id, int _count, double _value, XEntity entity, XSecurityMobInfo.MobInfo resetInfo)
		{
			this.id = _id;
			this.value = _value;
			this.count = _count;
			bool flag = resetInfo != null && resetInfo._TemplateID == this.id;
			if (flag)
			{
				this.value -= (double)resetInfo._AttackTotal;
				this.count -= resetInfo._CastCount;
			}
			bool flag2 = this.value < 0.0010000000474974513;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				XEntityStatistics.RowData byID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this.id);
				bool flag3 = byID != null;
				if (flag3)
				{
					this.name = byID.Name;
				}
				this.CutName();
				result = true;
			}
			return result;
		}

		public void MergeValue(XCombatStatisticsInfo other)
		{
			this.value += other.value;
		}

		public int CompareTo(XCombatStatisticsInfo other)
		{
			int num = -this.value.CompareTo(other.value);
			bool flag = num == 0;
			if (flag)
			{
				num = -this.count.CompareTo(other.count);
			}
			bool flag2 = num == 0;
			if (flag2)
			{
				num = this.id.CompareTo(other.id);
			}
			return num;
		}

		public override void Init()
		{
			base.Init();
			this.id = 0u;
			this.name = string.Empty;
			this.count = 0;
			this.value = 0.0;
			this.percent = 0f;
		}

		public override void Recycle()
		{
			base.Recycle();
			XDataPool<XCombatStatisticsInfo>.Recycle(this);
		}
	}
}