-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataSkillEff.cs
754 lines (672 loc) · 15.3 KB
/
DataSkillEff.cs
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
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
using System;
using System.Collections;
public class DataSkillEff
{
public long timeRemove;
public static mHashtable ALL_DATA_SKILL_EFF = new mHashtable();
public MyVector listFrame = new MyVector();
public MyVector listAnima = new MyVector();
public SmallImage[] smallImage;
public sbyte[][] frameChar = new sbyte[4][];
public sbyte[] sequence;
public sbyte Frame;
public sbyte f;
public bool IsStop;
public MyVector mst = new MyVector();
public static sbyte TYPE_EFFECT_END = 0;
public static sbyte TYPE_EFFECT_STARTSKILL = 1;
public static sbyte TYPE_EFFECT_BUFF = 2;
private int loop;
public int[] arrDame;
public sbyte leavelPaint;
public short x;
public short y;
public bool isLoadData;
public short idEff;
public bool canremove;
public bool canActorMove;
public bool canPaintActor;
public bool canActorFight;
public static sbyte ACTOR_NORMAL = 0;
public static sbyte ACTOR_CAN_NOT_MOVE = 1;
public static sbyte ACTOR_CAN_NOT_PAINT = 2;
public sbyte typeupdate;
public sbyte[] indexSplash = new sbyte[4];
public const sbyte NORMAL = 0;
public const sbyte REMOVE_BY_FRAME = 1;
public const sbyte REMOVE_BY_TIME = 2;
public const sbyte NO_REMOVE = 3;
private bool isHorse;
public bool isAddEffect;
public bool isHead;
public sbyte[] ActionStand;
public sbyte[] ActionMove;
public sbyte[] ActionJum;
public sbyte[] ActionFall;
public sbyte[] FrameChar;
public sbyte nHorseFrame;
public sbyte dxHorse;
public sbyte dyHorse;
private MyVector v1 = new MyVector();
private MyVector v2 = new MyVector();
private MyVector v3 = new MyVector();
private MyVector v4 = new MyVector();
private MyVector v5 = new MyVector();
public MyVector vecmySkil = new MyVector();
public long timelive;
public long timeWait;
public int miliSecondWait;
public bool wantDetroy;
public bool wait;
public int fw;
public int fh;
public DataSkillEff()
{
}
public DataSkillEff(short id, bool isEff)
{
idEff = id;
isHorse = isEff;
loadnew(null);
}
public DataSkillEff(short id, long timelive, int miliSecondWait, bool isHead)
{
idEff = id;
this.timelive = timelive;
this.miliSecondWait = miliSecondWait;
this.isHead = isHead;
loadnew(null);
switch (timelive)
{
case -1L:
typeupdate = 3;
break;
case 0L:
typeupdate = 1;
break;
default:
this.timelive += mSystem.currentTimeMillis();
typeupdate = 2;
break;
}
}
public DataSkillEff(sbyte[] array)
{
loadData(array);
}
public void loadnew(sbyte[] array)
{
try
{
if (array == null || array.Length == 0)
{
EffectData effectData = (EffectData)GameData.listbyteData.get(string.Empty + (idEff + GameData.ID_START_SKILL));
if (effectData != null && effectData.data != null)
{
array = effectData.data;
}
if (effectData == null)
{
effectData = new EffectData((short)(idEff + GameData.ID_START_SKILL));
GameData.listbyteData.put(string.Empty + (idEff + GameData.ID_START_SKILL), effectData);
Service.gI().doGetByteData(idEff + GameData.ID_START_SKILL);
effectData.timeremove = (int)(mSystem.currentTimeMillis() / 1000);
}
}
if (array != null && array.Length != 0)
{
loadData(array);
}
}
catch (Exception)
{
}
}
public void loadData(sbyte[] array)
{
if (array == null)
{
return;
}
DataInputStream dataInputStream = null;
try
{
bool flag = true;
listFrame.removeAllElements();
smallImage = null;
dataInputStream = new DataInputStream(array);
int num = dataInputStream.readByte();
smallImage = new SmallImage[num];
for (int i = 0; i < num; i++)
{
smallImage[i] = new SmallImage(dataInputStream.readUnsignedByte(), dataInputStream.readUnsignedByte(), dataInputStream.readUnsignedByte(), dataInputStream.readUnsignedByte(), dataInputStream.readUnsignedByte());
}
int num2 = 0;
int num3 = dataInputStream.readShort();
for (int j = 0; j < num3; j++)
{
sbyte b = dataInputStream.readByte();
MyVector myVector = new MyVector();
MyVector myVector2 = new MyVector();
for (int k = 0; k < b; k++)
{
PartFrame partFrame = new PartFrame(dataInputStream.readShort(), dataInputStream.readShort(), dataInputStream.readByte());
if (flag)
{
partFrame.flip = dataInputStream.readByte();
partFrame.onTop = dataInputStream.readByte();
}
if (partFrame.onTop == 0)
{
myVector.addElement(partFrame);
}
else
{
myVector2.addElement(partFrame);
}
if (num2 < Res.abs(partFrame.dy))
{
num2 = Res.abs(partFrame.dy);
}
}
listFrame.addElement(new FrameEff(myVector, myVector2));
}
fw = smallImage[0].w;
fh = (short)num2;
short num4 = 0;
num4 = ((!flag) ? dataInputStream.readShort() : ((short)dataInputStream.readUnsignedByte()));
sequence = new sbyte[num4];
int num5 = 0;
for (int l = 0; l < num4; l++)
{
sequence[l] = (sbyte)dataInputStream.readShort();
if (isHorse)
{
if (num5 == 2 && sequence[l] != -1)
{
v1.addElement(sequence[l] + string.Empty);
}
if (num5 == 3 && sequence[l] != -1)
{
v2.addElement(sequence[l] + string.Empty);
}
if (num5 == 4 && sequence[l] != -1)
{
v3.addElement(sequence[l] + string.Empty);
}
if (num5 == 5 && sequence[l] != -1)
{
v4.addElement(sequence[l] + string.Empty);
}
if (num5 == 6 && sequence[l] != -1)
{
v5.addElement(sequence[l] + string.Empty);
}
if (sequence[l] == -1)
{
num5++;
}
}
}
if (isHorse)
{
nHorseFrame = sequence[0];
dxHorse = sequence[2];
dyHorse = sequence[3];
FrameChar = vector2arr(v1);
ActionStand = vector2arr(v2);
ActionMove = vector2arr(v3);
ActionJum = vector2arr(v4);
ActionFall = vector2arr(v5);
v1.removeAllElements();
v2.removeAllElements();
v3.removeAllElements();
v4.removeAllElements();
v5.removeAllElements();
}
if (flag)
{
dataInputStream.readByte();
num4 = dataInputStream.readByte();
frameChar[0] = new sbyte[num4];
for (int m = 0; m < num4; m++)
{
frameChar[0][m] = dataInputStream.readByte();
}
num4 = dataInputStream.readByte();
frameChar[1] = new sbyte[num4];
for (int n = 0; n < num4; n++)
{
frameChar[1][n] = dataInputStream.readByte();
}
num4 = dataInputStream.readByte();
frameChar[3] = new sbyte[num4];
for (int num6 = 0; num6 < num4; num6++)
{
frameChar[3][num6] = dataInputStream.readByte();
}
}
isLoadData = true;
try
{
indexSplash[0] = (sbyte)(frameChar[0].Length - 7);
indexSplash[1] = (sbyte)(frameChar[1].Length - 7);
indexSplash[2] = (sbyte)(frameChar[3].Length - 7);
indexSplash[3] = (sbyte)(frameChar[3].Length - 7);
}
catch (Exception)
{
}
indexSplash[0] = dataInputStream.readByte();
indexSplash[1] = dataInputStream.readByte();
indexSplash[2] = dataInputStream.readByte();
indexSplash[3] = indexSplash[2];
}
catch (Exception)
{
}
finally
{
try
{
dataInputStream.close();
}
catch (Exception)
{
}
}
}
public static void checkremove()
{
try
{
IDictionaryEnumerator enumerator = GameData.listbyteData.GetEnumerator();
MyVector myVector = new MyVector();
while (enumerator.MoveNext())
{
string text = enumerator.Key.ToString();
EffectData effectData = (EffectData)GameData.listbyteData.get(text);
if (mSystem.currentTimeMillis() / 1000 - effectData.timeremove > 60)
{
myVector.addElement(text);
}
}
for (int i = 0; i < myVector.size(); i++)
{
string k = (string)myVector.elementAt(i);
GameData.listbyteData.remove(k);
}
}
catch (Exception)
{
}
}
public sbyte[] vector2arr(MyVector vec)
{
sbyte[] array = null;
array = new sbyte[vec.size()];
for (int i = 0; i < array.Length; i++)
{
array[i] = sbyte.Parse((string)vec.elementAt(i));
}
return array;
}
public void setTypeEff(long timelive)
{
switch (timelive)
{
case -1L:
typeupdate = 3;
break;
case 0L:
typeupdate = 1;
break;
default:
typeupdate = 2;
break;
}
}
public void setInfodata(EffectData dinfo)
{
if (dinfo != null && dinfo.isLoad)
{
listFrame = dinfo.listFrame;
smallImage = dinfo.smallImage;
fw = dinfo.fw;
fh = dinfo.fh;
sequence = dinfo.sequence;
indexSplash = dinfo.indexStartSkill;
frameChar = dinfo.frameChar;
isLoadData = dinfo.isLoad;
}
}
public bool isHavedata()
{
if (isLoadData)
{
return true;
}
loadnew(null);
return false;
}
public void paintBottomEff_new(mGraphics g, int x, int y, int Frame, int rotale)
{
if (!isHavedata() || Frame >= listFrame.size())
{
return;
}
FrameEff frameEff = (FrameEff)listFrame.elementAt(Frame);
try
{
MyVector listPartBottom = frameEff.listPartBottom;
for (int i = 0; i < listPartBottom.size(); i++)
{
PartFrame partFrame = (PartFrame)listPartBottom.elementAt(i);
SmallImage smallImage = this.smallImage[partFrame.idSmallImg];
ImageIcon imgIcon = GameData.getImgIcon((short)(idEff + GameData.ID_START_SKILL));
if (imgIcon != null && imgIcon.img != null)
{
int num = partFrame.dx;
int num2 = smallImage.w;
int num3 = smallImage.h;
int num4 = smallImage.x;
int num5 = smallImage.y;
int width = imgIcon.img.getWidth();
int height = imgIcon.img.getHeight();
if (num4 > width)
{
num4 = 0;
}
if (num5 > height)
{
num5 = 0;
}
if (num4 + num2 > width)
{
num2 = width - num4;
}
if (num5 + num3 > height)
{
num3 = height - num5;
}
int num6 = ((partFrame.flip == 1) ? 2 : 0);
if (rotale == 2 || rotale == 6)
{
num6 = ((num6 != 2) ? 2 : 0);
num = -(num + num2);
}
g.drawRegion(imgIcon.img, num4, num5, num2, num3, num6, x + num, y + partFrame.dy, 0);
}
}
}
catch (Exception)
{
}
}
public void paintTopEff_new(mGraphics g, int x, int y, int Frame, int rotale)
{
if (!isHavedata() || Frame >= listFrame.size())
{
return;
}
FrameEff frameEff = (FrameEff)listFrame.elementAt(Frame);
try
{
MyVector listPartTop = frameEff.listPartTop;
for (int i = 0; i < listPartTop.size(); i++)
{
PartFrame partFrame = (PartFrame)listPartTop.elementAt(i);
SmallImage smallImage = this.smallImage[partFrame.idSmallImg];
ImageIcon imgIcon = GameData.getImgIcon((short)(idEff + GameData.ID_START_SKILL));
if (imgIcon != null && imgIcon.img != null)
{
int num = partFrame.dx;
int num2 = smallImage.w;
int num3 = smallImage.h;
int num4 = smallImage.x;
int num5 = smallImage.y;
int width = imgIcon.img.getWidth();
int height = imgIcon.img.getHeight();
if (num4 > width)
{
num4 = 0;
}
if (num5 > height)
{
num5 = 0;
}
if (num4 + num2 > width)
{
num2 = width - num4;
}
if (num5 + num3 > height)
{
num3 = height - num5;
}
int num6 = ((partFrame.flip == 1) ? 2 : 0);
if (rotale == 2 || rotale == 6)
{
num6 = ((num6 != 2) ? 2 : 0);
num = -(num + num2);
}
g.drawRegion(imgIcon.img, num4, num5, num2, num3, num6, x + num, y + partFrame.dy, 0);
}
}
}
catch (Exception)
{
}
}
public void paintTopEff(mGraphics g, int x, int y)
{
try
{
if (!isHavedata() || wait || Frame >= listFrame.size())
{
return;
}
FrameEff frameEff = (FrameEff)listFrame.elementAt(Frame);
MyVector listPartTop = frameEff.listPartTop;
for (int i = 0; i < listPartTop.size(); i++)
{
PartFrame partFrame = (PartFrame)listPartTop.elementAt(i);
SmallImage smallImage = this.smallImage[partFrame.idSmallImg];
ImageIcon imgIcon = GameData.getImgIcon((short)(idEff + GameData.ID_START_SKILL));
if (imgIcon != null && imgIcon.img != null)
{
int dx = partFrame.dx;
int num = smallImage.w;
int num2 = smallImage.h;
int num3 = smallImage.x;
int num4 = smallImage.y;
if (num3 > imgIcon.img.getWidth())
{
num3 = 0;
}
if (num4 > imgIcon.img.getHeight())
{
num4 = 0;
}
if (num3 + num > imgIcon.img.getWidth())
{
num = imgIcon.img.getWidth() - num3;
}
if (num4 + num2 > imgIcon.img.getHeight())
{
num2 = imgIcon.img.getHeight() - num4;
}
g.drawRegion(imgIcon.img, num3, num4, num, num2, (partFrame.flip == 1) ? 2 : 0, x + dx, y + partFrame.dy, 0);
}
}
}
catch (Exception)
{
}
}
public void paintBottomEff(mGraphics g, int x, int y)
{
try
{
if (!isHavedata() || wait || Frame >= listFrame.size())
{
return;
}
FrameEff frameEff = (FrameEff)listFrame.elementAt(Frame);
MyVector listPartBottom = frameEff.listPartBottom;
for (int i = 0; i < listPartBottom.size(); i++)
{
PartFrame partFrame = (PartFrame)listPartBottom.elementAt(i);
SmallImage smallImage = this.smallImage[partFrame.idSmallImg];
ImageIcon imgIcon = GameData.getImgIcon((short)(idEff + GameData.ID_START_SKILL));
if (imgIcon != null && imgIcon.img != null)
{
int dx = partFrame.dx;
int num = smallImage.w;
int num2 = smallImage.h;
int num3 = smallImage.x;
int num4 = smallImage.y;
if (num3 > imgIcon.img.getWidth())
{
num3 = 0;
}
if (num4 > imgIcon.img.getHeight())
{
num4 = 0;
}
if (num3 + num > imgIcon.img.getWidth())
{
num = imgIcon.img.getWidth() - num3;
}
if (num4 + num2 > imgIcon.img.getHeight())
{
num2 = imgIcon.img.getHeight() - num4;
}
g.drawRegion(imgIcon.img, num3, num4, num, num2, (partFrame.flip == 1) ? 2 : 0, x + dx, y + partFrame.dy, 0);
}
}
}
catch (Exception)
{
}
}
public void setFrame(int fr)
{
Frame = (sbyte)fr;
}
private void setWait(bool iss)
{
if (miliSecondWait > 0)
{
wait = iss;
if (wait)
{
timeWait = mSystem.currentTimeMillis() + miliSecondWait;
}
}
else
{
wait = false;
}
}
public void updateEffCharDie()
{
if (isLoadData)
{
if (f < sequence.Length)
{
f++;
}
if (f > sequence.Length - 1)
{
f = (sbyte)(sequence.Length - 1);
}
Frame = sequence[f];
}
}
public void setLoop(int loop)
{
this.loop = loop;
}
public void update()
{
if (listFrame.size() <= 0)
{
return;
}
try
{
if (!wait)
{
switch (typeupdate)
{
case 0:
f++;
if (f > sequence.Length)
{
if (!canremove)
{
wantDetroy = true;
}
f = 0;
}
Frame = sequence[f];
break;
case 1:
f++;
if (f > sequence.Length)
{
f = 0;
wantDetroy = true;
}
Frame = sequence[f];
break;
case 2:
f++;
if (f == (sbyte)(sequence.Length - 1) && timelive - mSystem.currentTimeMillis() < 0)
{
wantDetroy = true;
}
if (f > sequence.Length)
{
f = 0;
setWait(iss: true);
}
Frame = sequence[f];
break;
case 3:
f++;
if (f > sequence.Length)
{
f = 0;
setWait(iss: true);
}
Frame = sequence[f];
break;
}
}
else if (timeWait - mSystem.currentTimeMillis() < 0)
{
setWait(iss: false);
}
}
catch (Exception)
{
}
}
public int getWidth()
{
return fw;
}
public int getHeight()
{
return fh;
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
}