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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
|
using System;
using System.Collections.Generic;
using XUtliPoolLib;
namespace XMainClient
{
internal sealed class XSkillMgr
{
public int SkillCount
{
get
{
return this._core.Count;
}
}
public static XSkillMgr.XQTEInfo[] QTEBuffer;
public static int MaxQTECount = 4;
private XEntity _host = null;
private SmallBuffer<uint> _physicals;
private SmallBuffer<object> _carriers;
private SmallBuffer<object> _core;
private Dictionary<uint, XSkillCore> _coreDic = new Dictionary<uint, XSkillCore>();
public SmallBuffer<object> SkillOrder;
private uint _physical = 0u;
private uint _ultra = 0u;
private uint _appear = 0u;
private uint _disappear = 0u;
private uint _dash = 0u;
private uint _recovery = 0u;
private uint _broken = 0u;
internal struct XQTEInfo
{
public int key;
public uint skill;
public XQTEInfo(int rkey, uint rskill)
{
this.key = rkey;
this.skill = rskill;
}
public void Empty()
{
this.key = 0;
this.skill = 0u;
}
}
public XSkillMgr(XEntity entity)
{
this.Initialize(entity);
}
public XSkillCore GetSkillCore(int index)
{
return this._core[index] as XSkillCore;
}
private bool TryGetSkillCore(uint id, out XSkillCore s)
{
return this._coreDic.TryGetValue(id, out s);
}
private bool ContainSkillCore(uint id)
{
return this._coreDic.ContainsKey(id);
}
public void Initialize(XEntity entity)
{
this._host = entity;
this._physicals.debugName = "XSkillMgr._physicals";
this._carriers.debugName = "XSkillMgr._carriers";
this.SkillOrder.debugName = "XSkillMgr.SkillOrder";
XSingleton<BufferPoolMgr>.singleton.GetSmallBuffer(ref this._physicals, 16, 0);
XSingleton<BufferPoolMgr>.singleton.GetSmallBuffer(ref this._carriers, 4, 0);
int i = 0;
int num = XSkillData.Skills.Length;
while (i < num)
{
this._carriers.Add(null);
i++;
}
XSingleton<BufferPoolMgr>.singleton.GetSmallBuffer(ref this._core, 16, 0);
XSingleton<BufferPoolMgr>.singleton.GetSmallBuffer(ref this.SkillOrder, 16, 0);
}
public void Uninitialize()
{
XSingleton<BufferPoolMgr>.singleton.ReturnSmallBuffer(ref this._physicals);
XSingleton<BufferPoolMgr>.singleton.ReturnSmallBuffer(ref this.SkillOrder);
int i = 0;
int count = this._carriers.Count;
while (i < count)
{
XSkill xskill = this._carriers[i] as XSkill;
bool flag = xskill != null;
if (flag)
{
xskill.Uninitialize();
XSingleton<XSkillFactory>.singleton.ReturnSkill(xskill);
}
i++;
}
this._carriers.Clear();
int j = 0;
int count2 = this._core.Count;
while (j < count2)
{
XSkillCore xskillCore = this._core[j] as XSkillCore;
bool flag2 = xskillCore != null;
if (flag2)
{
XSingleton<XSkillFactory>.singleton.Release(xskillCore);
}
j++;
}
this._core.Clear();
this._coreDic.Clear();
this._physical = 0u;
this._ultra = 0u;
this._appear = 0u;
this._disappear = 0u;
this._dash = 0u;
this._recovery = 0u;
this._broken = 0u;
}
public void AttachPhysicalSkill(XSkillCore core)
{
this._physical = core.ID;
this.AttachSkill(core, true);
}
public void AttachAppearSkill(XSkillCore core)
{
this._appear = core.ID;
this.AttachSkill(core, false);
}
public void AttachDisappearSkill(XSkillCore core)
{
this._disappear = core.ID;
this.AttachSkill(core, false);
}
public void AttachUltraSkill(XSkillCore core)
{
this._ultra = core.ID;
this.AttachSkill(core, true);
}
public void AttachRecoverySkill(XSkillCore core)
{
this._recovery = core.ID;
this.AttachSkill(core, false);
}
public void AttachBrokenSkill(XSkillCore core)
{
this._broken = core.ID;
this.AttachSkill(core, false);
}
public void AttachDashSkill(XSkillCore core)
{
this._dash = core.ID;
this.AttachSkill(core, true);
}
public void AttachSkill(XSkillCore core, bool inorder = true)
{
bool flag = !this.ContainSkillCore(core.ID);
if (flag)
{
bool flag2 = this._host.Attributes != null;
if (flag2)
{
bool flag3 = core.Level > 0u;
if (flag3)
{
this.SkillBuildIn(core, inorder);
}
else
{
bool preLoad = XSkillData.PreLoad;
XSkillData.PreLoad = false;
bool isSkillReplaced = this._host.Skill.IsSkillReplaced;
if (isSkillReplaced)
{
this.SkillBuildIn(core, inorder);
}
XSkillData.PreLoad = preLoad;
}
}
else
{
this._core.Add(core);
this._coreDic.Add(core.ID, core);
bool flag4 = core.Soul.TypeToken == 3;
if (flag4)
{
for (int i = 0; i < core.Soul.Combined.Count; i++)
{
XSkillCore xskillCore = XSingleton<XSkillFactory>.singleton.Build(this._host.IsTransform ? this._host.Transformer.Present.SkillPrefix : this._host.Present.SkillPrefix, core.Soul.Combined[i].Name, this._host);
bool flag5 = !this.ContainSkillCore(xskillCore.ID);
if (flag5)
{
this._core.Add(xskillCore);
this._coreDic.Add(xskillCore.ID, xskillCore);
}
}
}
bool flag6 = core.Soul.TypeToken < this._carriers.Count;
if (flag6)
{
bool flag7 = this._carriers[core.Soul.TypeToken] == null;
if (flag7)
{
this._carriers[core.Soul.TypeToken] = XSingleton<XSkillFactory>.singleton.CreateSkill(this._host, core.Soul.TypeToken);
}
}
}
}
}
public void DetachSkill(uint id)
{
XSkillCore item = null;
bool flag = this.TryGetSkillCore(id, out item);
if (flag)
{
bool flag2 = id == this._physical;
if (flag2)
{
this._physical = 0u;
}
bool flag3 = id == this._ultra;
if (flag3)
{
this._ultra = 0u;
}
bool flag4 = id == this._appear;
if (flag4)
{
this._appear = 0u;
}
bool flag5 = id == this._disappear;
if (flag5)
{
this._disappear = 0u;
}
this.SkillOrder.Remove(item);
this._core.Remove(id);
this._coreDic.Remove(id);
this._physicals.Remove(id);
}
}
public XSkill GetCarrier(int id)
{
XSkill xskill = null;
bool flag = id < this._carriers.Count;
if (flag)
{
xskill = (this._carriers[id] as XSkill);
bool flag2 = xskill == null;
if (flag2)
{
xskill = XSingleton<XSkillFactory>.singleton.CreateSkill(this._host, id);
this._carriers[id] = xskill;
}
}
bool flag3 = xskill == null;
if (flag3)
{
XSingleton<XDebug>.singleton.AddErrorLog("Invalid carrier id: ", id.ToString(), null, null, null, null);
}
return xskill;
}
public XSkillCore GetPhysicalSkill()
{
return this.GetSkill(this._physical);
}
public XSkillCore GetDashSkill()
{
return this.GetSkill(this._dash);
}
public XSkillCore GetSkill(uint id)
{
XSkillCore result = null;
this.TryGetSkillCore(id, out result);
return result;
}
public uint GetPhysicalIdentity()
{
return this._physical;
}
public bool IsPhysicalAttack(uint id)
{
return this._physicals.Contains(id);
}
public uint GetUltraIdentity()
{
return this._ultra;
}
public uint GetAppearIdentity()
{
return this._appear;
}
public uint GetDisappearIdentity()
{
return this._disappear;
}
public uint GetDashIdentity()
{
return this._dash;
}
public uint GetRecoveryIdentity()
{
return this._recovery;
}
public uint GetBrokenIdentity()
{
return this._broken;
}
public bool IsCooledDown(XSkillCore skill)
{
return skill.CooledDown;
}
public bool IsCooledDown(uint id)
{
return this.IsCooledDown(this.GetSkill(id));
}
public bool IsQTESkill(uint id)
{
XSkillCore skill = this.GetSkill(id);
return skill != null && skill.Soul.Logical.CanCastAt_QTE > 0;
}
public float GetCD(uint id)
{
XSkillCore skill = this.GetSkill(id);
return (skill != null) ? skill.GetCoolDown() : 0f;
}
public static float GetCD(XEntity entity, string name, uint skillLevel = 0u)
{
XSkillData data = XSingleton<XResourceLoaderMgr>.singleton.GetData<XSkillData>(XSingleton<XCommon>.singleton.StringCombine(entity.Present.SkillPrefix, name), ".txt");
data.Prefix = entity.Present.SkillPrefix;
uint skillHash = XSingleton<XCommon>.singleton.XHash(data.Name);
bool flag = skillLevel == 0u;
if (flag)
{
skillLevel = ((entity.Attributes == null) ? 1u : entity.Attributes.SkillLevelInfo.GetSkillLevel(XSingleton<XCommon>.singleton.XHash(data.Name)));
bool flag2 = skillLevel == 0u;
if (flag2)
{
skillLevel = 1u;
}
}
float num = (data != null) ? (XSingleton<XSkillEffectMgr>.singleton.GetSkillCDStaticRatio(skillHash, skillLevel, entity.SkillCasterTypeID, XSingleton<XScene>.singleton.IsPVPScene) * data.CoolDown) : 0f;
return entity.IsPlayer ? (num * XSingleton<XSkillEffectMgr>.singleton.GetSkillCDDynamicRatio(entity.Attributes, skillHash)) : num;
}
public void CoolDown(uint id)
{
XSkillCore skill = this.GetSkill(id);
bool flag = skill != null;
if (flag)
{
skill.CoolDown();
}
}
public void ResetStaticCD(uint id)
{
XSkillCore skill = this.GetSkill(id);
bool flag = skill != null;
if (flag)
{
skill.ResetStaticCD();
}
}
public void AccelerateStaticCD(uint id, float delta)
{
XSkillCore skill = this.GetSkill(id);
bool flag = skill != null;
if (flag)
{
skill.AccelerateStaticCD(delta);
}
}
public void Accelerate(uint id, float delta, bool ratio)
{
XSkillCore skill = this.GetSkill(id);
bool flag = skill != null;
if (flag)
{
skill.AccelerateCD(delta, ratio);
}
}
public float GetCastRangeUpper(uint id)
{
XSkillCore skill = this.GetSkill(id);
return skill.CastRangeUpper;
}
public float GetCastRangeLower(uint id)
{
XSkillCore skill = this.GetSkill(id);
return skill.CastRangeLower;
}
public float GetCastScope(uint id)
{
XSkillCore skill = this.GetSkill(id);
return skill.CastScope;
}
public float GetElapsedCD(uint id)
{
XSkillCore skill = this.GetSkill(id);
bool flag = skill == null;
float result;
if (flag)
{
result = 0f;
}
else
{
result = skill.GetElapsedCD();
}
return result;
}
public float GetMPCost(uint id)
{
float result = float.PositiveInfinity;
bool flag = this.GetSkill(id) != null;
if (flag)
{
XAttributes attributes = this._host.Attributes;
uint skillLevel = attributes.SkillLevelInfo.GetSkillLevel(id);
SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(id, skillLevel, this._host.SkillCasterTypeID);
bool flag2 = skillConfig != null;
if (flag2)
{
result = skillConfig.CostMP[0] + skillConfig.CostMP[1] * skillLevel;
}
}
return result;
}
public void StatisticsPhysicalSkill()
{
this._physicals.Clear();
XSkillCore xskillCore = this.GetPhysicalSkill();
while (xskillCore != null)
{
this._physicals.Add(xskillCore.ID);
bool flag = xskillCore.Soul.Logical.Association && !string.IsNullOrEmpty(xskillCore.Soul.Logical.Association_Skill);
if (flag)
{
this._physicals.Add(XSingleton<XCommon>.singleton.XHash(xskillCore.Soul.Logical.Association_Skill));
}
bool flag2 = xskillCore.Soul.Ja != null && xskillCore.Soul.Ja.Count > 0;
if (flag2)
{
uint num = XSingleton<XCommon>.singleton.XHash(xskillCore.Soul.Ja[0].Name);
bool flag3 = num > 0u;
if (flag3)
{
this._physicals.Add(num);
}
xskillCore = this.GetSkill(num);
}
else
{
xskillCore = null;
}
}
}
public int GetQTE(uint id, out XSkillMgr.XQTEInfo[] qteList)
{
bool flag = XSkillMgr.QTEBuffer == null;
if (flag)
{
XSkillMgr.QTEBuffer = new XSkillMgr.XQTEInfo[XSkillMgr.MaxQTECount];
}
qteList = XSkillMgr.QTEBuffer;
int num = 0;
int i = 0;
int count = this._core.Count;
while (i < count)
{
XSkillCore xskillCore = this._core[i] as XSkillCore;
bool flag2 = xskillCore != null && (1 << (int)id & xskillCore.Soul.Logical.CanCastAt_QTE) > 0;
if (flag2)
{
XSkillMgr.XQTEInfo xqteinfo = default(XSkillMgr.XQTEInfo);
xqteinfo.skill = xskillCore.ID;
xqteinfo.key = xskillCore.Soul.Logical.QTE_Key;
qteList[num++] = xqteinfo;
bool flag3 = num == 4;
if (flag3)
{
return num;
}
}
i++;
}
return num;
}
private void SkillBuildIn(XSkillCore core, bool inorder)
{
bool preLoad = XSkillData.PreLoad;
if (preLoad)
{
XSkillData.PreLoadSkillRes(core.Soul, 1);
}
this._core.Add(core);
this._coreDic.Add(core.ID, core);
if (inorder)
{
bool flag = core.ID != this._physical;
if (flag)
{
this.SkillOrder.Add(core);
}
}
bool flag2 = core.Soul.TypeToken == 3;
if (flag2)
{
for (int i = 0; i < core.Soul.Combined.Count; i++)
{
XSkillCore xskillCore = XSingleton<XSkillFactory>.singleton.Build(core.Soul.Prefix, core.Soul.Combined[i].Name, this._host);
bool flag3 = !this.ContainSkillCore(xskillCore.ID);
if (flag3)
{
bool preLoad2 = XSkillData.PreLoad;
if (preLoad2)
{
XSkillData.PreLoadSkillRes(xskillCore.Soul, 1);
}
this._core.Add(xskillCore);
this._coreDic.Add(xskillCore.ID, xskillCore);
}
}
}
bool flag4 = core.Soul.TypeToken < this._carriers.Count;
if (flag4)
{
bool flag5 = this._carriers[core.Soul.TypeToken] == null;
if (flag5)
{
this._carriers[core.Soul.TypeToken] = XSingleton<XSkillFactory>.singleton.CreateSkill(this._host, core.Soul.TypeToken);
}
}
}
}
}
|