-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
1729 lines (1600 loc) · 70.6 KB
/
index.js
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
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* SCRIPT BY YOUR MOM */
const DRMKEY = 0x8060800852A0;
'use strict'
//DONT TOUCH ANYTHING UNDER HERE =============================
const JOB_GUNNER =9;
const S_Blast = 11201; //C_START_SKILL
const S_Blast2 =11202;
const S_Blast_D = 1205;// 1190; //720;//1190 //fixed aspd 1
const S_Bomb_Channel = 20600; //charge fix speed 1
const S_Bomb_Cast = 20601; //C_START_INSTANCE_SKILL
const S_Bomb_D =3280;
const S_Scatter = 31101; //has chains (94) C_START_SKILL
const S_Scatter2 =31102;
const S_Scatter_D = 1730; //distance glyph
const S_PointB = 40801; //30 C_START_SKILL
const S_PointB2 =40802;
const S_PointB_2 =40803;
const S_PointB2_2 =40804;
const S_PointB_D =1525;
const S_PointB_2_D =1200;
const S_BurstPrime =51010;
const S_BurstPrime_D =880;
const S_BurstFire =51011;
const S_BurstFire_EX_Wind =51020;
const S_BurstFire_D_EX_Wind_D =800;
const S_BurstFire_EX =51021;
const S_BurstFire_D = 10; //120;
const S_BurstFire_D_EX = 150; //for special BF
const S_TimeBomb = 61101; //C_START_SKILL
const S_TimeBomb2 =61102;
const S_TimeBomb_D = 1000; //fixed speed 1
const S_AB = 71101; //C_START_SKILL C_START_INSTANCE_SKILLEx
const S_AB2 =71102;
const S_AB_2 =71103;
const S_AB2_2 =71104;
const S_AB_D =1500;
const S_AB_2_D = 1200; //first step fixed aspd
const S_Mana =91000;
const S_Mana2 =91010;
const S_Mana22 =91011;
const S_MM_Instant =91012;
const S_MM_Instant_2 =93112;
const S_Mana_D =1270;
const S_Mana_D2 =1270;
const S_Arc = 100901; //C_START_SKILL
const S_Arc2 =100902;
const S_Arc_D =1460;
const S_Rocket = 110801; //C_START_SKILL
const S_Rocket2 = 110802; //chain from rolling reload
const S_Rocket_D =1550;
const S_Balder = 130201; //C_START_SKILL
const S_Balder2 =130202;
const S_Balder_D = 5800; //fixed speed
const S_Reple = 151101; //C_START_SKILL
const S_Reple2 =151102;
const S_Reple_D = 1325; //fixed speed
const S_HB = 180701; //C_START_SKILL
const S_HB2 =180702;
const S_HB_D = 1430; //fixed speed
const S_ST = 190401; //C_START_SKILL
const S_ST2 =190402;
const S_ST_D =1460;
const S_Retal = 201000; //C_START_SKILL
const S_Retal_D =1590;
const S_CRecall = 210300; //C_NOTIMELINE_SKILL
const S_CRecall_D =480;
const S_ModWeapSys =410101;
const S_ModWeapSys_D =1585;
const S_Remote_Trigger =430101;
const S_Remote_Trigger1 =430103;
const S_Remote_Trigger2 =430131;
const S_Remote_Trigger22 =430151;
const S_Remote_Trigger_D =870;
const S_Remote_Trigger_D2 =1630;
const S_Obliterate =470101;
const S_Obliterate_D =5180;
//talent 81112001 + 1 + 1
const S_ArcaneBeam =420101;
const S_ArcaneBeam_D = 700; //715; //700;
const S_BalderEx =440101;
const S_BalderEx_2 =440130;
const S_BalderEx_D =5800;
const S_Reload =400101;
const S_Reload_EX =400102;
const S_Reload_D =950;
const BLACKLIST = [110100, 111110, 111111, 111112, 111113, 111114, 111115, 111116, 111117, 111118, 111119, 111120, 111121, 111122, 111124, 111125,
111126, 111127, 111128, 111129, 111130, 111131, 111134, 111135, 111139, 111140, 111143, 111144, 111145, 111190, 111191, 111193,
111194, 111195, 111197, 111199, 111202, 111203, 116001, 116002, 116003, 116004, 117002, 117003, 140100, 460100, 480100, 900001,
111136, 111137, 111138, 111141, 111142, 111147, 111149, 111150, 111151, 111152, 111153, 111154, 111155, 111156, 111157, 111158,
211141, 211150, 111123, 111132, 111133, 111146, 111148, 111192, 111196, 111198, 211145, 111159, 111160, 111161, 111162, 111163,
111164, 111165, 111166, 111168, 111169, 111170, 111171, 111172, 111173, 111174, 111175, 111176, 111177, 111178, 111179, 111180,
111204, 111205, 111206, 111207, 111208, 111209, 111210, 111211, 111212, 111214, 111215, 111216, 111217, 111218, 111219, 111220,
111221, 111222, 111223, 111224, 111225, 111226, 111227, 111228, 111229, 111230, 111231, 111232, 111233, 111234, 111235, 111236,
111237, 111238, 111239, 111241, 111242, 111243, 111244, 111245, 111246, 111247, 111248, 111249, 111250, 111251, 111252, 111253,
111254, 111255, 111256, 111257, 111258, 111259, 111260, 111261, 111262, 111263, 111264, 111265, 111266, 111267, 111268, 111269,
111270, 111271, 111272, 111273, 111274, 111275, 111276, 111277, 111278, 111279, 111280, 111281, 111282, 111283, 111284, 111285,
111286, 111287, 111288, 111289, 111290, 111291, 111292, 111293, 111294, 111295, 111296, 111297, 111298, 111299, 111301, 111302];
module.exports = function gunner(dispatch) {
let config = {};
let settingTimeout = null;
let settingLock = false;
const path = require('path');
const fs = require('fs');
try { config = require('./config.json'); }
catch (e) {
config = {};
settingUpdate();
}
function settingUpdate() {
clearTimeout(settingTimeout);
settingTimeout = setTimeout(settingSave,1000);
}
function settingSave() {
if (settingLock) {
settingUpdate();
return;
}
settingLock = false;
fs.writeFile(path.join(__dirname, 'config.json'), JSON.stringify(config, undefined, '\t'), err => {
settingLock = false;
});
}
//change GLOBAL_LATENCY to your lowest usual ping
let GLOBAL_LATENCY =0;
if (("GLOBAL_LATENCY" in config)) {
GLOBAL_LATENCY = config.GLOBAL_LATENCY;
}
if (!("GLOBAL_LATENCY" in config)) {
config.GLOBAL_LATENCY =0;
config.GLOBAL_LATENCY_DESCRIPTION = "change GLOBAL_LATENCY to your lowest usual ping";
settingUpdate();
}
let DISABLE_CHARGE = false;
if (("DISABLE_CHARGE" in config)) {
DISABLE_CHARGE = config.DISABLE_CHARGE;
}
if (!("DISABLE_CHARGE" in config)) {
config.DISABLE_CHARGE = false;
config.DISABLE_CHARGE_DESCRIPTION = "this will disable charge bar emulation, useful for people who have unstable net and prone to get stuck or server lagging badly";
config.DISABLE_CHARGE_DESCRIPTION_2 = "disabling charge actually does not significantly impact ping tax, because charge skills are actually not ping taxed if you simply release the skill early";
settingUpdate();
}
let SPOOF_GRANT = true;
if (("SPOOF_GRANT" in config)) {
SPOOF_GRANT = config.SPOOF_GRANT;
}
if (!("SPOOF_GRANT" in config)) {
config.SPOOF_GRANT = true;
config.SPOOF_GRANT_DESCRIPTION = "greatly speeds up charging skills, however may cause asynchronization with high jitter";
settingUpdate();
}
let ABNORMALITY_TOGGLE = true;
if (("ABNORMALITY_TOGGLE" in config)) {
ABNORMALITY_TOGGLE = config.ABNORMALITY_TOGGLE;
}
if (!("ABNORMALITY_TOGGLE" in config)) {
config.ABNORMALITY_TOGGLE = true;
config.ABNORMALITY_TOGGLE_DESCRIPTION = "set this to true will enable an experimental feature which will likely smooth your rotations";
settingUpdate();
}
let autoCancelState = false;
if (("autoCancelState" in config)) {
autoCancelState = config.autoCancelState;
}
if (!("autoCancelState" in config)) {
config.autoCancelState = false;
config.autoCancelState_DESCRIPTION = "ROBOTJS Options - DO NOT USE WITHOUT ROBOTJS - setting it to true will auto blast cancel almost everything";
settingUpdate();
}
let TBCancelState = false;
if (("TBCancelState" in config)) {
TBCancelState = config.TBCancelState;
}
if (!("TBCancelState" in config)) {
config.TBCancelState = false;
config.TBCancelState_DESCRIPTION = "ROBOTJS Options - DO NOT USE WITHOUT ROBOTJS - setting it to true will auto blast cancel Time Bomb only";
settingUpdate();
}
let BLAST_KEY = "4";
if (("BLAST_KEY" in config)) {
BLAST_KEY = config.BLAST_KEY;
}
if (!("BLAST_KEY" in config)) {
config.BLAST_KEY = "4";
config.BLAST_KEY_DESCRIPTION = "Key for Blast, find keyboard syntax list here http://robotjs.io/docs/syntax";
settingUpdate();
}
let REMOTE_TRIGGER_KEY = "5";
if (("REMOTE_TRIGGER_KEY" in config)) {
REMOTE_TRIGGER_KEY = config.REMOTE_TRIGGER_KEY;
}
if (!("REMOTE_TRIGGER_KEY" in config)) {
config.REMOTE_TRIGGER_KEY = "5";
config.REMOTE_TRIGGER_KEY_DESCRIPTION = "Key for Remote Trigger, find keyboard syntax list here http://robotjs.io/docs/syntax";
settingUpdate();
}
let AUTO_REMOTE_TRIGGER_2 = false;
if (("AUTO_REMOTE_TRIGGER_2" in config)) {
AUTO_REMOTE_TRIGGER_2 = config.AUTO_REMOTE_TRIGGER_2;
}
if (!("AUTO_REMOTE_TRIGGER_2" in config)) {
config.AUTO_REMOTE_TRIGGER_2 = false;
config.AUTO_REMOTE_TRIGGER_2_DESCRIPTION = "Auto cast remote trigger 2 after remote trigger 1.";
settingUpdate();
}
let REMOTE_TRIGGER_NO_CANCEL = false;
if (("REMOTE_TRIGGER_NO_CANCEL" in config)) {
REMOTE_TRIGGER_NO_CANCEL = config.REMOTE_TRIGGER_NO_CANCEL;
}
if (!("REMOTE_TRIGGER_NO_CANCEL" in config)) {
config.REMOTE_TRIGGER_NO_CANCEL = false;
config.REMOTE_TRIGGER_NO_CANCEL_DESCRIPTION = "Blocks remote trigger from being cancelled by certain skills and slow it down.";
settingUpdate();
}
let PB_SLOW = false;
if (("PB_SLOW" in config)) {
PB_SLOW = config.PB_SLOW;
}
if (!("PB_SLOW" in config)) {
config.PB_SLOW = false;
config.PB_SLOW_DESCRIPTION = "Slows Point Blank second hit execution.";
settingUpdate();
}
let UNLOCK_RRMM = false;
if (("UNLOCK_RRMM" in config)) {
UNLOCK_RRMM = config.UNLOCK_RRMM;
}
if (!("UNLOCK_RRMM" in config)) {
config.UNLOCK_RRMM = false;
config.UNLOCK_RRMM_DESCRIPTION = "Unlocks script RR MM speed lock. This option is for advanced users only as it can cause ghosting if not used correctly.";
settingUpdate();
}
let POLLING_RATE_REDUCE = false;
if (("POLLING_RATE_REDUCE" in config)) {
POLLING_RATE_REDUCE = config.POLLING_RATE_REDUCE;
}
if (!("POLLING_RATE_REDUCE" in config)) {
config.POLLING_RATE_REDUCE = false;
config.POLLING_RATE_REDUCE_DESCRIPTION = "Slows Special Burst Fire polling rate. This will reduce the speed however if your internet sucks you'll need to enable this to not DC.";
settingUpdate();
}
let POLLING_RATE_SUPER_REDUCE = false;
if (("POLLING_RATE_SUPER_REDUCE" in config)) {
POLLING_RATE_SUPER_REDUCE = config.POLLING_RATE_SUPER_REDUCE;
}
if (!("POLLING_RATE_SUPER_REDUCE" in config)) {
config.POLLING_RATE_SUPER_REDUCE = false;
config.POLLING_RATE_SUPER_REDUCE_DESCRIPTION = "If you DC even with POLLING_RATE_REDUCE because your net is ultra bad, then you can try enable this.";
settingUpdate();
}
let POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY = false;
if (("POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY" in config)) {
POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY = config.POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY;
}
if (!("POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY" in config)) {
config.POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY = false;
config.POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY_DESCRIPTION = "Only applies to special BF. If you DC even with POLLING_RATE_REDUCE because your net is ultra bad, then you can try enable this.";
settingUpdate();
}
let AB_PROJ_SPOOF = true;
if (("AB_PROJ_SPOOF" in config)) {
AB_PROJ_SPOOF = config.AB_PROJ_SPOOF;
}
if (!("AB_PROJ_SPOOF" in config)) {
config.AB_PROJ_SPOOF = true;
config.AB_PROJ_SPOOF_DESCRIPTION = "Spoof arcane barrage projectile.";
settingUpdate();
}
let cid;
let job;
let model;
let enabled = false;
let aspd;
let atkid = [];
let atkid_base = 0xFEFEFFEE;
let atkid_base_AB = 0xFEFEFFEE;
let disabSkill = [];
let startTime = [];
let timer = [];
let finishcheck = [];
let finish = [];
let trueloc;
let l1;
let l2;
let l3;
let l4;
let bomb1;
let bomb2;
let manaer;
let yeser;
let modularweaponsystem = false;
let msgSuppress;
let Ignore1 = false;
let Ignore2;
let blockGrant = false;
let blockGrant2;
let APActive;
let APState =0;
let stallSorc =0;
let chargeSkillFix = [];
let chargeSkillFix2;
let chargeSkillIDx =0;
let glyphState = [];
let blaster;
let bombchannel;
let sendYes = false;
let storedProj = [];
let lastSkillTime = [];
let lastSkillDelay;
let lastLastSkill;
let lastLastSkillDelay;
let lastSkillStart;
let lastSkillEvent;
let RecheckTimer;
let realprojID =0;
let xloc;
let yloc;
let zloc;
let wloc;
let timeloc;
let lockC;
let myRE;
let lastSkill =0;
let lastEvent = { skill: undefined };
let lastEventTime;
let GLOBAL_LOCK_DELAY =300;
let failsafe =0;
var atkArr;
dispatch.hook('S_LOAD_TOPO', 3, (event) => {
if (event.loc.zone ==118) {
enabled = false;
}
else {
enabled = [JOB_GUNNER].includes(job);
}
});
dispatch.hook('S_PLAYER_CHANGE_STAMINA', 1, (event) => {
if (!enabled) return;
myRE = event.current;
});
dispatch.hook('S_LOGIN', dispatch.majorPatchVersion >= 86 ? 14 : 13, (event) => {
cid = event.gameId;
model = event.templateId;
job = (model -10101) %100;
enabled = [JOB_GUNNER].includes(job);
});
dispatch.hook('C_CHAT', 1, (event) => {
if (event.message.includes("disable9") && !event.message.includes("disable99")) {
enabled = false;
console.log("Gunner script disabled");
return false;
}
if (event.message.includes("enable9") && !event.message.includes("enable99")) {
enabled = [JOB_GUNNER].includes(job);
console.log("Gunner script enabled if you are currently logged into gunner");
return false;
}
});
function force_end(event, unkz) {
dispatch.toClient('S_ACTION_END', 5, {
gameId: cid,
loc: {
x: xloc || event.loc.x,
y: yloc || event.loc.y,
z: zloc || event.loc.z
},
w: wloc || event.w,
templateId: model,
skill: event.skill.id,
type: unkz, //0x02
id: atkid[event.skill.id],
});
}
function fakeEnd_AP(event, stage, xy, yy) {
atkid[event.skill.id] = atkid_base;
atkid_base--;
dispatch.toClient('S_ACTION_STAGE', 9, {
gameId: cid,
loc: {
x: xy,
y: yy,
z: event.loc.z
},
w: event.w,
templateId: model,
skill: event.skill.id,
stage: stage,
speed: aspd,
projectileSpeed: 1,
id: atkid[event.skill.id],
effectScale: 1.0,
moving: false,
dest: { x: 0, y: 0, Z: 0 },
target: 0n,
animSeq: [],
});
}
function fakeEnd_sorc_dist(event, duration, dist) {
if (timer[lastSkill]) {
clearTimeout(timer[lastSkill]);
}
var yyy =1;
var zzz =0;
if (event.skill.id == S_Rocket && (lastSkill == S_Reload) && finish[lastSkill] == false) {
var zzz =30;
duration =1660;
dist =400;
force_end(lastEvent,4);
finish[lastSkill] = true;
}
if (event.skill.id == S_Rocket2 && (lastSkill == S_Reload) && finish[lastSkill] == false) {
var zzz =29;
duration =1660;
dist =400;
force_end(lastEvent,4);
finish[lastSkill] = true;
}
if (event.skill.id == S_Remote_Trigger && sendYes) {
var zzz =30;
duration = S_Remote_Trigger_D2;
}
if (event.skill.id == S_Remote_Trigger1 && sendYes) {
var zzz =48;
duration = S_Remote_Trigger_D2;
}
if (finish[lastSkill] == false && zzz ==0) {
force_end(lastEvent,4);
finish[lastSkill] = true;
}
clearTimeout(finishcheck[lastSkill]);
if (event.skill.id == S_Reload_EX || event.skill.id == S_ArcaneBeam || event.skill.id == S_ModWeapSys || event.skill.id == (S_ModWeapSys +1) || event.skill.id == S_BurstFire || event.skill.id == S_Blast || event.skill.id == S_Blast2 || event.skill.id == (S_Blast +29) || event.skill.id == S_TimeBomb || event.skill.id == S_TimeBomb2 || event.skill.id == (S_TimeBomb +29) || event.skill.id == S_AB || event.skill.id == S_AB2 || event.skill.id == (S_AB +29) || event.skill.id == S_Reple || event.skill.id == S_Reple2 || event.skill.id == (S_Reple +29) || event.skill.id == S_Reload || event.skill.id == S_HB || event.skill.id == S_HB2 || event.skill.id == (S_HB +29)) {
yyy = 1 / aspd;
}
if (event.skill.id == S_Bomb_Cast && glyphState[30004] ==1) {
yyy = 1.25;
}
var recoil = [];
if (glyphState[30007] == 1 && (event.skill.id == S_Scatter || event.skill.id == S_Scatter2 || (event.skill.id == S_Scatter +29))) {
recoil = [{ duration: 394, xyRate: 1, zRate: 1, distance: 0 },
{ duration: 111, xyRate: 1, zRate: 1, distance: 0 },
{
duration: 1333,
xyRate: 1.8,
zRate: 1,
distance: 65
}];
}
clearTimeout(finishcheck[event.skill.id]);
finish[event.skill.id] = false;
var d = new Date();
lastSkillStart = d.getTime();
lastLastSkillDelay = lastSkillDelay;
atkid[event.skill.id + zzz] = atkid_base;
atkid_base--;
dispatch.toClient('S_ACTION_STAGE', 9, {
gameId: cid,
loc: {
x: event.loc.x,
y: event.loc.y,
z: event.loc.z
},
w: event.w,
templateId: model,
skill: event.skill.id + zzz,
stage: 0,
speed: aspd * yyy,
projectileSpeed: aspd * yyy,
id: atkid[event.skill.id + zzz],
effectScale: 1.0,
moving: false,
dest: { x: 0, y: 0, Z: 0 },
target: 0n,
animSeq: recoil,
});
var newX;
var newY;
var angle = parseFloat(event.w);
var vvv =0;
newX = Math.cos(angle) * dist;
newY = Math.sin(angle) * dist;
xloc = event.loc.x + newX;
yloc = event.loc.y + newY;
zloc = event.loc.z +2;
wloc = event.w;
if (event.skill.id == S_ArcaneBeam || event.skill.id == S_Blast || event.skill.id == S_Blast2 || event.skill.id == (S_Blast +29) || event.skill.id == S_HB || event.skill.id == S_HB2 || event.skill.id == (S_HB +29) || event.skill.id == S_TimeBomb || event.skill.id == S_TimeBomb2 || event.skill.id == (S_TimeBomb +29) || event.skill.id == S_AB || event.skill.id == S_AB2 || event.skill.id == (S_AB +29)) {
yyy =1;
}
lastSkillDelay = duration / aspd;
setTimeout(function () {
lastSkillEvent = {
gameId: cid,
loc: {
x: event.loc.x + newX,
y: event.loc.y + newY,
z: event.loc.z + 2
},
w: event.w,
templateId: model,
skill: event.skill.id + zzz,
type: 0,
id: atkid[event.skill.id + zzz],
};
}, duration / (aspd * yyy), event);
finishcheck[event.skill.id] = setTimeout(function (event) { finish[event.skill.id] = true; }, (duration / (aspd * yyy)), event);
timer[event.skill.id] = setTimeout(
function (event) {
if (event.skill.id != lastSkill) { return; }
dispatch.toClient('S_ACTION_END', 5, {
gameId: cid,
loc: {
x: xloc,
y: yloc,
z: zloc
},
w: wloc,
templateId: model,
skill: event.skill.id + zzz,
type: 0,
id: atkid[event.skill.id + zzz],
});
}, duration / (aspd * yyy), event);
}
dispatch.hook('S_CREST_INFO', 2, (event) => {
if (!enabled) { return };
event.crests.forEach(function (element) {
glyphState[element.id] = element.enable;
});
});
dispatch.hook('S_SYSTEM_MESSAGE', 1, (event) => {
if (!enabled) { return };
if ((event.message == '@2059' || event.message == '@36') && msgSuppress == event.message) {
return false;
}
msgSuppress = event.message;
});
function repeater(key, trigger) {
if (lastSkill == trigger && failsafe <40) {
failsafe++;
var robot17 = require("robotjs");
robot17.keyTap(key);
setTimeout(function (key, trigger) { repeater(key, trigger); }, 50, key, trigger);
}
}
function repeaterspec(key, trigger) {
if (lastSkill == trigger && sendYes && failsafe <40) {
failsafe++;
var robot17 = require("robotjs");
robot17.keyTap(key);
setTimeout(function (key, trigger) { repeater(key, trigger); }, 50, key, trigger);
}
}
dispatch.hook('S_EACH_SKILL_RESULT', dispatch.majorPatchVersion >= 86 ? 14 : 13, (event) => {
if(event.target === cid) {
if (event.reaction.enable == true) {
lastSkill =1;
}
}
});
dispatch.hook('S_CREST_APPLY', 2, (event) => {
if (!enabled) { return };
glyphState[event.id] = event.enable;
});
dispatch.hook('C_START_COMBO_INSTANT_SKILL', 6, (event) => {
if (!enabled) return;
lastSkillDelay =999999;
if(myRE <= 69 && (event.skill.id == S_BurstPrime || event.skill.id == S_BurstFire)){
return false;
}
if (disabSkill[event.skill.id] == 'undefined') disabSkill[event.skill.id] = false;
if (!disabSkill[event.skill.id]) {
msgSuppress =0;
if (job == JOB_GUNNER && (event.skill.id == S_BurstPrime)) {
disabSkill[event.skill.id] = true;
var timer = setTimeout(function (event) { disabSkill[event.skill.id] = false; }, GLOBAL_LOCK_DELAY, event);
fakeEnd_sorc_dist(event, S_BurstPrime_D,0);
}
if (job == JOB_GUNNER && (event.skill.id == S_BurstFire_EX_Wind)) {
disabSkill[event.skill.id] = true;
var timer = setTimeout(function (event) { disabSkill[event.skill.id] = false; }, GLOBAL_LOCK_DELAY, event);
fakeEnd_sorc_dist(event, S_BurstFire_D_EX_Wind_D,0);
}
if (job == JOB_GUNNER && (event.skill.id == S_BurstFire)) {
if(!POLLING_RATE_SUPER_REDUCE){
fakeEnd_sorc_dist(event, S_BurstFire_D,0);
}
if(POLLING_RATE_SUPER_REDUCE){
fakeEnd_sorc_dist(event, S_BurstFire_D * 6,0);
}
}
if (job == JOB_GUNNER && (event.skill.id == S_BurstFire_EX)) {
if (!POLLING_RATE_REDUCE && !POLLING_RATE_SUPER_REDUCE && !POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY) {
setTimeout(function (event) { if (lastSkill == S_BurstFire_EX) { dispatch.toServer('C_START_COMBO_INSTANT_SKILL', 6, event); } }, 30, event);
setTimeout(function (event) { if (lastSkill == S_BurstFire_EX) { dispatch.toServer('C_START_COMBO_INSTANT_SKILL', 6, event); } }, 60, event);
setTimeout(function (event) { if (lastSkill == S_BurstFire_EX) { dispatch.toServer('C_START_COMBO_INSTANT_SKILL', 6, event); } }, 90, event);
setTimeout(function (event) { if (lastSkill == S_BurstFire_EX) { dispatch.toServer('C_START_COMBO_INSTANT_SKILL', 6, event); } }, 120, event);
setTimeout(function (event) { if (lastSkill == S_BurstFire_EX) { dispatch.toServer('C_START_COMBO_INSTANT_SKILL', 6, event); } }, 150, event);
}
if (POLLING_RATE_REDUCE && !POLLING_RATE_SUPER_REDUCE && !POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY) {
setTimeout(function (event) { if (lastSkill == S_BurstFire_EX) { dispatch.toServer('C_START_COMBO_INSTANT_SKILL', 6, event); } }, 60, event);
setTimeout(function (event) { if (lastSkill == S_BurstFire_EX) { dispatch.toServer('C_START_COMBO_INSTANT_SKILL', 6, event); } }, 120, event);
}
if(POLLING_RATE_SUPER_REDUCE || POLLING_RATE_SUPER_REDUCE_SPECIAL_ONLY){
}
fakeEnd_sorc_dist(event, S_BurstFire_D_EX,0);
}
lastLastSkill = lastSkill;
lastSkill = event.skill.id;
lastEvent = event;
}
});
dispatch.hook('C_START_INSTANCE_SKILL', 7, (event) => {
if (!enabled) return;
lastSkillDelay =999999;
if (disabSkill[event.skill.id] == 'undefined') disabSkill[event.skill.id] = false;
if (!disabSkill[event.skill.id]) {
msgSuppress =0;
if (job == JOB_GUNNER && (event.skill.id == S_Bomb_Cast)) {
//dispatch.toServer('C_START_SKILL', 7, bombchannel);
disabSkill[event.skill.id] = true;
var timer = setTimeout(function (event) { disabSkill[event.skill.id] = false; }, GLOBAL_LOCK_DELAY, event);
disabSkill[(event.skill.id +1)] = true;
var timer2 = setTimeout(function (event) { disabSkill[(event.skill.id +1)] = false; }, GLOBAL_LOCK_DELAY, event);
fakeEnd_sorc_dist(event, S_Bomb_D,0);
setTimeout(function (event) { if (lastSkill == S_Bomb_Cast) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); } }, 25, event);
setTimeout(function (event) { if (lastSkill == S_Bomb_Cast) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); } }, 50, event);
setTimeout(function (event) { if (lastSkill == S_Bomb_Cast) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); } }, 75, event);
setTimeout(function (event) { if (lastSkill == S_Bomb_Cast) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); } }, 100, event);
setTimeout(function (event) { if (lastSkill == S_Bomb_Cast) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); } }, 125, event);
}
if (job == JOB_GUNNER && (event.skill.id == S_AB_2 || event.skill.id == S_AB2_2)) {
//return false;
//return;
setTimeout(function (event) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); }, 100, event);
setTimeout(function (event) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); }, 50, event);
setTimeout(function (event) { dispatch.toServer('C_START_INSTANCE_SKILL', 7, event); }, 25, event);
abnormalityx(10152010,3100);
disabSkill[S_AB_2] = true;
var timer = setTimeout(function (event) { disabSkill[S_AB_2] = false; }, GLOBAL_LOCK_DELAY, event);
fakeEnd_sorc_dist(event, S_AB_2_D,0);
disabSkill[S_AB2_2] = true;
var timer2 = setTimeout(function (event) { disabSkill[S_AB2_2] = false; }, GLOBAL_LOCK_DELAY, event);
}
lastLastSkill = lastSkill;
lastSkill = event.skill.id;
lastEvent = event;
if (autoCancelState && lastSkill != S_AB && lastSkill != S_AB2 && lastSkill != (S_AB +29) && lastSkill != S_Rocket && lastSkill != S_Rocket2 && lastSkill != (S_Rocket +29) && lastSkill != S_Blast && lastSkill != S_Blast2 && lastSkill != (S_Blast +29) && lastSkill != S_Reload && lastSkill != S_Retal && lastSkill != S_Bomb_Channel && lastSkill != S_PointB && lastSkill != S_PointB2 && lastSkill != (S_PointB +29) && lastSkill != S_PointB_2 && lastSkill != S_PointB2_2 && lastSkill != (S_PointB_2 +29)) {
failsafe =0;
repeater(BLAST_KEY, lastSkill);
}
}
if (job == JOB_GUNNER && (event.skill.id == S_AB_2 || event.skill.id == S_AB2_2)) {
return false;
}
});
dispatch.hook('C_START_INSTANCE_SKILL_EX', 5, (event) => {
if (!enabled) return;
lastSkillDelay =999999;
if (disabSkill[event.skill.id] == 'undefined') disabSkill[event.skill.id] = false;
if (!disabSkill[event.skill.id]) {
msgSuppress =0;
if (job == JOB_GUNNER && (event.skill.id == S_AB_2 || event.skill.id == S_AB2_2)) {
if (AB_PROJ_SPOOF) {
event.projectile = realprojID;
}
setTimeout(function (event) { dispatch.toServer('C_START_INSTANCE_SKILL_EX', 5, event); }, 100, event);
setTimeout(function (event) { dispatch.toServer('C_START_INSTANCE_SKILL_EX', 5, event); }, 50, event);
setTimeout(function (event) { dispatch.toServer('C_START_INSTANCE_SKILL_EX', 5, event); }, 25, event);
abnormalityx(10152010,3100);
//abnormalityx(10152081,4100);
disabSkill[S_AB_2] = true;
var timer = setTimeout(function (event) { disabSkill[S_AB_2] = false; }, GLOBAL_LOCK_DELAY, event);
fakeEnd_sorc_dist(event, S_AB_2_D,0);
disabSkill[S_AB2_2] = true;
var timer2 = setTimeout(function (event) { disabSkill[S_AB2_2] = false; }, GLOBAL_LOCK_DELAY, event);
if (AB_PROJ_SPOOF) {
dispatch.toClient('S_END_USER_PROJECTILE', 4, {
id: atkid_base_AB,
unk1: false,
unk2: false,
target: 0,
unk3: 0,
unk4: 0,
unk5: 0,
});
}
}
lastLastSkill = lastSkill;
lastSkill = event.skill.id;
lastEvent = event;
if (autoCancelState && lastSkill != S_AB && lastSkill != S_AB2 && lastSkill != (S_AB +29) && lastSkill != S_Rocket && lastSkill != S_Rocket2 && lastSkill != (S_Rocket +29) && lastSkill != S_Blast && lastSkill != S_Blast2 && lastSkill != (S_Blast +29) && lastSkill != S_Reload && lastSkill != S_Retal && lastSkill != S_Bomb_Channel && lastSkill != S_PointB && lastSkill != S_PointB2 && lastSkill != (S_PointB +29) && lastSkill != S_PointB_2 && lastSkill != S_PointB2_2 && lastSkill != (S_PointB_2 +29)) {
failsafe =0;
repeater(BLAST_KEY, lastSkill);
}
}
if (job == JOB_GUNNER && (event.skill.id == S_AB_2 || event.skill.id == S_AB2_2)) {
return false;
}
if (AB_PROJ_SPOOF) {
return true;
}
});
dispatch.hook('C_HIT_USER_PROJECTILE', 4, (event) => {
if (!enabled) return;
if (!AB_PROJ_SPOOF) return;
if (realprojID != 0 && event.id == atkid_base_AB) {
event.id = realprojID;
return true;
}
if (realprojID == 0 && event.id == atkid_base_AB) {
storedProj.push(event);
return false;
}
});
dispatch.hook('S_START_USER_PROJECTILE', 9, (event) => {
if (!enabled) return;
if (!AB_PROJ_SPOOF) return;
if (event.skill.id ==71120) {
realprojID = event.id;
if (AB_PROJ_SPOOF) {
storedProj.forEach(function (element) {
element.id = realprojID;
dispatch.toServer('C_HIT_USER_PROJECTILE', 4, element);
});
storedProj = [];
}
return false;
}
});
function grantskill(xskill) {
if (!SPOOF_GRANT) {
return;
}
clearTimeout(blockGrant2);
blockGrant = true;
blockGrant2 = setTimeout(function () { blockGrant = false; },500);
dispatch.toClient('S_GRANT_SKILL', 3, {
skill: xskill,
});
}
dispatch.hook('S_GRANT_SKILL', 3, (event) => {
if (blockGrant) {
return false;
}
});
dispatch.hook('C_NOTIMELINE_SKILL', 3, (event) => {
if (!enabled) return;
if (timer[lastSkill]) {
clearTimeout(timer[lastSkill]);
}
if(lastEvent.skill.id && lastSkill != S_CRecall){
force_end(lastEvent,4);
}
finish[lastSkill] = true;
lastLastSkill = lastSkill;
lastSkill = event.skill.id;
lastEvent = event;
APActive =0;
});
dispatch.hook('C_PRESS_SKILL', 4, (event) => {
if (!enabled) return;
if (job == JOB_GUNNER && event.skill.id == S_Mana && event.press == true && (lastSkill == S_Blast || lastSkill == S_Blast2 || (lastSkill == S_Blast +29)) && finish[lastSkill] == false) {
return false;
}
if (!disabSkill[event.skill.id]) {
lastSkillDelay =999999;
if (job == JOB_GUNNER && event.skill.id == S_Mana) {
APActive = event.press;
}
if (finish[S_MM_Instant] == false) { return false; }
if (job == JOB_GUNNER && event.skill.id == S_Mana && event.press == false) {
if (lastSkill == S_Reload_EX && finish[lastSkill] == false) {
grantskill(S_MM_Instant);
lastLastSkill = lastSkill;
lastSkill = event.skill.id;
setTimeout(function (event) { dispatch.toServer('C_PRESS_SKILL', 4, event); }, 25, event);
setTimeout(function (event) { dispatch.toServer('C_PRESS_SKILL', 4, event); }, 50, event);
setTimeout(function (event) { dispatch.toServer('C_PRESS_SKILL', 4, event); }, 75, event);
setTimeout(function (event) { dispatch.toServer('C_PRESS_SKILL', 4, event); }, 100, event);
setTimeout(function (event) { dispatch.toServer('C_PRESS_SKILL', 4, event); }, 150, event);
setTimeout(function (event) { dispatch.toServer('C_PRESS_SKILL', 4, event); }, 200, event);
return;
}
if (lastSkill == S_Mana) {
grantskill((event.skill.id + 9 + APState));
}
if (stallSorc >10) {
console.log('attempt unstuck');
dispatch.toClient('S_ACTION_END', 5, {
gameId: cid,
loc: {
x: event.loc.x,
y: event.loc.y,
z: event.loc.z
},
w: event.w,
templateId: model,
skill: S_Mana,
type: 0,
id: atkid[S_Mana],
});
}
stallSorc = stallSorc +1;
}
if (job == JOB_GUNNER && event.skill.id == S_Mana && APActive ==1) {
setTimeout(function () { dispatch.toServer('C_PRESS_SKILL', 4, event); },25);
setTimeout(function () { dispatch.toServer('C_PRESS_SKILL', 4, event); },50);
setTimeout(function () { dispatch.toServer('C_PRESS_SKILL', 4, event); },75);
setTimeout(function () { dispatch.toServer('C_PRESS_SKILL', 4, event); },100);
chargeSkillFix[chargeSkillIDx] = setInterval(function (event, nnn) {
if ((event.skill.id == S_Mana) && lastSkill == event.skill.id && event.press == true && chargeSkillFix2 != lastSkill) {
dispatch.toServer('C_PRESS_SKILL', 4, event);
}
if (chargeSkillFix2 == lastSkill) {
clearInterval(chargeSkillFix[nnn]);
}
if (event.skill.id == S_Mana && APActive ==0) {
clearInterval(chargeSkillFix[nnn]);
}
}, 200, event, chargeSkillIDx);
chargeSkillIDx++;
if (DISABLE_CHARGE) { lastSkill = S_Mana; return; }
if (lastSkill == S_Reload_EX && finish[lastSkill] == false) {
grantskill(S_MM_Instant);
lastLastSkill = lastSkill;
lastSkill = event.skill.id;
clearTimeout(blockGrant2);
blockGrant = false;
return;
}
var delay1 =0;
if(lastSkill == S_BurstFire && !modularweaponsystem){
delay1 =120;
}
fakeEnd_AP(event, 0, event.loc.x, event.loc.y);
APState =1;
stallSorc =0;
setTimeout(function (event) {
if (job == JOB_GUNNER && event.skill.id == S_Mana && APActive == 1 && APState ==1) {
fakeEnd_AP(event, 1, event.loc.x, event.loc.y);
APState =2; //KEY=141151953244832
}
}, S_Mana_D / (aspd) + delay1, event);
}
if (event.press == true) {
lastLastSkill = lastSkill;
lastSkill = event.skill.id;
clearTimeout(blockGrant2);
blockGrant = false;
}
}
});
function abnormalityx(idx, durx) {
if (!ABNORMALITY_TOGGLE) { return; }
dispatch.toClient('S_ABNORMALITY_BEGIN', 5, {
target: cid,
source: cid,
id: idx,
duration: durx,
unk: 0,
stacks: 1,
unk2: 0,
unk3: 0,
});
}
dispatch.hook('S_ABNORMALITY_BEGIN', 5, (event) => {
if (!enabled) return;
if (event.target !== cid) {
return;
}
if ((event.id == 10152010 || event.id == 10152011 || event.id ==10152000) && ABNORMALITY_TOGGLE) {
return false;
}
if (event.id ==10152331) {
sendYes = true;
}
if (event.id ==10152340) {
modularweaponsystem = true;
}
});
dispatch.hook('S_ABNORMALITY_END', 1, (event) => {
if (!enabled) return;
if (event.target !== cid) {
return;
}
if ((event.skill == 10152000 || event.skill ==10152001) && lastSkill == S_PointB && finish[lastSkill] == false && !PB_SLOW) {
return false;
}
if ((event.id == 10152010 || event.id == 10152011 || event.id ==10152000) && ABNORMALITY_TOGGLE) {
return false;
}
if (event.id ==10152331) {
sendYes = false;
}