blob: d2e49c6dc9ec379672eb13cf1978e55068424f85 (
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
|
using System;
using System.Collections.Generic;
namespace XMainClient
{
internal class XSecurityMobInfo
{
public List<XSecurityMobInfo.MobInfo> MobInfoList
{
get
{
return this._MobInfosList;
}
}
private List<XSecurityMobInfo.MobInfo> _MobInfosList = new List<XSecurityMobInfo.MobInfo>();
private Dictionary<uint, XSecurityMobInfo.MobInfo> _MobInfos = new Dictionary<uint, XSecurityMobInfo.MobInfo>();
public class MobInfo : XDataBase
{
public uint _TemplateID;
public int _CastCount;
public float _AttackTotal;
public void Reset()
{
this._TemplateID = 0u;
this._CastCount = 0;
this._AttackTotal = 0f;
}
public void Merge(XSecurityMobInfo.MobInfo other)
{
bool flag = other == null;
if (!flag)
{
this._AttackTotal += other._AttackTotal;
this._CastCount += other._CastCount;
}
}
public override void Init()
{
base.Init();
this.Reset();
}
public override void Recycle()
{
base.Recycle();
XDataPool<XSecurityMobInfo.MobInfo>.Recycle(this);
}
}
private XSecurityMobInfo.MobInfo _TryGetMobInfo(uint templateID)
{
XSecurityMobInfo.MobInfo data;
bool flag = !this._MobInfos.TryGetValue(templateID, out data);
if (flag)
{
data = XDataPool<XSecurityMobInfo.MobInfo>.GetData();
data._TemplateID = templateID;
this._MobInfosList.Add(data);
this._MobInfos.Add(templateID, data);
}
return data;
}
public void Reset()
{
for (int i = 0; i < this._MobInfosList.Count; i++)
{
this._MobInfosList[i].Recycle();
}
this._MobInfosList.Clear();
this._MobInfos.Clear();
}
public void Merge(XSecurityMobInfo other)
{
for (int i = 0; i < other._MobInfosList.Count; i++)
{
XSecurityMobInfo.MobInfo mobInfo = this._TryGetMobInfo(other._MobInfosList[i]._TemplateID);
mobInfo.Merge(other._MobInfosList[i]);
}
}
public void OnCast(uint templateID, int count)
{
XSecurityMobInfo.MobInfo mobInfo = this._TryGetMobInfo(templateID);
mobInfo._CastCount += count;
}
public void OnCastDamage(uint templateID, double value)
{
XSecurityMobInfo.MobInfo mobInfo = this._TryGetMobInfo(templateID);
mobInfo._AttackTotal += (float)value;
}
public void Append(XEntity entity)
{
XSecurityStatistics xsecurityStatistics = XSecurityStatistics.TryGetStatistics(entity);
bool flag = xsecurityStatistics == null || !xsecurityStatistics.bValid;
if (!flag)
{
XSecurityMobInfo.MobInfo mobInfo = this._TryGetMobInfo(entity.TypeID);
mobInfo._CastCount++;
mobInfo._AttackTotal += xsecurityStatistics.DamageStatistics._AttackTotal;
}
}
public XSecurityMobInfo.MobInfo GetMobInfoByID(uint templateID)
{
XSecurityMobInfo.MobInfo result;
this._MobInfos.TryGetValue(templateID, out result);
return result;
}
public static XSecurityMobInfo TryGetStatistics(XEntity entity)
{
XSecurityStatistics xsecurityStatistics = XSecurityStatistics.TryGetStatistics(entity);
bool flag = xsecurityStatistics == null;
XSecurityMobInfo result;
if (flag)
{
result = null;
}
else
{
result = xsecurityStatistics.MobStatistics;
}
return result;
}
}
}
|