-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathMiniMenu.java
More file actions
2499 lines (2130 loc) · 115 KB
/
MiniMenu.java
File metadata and controls
2499 lines (2130 loc) · 115 KB
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
import com.jagex.Client;
import com.jagex.ClientProt;
import com.jagex.IndexedImage;
import com.jagex.PickableEntity;
import com.jagex.core.constants.MiniMenuAction;
import com.jagex.core.constants.ModeGame;
import com.jagex.core.datastruct.LinkedList;
import com.jagex.core.datastruct.key.Deque;
import com.jagex.core.datastruct.key.DequeIterator;
import com.jagex.core.datastruct.key.IterableHashTable;
import com.jagex.core.datastruct.key.Node2;
import com.jagex.core.datastruct.key.Queue;
import com.jagex.core.datastruct.key.QueueIterator;
import com.jagex.core.datastruct.ref.ReferenceCache;
import com.jagex.core.util.Arrays;
import com.jagex.core.util.TimeUtils;
import com.jagex.game.LocalisedText;
import com.jagex.game.Location;
import com.jagex.game.runetek6.client.GameShell;
import com.jagex.game.runetek6.config.iftype.ServerActiveProperties;
import com.jagex.game.runetek6.config.iftype.TargetMask;
import com.jagex.game.runetek6.config.loctype.LocType;
import com.jagex.game.runetek6.config.loctype.LocTypeList;
import com.jagex.game.runetek6.config.npctype.NPCType;
import com.jagex.game.runetek6.config.objtype.ObjType;
import com.jagex.game.runetek6.config.objtype.ObjTypeList;
import com.jagex.game.runetek6.config.paramtype.ParamType;
import com.jagex.game.runetek6.config.paramtype.ParamTypeList;
import com.jagex.game.runetek6.config.questtype.QuestType;
import com.jagex.game.runetek6.config.questtype.QuestTypeList;
import com.jagex.game.runetek6.config.vartype.TimedVarDomain;
import com.jagex.graphics.Font;
import com.jagex.graphics.Fonts;
import com.jagex.graphics.Matrix;
import com.jagex.graphics.Sprite;
import com.jagex.graphics.Toolkit;
import com.jagex.js5.js5;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import rs2.client.event.keyboard.KeyboardMonitor;
import rs2.client.event.keyboard.SimpleKeyboardMonitor;
import rs2.client.event.mouse.MouseLog;
import rs2.client.event.mouse.MouseMonitor;
import java.util.Random;
public final class MiniMenu {
@OriginalMember(owner = "client!sw", name = "b", descriptor = "[Z")
public static final boolean[] playerOpsReducedPriority = new boolean[8];
@OriginalMember(owner = "client!eka", name = "h", descriptor = "[I")
public static final int[] playerOpCursors = new int[8];
@OriginalMember(owner = "client!pj", name = "f", descriptor = "Ljava/util/Random;")
public static final Random random = new Random();
private static final int QUEST_ICON_COUNT = 10;
private static final int QUEST_ICON_HEIGHT = 12;
private static final int SPRITE_TOP_HEIGHT = 33;
private static final int TOP_HEIGHT = 31;
private static final int ENTRY_HEIGHT = 16;
@OriginalMember(owner = "client!gfa", name = "u", descriptor = "Lclient!sia;")
public static final Deque otherInnerEntries = new Deque();
@OriginalMember(owner = "client!hha", name = "b", descriptor = "Lclient!sia;")
public static final Deque targetInnerEntries = new Deque();
@OriginalMember(owner = "client!vu", name = "f", descriptor = "Lclient!sia;")
public static final Deque innerEntryQueue = new Deque();
@OriginalMember(owner = "client!pha", name = "m", descriptor = "Lclient!av;")
public static final IterableHashTable entryTable = new IterableHashTable(16);
@OriginalMember(owner = "client!wn", name = "k", descriptor = "Lclient!dla;")
public static final ReferenceCache cache = new ReferenceCache(30);
@OriginalMember(owner = "client!oea", name = "w", descriptor = "Lclient!dla;")
public static final ReferenceCache questCache = new ReferenceCache(8);
@OriginalMember(owner = "client!la", name = "v", descriptor = "Lclient!jga;")
public static final Queue entryQueue = new Queue();
@OriginalMember(owner = "client!fp", name = "T", descriptor = "Z")
public static final boolean debugOps = false;
@OriginalMember(owner = "client!jha", name = "k", descriptor = "[Ljava/lang/String;")
public static final String[] playerOps = new String[8];
@OriginalMember(owner = "client!mk", name = "c", descriptor = "Z")
public static boolean open = false;
@OriginalMember(owner = "client!sn", name = "j", descriptor = "I")
public static int innerEntryCount = 0;
@OriginalMember(owner = "client!bb", name = "c", descriptor = "I")
public static int entryCount = 0;
@OriginalMember(owner = "client!qja", name = "c", descriptor = "Lclient!pg;")
public static MiniMenuEntryInner cancelEntry;
@OriginalMember(owner = "client!da", name = "o", descriptor = "Lclient!pg;")
public static MiniMenuEntryInner topEntry;
@OriginalMember(owner = "client!or", name = "F", descriptor = "Lclient!pg;")
public static MiniMenuEntryInner activeEntry;
@OriginalMember(owner = "client!fo", name = "a", descriptor = "[Lclient!st;")
public static Sprite[] icons;
@OriginalMember(owner = "client!ki", name = "c", descriptor = "I")
public static int nameIconsCount;
@OriginalMember(owner = "client!oj", name = "j", descriptor = "[I")
public static int[] iconHeights;
@OriginalMember(owner = "client!vka", name = "c", descriptor = "I")
public static int width;
@OriginalMember(owner = "client!cea", name = "p", descriptor = "I")
public static int x;
@OriginalMember(owner = "client!mr", name = "b", descriptor = "I")
public static int height;
@OriginalMember(owner = "client!client", name = "wb", descriptor = "I")
public static int y;
@OriginalMember(owner = "client!eg", name = "j", descriptor = "Lclient!cba;")
public static MiniMenuEntry openedEntry = null;
@OriginalMember(owner = "client!pj", name = "p", descriptor = "I")
public static int openedEntryY;
@OriginalMember(owner = "client!cm", name = "o", descriptor = "I")
public static int openedEntryWidth;
@OriginalMember(owner = "client!vt", name = "c", descriptor = "I")
public static int openedEntryX;
@OriginalMember(owner = "client!as", name = "g", descriptor = "I")
public static int openedEntryHeight;
@OriginalMember(owner = "client!ik", name = "w", descriptor = "Z")
public static boolean ignorePlayerLevels = true;
@OriginalMember(owner = "client!bw", name = "I", descriptor = "Z")
public static boolean useSprites = false;
@OriginalMember(owner = "client!fi", name = "h", descriptor = "I")
public static int verticalBorderSpriteId;
@OriginalMember(owner = "client!caa", name = "b", descriptor = "Lclient!st;")
public static Sprite leftBorderSprite;
@OriginalMember(owner = "client!caa", name = "c", descriptor = "I")
public static int separatorSpriteId;
@OriginalMember(owner = "client!rb", name = "a", descriptor = "Lclient!st;")
public static Sprite rightBorderSprite;
@OriginalMember(owner = "client!at", name = "j", descriptor = "Lclient!st;")
public static Sprite bottomBorderSprite;
@OriginalMember(owner = "client!ic", name = "a", descriptor = "Lclient!st;")
public static Sprite bottomLeftCornerSprite;
@OriginalMember(owner = "client!rla", name = "f", descriptor = "Lclient!st;")
public static Sprite bottomRightCornerSprite;
@OriginalMember(owner = "client!wq", name = "T", descriptor = "I")
public static int topColour;
@OriginalMember(owner = "client!qca", name = "w", descriptor = "I")
public static int topOpacity;
@OriginalMember(owner = "client!fm", name = "l", descriptor = "I")
public static int spriteBodyColour;
@OriginalMember(owner = "client!mn", name = "m", descriptor = "I")
public static int spriteBodyOpacity;
@OriginalMember(owner = "client!is", name = "f", descriptor = "I")
public static int topCornerSpriteId;
@OriginalMember(owner = "client!is", name = "m", descriptor = "I")
public static int bottomCornerSpriteId;
@OriginalMember(owner = "client!kla", name = "Hc", descriptor = "I")
public static int horizontalBorderSpriteId;
@OriginalMember(owner = "client!ro", name = "f", descriptor = "I")
public static int textColour;
@OriginalMember(owner = "client!uaa", name = "c", descriptor = "I")
public static int spriteHighlightColour;
@OriginalMember(owner = "client!oia", name = "f", descriptor = "Lclient!st;")
public static Sprite separatorSprite;
@OriginalMember(owner = "client!aa", name = "b", descriptor = "Lclient!st;")
public static Sprite topLeftCornerSprite;
@OriginalMember(owner = "client!td", name = "r", descriptor = "Lclient!st;")
public static Sprite topRightCornerSprite;
@OriginalMember(owner = "client!hfa", name = "r", descriptor = "Z")
public static boolean collapsed = false;
@OriginalMember(owner = "client!eia", name = "y", descriptor = "I")
public static int subMenuMinLength = -1;
@OriginalMember(owner = "client!gi", name = "d", descriptor = "Z")
public static boolean shiftClick = false;
@OriginalMember(owner = "client!qt", name = "c", descriptor = "I")
public static int anInt8149 = 0;
@OriginalMember(owner = "client!ch", name = "j", descriptor = "Lclient!pg;")
public static MiniMenuEntryInner draggedEntry;
@OriginalMember(owner = "client!oj", name = "t", descriptor = "I")
public static int anInt6964 = 0;
@OriginalMember(owner = "client!pq", name = "x", descriptor = "Z")
public static boolean showFaceHere;
@OriginalMember(owner = "client!fj", name = "z", descriptor = "I")
public static int randomSeed;
@OriginalMember(owner = "client!cja", name = "b", descriptor = "(B)V")
public static void reset() {
for (@Pc(10) MiniMenuEntry entry = (MiniMenuEntry) entryQueue.first(); entry != null; entry = (MiniMenuEntry) entryQueue.next()) {
if (entry.size > 1) {
entry.size = 0;
cache.put(entry, ((MiniMenuEntryInner) entry.innerEntries.sentinel.next2).entryKey);
entry.innerEntries.clear();
}
}
innerEntryCount = 0;
entryCount = 0;
innerEntryQueue.clear();
entryTable.clear();
entryQueue.clear();
addEntryInner(cancelEntry);
}
@OriginalMember(owner = "client!eka", name = "a", descriptor = "(IIILclient!ha;)V")
public static void addEntries3DView(@OriginalArg(3) Toolkit toolkit, @OriginalArg(2) int mouseX, @OriginalArg(0) int mouseY) {
if (mouseX < 0 || mouseY < 0 || Static240.anInt3955 == 0 || Static275.anInt4424 == 0) {
return;
}
@Pc(38) Matrix local38;
@Pc(57) int local57;
@Pc(45) int local45;
@Pc(49) int local49;
@Pc(53) int local53;
@Pc(63) int local63;
@Pc(69) int local69;
if (OrthoMode.toolkitActive) {
OrthoMode.method9331(false);
local38 = toolkit.camera();
@Pc(41) int[] local41 = toolkit.Y();
local45 = local41[1];
local49 = local41[2];
local53 = local41[3];
local57 = local41[0];
local63 = OrthoMode.method3503(false) + mouseX;
local69 = OrthoMode.method7649(false) + mouseY;
} else {
toolkit.DA(Static168.anInt2842, Static232.anInt3829, Static240.anInt3955, Static275.anInt4424);
local49 = Static240.anInt3955;
local53 = Static275.anInt4424;
local45 = Static232.anInt3829;
local57 = Static168.anInt2842;
toolkit.KA(InterfaceManager.optionsX, InterfaceManager.optionsY, Static240.anInt3955, Static275.anInt4424);
local38 = toolkit.createMatrix();
local38.createCamera(Static428.anInt6487, Static427.anInt6480, Static523.anInt3888, Static524.anInt8044, Static271.anInt4363, Static707.anInt10641);
local63 = mouseX;
toolkit.setCamera(local38);
local69 = mouseY;
}
Static501.method6716(true);
if (local53 == 0) {
local53 = 1;
}
if (local49 == 0) {
local49 = 1;
}
@Pc(148) int local148;
@Pc(177) int local177;
@Pc(186) int local186;
@Pc(286) int local286;
@Pc(295) int local295;
@Pc(306) int local306;
@Pc(317) int local317;
@Pc(140) int local140;
@Pc(370) int local370;
if (Static706.floor != null && (!InterfaceManager.targetMode || (InterfaceManager.targetMask & 0x40) != 0)) {
local140 = -1;
@Pc(142) int local142 = -1;
@Pc(145) int local145 = toolkit.i();
local148 = toolkit.XA();
@Pc(159) int local159;
@Pc(168) int local168;
if (OrthoMode.enabled) {
local177 = local168 = OrthoMode.renderZoom * (local63 - local57) / local49;
local159 = local186 = OrthoMode.renderZoom * (local69 - local45) / local53;
} else {
local159 = (local69 - local45) * local145 / local53;
local168 = local148 * (local63 - local57) / local49;
local177 = (local63 - local57) * local145 / local49;
local186 = (local69 - local45) * local148 / local53;
}
@Pc(224) int[] local224 = new int[]{local177, local159, local145};
@Pc(239) int[] local239 = new int[]{local168, local186, local148};
local38.project(local224);
local38.project(local239);
@Pc(273) float local273 = Static394.method5543((float) local224[0], (float) local239[2], 4, (float) local224[2], (float) local239[1], (float) local224[1], (float) local239[0]);
if (local273 > 0.0F) {
local286 = local239[0] - local224[0];
local295 = local239[2] - local224[2];
local306 = (int) ((float) local224[0] + local273 * (float) local286);
local317 = (int) ((float) local224[2] + local273 * (float) local295);
local140 = local306 + (PlayerEntity.self.getSize() - 1 << 8) >> 9;
local142 = local317 + (PlayerEntity.self.getSize() - 1 << 8) >> 9;
@Pc(345) byte local345 = PlayerEntity.self.level;
if (local345 < 3 && (Static280.tileFlags[1][local306 >> 9][local317 >> 9] & 0x2) != 0) {
local370 = local345 + 1;
}
}
if (local140 != -1 && local142 != -1) {
if (InterfaceManager.targetMode && (InterfaceManager.targetMask & 0x40) != 0) {
@Pc(453) Component local453 = InterfaceList.getComponent(InterfaceManager.targetSlot, InterfaceManager.targetComponent);
if (local453 == null) {
InterfaceManager.endTargetMode();
} else {
addEntryInner(false, -1, 0L, local140, local142, InterfaceManager.targetVerb, 21, true, InterfaceManager.targetEnterCursor, " ->", local140 << 0 | local142, true);
}
} else {
if (showFaceHere) {
addEntryInner(false, -1, 0L, local140, local142, LocalisedText.FACEHERE.localise(Client.language), 11, true, -1, "", local142 | local140 << 0, true);
}
addEntryInner(false, -1, 0L, local140, local142, Static331.moveText, 58, true, Static331.moveCursor, "", local142 | local140 << 0, true);
}
}
}
if (OrthoMode.toolkitActive) {
Static480.method6469();
}
for (local140 = 0; local140 < (OrthoMode.toolkitActive ? 2 : 1); local140++) {
@Pc(503) boolean local503 = local140 == 0;
@Pc(510) Class213 local510 = local503 ? Static514.aClass213_2 : OrthoMode.aClass213_1;
local148 = mouseX;
local177 = mouseY;
if (OrthoMode.toolkitActive) {
OrthoMode.method9331(local503);
local148 = mouseX + OrthoMode.method3503(local503);
local177 = mouseY + OrthoMode.method7649(local503);
}
@Pc(538) LinkedList local538 = local510.entities;
for (@Pc(543) PickableEntity local543 = (PickableEntity) local538.first(); local543 != null; local543 = (PickableEntity) local538.next()) {
if ((ignorePlayerLevels || local543.aEntity_18.level == PlayerEntity.self.level) && local543.method6496(toolkit, local177, local148)) {
@Pc(584) int local584;
if (local543.aEntity_18 instanceof PositionEntity) {
local186 = ((PositionEntity) local543.aEntity_18).x1;
local584 = ((PositionEntity) local543.aEntity_18).z1;
} else {
local584 = local543.aEntity_18.z >> 9;
local186 = local543.aEntity_18.x >> 9;
}
@Pc(723) int local723;
@Pc(735) int local735;
@Pc(864) int local864;
@Pc(614) int local614;
if (local543.aEntity_18 instanceof PlayerEntity) {
@Pc(610) PlayerEntity local610 = (PlayerEntity) local543.aEntity_18;
local614 = local610.getSize();
if ((local614 & 0x1) == 0 && (local610.x & 0x1FF) == 0 && (local610.z & 0x1FF) == 0 || (local614 & 0x1) == 1 && (local610.x & 0x1FF) == 256 && (local610.z & 0x1FF) == 256) {
local286 = local610.x - (local610.getSize() - 1 << 8);
local295 = local610.z - (local610.getSize() - 1 << 8);
for (local306 = 0; local306 < NPCList.size; local306++) {
@Pc(690) NPCEntityNode local690 = (NPCEntityNode) NPCList.local.get(NPCList.slots[local306]);
if (local690 != null) {
@Pc(695) NPCEntity local695 = local690.npc;
if (TimeUtils.clock != local695.anInt10743 && local695.visible) {
local723 = local695.x - (local695.type.size - 1 << 8);
local735 = local695.z - (local695.type.size - 1 << 8);
if (local286 <= local723 && local695.type.size <= local610.getSize() - (local723 - local286 >> 9) && local735 >= local295 && local695.type.size <= local610.getSize() - (local735 - local295 >> 9)) {
addNpcEntries(local543.aEntity_18.level != PlayerEntity.self.level, local695);
local695.anInt10743 = TimeUtils.clock;
}
}
}
}
local317 = PlayerList.highResolutionCount;
@Pc(820) int[] local820 = PlayerList.highResolutionSlots;
for (local723 = 0; local723 < local317; local723++) {
@Pc(830) PlayerEntity local830 = PlayerList.highResolutionPlayers[local820[local723]];
if (local830 != null && local830.anInt10743 != TimeUtils.clock && local830 != local610 && local830.visible) {
local864 = local830.x - (local830.getSize() - 1 << 8);
@Pc(876) int local876 = local830.z - (local830.getSize() - 1 << 8);
if (local864 >= local286 && local830.getSize() <= local610.getSize() - (local864 - local286 >> 9) && local876 >= local295 && local830.getSize() <= local610.getSize() - (local876 - local295 >> 9)) {
addPlayerEntries(local543.aEntity_18.level != PlayerEntity.self.level, local830);
local830.anInt10743 = TimeUtils.clock;
}
}
}
}
if (TimeUtils.clock == local610.anInt10743) {
continue;
}
addPlayerEntries(PlayerEntity.self.level != local543.aEntity_18.level, local610);
local610.anInt10743 = TimeUtils.clock;
}
if (local543.aEntity_18 instanceof NPCEntity) {
@Pc(988) NPCEntity local988 = (NPCEntity) local543.aEntity_18;
if (local988.type != null) {
if ((local988.type.size & 0x1) == 0 && (local988.x & 0x1FF) == 0 && (local988.z & 0x1FF) == 0 || (local988.type.size & 0x1) == 1 && (local988.x & 0x1FF) == 256 && (local988.z & 0x1FF) == 256) {
local614 = local988.x - (local988.type.size - 1 << 8);
local286 = local988.z - (local988.type.size - 1 << 8);
for (local295 = 0; local295 < NPCList.size; local295++) {
@Pc(1081) NPCEntityNode local1081 = (NPCEntityNode) NPCList.local.get(NPCList.slots[local295]);
if (local1081 != null) {
@Pc(1086) NPCEntity local1086 = local1081.npc;
if (local1086.anInt10743 != TimeUtils.clock && local1086 != local988 && local1086.visible) {
local370 = local1086.x - (local1086.type.size - 1 << 8);
local723 = local1086.z - (local1086.type.size - 1 << 8);
if (local614 <= local370 && local988.type.size - (local370 - local614 >> 9) >= local1086.type.size && local723 >= local286 && local1086.type.size <= local988.type.size - (local723 - local286 >> 9)) {
addNpcEntries(PlayerEntity.self.level != local543.aEntity_18.level, local1086);
local1086.anInt10743 = TimeUtils.clock;
}
}
}
}
local306 = PlayerList.highResolutionCount;
@Pc(1216) int[] local1216 = PlayerList.highResolutionSlots;
for (local370 = 0; local370 < local306; local370++) {
@Pc(1226) PlayerEntity local1226 = PlayerList.highResolutionPlayers[local1216[local370]];
if (local1226 != null && local1226.anInt10743 != TimeUtils.clock && local1226.visible) {
local735 = local1226.x - (local1226.getSize() - 1 << 8);
local864 = local1226.z - (local1226.getSize() - 1 << 8);
if (local614 <= local735 && local1226.getSize() <= local988.type.size - (local735 - local614 >> 9) && local286 <= local864 && local1226.getSize() <= local988.type.size - (local864 - local286 >> 9)) {
addPlayerEntries(PlayerEntity.self.level != local543.aEntity_18.level, local1226);
local1226.anInt10743 = TimeUtils.clock;
}
}
}
}
if (TimeUtils.clock == local988.anInt10743) {
continue;
}
addNpcEntries(PlayerEntity.self.level != local543.aEntity_18.level, local988);
local988.anInt10743 = TimeUtils.clock;
}
}
if (local543.aEntity_18 instanceof ObjStackEntity) {
@Pc(1385) int local1385 = local186 + WorldMap.areaBaseX;
local614 = WorldMap.areaBaseZ + local584;
@Pc(1406) ObjStack local1406 = (ObjStack) Static497.objStacks.get(local614 << 14 | local543.aEntity_18.level << 28 | local1385);
if (local1406 != null) {
local295 = 0;
for (@Pc(1416) ObjStackEntry local1416 = (ObjStackEntry) local1406.objs.last(); local1416 != null; local1416 = (ObjStackEntry) local1406.objs.previous()) {
@Pc(1424) ObjType local1424 = ObjTypeList.instance.list(local1416.id);
if (InterfaceManager.targetMode && PlayerEntity.self.level == local543.aEntity_18.level) {
@Pc(1451) ParamType local1451 = InterfaceManager.targetParam == -1 ? null : ParamTypeList.instance.list(InterfaceManager.targetParam);
if ((InterfaceManager.targetMask & 0x1) != 0 && (local1451 == null || local1424.param(InterfaceManager.targetParam, local1451.defaultint) != local1451.defaultint)) {
addEntryInner(false, -1, local1416.id, local186, local584, InterfaceManager.targetVerb, 17, true, InterfaceManager.targetEnterCursor, InterfaceManager.targetedVerb + " -> <col=ff9040>" + local1424.name, local295, false);
}
}
if (local543.aEntity_18.level == PlayerEntity.self.level) {
@Pc(1525) String[] local1525 = local1424.op;
for (local723 = local1525.length - 1; local723 >= 0; local723--) {
if (local1525[local723] != null) {
@Pc(1540) short local1540 = 0;
local864 = Cursor.interaction;
if (local723 == 0) {
local1540 = 25;
}
if (local723 == 1) {
local1540 = 5;
}
if (local723 == 2) {
local1540 = 50;
}
if (local723 == 3) {
local1540 = 6;
}
if (local723 == 4) {
local1540 = 45;
}
if (local723 == 5) {
local1540 = 1007;
}
if (local723 == local1424.cursor1op) {
local864 = local1424.cursor1;
}
if (local723 == local1424.cursor2op) {
local864 = local1424.cursor2;
}
addEntryInner(false, -1, local1416.id, local186, local584, local1525[local723], local1540, true, local864, "<col=ff9040>" + local1424.name, local295, false);
}
}
}
local295++;
}
}
}
if (local543.aEntity_18 instanceof Location) {
@Pc(1654) Location local1654 = (Location) local543.aEntity_18;
@Pc(1661) LocType local1661 = LocTypeList.instance.list(local1654.getId());
if (local1661.multiloc != null) {
local1661 = local1661.getMultiLoc(TimedVarDomain.instance);
}
if (local1661 != null) {
if (InterfaceManager.targetMode && PlayerEntity.self.level == local543.aEntity_18.level) {
@Pc(1697) ParamType local1697 = InterfaceManager.targetParam == -1 ? null : ParamTypeList.instance.list(InterfaceManager.targetParam);
if ((InterfaceManager.targetMask & 0x4) != 0 && (local1697 == null || local1661.param(local1697.defaultint, InterfaceManager.targetParam) != local1697.defaultint)) {
addEntryInner(false, -1, Static277.method4042(local1654, local584, local186), local186, local584, InterfaceManager.targetVerb, 60, true, InterfaceManager.targetEnterCursor, InterfaceManager.targetedVerb + " -> <col=00ffff>" + local1661.name, local1654.hashCode(), false);
}
}
if (PlayerEntity.self.level == local543.aEntity_18.level) {
@Pc(1763) String[] local1763 = local1661.ops;
if (local1763 != null) {
for (local295 = local1763.length - 1; local295 >= 0; local295--) {
if (local1763[local295] != null) {
@Pc(1780) short local1780 = 0;
local317 = Cursor.interaction;
if (local295 == 0) {
local1780 = 19;
}
if (local295 == 1) {
local1780 = 13;
}
if (local295 == 2) {
local1780 = 46;
}
if (local295 == 3) {
local1780 = 8;
}
if (local295 == 4) {
local1780 = 1010;
}
if (local295 == local1661.cursor1Op) {
local317 = local1661.cursor1;
}
if (local295 == 5) {
local1780 = 1008;
}
if (local1661.cursor2Op == local295) {
local317 = local1661.cursor2;
}
addEntryInner(false, -1, Static277.method4042(local1654, local584, local186), local186, local584, local1763[local295], local1780, true, local317, "<col=00ffff>" + local1661.name, local1654.hashCode(), false);
}
}
}
}
}
}
}
}
if (OrthoMode.toolkitActive) {
Static480.method6469();
}
}
Static501.method6716(false);
}
@OriginalMember(owner = "client!om", name = "a", descriptor = "(Lclient!cg;I)V")
public static void addEntityEntries(@OriginalArg(0) PathingEntity entity) {
if (entity instanceof NPCEntity) {
@Pc(5) NPCEntity npc = (NPCEntity) entity;
if (npc.type != null) {
addNpcEntries(PlayerEntity.self.level != npc.level, npc);
}
} else if (entity instanceof PlayerEntity) {
@Pc(33) PlayerEntity player = (PlayerEntity) entity;
addPlayerEntries(player.level != PlayerEntity.self.level, player);
}
}
@OriginalMember(owner = "client!nca", name = "a", descriptor = "(ZIJIILjava/lang/String;IZILjava/lang/String;JBZ)V")
public static void addEntryInner(@OriginalArg(0) boolean differentLevel, @OriginalArg(1) int invObject, @OriginalArg(2) long v1, @OriginalArg(3) int v2, @OriginalArg(4) int v3, @OriginalArg(5) String targetVerb, @OriginalArg(6) int action, @OriginalArg(7) boolean arg7, @OriginalArg(8) int cursor, @OriginalArg(9) String opBase, @OriginalArg(10) long key, @OriginalArg(12) boolean independent) {
if (!open && innerEntryCount < 500) {
@Pc(20) int targetEndCursor = cursor != -1 ? cursor : InterfaceManager.targetEndCursor;
@Pc(36) MiniMenuEntryInner inner = new MiniMenuEntryInner(targetVerb, opBase, targetEndCursor, action, invObject, v1, v2, v3, arg7, differentLevel, key, independent);
addEntryInner(inner);
}
}
@OriginalMember(owner = "client!gfa", name = "a", descriptor = "(Z)Z")
public static boolean topEntryIsIfButtonX1() {
if (topEntry == null) {
return false;
} else {
if (topEntry.action >= 2000) {
topEntry.action -= 2000;
}
return topEntry.action == MiniMenuAction.IF_BUTTONX2;
}
}
@OriginalMember(owner = "client!ci", name = "a", descriptor = "(I)Z")
public static boolean isPopulated() {
return innerEntryCount > 0;
}
@OriginalMember(owner = "client!cv", name = "b", descriptor = "(B)V")
public static void openButtons() {
for (@Pc(4) MiniMenuEntryInner entry = (MiniMenuEntryInner) innerEntryQueue.first(); entry != null; entry = (MiniMenuEntryInner) innerEntryQueue.next()) {
if (MiniMenuAction.isButtonOp(entry.action)) {
openInner(entry);
}
}
}
@OriginalMember(owner = "client!client", name = "a", descriptor = "(BLclient!pg;)V")
public static void addEntryInner(@OriginalArg(1) MiniMenuEntryInner inner) {
if (inner == null) {
return;
}
innerEntryQueue.addLast(inner);
innerEntryCount++;
@Pc(33) MiniMenuEntry entry;
if (inner.independent || "".equals(inner.opBase)) {
entry = new MiniMenuEntry(inner.opBase);
entryCount++;
} else {
@Pc(41) long key = inner.entryKey;
for (entry = (MiniMenuEntry) entryTable.get(key); entry != null && !entry.title.equals(inner.opBase); entry = (MiniMenuEntry) entryTable.nextWithSameKey()) {
}
if (entry == null) {
entry = (MiniMenuEntry) cache.get(key);
if (entry != null && !entry.title.equals(inner.opBase)) {
entry = null;
}
if (entry == null) {
entry = new MiniMenuEntry(inner.opBase);
}
entryTable.put(key, entry);
entryCount++;
}
}
if (entry.add(inner)) {
reposition(entry);
}
}
@OriginalMember(owner = "client!mb", name = "a", descriptor = "(Lclient!cba;B)V")
public static void reposition(@OriginalArg(0) MiniMenuEntry entry) {
@Pc(5) boolean inserted = false;
entry.unlink2();
for (@Pc(21) MiniMenuEntry other = (MiniMenuEntry) entryQueue.first(); other != null; other = (MiniMenuEntry) entryQueue.next()) {
if (isActionBefore(entry.getAction(), other.getAction())) {
inserted = true;
Node2.addAfter(other, entry);
break;
}
}
if (!inserted) {
entryQueue.add(entry);
}
}
@OriginalMember(owner = "client!rd", name = "a", descriptor = "(BII)Z")
public static boolean isActionBefore(@OriginalArg(1) int curr, @OriginalArg(2) int prev) {
if (prev >= 1000 && curr < 1000) {
return true;
} else if (prev >= 1000 || curr >= 1000) {
return prev >= 1000 && curr >= 1000;
} else if (MiniMenuAction.isTarget(curr)) {
return true;
} else if (!MiniMenuAction.isTarget(prev)) {
return true;
} else {
return false;
}
}
@OriginalMember(owner = "client!hj", name = "c", descriptor = "(I)V")
public static void setCancelEntry() {
cancelEntry = new MiniMenuEntryInner(LocalisedText.CANCEL.localise(Client.language), "", InterfaceManager.targetEndCursor, 1012, -1, 0L, 0, 0, true, false, 0L, true);
}
@OriginalMember(owner = "client!vj", name = "a", descriptor = "(ILclient!pg;)V")
public static void openInner(@OriginalArg(1) MiniMenuEntryInner inner) {
if (open) {
return;
}
inner.unlink();
innerEntryCount--;
if (inner.independent) {
for (@Pc(22) MiniMenuEntry entry = (MiniMenuEntry) entryQueue.first(); entry != null; entry = (MiniMenuEntry) entryQueue.next()) {
if (!entry.title.equals(inner.opBase)) {
continue;
}
@Pc(31) boolean found = false;
for (@Pc(37) MiniMenuEntryInner other = (MiniMenuEntryInner) entry.innerEntries.first(); other != null; other = (MiniMenuEntryInner) entry.innerEntries.next()) {
if (other == inner) {
found = true;
if (entry.remove(inner)) {
reposition(entry);
}
break;
}
}
if (found) {
break;
}
}
} else {
@Pc(79) long key = inner.entryKey;
@Pc(85) MiniMenuEntry entry;
for (entry = (MiniMenuEntry) entryTable.get(key); entry != null; entry = (MiniMenuEntry) entryTable.nextWithSameKey()) {
if (entry.title.equals(inner.opBase)) {
break;
}
}
if (entry != null && entry.remove(inner)) {
reposition(entry);
}
}
}
@OriginalMember(owner = "client!uja", name = "a", descriptor = "(IZLclient!wj;)V")
public static void addNpcEntries(@OriginalArg(1) boolean differentLevel, @OriginalArg(2) NPCEntity npc) {
if (innerEntryCount >= 400) {
return;
}
@Pc(21) NPCType type = npc.type;
@Pc(24) String npcName = npc.name;
if (type.multinpcs != null) {
type = type.getMultiNPC(TimedVarDomain.instance);
if (type == null) {
return;
}
npcName = type.name;
}
if (!type.interactive) {
return;
}
if (npc.combatLevel != 0) {
@Pc(67) String text = ModeGame.STELLAR_DAWN == Client.modeGame ? LocalisedText.RATING.localise(Client.language) : LocalisedText.LEVEL.localise(Client.language);
npcName = npcName + colourCode(PlayerEntity.self.combatLevel, npc.combatLevel) + " (" + text + npc.combatLevel + ")";
}
if (InterfaceManager.targetMode && !differentLevel) {
@Pc(113) ParamType param = InterfaceManager.targetParam != -1 ? ParamTypeList.instance.list(InterfaceManager.targetParam) : null;
if ((InterfaceManager.targetMask & TargetMask.TGT_NPC) != 0 && (param == null || type.param(InterfaceManager.targetParam, param.defaultint) != param.defaultint)) {
addEntryInner(false, -1, npc.slot, 0, 0, InterfaceManager.targetVerb, MiniMenuAction.TGT_NPC, true, InterfaceManager.targetEnterCursor, InterfaceManager.targetedVerb + " -> <col=ffff00>" + npcName, npc.slot, false);
}
}
if (differentLevel) {
return;
}
@Pc(176) String[] ops = type.op;
if (debugOps) {
ops = prefixWithNum(ops);
}
if (ops == null) {
return;
}
for (@Pc(189) int op = ops.length - 1; op >= 0; op--) {
if (ops[op] != null && (type.aByte107 == 0 || !ops[op].equalsIgnoreCase(LocalisedText.ATTACK.localise(Client.language)) && !ops[op].equalsIgnoreCase(LocalisedText.EXAMINE.localise(Client.language)))) {
@Pc(226) short action = 0;
@Pc(228) int cursor = Cursor.interaction;
if (op == 0) {
action = MiniMenuAction.OPNPC1;
}
if (op == 1) {
action = MiniMenuAction.OPNPC2;
}
if (op == 2) {
action = MiniMenuAction.OPNPC3;
}
if (op == 3) {
action = MiniMenuAction.OPNPC4;
}
if (op == 4) {
action = MiniMenuAction.OPNPC5;
}
if (op == 5) {
action = MiniMenuAction.OPNPC6;
}
if (op == type.cursor1Op) {
cursor = type.cursor1;
}
if (type.cursor2Op == op) {
cursor = type.cursor2;
}
addEntryInner(false, -1, npc.slot, 0, 0, ops[op], action, true, ops[op].equalsIgnoreCase(LocalisedText.ATTACK.localise(Client.language)) ? type.attackCursor : cursor, "<col=ffff00>" + npcName, npc.slot, false);
}
}
if (type.aByte107 == 1) {
for (@Pc(341) int op = 0; op < ops.length; op++) {
if (ops[op] != null && (ops[op].equalsIgnoreCase(LocalisedText.ATTACK.localise(Client.language)) || ops[op].equalsIgnoreCase(LocalisedText.EXAMINE.localise(Client.language)))) {
@Pc(372) short offset = 0;
if (npc.combatLevel > PlayerEntity.self.combatLevel) {
offset = 2000;
}
@Pc(385) short action = 0;
@Pc(387) int cursor = Cursor.interaction;
if (op == 0) {
action = MiniMenuAction.OPNPC1;
}
if (op == 1) {
action = MiniMenuAction.OPNPC2;
}
if (op == 2) {
action = MiniMenuAction.OPNPC3;
}
if (op == 3) {
action = MiniMenuAction.OPNPC4;
}
if (op == 4) {
action = MiniMenuAction.OPNPC5;
}
if (op == 5) {
action = MiniMenuAction.OPNPC6;
}
if (type.cursor1Op == op) {
cursor = type.cursor1;
}
if (action != 0) {
action += offset;
}
if (type.cursor2Op == op) {
cursor = type.cursor2;
}
addEntryInner(false, -1, npc.slot, 0, 0, ops[op], action, true, ops[op].equalsIgnoreCase(LocalisedText.ATTACK.localise(Client.language)) ? type.attackCursor : cursor, "<col=ffff00>" + npcName, npc.slot, false);
}
}
}
}
@OriginalMember(owner = "client!vu", name = "b", descriptor = "(III)Ljava/lang/String;")
public static String colourCode(@OriginalArg(1) int ourLevel, @OriginalArg(2) int theirLevel) {
@Pc(8) int delta = ourLevel - theirLevel;
if (delta < -9) {
return "<col=ff0000>";
} else if (delta < -6) {
return "<col=ff3000>";
} else if (delta < -3) {
return "<col=ff7000>";
} else if (delta < 0) {
return "<col=ffb000>";
} else if (delta > 9) {
return "<col=00ff00>";
} else if (delta > 6) {
return "<col=40ff00>";
} else if (delta > 3) {
return "<col=80ff00>";
} else if (delta > 0) {
return "<col=c0ff00>";
} else {
return "<col=ffff00>";
}
}
@OriginalMember(owner = "client!hl", name = "a", descriptor = "(I[Ljava/lang/String;)[Ljava/lang/String;")
public static String[] prefixWithNum(@OriginalArg(1) String[] ops) {
@Pc(6) String[] prefixed = new String[5];
for (@Pc(8) int i = 0; i < 5; i++) {
prefixed[i] = i + ": ";
if (ops != null && ops[i] != null) {
prefixed[i] = prefixed[i] + ops[i];
}
}
return prefixed;
}
@OriginalMember(owner = "client!rj", name = "a", descriptor = "(Lclient!ha;I)V")
public static void drawPreview(@OriginalArg(0) Toolkit toolkit) {
if ((innerEntryCount < 2 && !InterfaceManager.targetMode) || InterfaceManager.dragSource != null) {
return;
}
@Pc(63) String text;
if (InterfaceManager.targetMode && innerEntryCount < 2) {
text = InterfaceManager.targetVerb + LocalisedText.MINISEPARATOR.localise(Client.language) + InterfaceManager.targetedVerb + " ->";
} else if (shiftClick && KeyboardMonitor.instance.isPressed(SimpleKeyboardMonitor.KEY_CODE_SHIFT) && innerEntryCount > 2) {
text = getLineText(activeEntry);
} else {
@Pc(55) MiniMenuEntryInner entry = activeEntry;
if (entry == null) {
return;
}
text = getLineText(entry);
@Pc(65) int[] quests = null;
if (MiniMenuAction.isObjOp(entry.action)) {
quests = ObjTypeList.instance.list((int) entry.v1).quests;
} else if (entry.objId != -1) {
quests = ObjTypeList.instance.list(entry.objId).quests;
} else if (MiniMenuAction.isNpcOp(entry.action)) {
@Pc(93) NPCEntityNode node = (NPCEntityNode) NPCList.local.get((int) entry.v1);
if (node != null) {
@Pc(98) NPCEntity entity = node.npc;
@Pc(101) NPCType type = entity.type;
if (type.multinpcs != null) {
type = type.getMultiNPC(TimedVarDomain.instance);
}
if (type != null) {
quests = type.quests;
}
}
} else if (MiniMenuAction.isLocOp(entry.action)) {
@Pc(131) LocType type = LocTypeList.instance.list((int) ((entry.v1 >>> 32) & 0x7FFFFFFFL));
if (type.multiloc != null) {
type = type.getMultiLoc(TimedVarDomain.instance);
}
if (type != null) {
quests = type.quests;
}
}
if (quests != null) {
text = text + questIcon(quests);
}
}
if (innerEntryCount > 2) {
text = text + "<col=ffffff> / " + (innerEntryCount - 2) + LocalisedText.MOREOPTIONS.localise(Client.language);
}
if (WorldMap.optionsComponent != null) {
@Pc(232) Font font = WorldMap.optionsComponent.font(toolkit);
if (font == null) {
font = Fonts.b12;
}
font.renderRandom(Static329.anIntArray163, WorldMap.optionsComponent.textAlignX, WorldMap.optionsComponent.width, iconHeights, WorldMap.optionsComponent.colour, WorldMap.optionsComponent.height, random, text, WorldMap.optionsX, WorldMap.optionsComponent.graphicShadow, icons, randomSeed, WorldMap.optionsY, WorldMap.optionsComponent.textAlignY);
InterfaceManager.redrawWithin(Static329.anIntArray163[0], Static329.anIntArray163[1], Static329.anIntArray163[2], Static329.anIntArray163[3]);
} else if (InterfaceManager.optionsComponent != null && Client.modeGame == ModeGame.RUNESCAPE) {
@Pc(299) int width = Fonts.b12.renderRandom(icons, randomSeed, 0xFFFFFF, InterfaceManager.optionsY + 16, text, iconHeights, 0, random, InterfaceManager.optionsX + 4);
InterfaceManager.redrawWithin(InterfaceManager.optionsX + 4, InterfaceManager.optionsY, width + Fonts.b12Metrics.stringWidth(text), 16);
}
}
@OriginalMember(owner = "client!qf", name = "a", descriptor = "(Lclient!pg;B)Ljava/lang/String;")
public static String getLineText(@OriginalArg(0) MiniMenuEntryInner entry) {
if (entry.second == null || entry.second.length() == 0) {
return entry.opBase == null || entry.opBase.length() <= 0 ? entry.op : entry.op + LocalisedText.MINISEPARATOR.localise(Client.language) + entry.opBase;
} else if (entry.opBase == null || entry.opBase.length() <= 0) {
return entry.op + LocalisedText.MINISEPARATOR.localise(Client.language) + entry.second;
} else {
return entry.op + LocalisedText.MINISEPARATOR.localise(Client.language) + entry.opBase + LocalisedText.MINISEPARATOR.localise(Client.language) + entry.second;
}
}
@OriginalMember(owner = "client!hda", name = "a", descriptor = "(Lclient!ha;IIIIILclient!pg;IIIII)V")
public static void drawEntryInner(@OriginalArg(0) Toolkit toolkit, @OriginalArg(6) MiniMenuEntryInner entry, @OriginalArg(9) int x, @OriginalArg(3) int y, @OriginalArg(1) int width, @OriginalArg(2) int height, @OriginalArg(10) int mouseX, @OriginalArg(8) int mouseY, @OriginalArg(7) int textColour, @OriginalArg(5) int highlightColour, @OriginalArg(4) int innerY) {
if (mouseX > x && mouseX < width + x && mouseY > innerY - 13 && mouseY < innerY + 3 && entry.aBoolean552) {
textColour = highlightColour;
}