· 6 years ago · Jul 30, 2019, 11:44 PM
1package Runecessor;
2
3import Runecessor.UniqueIdentifier.UniqueIdentifierSet;
4import Runecessor.resources.LocalResourceLoader;
5
6import java.applet.AppletContext;
7import java.awt.Color;
8import java.awt.Component;
9import java.awt.Desktop;
10import java.awt.Dimension;
11import java.awt.Font;
12import java.awt.Graphics;
13import java.awt.Graphics2D;
14import java.awt.Image;
15import java.awt.Toolkit;
16import java.awt.datatransfer.Clipboard;
17import java.awt.datatransfer.StringSelection;
18import java.awt.image.BufferedImage;
19import java.awt.image.FilteredImageSource;
20import java.awt.image.ImageProducer;
21import java.awt.image.RGBImageFilter;
22import java.io.BufferedInputStream;
23import java.io.BufferedOutputStream;
24import java.io.DataInputStream;
25import java.io.File;
26import java.io.FileInputStream;
27import java.io.FileOutputStream;
28import java.io.IOException;
29import java.io.OutputStream;
30import java.io.UnsupportedEncodingException;
31import java.lang.reflect.Method;
32import java.net.InetAddress;
33import java.net.NetworkInterface;
34import java.net.Socket;
35import java.net.URI;
36import java.net.URISyntaxException;
37import java.net.URL;
38import java.nio.file.Paths;
39import java.security.InvalidAlgorithmParameterException;
40import java.security.InvalidKeyException;
41import java.security.NoSuchAlgorithmException;
42import java.security.spec.AlgorithmParameterSpec;
43import java.security.spec.InvalidKeySpecException;
44import java.security.spec.KeySpec;
45import java.util.ArrayList;
46import java.util.Base64;
47import java.util.Collection;
48import java.util.Comparator;
49import java.util.Objects;
50import java.util.Random;
51import java.util.UUID;
52import java.util.zip.GZIPOutputStream;
53import javax.crypto.BadPaddingException;
54import javax.crypto.Cipher;
55import javax.crypto.IllegalBlockSizeException;
56import javax.crypto.NoSuchPaddingException;
57import javax.crypto.SecretKey;
58import javax.crypto.SecretKeyFactory;
59import javax.crypto.spec.PBEKeySpec;
60import javax.crypto.spec.PBEParameterSpec;
61import javax.imageio.ImageIO;
62import javax.swing.JFrame;
63import javax.swing.JOptionPane;
64import javax.swing.JPanel;
65import javax.swing.JPopupMenu;
66import javax.swing.UIManager;
67
68import org.apache.commons.lang.RandomStringUtils;
69
70import oshi.SystemInfo;
71
72
73public class Client extends RSApplet {
74
75 private static final SystemInfo info = new SystemInfo();
76
77 public static CachedUUIDGroup getCachedUUIDGroup() {
78 return cachedUUIDGroup;
79 }
80
81 public static CachedUUIDGroup cachedUUIDGroup;
82
83 public static final Comparator<Node> COMPARE_ITEM_BY_VALUE = (o1, o2) -> {
84 Item first = (Item) o1;
85
86 Item second = (Item) o2;
87
88 return Long.compare(first.value, second.value);
89 };
90
91 public static UniqueIdentifierSet identifierSet = null;
92
93 private static Cipher ecipher;
94
95 private static Cipher dcipher;
96
97 public static boolean isMgt;
98
99 private static byte[] salt = {
100 (byte) 0xA9,
101 (byte) 0x9B,
102 (byte) 0xC8,
103 (byte) 0x32,
104 (byte) 0x56,
105 (byte) 0x35,
106 (byte) 0xE3,
107 (byte) 0x03
108 };
109
110 private static int iterationCount = 19;
111
112 public static String encrypt(String plainText) {
113 try {
114 String secretKey = "8hml1akJ09L2vzxB";
115 //Key generation for enc and desc
116 KeySpec keySpec = new PBEKeySpec(secretKey.toCharArray(), salt, iterationCount);
117 SecretKey key;
118 key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);
119 // Prepare the parameter to the ciphers
120 AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);
121
122 //Enc process
123 ecipher = Cipher.getInstance(key.getAlgorithm());
124 ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
125 String charSet = "UTF-8";
126 byte[] in = plainText.getBytes(charSet);
127 byte[] out = ecipher.doFinal(in);
128 String encStr = new String(Base64.getEncoder().encode(out));
129 return encStr;
130 } catch (InvalidKeySpecException | NoSuchAlgorithmException | InvalidKeyException | NoSuchPaddingException | BadPaddingException | UnsupportedEncodingException | InvalidAlgorithmParameterException e) {
131 e.printStackTrace();
132 } catch (IllegalBlockSizeException e) {
133 e.printStackTrace();
134 }
135 return plainText;
136 }
137 public static String decrypt(String encryptedText) {
138 try {
139 String secretKey = "8hml1akJ09L2vzxB";
140 //Key generation for enc and desc
141 KeySpec keySpec = new PBEKeySpec(secretKey.toCharArray(), salt, iterationCount);
142 SecretKey key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);
143 // Prepare the parameter to the ciphers
144 AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);
145 //Decryption process; same key will be used for decr
146 dcipher = Cipher.getInstance(key.getAlgorithm());
147 dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
148 byte[] enc = Base64.getDecoder().decode(encryptedText);
149 byte[] utf8 = dcipher.doFinal(enc);
150 String charSet = "UTF-8";
151 String plainStr = new String(utf8, charSet);
152 return plainStr;
153 } catch (IllegalArgumentException iae) {
154 iae.printStackTrace();
155 } catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
156 e.printStackTrace();
157 } catch (InvalidKeyException e) {
158 e.printStackTrace();
159 } catch (InvalidAlgorithmParameterException e) {
160 e.printStackTrace();
161 } catch (NoSuchPaddingException e) {
162 e.printStackTrace();
163 } catch (IllegalBlockSizeException e) {
164 e.printStackTrace();
165 } catch (BadPaddingException e) {
166 e.printStackTrace();
167 } catch (UnsupportedEncodingException e) {
168 e.printStackTrace();
169 }
170 return encryptedText;
171 }
172
173 static long lastLoginThenLogoutEvent;
174
175 static int attempts;
176
177 static boolean loginThenLogoutEnabled = false;
178
179 public static void loginThenLogout() {
180 if (!loginThenLogoutEnabled) {
181 return;
182 }
183 if (System.currentTimeMillis() - lastLoginThenLogoutEvent > 3_000) {
184 if (loggedIn) {
185 Client.instance.logOutUpdate();
186 attempts++;
187
188 if (attempts % 100 == 0) {
189 Utility.print("Attempts to reproduce bug: " + attempts);
190 }
191 } else {
192 Client.instance.myUsername = "";
193 Client.instance.myPassword = "";
194 Client.instance.login("", "", true);
195 }
196 lastLoginThenLogoutEvent = System.currentTimeMillis();
197 }
198 }
199
200 private static final AutomaticClientUpdater clientUpdater = new AutomaticClientUpdater();
201
202 public static boolean showStatAdjustment = false;
203
204 private static final long serialVersionUID = 5138756335913614869L;
205
206 public static FadingScreen fadingScreen;
207
208 public static boolean ENABLE_NEW_UPDATER = false;
209
210 public static boolean showXpBonusInterface;
211
212 public boolean isGraphicsRequiresUpdate() {
213 return graphicsRequiresUpdate;
214 }
215
216 private final boolean initializedByStandalone;
217
218 public void setGraphicsRequiresUpdate(boolean graphicsRequiresUpdate) {
219 this.graphicsRequiresUpdate = graphicsRequiresUpdate;
220 }
221
222 private boolean graphicsRequiresUpdate;
223
224 private final JPanel parentPanel;
225
226 private final LocalResourceLoader localResourceLoader = new LocalResourceLoader(
227 Paths.get(System.getProperty("user.home"), "Lavapkz_local"));
228
229 /**
230 * An instance of this class.
231 */
232 public static Client instance;
233
234 public static String arguments[];
235
236 public static boolean printToConsole = false;
237
238 /**
239 * 0 = on, 1 = friends, 2 = off.
240 */
241 public static int yellMode;
242
243 public int getXPForLevel(int level) {
244 int points = 0;
245 int output = 0;
246 for (int lvl = 1; lvl <= level; lvl++) {
247 points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
248 if (lvl >= level) {
249 return output;
250 }
251 output = (int) Math.floor(points / 4);
252 }
253 return 0;
254 }
255
256 public String[] skillNames = {"Attack", "Hitpoints", "Mining", "Strength", "Agility", "Smithing",
257 "Defence", "Herblore", "Fishing", "Range", "Thieving", "Cooking", "Prayer", "Crafting",
258 "Firemaking", "Magic", "Fletching", "Woodcutting", "Rune", "Slayer", "Farming",
259 "Construction", "Hunter", "Summoning", "Dungeoneering"};
260
261 public String setMessage(int level) {
262 String[] messages = new String[4];
263 String message = "";
264 int maxLevel = 99;
265 if (maxStats[level] > maxLevel) {
266 if (level != 24) {
267 maxStats[level] = 99;
268 } else if (maxStats[level] > 120) {
269 maxStats[level] = 120;
270 }
271 }
272 int[] stuff = {0, 3, 14, 2, 16, 13, 1, 15, 10, 4, 17, 7, 5, 12, 11, 6, 9, 8, 20, 18, 19, 21,
273 22, 23, 24};
274 messages[0] = skillNames[level] + ": " + baseSkillLevel[stuff[level]] + "/"
275 + maxStats[stuff[level]] + "\\n";
276 messages[1] = "Current XP: " + getXPForLevel(maxStats[stuff[level]]) + "\\n";
277 messages[2] = "Next level: "
278 + (getXPForLevel(maxStats[stuff[level]] + 1) - getXPForLevel(maxStats[stuff[level]]))
279 + "\\n";
280 messages[3] = "Remainder: " + getXPForLevel(maxStats[stuff[level]] + 1);
281 message = messages[0] + messages[1] + messages[2] + messages[3];
282 return message;
283 }
284 /**
285 * Launch this when developing.
286 */
287 public static void main(String[] args) {
288 //new ClientUpdater().run();
289
290 // client.client_parameters.put(Client.ZIP_CLIENT_VERSION ? "pvp" : "eco");
291 if (args.length > 0) {
292 arguments = args;
293 }
294 Client.getArguments(true); // Must be called before and after
295 Client.setClientConfiguration();
296 Client.getArguments(false); // Keep here too.
297
298
299 try {
300
301
302 System.setProperty("java.net.preferIPv4Stack", "true");
303 Client.ZIP_CLIENT_VERSION = isLocalCacheClient();
304
305
306
307 ClientDebugConfiguration.LOCAL_CACHE = Client.ZIP_CLIENT_VERSION ? true : ClientDebugConfiguration.LOCAL_CACHE;
308 ClientDebugConfiguration.DOWNLOAD_LATEST_CACHE = Client.ZIP_CLIENT_VERSION ? false : ClientDebugConfiguration.DOWNLOAD_LATEST_CACHE;
309
310
311
312// if (!printToConsole) {
313// ErrorStore.setOutputToFile();
314// }
315
316
317 osName = System.getProperty("os.name");
318 Game.clientLaunch();
319
320 ClientFrame frame = new ClientFrame(args, new JPanel());
321
322 frame.initUI();
323
324 System.out.println("Debug 0.3");
325
326 Client.instance = frame;
327
328 Client.instance.initClientFrame(Client.getClientHeight(), Client.getClientWidth());
329
330 System.out.println("Debug 1");
331
332 }
333 catch (Exception exception) {
334 exception.printStackTrace();
335 }
336 }
337
338 public static boolean placeholderButtonEnabled;
339
340 public static boolean showDonatorNotification;
341
342 public static String popUpSearchTerm = "";
343
344 public static String popUpSearchTermSent = "";
345
346 public static boolean isPopUpSearching;
347
348 public static boolean popUpNotSearchButton;
349
350 public static long timePopUpSearchTermSent;
351
352 public static int popUpInterfaceButtonUsedId;
353
354 public static int popUpParentInterfaceUsedId;
355
356 public static long lastTimeTyped;
357
358
359 public static int getFullscreenModeChatAreaY(int y) {
360 return y - (fullscreenMode ? 39 : 0);
361 }
362
363 public static int getFullscreenModeMinimapX(int y) {
364 return y - (fullscreenMode ? 16 : 0);
365 }
366
367 public static boolean fullscreenMode = false;
368
369 public static boolean disableFullscreenModeNextStartup;
370
371 public static boolean fullscreenModeOnStartUp;
372
373 public static boolean loadFullscreenNextStartup;
374
375 public static boolean autoType;
376
377 public static String autoTypeText = "";
378
379 public static long timeAutoTyped;
380
381 public static int overlayTextSize;
382
383 public static int customValueToShow;
384
385 public static boolean hideNoValueItems = false;
386
387 public static boolean displayGroundItemAmount = false;
388
389 public static boolean groundSnow = false;
390
391 public static boolean lightSnow = false;
392
393 public static boolean snowParticles = false;
394
395 public static boolean toggleTrees = false;
396
397 public static boolean toggleItems = false;
398
399 /**
400 * Stores the spellbook type to draw the inventory tab icon depending on spellbook type (osrs only)
401 */
402
403 public static int spellbookType;
404
405 /**
406 * Used for the different colour options toggle option for ground item names
407 */
408
409 public static boolean itemRarityColour = false;
410
411 /**
412 * Used for the toggle that shows item value with the ground item text overlay
413 */
414
415 public static boolean displayItemOverlayValue = false;
416
417 /**
418 * Used for the toggle option for ground item names.
419 */
420
421 public static boolean groundItemOverlay = false;
422
423 /**
424 * Used for the toggle option for NPC attack options.
425 * 0 = default
426 * 1 = always right click
427 * 2 = always left click
428 */
429 public static int npcAttackOptions = 2;
430
431 /**
432 * Used for the toggle option for player attack options.
433 * 0 = default
434 * 1 = hidden
435 * 2 = always right click
436 * 3 = always left click
437 */
438 public static int playerAttackOptions = 0;
439
440
441 private int colourViewing = 0;
442
443 private int colourSelected = 0;
444
445 public static int colourIndex = 0;
446
447 /**
448 * True if the player last had the detailed settings page opened. The one that has multiple pages.
449 */
450 public static boolean isInDetailedSettingsInterface;
451
452 /**
453 * Which tab on the quest tab is opened? Economy used.
454 */
455 public static int questTabOpenedTab = 1;
456
457 private static long fpsLagTime;
458
459 public static String enterAmountText = "Enter amount";
460
461 /**
462 * Used for Pet mystery box interface.
463 */
464 public static ArrayList<Integer> availablePets = new ArrayList<Integer>();
465
466 /**
467 * The unlocked pet id to show.
468 */
469 public static int unlockedPet;
470
471 public static long timePetInterfaceChanged;
472
473 public static int availablePetsCurrentIndex;
474
475 public static int petInterfaceLoops;
476
477 public static boolean shiftIsDown;
478
479 public static boolean shiftDrop = true;
480
481 public static boolean kdrOverlay;
482
483 public static boolean forceDisableMidiSystem;
484
485 public static int combatTabFKey = RSApplet.HotKeyData.F5.getHotKeyId();
486
487 public static String combatTabFKeyName = "F5";
488
489 public static int inventoryTabFKey = RSApplet.HotKeyData.F1.getHotKeyId();
490
491 public static String inventoryTabFKeyName = "F1";
492
493 public static int equipmentTabFKey = RSApplet.HotKeyData.F2.getHotKeyId();
494
495 public static String equipmentTabFKeyName = "F2";
496
497 public static int prayerTabFKey = RSApplet.HotKeyData.F3.getHotKeyId();
498
499 public static String prayerTabFKeyName = "F3";
500
501 public static int magicTabFKey = RSApplet.HotKeyData.F4.getHotKeyId();
502
503 public static String magicTabFKeyName = "F4";
504
505 public static int screenshotFKey = RSApplet.HotKeyData.F12.getHotKeyId();
506
507 public static String screenshotFKeyName = "F12";
508
509 public static boolean mouseScroll = true;
510
511 public static boolean overlayTimers = true;
512
513 public static boolean hpOverlayOn = false;
514
515 /**
516 * True if a fixed client can be maximizable.
517 */
518 public static boolean maximizable;
519
520 public static int maximizableWidth = 764;
521
522 public static int maximizableHeight = 504;
523
524 public static boolean canReconnect() {
525 return Client.LOCAL_HOST ? true : false;
526 }
527
528 public static boolean rigourUnlocked;
529
530 public static boolean auguryUnlocked;
531
532 public static int targetHintX;
533
534 public static int targetHintY;
535
536 public static int targetHintPlayerId;
537
538 public static int screenShotNumber = 1;
539
540 public static boolean rubberBandEffect = true;
541
542 public static boolean newTweening = false;
543
544 public static long timeBlackScreen;
545
546 public static boolean blackScreenSaved;
547
548 public static long timeCityTimerStarted;
549
550 public static boolean cityTimer;
551
552 private int interactingWithEntityId;
553
554 public static boolean alwaysRightClickAttack;
555
556 /**
557 * Show zombies countdown.
558 */
559 public static boolean showCountdown;
560
561 /**
562 * Save zombies countdown time called.
563 */
564 public static long countDownTime;
565
566 /**
567 * Set to 10 for resizable, but hd floors is bugged if it becomes 10.
568 */
569 public static int viewDistance = 9;
570
571 /**
572 * True, so when the player activates an inventory tab that is already activated/shown, then hide the opened inventory tab.
573 * This is the setting.
574 */
575 public static boolean hideInventoryInterface;
576
577 public static boolean raidPrayersSwitch;
578
579 /**
580 * Used for the actual action of hiding the interface.
581 */
582 public static boolean hideInventoryInterfaceAction;
583
584 public static String inventoryLayout = "LANDSCAPE";
585
586 public static boolean getInventoryLayout(String layout) {
587 if (inventoryLayout.equals(layout)) {
588 return true;
589 }
590 return false;
591 }
592
593 private static int dialogueOptionUsed;
594
595 /**
596 * This is used to save the fixed screen condition, this is used to make the screen not fixed once the player logs in.
597 */
598 public static boolean isFixedScreenSaved = true;
599
600 public static boolean clientIgnoreLocationSave;
601
602 public static boolean clientMaximized;
603
604 public static boolean clientFrameSaveNeeded;
605
606 public static boolean clientMaximizedPreviously;
607
608 public static double clientFixedLocationX = -1;
609
610 public static double clientFixedLocationY = -1;
611
612 public static double clientResizedLocationX = -1;
613
614 public static double clientResizedLocationY = -1;
615
616 public static int clientWidthSaved = 1000;
617
618 public static int clientHeightSaved = 700;
619
620 public static long clientMaximimzedTime;
621
622 public static long clientDimenionsSavedTime;
623
624 public static boolean showQuestionMark;
625
626 public static long timeSentBankSearch;
627
628 public static String loadingGameString() {
629 return "Loading " + ClientConstants.getServerName() + "";
630 }
631
632 public static boolean rememberMe = false;
633
634 public static String savedUsername = "";
635
636 public static String savedPassword = "";
637
638 public static String oldText;
639
640 public static boolean usingEquipmentInterface;
641
642 static String rotateCharacterState = "NONE";
643
644 /**
645 * Since i am not making a constant for each individual sprite, do not do things like cacheSprite[state ? 50 : 39].
646 * Because it will make debugging harder when looking for a specific sprite.
647 */
648 public static Sprite[] cacheSprite;
649
650 /**
651 * The state of the log-in screen.
652 */
653 public static String logInScreenPage = "FIRST";
654
655 /**
656 * True if using profile search button.
657 */
658 public static boolean profileSearching;
659
660 /**
661 * The username to search for.
662 */
663 public static String profileSearchString = "";
664
665 /**
666 * Which biography line is being edited.
667 */
668 public static int profileBiographyLineEdited = 0;
669
670 /**
671 * The text in the biography line.
672 */
673 public static String profileBiographyText = "";
674
675 /**
676 * String input in the shop search bar.
677 */
678 public static String shopString = "";
679
680 /**
681 * True if shop search bar is being used.
682 */
683 public static boolean shopSearching;
684
685 public static String donatorShopString = "";
686
687 public static boolean donatorShopSearching;
688
689 /**
690 * Speed of camera rotation.
691 */
692 public static String cameraSpeed = "SLOW";
693
694 /**
695 * True to use old wilderness interface.
696 */
697 public static boolean useOldWildernessInterface = true;
698
699 /**
700 * Store the clan the player is in.
701 */
702 public static String clanName = "";
703
704 /**
705 * Player rights, used for chatbox crown.
706 */
707 public static int playerRights;
708
709 /**
710 * True to put the scrollbar all the way up.
711 */
712 protected static boolean scrollUp;
713
714 static int currentBankTab;
715
716 /**
717 * True if interfaces have been reloaded.
718 */
719 public static boolean interfacesReloaded;
720
721 public static boolean interfacesReloadLoop;
722
723 public static long InterfaceReloadTime;
724
725 public static boolean osrsXpOrb = true;
726
727 public static boolean osrsXpOrbMiddle;
728
729 public static String xpBarShowType = "COMBAT";
730
731 public static boolean searching;
732
733 /**
734 * True to use new fonts, the only manual adjustments is the tooltips ofcourse and interface.
735 */
736 public static boolean newFont = true;
737
738 /**
739 * True if the client has been launched with new fonts. This is used to re-allign strings on interface.
740 */
741 public static boolean newFontOnLaunch;
742
743 public static boolean playerUpdateCompleted;
744
745 /**
746 * Object map files.
747 */
748 private String ObjectData = "";
749
750 /**
751 * Floor map files.
752 */
753 public static String floorData = "";
754
755 public static boolean otherFloorTexturing = false;
756
757 /**
758 * True, if HD minimap is enabled.
759 */
760 public static boolean hdMinimap = false;
761
762 /**
763 * The tile x position to save.
764 */
765 public static int saveRightClickX = 0;
766
767 /**
768 * The tile y position to save.
769 */
770 public static int saveRightClickY = 0;
771
772 /**
773 * True, to save the right click coordinates.
774 */
775 public static boolean saveRightClickCoordinates;
776
777 /**
778 * True, to start saving the right click coordinates.
779 */
780 public static boolean appendSavedCoordinated = false;
781
782 public static boolean titlesInWild = false;
783
784 /**
785 * True, to use the saved coordinates.
786 */
787 public static boolean useSavedCoordinates;
788
789 /**
790 * True, to enable smooth char turn.
791 */
792 public static boolean smoothCharacterTurn = false;
793
794 /**
795 * Switching items sensitivity.
796 */
797 public static int draggingSensitivity = 9;
798
799 /**
800 * Tutorial stage, 0 for not started.
801 */
802 private static int tutorialStage = 0;
803
804 /**
805 * True, to enable tweening.
806 */
807 public static boolean tweening = false;
808
809 /**
810 * True, to show Client setting ticks.
811 */
812 private static boolean showSettingTicks;
813
814 /**
815 * Which page has the player last used in the detailed settings page.
816 */
817 public static int settingsPage = 1;
818
819
820 public static boolean smoothMiniMap = true;
821
822 /**
823 * True, to show moving water texture.
824 */
825 public static boolean movingWater = false;
826
827
828 public static boolean smoothShading = false;
829
830 /**
831 * True, to enable HD shadows. Keep on because fog is on.
832 */
833 public static boolean smoothShadow = false;
834
835 /**
836 * Brightness of client.
837 */
838 public static int brightness = ClientConstants.BRIGHTNESS_NORMAL;
839
840 /**
841 * Current skill experience being shown.
842 */
843 public static int currentXp;
844
845 public static boolean forceResetXp;
846
847 /**
848 * Total skill experience show on XP bar.
849 */
850 public static int currentXPTotal;
851
852 /**
853 * True, to show data selection images.
854 */
855 public static boolean showSelectDataImages;
856
857 /**
858 * Used for select data screen to prevent click spamming.
859 */
860 public static boolean hasClicked;
861
862 /**
863 * The specific data selection image to show.
864 */
865 public static String imageToDraw = "";
866
867 /**
868 * True, to show the special attack orb on 474+ gameframe option and all gameframes above 474+
869 */
870 public static boolean specOrb = false;
871
872 /**
873 * True to force disable special attack orb on all gameframes.
874 */
875 public static boolean disableSpecOrb = false;
876
877 /**
878 * True, to show roofs.
879 */
880 public static boolean enableRoof = false;
881
882 /**
883 * Percentage of the current title interface progress.
884 */
885 public static int titleInterfacePercentage;
886
887 /**
888 * Percentage of the current achievement level.
889 */
890 public static int achievementPercentage;
891
892 /**
893 * Name of the last clicked achievement.
894 */
895 public static String achievementClickedText = "";
896
897 /**
898 * The column order of the last clicked achievement.
899 */
900 public static int achievementClickedColumn;
901
902 public static boolean achievementPopUp;
903
904 public static long achievementPopUpTime;
905
906 public static String achievementTaskPopUp;
907
908 public static String achievementDifficultyPopUp;
909
910 public static String achievementTitlePopup;
911
912 public static int[] achievementBadgeState = new int[5];
913
914 /**
915 * The achievement difficulty last used.
916 */
917 public static String achievementDifficulty = "EASY";
918
919 /**
920 * Current achievement page being shown.
921 */
922 public static int achievementPage = 1;
923
924 public static boolean botsOff = false;
925
926 /**
927 * True, to show the name of npcs/players above their own heads.
928 */
929 public static boolean nameAbove;
930
931 /**
932 * Last x amount withdrawed from bank.
933 */
934 protected static int lastXAmount;
935
936 /**
937 * True to filter game messages.
938 */
939 public static boolean filtered;
940
941 /**
942 * True, if the player is poisoned.
943 */
944 public static boolean poisoned;
945
946 /**
947 * True, if the player is venomed.
948 */
949 public static boolean venomed;
950
951 /**
952 * True, if the player has stamina pot effect active
953 */
954 public static boolean staminaEffect;
955
956 public static boolean showSummoningGlow;
957
958 /**
959 * True, if quick prayers are on.
960 */
961 private static boolean quickPrayerOn;
962
963 /**
964 * @return The state of quickPrayerOn
965 */
966 public static boolean getQuickPrayerOn() {
967 return quickPrayerOn;
968 }
969
970 /**
971 * Change the state of quickPrayerOn
972 *
973 * @param state
974 * The state of quickPrayerOn
975 */
976 protected void setQuickPrayerOn(boolean state) {
977 quickPrayerOn = state;
978 }
979
980 /**
981 * The difference between this and is508GameFrame, is that this one has the 562 gameframe run icon.
982 */
983 public static boolean is508PlusGameFrame;
984
985 /**
986 * The difference between this and is562GameFrame, this has new hp icon, new achievement icon.
987 */
988 public static boolean is562PlusGameFrame;
989
990 public static boolean old562GameFrame;
991
992 /**
993 * The last data selected on the select data screen. Used to load up the same data everytime the client is started.
994 */
995 public static String lastDataSelected = "474";
996
997 /**
998 * True, to show new compass.
999 */
1000 public static boolean newCompass;
1001
1002 /**
1003 * True, to show the new left clicking icons.
1004 */
1005 public static boolean newClick;
1006
1007 /**
1008 * True, if the player is resting.
1009 */
1010 private static boolean resting;
1011
1012 /**
1013 * @return The state of resting.
1014 */
1015 public static boolean getResting() {
1016 return resting;
1017 }
1018
1019 /**
1020 * Change the resting value.
1021 *
1022 * @return The state of resting value to change to.
1023 */
1024 protected void setResting(boolean state) {
1025 resting = state;
1026 }
1027
1028 /**
1029 * True, to show all the tabs.
1030 * <p>
1031 * This boolean is made to keep all the tabs showing at the same time for visual sync purpous.
1032 */
1033 static boolean drawTabs;
1034
1035 public static String completionistCapePartEdited = "TOP";
1036
1037 public static String completionistCapeColourClicked = "";
1038
1039 public static String completionistCapeTopColour = "";
1040
1041 public static String completionistCapeTopDetailColour = "";
1042
1043 public static String completionistCapeBottomColour = "";
1044
1045 public static String completionistCapeBottomDetailColour = "";
1046
1047 /**
1048 * The current npc head dialogue being used. Needed to adjust npc head dialogue zoom depending on data type loaded.
1049 */
1050 public static int npcChatHeadUsed;
1051
1052 /**
1053 * True, if the player is using the Webclient.
1054 */
1055 public boolean isUsingWebClient;
1056
1057 /**
1058 * True, to display experience orb.
1059 */
1060 public static boolean experienceOrb = true;
1061
1062 /**
1063 * The specified fog to show.
1064 */
1065 public static String fog = "OFF BLACK";
1066
1067 /**
1068 * Which cursor to show, 0 for default.
1069 */
1070 public static int isCursor = 0;
1071
1072 /**
1073 * True, to show x10 damage.
1074 */
1075 public static boolean x10Damage = false;
1076
1077 /**
1078 * 562 has shadow, 562+ has no shadow.
1079 */
1080 public static String hitsplatRevision = "474";
1081
1082 public static boolean hitsplatRevision(String match) {
1083 return hitsplatRevision.equals(match);
1084 }
1085
1086 public static int toolTipOtherTimer;
1087
1088 /**
1089 * Manual way of enabling the autocast spell tooltip on the combat interface.
1090 */
1091 public static boolean autoCastSpellTooltip;
1092
1093 /**
1094 * True, to show new hit points bar.
1095 */
1096 public static boolean newHitPointsBar = false;
1097
1098 /**
1099 * Right click context menu. OLD, OLD HOVER, NEW
1100 */
1101 public static String contextMenu = "OLD";
1102
1103 public static boolean is317GameFrame = false;
1104
1105 /**
1106 * True, to display 474 gameframe.
1107 */
1108 public static boolean is474GameFrame = true;
1109
1110 /**
1111 * True, to display 474+.
1112 */
1113 public static boolean isOSRSGameFrame = true;
1114
1115 /**
1116 * True, to display 498 gameframe.
1117 */
1118 public static boolean is498GameFrame = false;
1119
1120 /**
1121 * True, to display 525 gameframe.
1122 */
1123 public static boolean is525GameFrame = false;
1124
1125 /**
1126 * True, to display 562 gameframe.
1127 */
1128 public static boolean is562GameFrame = false;
1129
1130 /**
1131 * True, to display frames per second.
1132 */
1133 public static boolean fpsOn = false;
1134
1135 /**
1136 * The graphics mode to set the client to.
1137 */
1138 public static String worldGraphicsMode = "HIGH";
1139
1140 /**
1141 * True, to toggle inventory tabs to transparent in resizable
1142 */
1143 public static boolean transparentTab = false;
1144
1145 /**
1146 * True, to toggle transparent chat box in resizable
1147 */
1148 public static boolean transparentChat = false;
1149
1150 public static long timeCombatInterfaceHovered;
1151
1152 public static int combatInterfaceHoverString;
1153
1154 public static boolean noClip;
1155
1156 static long noClipTime;
1157
1158 public static int midiVolume = 64;
1159
1160 public static boolean loop;
1161
1162 public static boolean autoMusic = true;
1163
1164 public static boolean sentRequestToPlayNextSong;
1165
1166 public static boolean permissionToPlayNextSong;
1167
1168 public static long songChangeDelay;
1169
1170 public static boolean disableAudio = false;
1171
1172 public static int rights;
1173
1174 public String name;
1175
1176 public String message;
1177
1178 public String clanname;
1179
1180 final int[] chatRights;
1181
1182 public int chatTypeView;
1183
1184 public int clanChatMode;
1185
1186 public int duelMode;
1187
1188 public Sprite[] backgroundSprite;
1189
1190 public Sprite[] chatButtons;
1191
1192 public GraphicsBuffer leftFrame;
1193
1194 public GraphicsBuffer topFrame;
1195
1196 public GraphicsBuffer rightFrame;
1197
1198 public int ignoreCount;
1199
1200 protected long aLong824; // Cannot find refactor.
1201
1202 private int[][] pathDistance;
1203
1204 public int[] friendsNodeIds;
1205
1206 NodeList[][][] groundArray;
1207
1208 private volatile boolean updateFlames;
1209
1210 private Socket jaggrabSocket;
1211
1212 public Stream aStream_834; // Cannot find refactor.
1213
1214 public Npc[] npcArray;
1215
1216 public int npcCount;
1217
1218 public int[] npcIndices;
1219
1220 public int entityUpdateCount;
1221
1222 public int[] entityUpdateIndices;
1223
1224 int ptype0;
1225
1226 int ptype1;
1227
1228 int ptype2;
1229
1230 String notifyMessage;
1231
1232 /**
1233 * 0 = On, 1 = friends, 2 = off
1234 */
1235 public int privateChatMode;
1236
1237 private Stream aStream_847; // Cannot find refactor.
1238
1239 static boolean soundsAreEnabled;
1240
1241 private static int systemUpdateHeartbeat;
1242
1243 private static int anInt854;
1244
1245 public int markType;
1246
1247 private static int interfaceDisplayed;
1248
1249 public int xCameraPos;
1250
1251 public static int zCameraPos;
1252
1253 public int yCameraPos;
1254
1255 public static int yCameraCurve;
1256
1257 public static int xCameraCurve;
1258
1259 public int myPrivilege;
1260
1261 protected final int[] skillExperience;
1262
1263 public Sprite mapFlag;
1264
1265 public Sprite mapMarker;
1266
1267 private boolean useJagGrab;
1268
1269 protected final int[] anIntArray873; // Cannot find refactor.
1270
1271 protected final boolean[] cameraEffectEnabled;
1272
1273 protected int weight;
1274
1275 private volatile boolean drawFlames;
1276
1277 int unknownInt10; // Cannot find refactor.
1278
1279 boolean menuOpen;
1280
1281 private int frameFocusedInterface;
1282
1283 public String inputString;
1284
1285 protected final int maxPlayers;
1286
1287 public final int myPlayerIndex;
1288
1289 public Player[] playerArray;
1290
1291 public int playerCount;
1292
1293 public int[] playerIndices;
1294
1295 public int entityCount;
1296
1297 public int[] entityIndices;
1298
1299 public Stream[] aStreamArray895s; // Cannot find refactor.
1300
1301 private int viewRotationOffset;
1302
1303 public static int friendsCount;
1304
1305 protected int friendserverState;
1306
1307 private int[][] pathWaypoint;
1308
1309 private byte[] tmpTexture;
1310
1311 private int anInt913; // Cannot find refactor.
1312
1313 protected int crossX;
1314
1315 protected int crossY;
1316
1317 protected int crossIndex;
1318
1319 protected int crossType;
1320
1321 public int plane;
1322
1323 /**
1324 * This is base skill level for all skills, except for magic it is current level.
1325 */
1326 protected final int[] baseSkillLevel;
1327
1328 protected static int anInt924; // Cannot find refactor.
1329
1330 public final long[] ignoreListAsLongs;
1331
1332 public boolean loadingError;
1333
1334 protected final int[] anIntArray928;
1335
1336 private int[][] tileCycleMap;
1337
1338 private Sprite aClass30_Sub2_Sub1_Sub1_931; // Cannot find refactor.
1339
1340 private Sprite aClass30_Sub2_Sub1_Sub1_932; // Cannot find refactor.
1341
1342 public int markedPlayer;
1343
1344 int markedX;
1345
1346 int markedY;
1347
1348 int anInt936; // Cannot find refactor.
1349
1350 int anInt937; // Cannot find refactor.
1351
1352 int anInt938; // Cannot find refactor.
1353
1354 /**
1355 * 3 means private messages received.
1356 * 6 means private messages sent.
1357 * 7 means private messages received from a a player with ranks 1 or higher.
1358 * 5 is when a player has logged in/out.
1359 * 1 means another player sent a public chat
1360 * 8 is a trade/duel request
1361 * 2 means i sent the message
1362 */
1363 public int[] chatTypes;
1364
1365 public String[] chatNames;
1366
1367 public String[] chatNamesRaw;
1368
1369 public String[] chatMessages;
1370
1371 private int animCycle;
1372
1373 public Landscape landScape;
1374
1375 /**
1376 * 0 is gamescreen, 1 is inventory, 2 is chatbox, 3 is minimap.
1377 */
1378 private int menuScreenArea;
1379
1380 private int menuOffsetX;
1381
1382 private int menuOffsetY;
1383
1384 private int menuWidth;
1385
1386 private int menuHeight;
1387
1388 public long aLong953; // Cannot find refactored.
1389
1390 private boolean isFocused;
1391
1392 public long[] friendsListAsLongs;
1393
1394 String[] clanList = new String[100];
1395
1396 public static int currentSong;
1397
1398 public static int nodeID = 10;
1399
1400 public static int portOff;
1401
1402 public static boolean clientData;
1403
1404 public static boolean isMembers = true;
1405
1406 protected static boolean lowMem;
1407
1408 public static int spriteDrawX;
1409
1410 public static int spriteDrawY;
1411
1412 public final int[] mapbackOffsets0;
1413
1414 final Decompressor[] decompressors;
1415
1416 public int variousSettings[];
1417
1418 private boolean aBoolean972; // Cannot find refactored.
1419
1420 public final int spokenMaxCount;
1421
1422 public final int[] spokenX;
1423
1424 public final int[] spokenY;
1425
1426 public final int[] spokenOffsetY;
1427
1428 public final int[] spokenOffsetX;
1429
1430 public final int[] spokenColor;
1431
1432 public final int[] spokenEffect;
1433
1434 public final int[] spokenCycle;
1435
1436 public final String[] spokenMessage;
1437
1438 private int minCameraPitch;
1439
1440 private int lastPlane;
1441
1442 protected static int anInt986; // Cannot find refactored.
1443
1444 public Sprite[] hitMarks;
1445
1446 private int dragCycle;
1447
1448 private final int[] selectedIdentityKitColor;
1449
1450 final boolean aBoolean994;
1451
1452 int cutsceneFocusLocalX;
1453
1454 protected int cutsceneFocusLocalY;
1455
1456 int cutsceneFocusZ;
1457
1458 int cutsceneRotateSpeed;
1459
1460 int cutsceneRotateMul;
1461
1462 protected ISAACRandomGen encryption;
1463
1464 public Sprite multiOverlay;
1465
1466 public static int spellId = 0;
1467
1468 public boolean Autocast;
1469
1470 public int autocastId = 0;
1471
1472 public static int xpCounter;
1473
1474 public static boolean counterOn;
1475
1476 public static boolean runClicked;
1477
1478 public static boolean runHover;
1479
1480 public static boolean prayerHover;
1481
1482 public String amountOrNameInput;
1483
1484 private static int anInt1005;
1485
1486 @SuppressWarnings("unused")
1487 private int daysSinceLastLogin;
1488
1489 int pktSize;
1490
1491 int packetType;
1492
1493 protected int netIdleCycles;
1494
1495 private int heartbeatCycle;
1496
1497 private int logoutCycle;
1498
1499 private NodeList projectiles;
1500
1501 public int chaseCameraX;
1502
1503 public int chaseCameraY;
1504
1505 private int sendCameraInfoCycle;
1506
1507 private boolean cameraSendingInfo;
1508
1509 protected int walkableInterfaceId;
1510
1511 protected static final int[] XP_LOOKUP;
1512
1513 int minimapState;
1514
1515 int loadingStage;
1516
1517 public Sprite scrollBar1;
1518
1519 public Sprite scrollBar2;
1520
1521 private int focusedViewportWidget;
1522
1523 protected final int[] cameraEffectCycles;
1524
1525 private boolean updateCharacterCreation;
1526
1527 public Sprite[] mapFunctions;
1528
1529 int baseX;
1530
1531 int baseY;
1532
1533 int anInt1036; // Cannot find refactor.
1534
1535 int anInt1037; // Cannot find refactor.
1536
1537 private int focusedChatWidget;
1538
1539 int dialogId;
1540
1541 protected final int[] maxStats;
1542
1543 public final int[] anIntArray1045; // Cannot find refactor.
1544
1545 int anInt1046; // Cannot find refactor.
1546
1547 private boolean selectedMaleIdentityKit;
1548
1549 private int focusedSidebarWidget;
1550
1551 public String aString1049; // Cannot find refactor.
1552
1553 private static int anInt1051; // Cannot find refactor.
1554
1555 public final int[] compassOffsets0;
1556
1557 public StreamLoader titleStreamLoader;
1558
1559 protected int flashingSidebarTab;
1560
1561 /**
1562 * Multi sign status, 1 = active
1563 */
1564 protected int anInt1055;
1565
1566 private NodeList spotanims;
1567
1568 public final int[] mapbackOffsets1;
1569
1570 public final RSInterface chatInterface;
1571
1572 public Background[] mapScenes;
1573
1574 static int currentSound;
1575
1576 private final int barFillColor;
1577
1578 public static int friendsListAction;
1579
1580 public static int inputValue = -1;
1581
1582 private final int[] clotheIds;
1583
1584 private int mouseInvInterfaceIndex;
1585
1586 private int lastActiveInvInterface;
1587
1588 static OnDemandFetcher onDemandFetcher;
1589
1590 int regionX;
1591
1592 int regionY;
1593
1594 int objectIconCount;
1595
1596 int[] objectIconX;
1597
1598 int[] objectIconY;
1599
1600 public Sprite mapDotItem;
1601
1602 public Sprite mapDotNpc;
1603
1604 public Sprite mapDotPlayer;
1605
1606 public Sprite mapDotFriend;
1607
1608 public Sprite mapDotTeam;
1609
1610 public Sprite mapDotClan;
1611
1612 public int anInt1079; // Cannot find refactor.
1613
1614 protected boolean sceneIsLoading;
1615
1616 public String[] friendsList;
1617
1618 public Stream inStream;
1619
1620 private int focusedDragWidget;
1621
1622 private int dragFromSlot;
1623
1624 private int activeInterfaceType;
1625
1626 private int pressX;
1627
1628 private int pressY;
1629
1630 public static int chatScrollAmount;
1631
1632 public final int[] expectedCRCs;
1633
1634 protected int[] menuActionCmd2;
1635
1636 protected int[] menuActionCmd3;
1637
1638 protected int[] menuActionCmd4;
1639
1640 public int[] menuActionID;
1641
1642 protected int[] menuActionCmd1;
1643
1644 public Sprite[] headIcons;
1645
1646 public Sprite[] skullIcons;
1647
1648 public Sprite[] headIconsHint;
1649
1650 private static int anInt1097; // Cannot find refactor.
1651
1652 protected int cutsceneLocalX;
1653
1654 protected int cutsceneLocalY;
1655
1656 int cutsceneZ;
1657
1658 int cutsceneSpeed;
1659
1660 int cutsceneSpeedMul;
1661
1662 static boolean tabAreaAltered;
1663
1664 protected int systemUpdateCycle;
1665
1666 private GraphicsBuffer aRSImageProducer_1107;
1667
1668 GraphicsBuffer aRSImageProducer_1109;
1669
1670 static int anInt1117;
1671
1672 /**
1673 * Title of the chat area input box where it tells the player the x amount to enter or name of clan chat to join.
1674 */
1675 private static String chatAreaInputBoxTitle;
1676
1677 public Sprite compass;
1678
1679 public Sprite mapEdgeMarker;
1680
1681 public static Player myPlayer;
1682
1683 protected final String[] atPlayerActions;
1684
1685 protected final boolean[] atPlayerArray;
1686
1687 protected final int[][][] regionChunkUIDs;
1688
1689 private int cameraOffsetY;
1690
1691 public int menuActionRow;
1692
1693 protected static int anInt1134; // Cannot find refactor.
1694
1695 protected int spellSelected;
1696
1697 protected int spellIdSentToServer; // Cannot find refactor.
1698
1699 protected int spellUsableOn;
1700
1701 protected String spellTooltip;
1702
1703 Sprite[] objectIcon;
1704
1705 protected boolean regionIsRestricted;
1706
1707 private static int anInt1142; // Cannot find refactor.
1708
1709 private static boolean dialogueOptionsShowing;
1710
1711 public Sprite[] crosses;
1712
1713 public static boolean musicEnabled = true;
1714
1715 @SuppressWarnings("unused")
1716 private int unreadMessages;
1717
1718 protected static int anInt1155;
1719
1720 private static boolean loggedIn;
1721
1722 private boolean canMute;
1723
1724 boolean loadingReceivedMap;
1725
1726 protected boolean inCutsceneMode;
1727
1728 static int loopCycle;
1729
1730 static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
1731
1732 GraphicsBuffer inventoryBackImage;
1733
1734 GraphicsBuffer mapBackImage;
1735
1736 GraphicsBuffer inGameScreen;
1737
1738 GraphicsBuffer chatBackImage;
1739
1740 int daysSinceRecovChange;
1741
1742 RSSocket socketStream;
1743
1744 int minimapZoom;
1745
1746 public String myUsername;
1747
1748 public String myPassword;
1749
1750 protected static int anInt1175; // Cannot find refactor.
1751
1752 private boolean genericLoadingError;
1753
1754 public int reportAbuseInterfaceID;
1755
1756 protected NodeList objects;
1757
1758 public int[] chatOffsets;
1759
1760 public int[] sidebarOffsets;
1761
1762 public int[] viewportOffsets;
1763
1764 protected byte[][] objectScapeData;
1765
1766 public int chaseCameraPitch;
1767
1768 int viewRotation;
1769
1770 private int cameraYawTranslate;
1771
1772 public int cameraPitchTranslate;
1773
1774 protected static int anInt1188; // Cannot find refactor.
1775
1776 /**
1777 * This is changed when bank interface is opened, so the inventory tab is displayed.
1778 */
1779 private static int invOverlayInterfaceID;
1780
1781 public Stream stream;
1782
1783 static int splitPrivateChat;
1784
1785 final Background[] mapBack;
1786
1787 public String[] menuActionName;
1788
1789 public int interfaceHoverId;
1790
1791 protected final int[] anIntArray1203; // Cannot find refactor.
1792
1793 public static int CameraPos1 = 3;
1794
1795 /**
1796 * Distance of camera. 600 is default.
1797 */
1798 public static int CameraPos2 = 600;
1799
1800 public final static int resizableMaximumZoomIn = 425;
1801
1802 static int[] sound;
1803
1804 int minimapRotation;
1805
1806 public static int chatScrollHeight;
1807
1808 /**
1809 * The text/numbers entered by the player when he enters an x amount to bank or joins a clan chat, the dialogue box drawn over the chat area.
1810 */
1811 private static String chatAreaInputBoxPlayerInput;
1812
1813 private int clickCycle;
1814
1815 public int[][][] intGroundArray;
1816
1817 private long serverSeed;
1818
1819 int loginScreenCursorPos = 0;
1820
1821 public Sprite[] crown;
1822
1823 private long lastClickTime;
1824
1825 private static int tabId;
1826
1827 public int markedNpc;
1828
1829 private static boolean updateChatAreaPending;
1830
1831 public static int inputDialogState;
1832
1833 public static int npcPetId = -1;
1834
1835 public static int npcSecondPetId = -1;
1836
1837 protected static int anInt1226;
1838
1839 public static int nextSong;
1840
1841 public final int[] compassOffsets1;
1842
1843 public CollisionMap[] collisionMap;
1844
1845 public static int BIT_MASK[];
1846
1847 int[] chunkUIDs;
1848
1849 int[] objectScapeUIDs;
1850
1851 int[] landScapeUIDs;
1852
1853 public final int anInt1239 = 100; // Cannot find refactor.
1854
1855 static int[] soundType;
1856
1857 private boolean isDragging;
1858
1859 protected int atInventoryLoopCycle;
1860
1861 protected int atInventoryInterface;
1862
1863 protected int atInventoryIndex;
1864
1865 protected int atInventoryInterfaceType;
1866
1867 protected byte[][] landScapeData;
1868
1869 public int tradeMode;
1870
1871 public int assistMode;
1872
1873 public int showSpokenEffects;
1874
1875 static int[] soundDelay;
1876
1877 public int messagesAreIgnored;
1878
1879 private final boolean rsAlreadyLoaded;
1880
1881 private int useOneMouseButton;
1882
1883 private boolean welcomeScreenRaised;
1884
1885 private static boolean messagePromptRaised;
1886
1887 public byte[][][] byteGroundArray;
1888
1889 protected int previousSong;
1890
1891 int destX;
1892
1893 int destY;
1894
1895 public Sprite landImage;
1896
1897 int anInt1264; // Cannot find refactor.
1898
1899 public int sceneCycle;
1900
1901 private String loginMessage1;
1902
1903 private String loginMessage2;
1904
1905 private String loginMessage3;
1906
1907 int anInt1268; // Cannot find refactor.
1908
1909 int anInt1269; // Cannot find refactor.
1910
1911 public TextDrawingArea smallText;
1912
1913 public TextDrawingArea smallHit;
1914
1915 public RSFont newSmallFont, newRegularFont, newBoldFont;
1916
1917 public TextDrawingArea bigHit;
1918
1919 public TextDrawingArea aTextDrawingArea_1271;
1920
1921 public TextDrawingArea chatTextDrawingArea;
1922
1923 public static int backDialogueId;
1924
1925 private int cameraOffsetX;
1926
1927 private int[] bigX;
1928
1929 private int[] bigY;
1930
1931 protected int itemSelected;
1932
1933 protected int anInt1283; // Cannot find refactor.
1934
1935 protected int anInt1284; // Cannot find refactor.
1936
1937 protected int anInt1285; // Cannot find refactor.
1938
1939 protected String selectedItemName;
1940
1941 public int publicChatMode;
1942
1943 private static int anInt1288; // Cannot find refactor.
1944
1945 public static int anInt1290; // Cannot find refactor.
1946
1947 public int drawCount;
1948
1949 public int fullscreenInterfaceID;
1950
1951 public int anInt1044; // Cannot find refactor.
1952
1953 public int anInt1129; // Cannot find refactor.
1954
1955 public int anInt1315; // Cannot find refactor.
1956
1957 public int anInt1500; // Cannot find refactor.
1958
1959 public int menuHoveredTimer; // Cannot find refactor.
1960
1961 public int[] fullScreenTextureArray;
1962
1963 public static boolean logOutHover;
1964
1965 public static int[] tabInterfaceId =
1966 {-1, -1, -1, -1, -1, -1, -1, 2449, -1, -1, -1, -1, -1, 18128, 2449, 2449};
1967
1968 /**
1969 * Load custom objects.
1970 * <p>
1971 * These objects are automatically clipped for manual walking and not player following. For the player following part, it will have to be added manually server sided.
1972 */
1973 private void loadCustomObjects() {
1974 for (int i = 0; i < RemovedObjects.removeObjects.length; i++) {
1975 addObjectCustom(-1, RemovedObjects.removeObjects[i][0], RemovedObjects.removeObjects[i][1], 1, 10, RemovedObjects.removeObjects[i][2], 0, false);
1976 }
1977 // removeObject(-1, 3090, 3508, 0, 5, 0, 1); // Removed window at Edgeville building.
1978 // removeObject(-1, 3091, 3508, 0, 5, 0, 1); // Removed window at Edgeville building.
1979 // removeObject(-1, 3090, 3512, 0, 5, 0, 1); // Removed window at Edgeville building.
1980 // removeObject(-1, 3091, 3512, 0, 5, 0, 1); // Removed window at Edgeville building.
1981 // removeObject(-1, 3092, 3514, 0, 5, 0, 1); // Removed window at Edgeville building.
1982 // removeObject(-1, 3092, 3513, 0, 5, 0, 1); // Removed window at Edgeville building.
1983
1984
1985 //addObjectCustom(3194, 3080, 3514, 0, 10, 0, 0, false); // Chest at the west of Edge wilderness
1986 if (Config.ECO) {
1987 addObjectCustom(3194, 3096, 3514, 0, 10, 0, 0, false); // Chest.
1988 addObjectCustom(3194, 3112, 3516, 1, 10, 0, 0, false); // Chest.
1989 // addObjectCustom(23709, 3112, 3513, 1, 10, 0, 0, false); // Box of health.
1990 // addObjectCustom(29150, 3099, 3507, 1, 10, 0, 0, false); // Altar of the occult.
1991 // addObjectCustom(409, 3093, 3513,2, 10, 0, 0, false); // Altar.
1992 // addObjectCustom(27277, 3097, 3513, 0, 10, 0, 0, false); // Blood key chest.
1993 }
1994
1995 addObjectCustom(1814, 3153, 3923, 0, 4, 0, 0, false); // Wilderness ardougne lever
1996 // addObjectCustom(23709, 3090, 3512, 3, 10, 0, 0, false); // Box of health.
1997 // addObjectCustom(23709, 3091, 3493, 1, 10, 0, 0, false); // Box of health.
1998
1999
2000 addObjectCustom(7409, 3186, 3436, 1, 10, 0, 0, false); // Varrock west bank fix
2001
2002 addObjectCustom(14903, 3195, 3438, 0, 10, 0, 0, false); // Varrock west bank fix
2003 addObjectCustom(25808, 2728, 3494, 2, 10, 0, 0, false); // seers bank fix
2004
2005 addObjectCustom(6943, 2810, 3442, 2, 10, 0, 0, false); // catherby bank fix
2006
2007 addObjectCustom(818, 2853, 3546, 2, 10, 0, 0, false); // warrior's guild door clipping fix
2008 addObjectCustom(818, 2856, 3546, 2, 10, 0, 0, false); // warrior's guild door clipping fix
2009
2010 addObjectCustom(17119, 3682, 9888, 0, 10, 0, 0, false); // pool of slime for ecto
2011
2012 //addObjectCustom(19038, 3083, 3502, 0, 10, 0, 0, false); // Christmas tree
2013 //addObjectCustom(29709, 3084, 3500, 0, 10, 0, 0, false); // Present table
2014
2015 /*addObjectCustom(31878, 3101, 3502, 0, 10, 0, 0, false); // Easter rabbit hole
2016 addObjectCustom(15301, 2520, 9327, 0, 10, 0, 0, false); // Easter chocolate rock
2017 addObjectCustom(15301, 2519, 9317, 1, 10, 0, 0, false); // Easter chocolate rock
2018 addObjectCustom(15299, 2516, 9324, 2, 10, 0, 0, false); // Easter chocolate rock
2019 addObjectCustom(15299, 2518, 9320, 0, 10, 0, 0, false); // Easter chocolate rock
2020 addObjectCustom(15300, 2513, 9323, 0, 10, 0, 0, false); // Easter chocolate crater*/
2021
2022 // Resource area runite rocks
2023 addObjectCustom(7494, 3191, 3929, 2, 10, 0, 0, false);
2024 addObjectCustom(7494, 3192, 3930, 1, 10, 0, 0, false);
2025 //remove door from training zone
2026
2027
2028
2029
2030
2031 // addObjectCustom(6163, 3084, 3486, 3, 10, 0, 0, false); // Thieving stalls
2032 // addObjectCustom(6165, 3084, 3488, 3, 10, 0, 0, false); // Thieving stalls
2033 //addObjectCustom(6166, 3084, 3490, 3, 10, 0, 0, false); // Thieving stalls
2034 // addObjectCustom(6164, 3084, 3492, 3, 10, 0, 0, false); // Thieving stalls
2035 // addObjectCustom(6162, 3084, 3494, 3, 10, 0, 0, false); // Thieving stalls
2036//
2037 // addObjectCustom(13213, 3091, 3513, 0, 10, 0, 0, false); // Altar buners
2038 // addObjectCustom(13213, 3094, 3513, 0, 10, 0, 0, false); // Altar buners
2039 // addObjectCustom(30253, 3092, 3513, 2, 10, 0, 0, false); // Gilded altar
2040 addObjectCustom(30251, 3083, 3502, 0, 10, 0, 0, false); // Well of goodwill
2041
2042 // addObjectCustom(29149, 3096, 3512, 0, 10, 0, 0, false); // Dark altar
2043
2044 // addObjectCustom(172, 3085, 3605, 2, 10, 0, 0, false); // Crystal key chest
2045 // addObjectCustom(3194, 3081, 3491, 3, 10, 0, 0, false); // Bank chest
2046
2047 // addObjectCustom(27277, 3099, 3513, 0, 10, 0, 0, false); // Blood key chest.
2048
2049 // addObjectCustom(5249, 2895, 3117, 0, 10, 0, 0, false); // Fire @ karamb fishing spot
2050
2051 //Fossil island
2052 addObjectCustom(3194, 3742, 3805, 3, 10, 0, 0, false); // Bank chest
2053
2054
2055 //new shops area
2056
2057 //addObjectCustom(29211, 3076, 3508, 3, 10, 0, 0, false); // Skillcape stand
2058
2059 // addObjectCustom(10060, 3081, 3513, 2, 0, 0, 0, false); // right wall
2060 // addObjectCustom(10060, 3081, 3512, 2, 0, 0, 0, false); // right wall
2061 //addObjectCustom(10059, 3079, 3512, 1, 9, 0, 0, false); // diagonal, left
2062
2063 // addObjectCustom(10061, 3079, 3511, 1, 0, 0, 0, false); // lower wall
2064 // addObjectCustom(10061, 3080, 3511, 1, 0, 0, 0, false); // lower wall
2065 // addObjectCustom(10061, 3081, 3511, 1, 0, 0, 0, false); // lower wall
2066
2067 // addObjectCustom(30252, 3080, 3513, 0, 10, 0, 0, false); // suit of armour
2068
2069 //addObjectCustom(10062, 3081, 3512, 0, 9, 0, 0, false); // diagonal, right
2070 // addObjectCustom(10060, 3079, 3513, 0, 0, 0, 0, false); // left wall
2071 // addObjectCustom(10060, 3079, 3512, 0, 0, 0, 0, false); // left wall
2072
2073 // addObjectCustom(1534, 3078, 3514, 3, 0, 0, 0, false); // Curtain doorway
2074 // addObjectCustom(1534, 3082, 3514, 3, 0, 0, 0, false); // Curtain doorway
2075
2076 // addObjectCustom(27290, 3091, 3495, 3, 10, 0, 0, false); // loot key object
2077
2078 //Varrock Home
2079 addObjectCustom(23709, 3212, 3429, 2, 10, 0, 0, false); // Health Box
2080 addObjectCustom(30251, 3172, 3461, 0, 10, 0, 0, false); // Well Of Good Will
2081 //addObjectCustom(14507, 3215, 3421, 0, 10, 0, 0, false); // High Scores board
2082 addObjectCustom(29211, 3205, 3417, 0, 10, 0, 0, false);
2083 addObjectCustom(29170, 3204, 3417, 0, 10, 0, 0, false);
2084 addObjectCustom(9758, 3214, 3416, 3, 10, 0, 0, false);
2085 addObjectCustom(27277, 3214, 3417, 3, 10, 0, 0, false);
2086 addObjectCustom(172, 3218, 3419, 3, 10, 0, 0, false);
2087 addObjectCustom(4875, 3191, 3433, 0, 10, 0, 0, false);
2088 addObjectCustom(4876, 3191, 3434, 0, 10, 0, 0, false);
2089 addObjectCustom(4874, 3191, 3435, 0, 10, 0, 0, false);
2090 addObjectCustom(4877, 3191, 3436, 0, 10, 0, 0, false);
2091 addObjectCustom(4878, 3191, 3437, 0, 10, 0, 0, false);
2092
2093 // Donator zone objects
2094 addObjectCustom(29165, 2196, 3250, 0, 10, 0, 0, false); // Blood money stall
2095
2096 addObjectCustom(-1, 2192, 3250, 3, 10, 0, 0, false); // combat dummy removal
2097
2098 //staff zone
2099 addObjectCustom(9758, 3089, 3507, 0, 10, 0, 0, false); // Chest
2100
2101 addObjectCustom(312, 2948, 2801, 0, 10, 0, 0, false); // harry's potato plant
2102 addObjectCustom(3195, 2955, 2806, 0, 10, 0, 0, false); // Rotten tomatoes @ staffzone
2103
2104 //Falador market area
2105 for (int index = 0; index < 3; index++) {
2106 addObjectCustom(-1, 3003, 3382 + index, 0, 10, 0, 0, false);
2107 }
2108
2109 for (int x = 0; x < 7; x++) {
2110 for (int y = 0; y < 7; y++) {
2111 addObjectCustom(-1, 2995 + x, 3380 + y, 0, 10, 0, 0, false);
2112 }
2113 }
2114 addObjectCustom(-1, 3084, 3512, 1, 10, 0, 0, false); // Removed statue fally park
2115 addObjectCustom(-1, 3112, 3355, 1, 10, 0, 0, false); // Removed statue fally park
2116 addObjectCustom(-1, 3112, 3356, 1, 10, 0, 0, false); // Removed statue fally park
2117
2118 addObjectCustom(-1, 3004, 3383, 1, 10, 0, 0, false); // Removed statue fally park
2119 addObjectCustom(-1, 3001, 3383, 1, 10, 0, 0, false); // Removed flower
2120 addObjectCustom(-1, 3002, 3383, 1, 10, 0, 0, false); // Removed flower
2121 addObjectCustom(25808, 3004, 3384, 3, 10, 0, 0, false); // bank
2122 addObjectCustom(25809, 3004, 3383, 3, 10, 0, 0, false); // bank
2123 addObjectCustom(25808, 3004, 3382, 3, 10, 0, 0, false); // bank
2124 //addObjectCustom(30255, 2996, 3382, 3, 10, 0, 0, false); // trading post
2125
2126
2127 //orb charging objects
2128 addObjectCustom(15268, 3086, 3570, 0, 10, 0, 0, false);
2129 addObjectCustom(2796, 3112, 9690, 0, 10, 0, 0, false);
2130 addObjectCustom(15269, 3086, 3569, 0, 10, 0, 0, false);
2131 addObjectCustom(15270, 3088, 3560, 1, 10, 0, 0, false);
2132 addObjectCustom(15271, 3089, 9960, 1, 10, 0, 0, false);
2133 addObjectCustom(15275, 3086, 3571, 0, 10, 0, 0, false);
2134
2135
2136 // Tournament instance
2137 addObjectCustom(23709, 3328, 4753, 0, 10, 0, 20, false); // Box of health.
2138 addObjectCustom(76, 3327, 4753, 0, 10, 0, 20, false); // Chest.
2139
2140 // Clan wars objects
2141 addObjectCustom(23709, 3327, 4757, 0, 10, 0, 0, false); // Box of health.
2142 addObjectCustom(3194, 3328, 4757, 0, 10, 0, 0, false); // Chest.
2143
2144
2145 addObjectCustom(14841, 2148, 3864, 0, 10, 0, 0, false); // Portal at Astral altar
2146 addObjectCustom(14841, 1727, 3825, 0, 10, 0, 0, false); // Portal at Blood altar
2147 addObjectCustom(14841, 1820, 3862, 0, 10, 0, 0, false); // Portal at Soul altar
2148
2149
2150 addObjectCustom(15267, 2694, 4016, 0, 10, 0, 0, true); // Flag at jail
2151 addObjectCustom(15267, 2698, 4016, 0, 10, 0, 0, true); // Flag at jail
2152 addObjectCustom(15267, 2690, 4024, 1, 10, 0, 0, true); // Flag at jail
2153
2154 addObjectCustom(29111, 1692, 4257, 0, 10, 0, 0, true); // Deposit vault at Dice zone
2155
2156 // Ores at Level 6 wilderness in Edgeville.
2157 addObjectCustom(7489, 3103, 3565, 0, 10, 0, 0, false);
2158 addObjectCustom(7489, 3103, 3566, 0, 10, 0, 0, false);
2159 addObjectCustom(7489, 3104, 3567, 0, 10, 0, 0, false);
2160 addObjectCustom(7489, 3105, 3569, 0, 10, 0, 0, false);
2161 addObjectCustom(7489, 3104, 3570, 0, 10, 0, 0, false);
2162
2163 // removeObject(-1, 3085, 3508, 0, 4, 0, 1); // Removed window at General store building.
2164 // removeObject(-1, 3084, 3508, 0, 4, 0, 1); // Removed window at General store building.
2165 //EdgePvp
2166 // addObjectCustom(20839, 3091, 3509, 0, 10, 0, 4, true); // Energy barrier at Edgeville.
2167 // addObjectCustom(20839, 3084, 3509, 2, 10, 0, 4, true); // Energy barrier at Edgeville.
2168
2169 // Gates and fences removed.
2170 boolean gates = true;
2171 if (gates) {
2172 removeObject(-1, 3109, 3353, 0, 0, 0, 0);
2173 removeObject(-1, 3108, 3353, 0, 0, 0, 0);
2174 removeObject(-1, 3112, 3356, 0, 0, 0, 0);
2175 removeObject(-1, 3112, 3355, 0, 0, 0, 0);
2176 removeObject(-1, 3084, 3512, 0, 0, 0, 0);
2177 removeObject(-1, 3008, 3008, 0, 0, 0, 0);
2178 removeObject(-1, 3008, 3008, 0, 0, 0, 0);
2179 removeObject(-1, 3008, 3849, 0, 0, 0, 0);
2180 removeObject(-1, 3008, 3849, 0, 0, 0, 0);
2181 removeObject(-1, 3008, 3850, 0, 0, 0, 0);
2182 removeObject(-1, 2947, 3904, 0, 0, 0, 0);
2183 removeObject(-1, 2948, 3904, 0, 0, 0, 0);
2184 removeObject(-1, 3224, 3904, 0, 0, 0, 0);
2185 removeObject(-1, 3225, 3904, 0, 0, 0, 0);
2186 removeObject(-1, 3336, 3896, 0, 0, 0, 0);
2187 removeObject(-1, 3337, 3896, 0, 0, 0, 0);
2188 removeObject(-1, 2958, 3821, 0, 0, 0, 0);
2189 removeObject(-1, 2958, 3820, 0, 0, 0, 0);
2190 removeObject(-1, 3201, 3856, 0, 0, 0, 0);
2191 removeObject(-1, 3202, 3856, 0, 0, 0, 0);
2192 removeObject(-1, 2852, 3552, 0, 0, 1, 0);
2193 removeObject(-1, 2852, 3551, 0, 0, 1, 0);
2194 removeObject(-1, 3445, 3554, 0, 0, 2, 0);
2195 removeObject(-1, 3021, 3631, 0, 0, 0, 0);
2196 removeObject(-1, 3021, 3632, 0, 0, 0, 0);
2197 removeObject(-1, 3444, 3458, 0, 0, 0, 0);
2198 removeObject(-1, 3443, 3458, 0, 0, 0, 0);
2199 removeObject(-1, 3207, 3214, 0, 0, 0, 0);
2200 removeObject(-1, 3253, 3267, 0, 0, 0, 0);
2201 removeObject(-1, 3253, 3266, 0, 0, 0, 0);
2202 removeObject(-1, 3236, 3295, 0, 0, 0, 0);
2203 removeObject(-1, 3236, 3296, 0, 0, 0, 0);
2204 removeObject(-1, 3040, 10308, 0, 0, 0, 0);
2205 removeObject(-1, 3040, 10307, 0, 0, 0, 0);
2206 removeObject(-1, 3022, 10312, 0, 0, 0, 0);
2207 removeObject(-1, 3022, 10311, 0, 0, 0, 0);
2208 removeObject(-1, 3044, 10342, 0, 0, 0, 0);
2209 removeObject(-1, 3044, 10341, 0, 0, 0, 0);
2210 removeObject(-1, 2898, 9831, 0, 0, 0, 0);
2211 removeObject(-1, 2898, 9832, 0, 0, 0, 0);
2212 removeObject(-1, 2924, 9803, 0, 0, 0, 0);
2213 removeObject(-1, 2854, 3370, 0, 0, 0, 0);
2214 removeObject(-1, 2854, 3371, 0, 0, 0, 0);
2215
2216
2217 removeObject(-1, 3103, 9910, 0, 0, 0, 0);
2218 removeObject(-1, 3103, 9909, 0, 0, 0, 0);
2219 removeObject(-1, 3131, 9917, 0, 0, 0, 0);
2220 removeObject(-1, 3132, 9917, 0, 0, 0, 0);
2221 removeObject(-1, 3105, 9944, 0, 0, 0, 0);
2222 removeObject(-1, 3106, 9944, 0, 0, 0, 0);
2223 removeObject(-1, 3145, 9871, 0, 0, 0, 0);
2224 removeObject(-1, 3145, 9870, 0, 0, 0, 0);
2225
2226 // Adding gates opened.
2227 addObjectCustom(1728, 3008, 3849, 3, 0, 0, 0, false);
2228 addObjectCustom(1727, 3008, 3850, 1, 0, 0, 0, false);
2229 addObjectCustom(1727, 2947, 3904, 0, 0, 0, 0, false);
2230 addObjectCustom(1728, 2948, 3904, 2, 0, 0, 0, false);
2231 addObjectCustom(1727, 3224, 3904, 0, 0, 0, 0, false);
2232 addObjectCustom(1728, 3225, 3904, 2, 0, 0, 0, false);
2233 addObjectCustom(1727, 3336, 3896, 0, 0, 0, 0, false);
2234 addObjectCustom(1728, 3337, 3896, 2, 0, 0, 0, false);
2235 addObjectCustom(1524, 2957, 3821, 1, 0, 0, 0, false);
2236 addObjectCustom(1521, 2957, 3820, 3, 0, 0, 0, false);
2237 addObjectCustom(1727, 3201, 3856, 0, 0, 0, 0, false);
2238 addObjectCustom(1728, 3202, 3856, 2, 0, 0, 0, false);
2239 addObjectCustom(14752, 3022, 3631, 3, 0, 0, 0, false);
2240 addObjectCustom(14751, 3022, 3632, 1, 0, 0, 0, false);
2241 addObjectCustom(1728, 3040, 10308, 1, 0, 0, 0, false);
2242 addObjectCustom(1727, 3040, 10307, 3, 0, 0, 0, false);
2243 addObjectCustom(1728, 3044, 10342, 1, 0, 0, 0, false);
2244 addObjectCustom(1727, 3044, 10341, 3, 0, 0, 0, false);
2245 addObjectCustom(1728, 3022, 10312, 1, 0, 0, 0, false);
2246 addObjectCustom(1727, 3022, 10311, 3, 0, 0, 0, false);
2247 addObjectCustom(1568, 2898, 9831, 3, 0, 0, 0, false);
2248 addObjectCustom(1569, 2898, 9832, 1, 0, 0, 0, false);
2249 addObjectCustom(2623, 2924, 9803, 1, 0, 0, 0, false);
2250
2251 addObjectCustom(1728, 3104, 9910, 0, 0, 0, 0, false);
2252 addObjectCustom(1727, 3104, 9909, 0, 0, 0, 0, false);
2253
2254 addObjectCustom(1728, 3131, 9918, 3, 0, 0, 0, false);
2255 addObjectCustom(1727, 3132, 9918, 3, 0, 0, 0, false);
2256
2257 addObjectCustom(1728, 3105, 9945, 3, 0, 0, 0, false);
2258 addObjectCustom(1727, 3106, 9945, 3, 0, 0, 0, false);
2259
2260 addObjectCustom(1728, 3146, 9871, 0, 0, 0, 0, false);
2261 addObjectCustom(1727, 3146, 9870, 0, 0, 0, 0, false);
2262 }
2263
2264
2265 // Remove web on type 10 that clips the tile infront of it on the client.
2266 // Then add a web on type 0.
2267 removeObject(-1, 2565, 3124, 0, 10, 0, 2);
2268 removeObject(-1, 2565, 3124, 2, 0, 0, 0);
2269 removeObject(-1, 2569, 3118, 0, 10, 0, 2);
2270 removeObject(-1, 2569, 3118, 1, 0, 0, 0);
2271 removeObject(-1, 2570, 3118, 0, 10, 0, 2);
2272 removeObject(-1, 2570, 3118, 1, 0, 0, 0);
2273 removeObject(-1, 2574, 3124, 0, 10, 0, 2);
2274 removeObject(-1, 2574, 3124, 0, 0, 0, 0);
2275 removeObject(-1, 3030, 3852, 0, 10, 0, 2);
2276 removeObject(-1, 3030, 3852, 2, 0, 0, 0);
2277 removeObject(-1, 3115, 3859, 0, 10, 0, 2);
2278 removeObject(-1, 3115, 3859, 1, 0, 0, 0);
2279 removeObject(-1, 3092, 3957, 0, 10, 0, 2);
2280 removeObject(-1, 3092, 3957, 2, 0, 0, 0);
2281 removeObject(-1, 3095, 3957, 0, 10, 0, 2);
2282 removeObject(-1, 3095, 3957, 0, 0, 0, 0);
2283 removeObject(-1, 3105, 3958, 0, 10, 0, 2);
2284 removeObject(-1, 3105, 3958, 3, 0, 0, 0);
2285 removeObject(-1, 3106, 3958, 0, 10, 0, 2);
2286 removeObject(-1, 3106, 3958, 3, 0, 0, 0);
2287 removeObject(-1, 3147, 3727, 0, 10, 0, 2);
2288 removeObject(-1, 3147, 3727, 1, 0, 0, 0);
2289 removeObject(-1, 3163, 3736, 0, 10, 0, 2);
2290 removeObject(-1, 3163, 3736, 0, 0, 0, 0);
2291 removeObject(-1, 3183, 3733, 0, 10, 0, 2);
2292 removeObject(-1, 3183, 3733, 1, 0, 0, 0);
2293 removeObject(-1, 3158, 3951, 0, 10, 0, 2);
2294 removeObject(-1, 3158, 3951, 1, 0, 0, 0);
2295 removeObject(-1, 3210, 9898, 0, 10, 0, 2);
2296 removeObject(-1, 3210, 9898, 1, 0, 0, 0);
2297 // addObjectCustom(6163, 3084, 3486, 0, 1, 1, 0, false);
2298 // addObjectCustom(6165, 3084, 3488, 0, 1, 1, 0, false);
2299 // addObjectCustom(6166, 3084, 3490, 0, 1, 1, 0, false);
2300 // addObjectCustom(6164, 3084, 3492, 0, 1, 1, 0, false);
2301 // addObjectCustom(6162, 3084, 3494, 0, 1, 1, 0, false);//stalls
2302 // addObjectCustom(563, 3093, 3507, 2, 10, 0, 0, false); // Highscores Statue.
2303 // addObjectCustom(29170, 3095, 3507, 2, 10, 0, 0, false); // Completionist stand.
2304
2305 addObjectCustom(3194, 3381, 3269, 2, 10, 0, 0, false); // Opened chest at duel arena
2306 addObjectCustom(3194, 3382, 3270, 1, 10, 0, 0, false); // Opened chest at duel arena
2307
2308
2309 addObjectCustom(16680, 3088, 3571, 3, 10, 0, 0, false); // Ladder to go down, at the top of the wild mountain to do orbs.
2310
2311 // Entrana.
2312 addObjectCustom(1753, 2848, 3332, 0, 10, 0, 0, false); // Yew tree
2313 addObjectCustom(1761, 2853, 3338, 0, 10, 0, 0, false); // Magic tree
2314 addObjectCustom(1760, 2850, 3338, 0, 10, 0, 0, false); // Willow tree
2315 addObjectCustom(1751, 2852, 3332, 0, 10, 0, 0, false); // Oak tree.
2316 addObjectCustom(6943, 2860, 3338, 0, 10, 0, 0, false); // Bank booth at Entrana.
2317 addObjectCustom(6943, 2861, 3338, 0, 10, 0, 0, false); // Bank booth at Entrana.
2318 addObjectCustom(6943, 2862, 3338, 0, 10, 0, 0, false); // Bank booth at Entrana.
2319 addObjectCustom(6943, 2863, 3338, 0, 10, 0, 0, false); // Bank booth at Entrana.
2320 addObjectCustom(2031, 2833, 3349, 2, 10, 0, 0, false); // Anvil at Entrana.
2321
2322 addObjectCustom(6943, 3658, 3513, 2, 10, 0, 0, false); // Bank booth at Zombie waiting room.
2323 addObjectCustom(6948, 2911, 4832, 0, 10, 0, 0, false); // Deposit box at Rune essence mine
2324 addObjectCustom(14897, 2857, 3380, 0, 10, 0, 0, false); // Altar (Runecrafting).
2325
2326
2327 // Falador dwarf mine.
2328 addObjectCustom(24009, 3037, 9746, 1, 10, 0, 0, false); // Furnace.
2329 addObjectCustom(2031, 3042, 9746, 1, 10, 0, 0, false); // Anvil at Falador mining underground.
2330 addObjectCustom(6943, 3043, 9736, 0, 10, 0, 0, false);// Bank booth.
2331 addObjectCustom(7494, 3044, 9753, 0, 10, 0, 0, false); // Runite ore
2332 addObjectCustom(7494, 3048, 9754, 0, 10, 0, 0, false); // Runite ore
2333 addObjectCustom(7494, 3048, 9747, 0, 10, 0, 0, false); // Runite ore
2334 addObjectCustom(7494, 3045, 9744, 0, 10, 0, 0, false); // Runite ore
2335 addObjectCustom(7494, 3048, 9743, 0, 10, 0, 0, false); // Runite ore
2336 addObjectCustom(7493, 3046, 9735, 0, 10, 0, 0, false); // Adamant ore
2337 addObjectCustom(7493, 3047, 9737, 0, 10, 0, 0, false); // Adamant ore
2338 addObjectCustom(7493, 3049, 9735, 0, 10, 0, 0, false); // Adamant ore
2339 addObjectCustom(7493, 3049, 9734, 0, 10, 0, 0, false); // Adamant ore
2340 addObjectCustom(7493, 3049, 9740, 0, 10, 0, 0, false); // Adamant ore
2341 addObjectCustom(7492, 3045, 9741, 0, 10, 0, 0, false); // Mithril ore
2342 addObjectCustom(7492, 3045, 9738, 0, 10, 0, 0, false); // Mithril ore
2343 addObjectCustom(7492, 3046, 9742, 0, 10, 0, 0, false); // Mithril ore
2344 addObjectCustom(7492, 3043, 9743, 0, 10, 0, 0, false); // Mithril ore
2345 addObjectCustom(7489, 3032, 9741, 0, 10, 0, 0, false); // Coal ore
2346 addObjectCustom(7489, 3034, 9739, 0, 10, 0, 0, false); // Coal ore
2347 addObjectCustom(7455, 3035, 9742, 0, 10, 0, 0, false); // Iron ore
2348 addObjectCustom(7455, 3037, 9739, 0, 10, 0, 0, false); // Iron ore
2349 addObjectCustom(7455, 3037, 9735, 0, 10, 0, 0, false); // Iron ore
2350 addObjectCustom(7455, 3035, 9734, 0, 10, 0, 0, false); // Iron ore
2351 addObjectCustom(7485, 3032, 9737, 0, 10, 0, 0, false); // Tin ore
2352 addObjectCustom(7485, 3031, 9739, 0, 10, 0, 0, false); // Tin ore
2353 addObjectCustom(7485, 3028, 9739, 0, 10, 0, 0, false); // Tin ore
2354 addObjectCustom(7484, 3028, 9737, 0, 10, 0, 0, false); // Copper ore
2355 addObjectCustom(7484, 3029, 9734, 0, 10, 0, 0, false); // Copper ore
2356 addObjectCustom(7484, 3032, 9735, 0, 10, 0, 0, false); // Copper ore
2357
2358
2359 // Staff zone
2360 addObjectCustom(3194, 2698, 3250, 2, 10, 0, 0, false); // Chest
2361 addObjectCustom(24452, 2699, 3250, 2, 10, 0, 0, false); // Staff activity booth
2362 }
2363
2364 @SuppressWarnings("unused")
2365 private static void openInterface(int interfaceID) {
2366 resetInterfaceSequence(interfaceID);
2367 if (getInvOverlayInterfaceID() != -1) {
2368 setInvOverlayInterfaceID(-1);
2369 setTabAreaAltered(true);
2370 }
2371 if (backDialogueId != -1) {
2372 backDialogueId = -1;
2373 setUpdateChatAreaPending(true);
2374 }
2375 if (inputDialogState != 0) {
2376 inputDialogState = 0;
2377 setUpdateChatAreaPending(true);
2378 }
2379 setInterfaceDisplayed(interfaceID);
2380 setDialogueOptionsShowing(false);
2381 }
2382
2383 public final String methodR(long j) {
2384 if (j >= 0 && j < 10000)
2385 return String.valueOf(j);
2386 if (j >= 10000 && j < 10000000)
2387 return j / 1000 + "K";
2388 if (j >= 10000000 && j < 999999999)
2389 return j / 1000000 + "M";
2390 if (j >= 999999999)
2391 return "*";
2392 else
2393 return "?";
2394 }
2395
2396 public String indexLocation(int cacheIndex, int index) {
2397 return ClientConstants.getMainCacheLocation() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
2398 }
2399
2400 void repackCacheIndex(int cacheIndex) {
2401 Utility.print("Attempting to repack index " + cacheIndex + " at location " + new File(indexLocation(cacheIndex, -1)) + ".");
2402 int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
2403 File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
2404 int packed = 0;
2405 try {
2406 for (int index = 0; index < indexLength; index++) {
2407 String fileString = getFileNameWithoutExtension(file[index].toString());
2408 if (!fileString.contains("AllInOneZipper") && !fileString.contains("DS_") && !fileString.isEmpty()) {
2409 int fileIndex = Integer.parseInt(fileString);
2410 byte[] data = fileToByteArray(cacheIndex, fileIndex);
2411 if (data != null && data.length > 0) {
2412 if (Config.PRE_EOC) {
2413 decompressors[cacheIndex].put(data.length, java.nio.ByteBuffer.wrap(data), fileIndex);
2414 }
2415 else {
2416 decompressors[cacheIndex].method234Osrs(data.length, data, fileIndex);
2417 }
2418 Utility.print("Repacked index " + fileIndex + ".");
2419 packed++;
2420 }
2421 else {
2422 Utility.print("Unable to locate index " + fileIndex + ".");
2423 }
2424 }
2425 }
2426 }
2427 catch (Exception e) {
2428 Utility.print("Error packing cache index " + cacheIndex + ".");
2429 e.printStackTrace();
2430 }
2431 Utility.print("Finished repacking index " + cacheIndex + " with " + packed + " files.");
2432 }
2433
2434 public byte[] fileToByteArray(int cacheIndex, int index) {
2435 try {
2436 if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
2437 return null;
2438 }
2439 File file = new File(indexLocation(cacheIndex, index));
2440 byte[] fileData = new byte[(int) file.length()];
2441 FileInputStream fis = new FileInputStream(file);
2442 fis.read(fileData);
2443 fis.close();
2444 return fileData;
2445 }
2446 catch (Exception e) {
2447 if (ClientDebugConfiguration.PRINT_ALL_EXCEPTION) {
2448 e.printStackTrace();
2449 }
2450 return null;
2451 }
2452 }
2453
2454 public static String capitalize(String s) {
2455 for (int i = 0; i < s.length(); i++) {
2456 if (i == 0) {
2457 s = String.format("%s%s", Character.toUpperCase(s.charAt(0)), s.substring(1));
2458 }
2459 if (!Character.isLetterOrDigit(s.charAt(i))) {
2460 if (i + 1 < s.length()) {
2461 s = String.format("%s%s%s", s.subSequence(0, i + 1), Character.toUpperCase(s.charAt(i + 1)), s.substring(i + 2));
2462 }
2463 }
2464 }
2465 return s;
2466 }
2467
2468 public static final byte[] ReadFile(String s) {
2469 try {
2470 byte abyte0[];
2471 File file = new File(s);
2472 int i = (int) file.length();
2473 abyte0 = new byte[i];
2474 DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
2475 datainputstream.readFully(abyte0, 0, i);
2476 datainputstream.close();
2477 return abyte0;
2478 }
2479 catch (Exception e) {
2480 Utility.print((new StringBuilder()).append("Read Error: ").append(s).toString());
2481 e.printStackTrace();
2482 return null;
2483 }
2484 }
2485
2486 private boolean menuHasAddFriend(int j) {
2487 if (j < 0)
2488 return false;
2489 int k = menuActionID[j];
2490 if (k >= 2000)
2491 k -= 2000;
2492 return k == 337;
2493 }
2494
2495 public static final GraphicsBuffer constructGraphicsBuffer(int x, int y, Component component) {
2496 GraphicsBuffer graphicClass;
2497 try {
2498 GraphicsBuffer instance = new GraphicsBufferBasic();
2499
2500 instance.init(component, x, y, false);
2501
2502 graphicClass = instance;
2503 }
2504 catch (Throwable throwable) {
2505 GraphicsBufferProducing graphicInstance = new GraphicsBufferProducing();
2506 graphicInstance.init(component, x, y, false);
2507 throwable.printStackTrace();
2508 return graphicInstance;
2509 }
2510 return graphicClass;
2511 }
2512
2513 public void startRunnable(Runnable runnable, int i) {
2514 if (i > 10)
2515 i = 10;
2516 if (SignLink.mainapp != null) {
2517 SignLink.startthread(runnable, i);
2518 }
2519 else {
2520 super.startRunnable(runnable, i);
2521 }
2522 }
2523
2524 public Socket openSocket(int port) throws IOException {
2525
2526 return new Socket(InetAddress.getByName("162.252.11.137"), 43594);//serverip
2527 }
2528 private boolean processMenuClick() {
2529 if (activeInterfaceType != 0) {
2530 return false;
2531 }
2532 int j = super.getClickMode3();
2533
2534 if (menuOpen) {
2535 if (j != 1) {
2536 int x = super.mouseX;
2537 int y = super.mouseY;
2538
2539 if (getMenuScreenArea() == 0) {
2540 x -= 4;
2541 y -= 4;
2542 }
2543 if (getMenuScreenArea() == 1) {
2544 x -= 516;
2545 y -= 168;
2546 }
2547 if (getMenuScreenArea() == 2) {
2548 x -= 5;
2549 y -= 338;
2550 }
2551 if (getMenuScreenArea() == 3) {
2552 x -= 516;
2553 y -= 0;
2554 }
2555 if (x < menuOffsetX - 10 || x > menuOffsetX + menuWidth + 10 || y < menuOffsetY - 10 || y > menuOffsetY + menuHeight + 10) {
2556 menuOpen = false;
2557 if (getMenuScreenArea() == 2) {
2558 setUpdateChatAreaPending(true);
2559 }
2560 }
2561 }
2562 if (j == 1) {
2563 int l = menuOffsetX;
2564 int k1 = menuOffsetY;
2565 int i2 = menuWidth;
2566 int x = super.saveClickX;
2567 int y = super.saveClickY;
2568 if (getMenuScreenArea() == 0) {
2569 x -= 4;
2570 y -= 4;
2571 }
2572 if (getMenuScreenArea() == 1) {
2573 x -= 516; // 519
2574 y -= 168;
2575 }
2576 if (getMenuScreenArea() == 2) {
2577 x -= 5; // 17
2578 y -= 338;
2579 }
2580 if (getMenuScreenArea() == 3) {
2581 x -= 516; // 519
2582 y -= 0;
2583 }
2584 // return new Socket(InetAddress.getByName("127.0.0.1"), port);
2585 //TODO #FULLSCREEN ADJUST menu right clicking action.
2586 if (!isFixedScreen()) {
2587 y += 4;
2588 }
2589 int i3 = -1;
2590 for (int j3 = 0; j3 < menuActionRow; j3++) {
2591 int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
2592 if (x > l && x < l + i2 && y > k3 - 13 && y < k3 + 3) {
2593 i3 = j3;
2594 }
2595 }
2596 if (i3 != -1) {
2597 Action.doAction(i3);
2598 }
2599 menuOpen = false;
2600 if (getMenuScreenArea() == 2) {
2601 setUpdateChatAreaPending(true);
2602 }
2603 }
2604 return true;
2605 }
2606 else {
2607 int indexSpot = menuActionRow;
2608 if (j == 1 && menuActionRow > 0) {
2609 int i1 = menuActionID[indexSpot - 1];
2610 if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53 || i1 == 74 || i1 == 454 || i1 == 539 || i1 == 493 || i1 == 847 || i1 == 447 || i1 == 1125 || i1 == 1126) {
2611 int l1 = menuActionCmd2[indexSpot - 1];
2612 int j2 = menuActionCmd3[indexSpot - 1];
2613 RSInterface class9 = RSInterface.interfaceCache[j2];
2614 if (shiftDrop && shiftIsDown) {
2615 boolean hasDrop = false;
2616 int dropAction = 0;
2617 for (int i = 0; i < menuActionName.length; i++) {
2618 if (menuActionName[i] == null) {
2619 continue;
2620 }
2621 if (menuActionName[i].contains("Drop") || menuActionName[i].contains("Destroy") || menuActionName[i].contains("Release")) {
2622 hasDrop = true;
2623 dropAction = i;
2624 }
2625 }
2626 if (hasDrop) {
2627 Action.doAction(dropAction);
2628 return true;
2629 }
2630 }
2631 if (class9.itemsAreDraggable || class9.itemsAreSwappable) {
2632 isDragging = false;
2633 dragCycle = 0;
2634 focusedDragWidget = j2;
2635 dragFromSlot = l1;
2636 activeInterfaceType = 2;
2637 pressX = super.saveClickX;
2638 pressY = super.saveClickY;
2639 if (RSInterface.interfaceCache[j2].parentId == getInterfaceDisplayed())
2640 activeInterfaceType = 1;
2641 if (RSInterface.interfaceCache[j2].parentId == backDialogueId)
2642 activeInterfaceType = 3;
2643 return true;
2644 }
2645 }
2646 }
2647 if (j == 1 && (useOneMouseButton == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
2648 j = 2;
2649 }
2650 if (j == 1 && menuActionRow > 0) {
2651 Action.doAction(indexSpot - 1);
2652 }
2653 if (j == 2 && menuActionRow > 0) {
2654 determineMenuSize();
2655 }
2656 return false;
2657 }
2658
2659 }
2660
2661 public static int totalRead = 0;
2662
2663 public static String getFileNameWithoutExtension(String fileName) {
2664 File tmpFile = new File(fileName);
2665 tmpFile.getName();
2666 int whereDot = tmpFile.getName().lastIndexOf('.');
2667 if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
2668 return tmpFile.getName().substring(0, whereDot);
2669 }
2670 return "";
2671 }
2672
2673 public static void preloadModels() {
2674 File file = new File(ClientConstants.getCacheLocation() + "raw/");
2675 File[] fileArray = file.listFiles();
2676 for (int y = 0; y < fileArray.length; y++) {
2677 String s = fileArray[y].getName();
2678 if (s.endsWith(".dat")) {
2679 @SuppressWarnings("unused")
2680 int number = Integer.parseInt(s.replace(".dat", ""));
2681 byte[] buffer = ReadFile(ClientConstants.getCacheLocation() + "raw/" + s);
2682 Model.method460(buffer, Integer.parseInt(getFileNameWithoutExtension(s)));
2683 }
2684 }
2685 }
2686
2687
2688 public int mapX, mapY;
2689
2690 /**
2691 * @param objectId
2692 * The object identity
2693 * @param x
2694 * Location of the object, x-axis.
2695 * @param y
2696 * Location of the object, y-axis.
2697 * @param face
2698 * Where the object will face.
2699 * @param type
2700 * The type of the object? Keep at 10.
2701 * @param height
2702 * The height of the object.
2703 */
2704 public void addObjectCustom(int objectId, int x, int y, int face, int type, int height, int instanceHeight, boolean global) {
2705 int mX = mapX - 6;
2706 int mY = mapY - 6;
2707 int x2 = x - (mX * 8);
2708 int y2 = y - (mY * 8);
2709 int i15 = 40 >> 2;
2710 int l17 = ClientConstants.anIntArray1177[i15];
2711 if (y2 > 0 && y2 < 103 && x2 > 0 && x2 < 103) {
2712 addTemporaryObject(-1, objectId, face, l17, y2, type, height, x2, 0, instanceHeight, global, true);
2713 }
2714 }
2715
2716 public void removeObject(int objectId, int x, int y, int face, int type, int height, int other) {
2717 int mX = mapX - 6;
2718 int mY = mapY - 6;
2719 int x2 = x - (mX * 8);
2720 int y2 = y - (mY * 8);
2721 if (y2 > 0 && y2 < 103 && x2 > 0 && x2 < 103) {
2722
2723 addTemporaryObject(-1, objectId, face, other, y2, type, height, x2, 0, 0, false, false);
2724 }
2725 }
2726
2727 public void loadScene() {
2728 try {
2729 loadCustomObjects();
2730 lastPlane = -1;
2731 spotanims.removeAll();
2732 projectiles.removeAll();
2733 Rasterizer.clearTextures();
2734 unlinkMRUNodes();
2735 landScape.initToNull();
2736 System.gc();
2737 for (int i = 0; i < 4; i++)
2738 collisionMap[i].reset();
2739
2740 for (int l = 0; l < 4; l++) {
2741 for (int k1 = 0; k1 < 104; k1++) {
2742 for (int j2 = 0; j2 < 104; j2++)
2743 byteGroundArray[l][k1][j2] = 0;
2744 }
2745
2746 }
2747
2748 ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
2749 int k2 = objectScapeData.length;
2750 stream.createFrame(0);
2751 if (!loadingReceivedMap) {
2752 for (int i3 = 0; i3 < k2; i3++) {
2753 int i4 = (chunkUIDs[i3] >> 8) * 64 - baseX;
2754 int k5 = (chunkUIDs[i3] & 0xff) * 64 - baseY;
2755 byte abyte0[] = objectScapeData[i3];
2756 if (abyte0 != null) {
2757 objectManager.loadLand2(abyte0, k5, i4, (regionX - 6) * 8, (regionY - 6) * 8, collisionMap);
2758 }
2759 }
2760
2761 for (int j4 = 0; j4 < k2; j4++) {
2762 int l5 = (chunkUIDs[j4] >> 8) * 64 - baseX;
2763 int k7 = (chunkUIDs[j4] & 0xff) * 64 - baseY;
2764 byte abyte2[] = objectScapeData[j4];
2765 if (abyte2 == null && regionY < 800) {
2766 objectManager.sewEdges(k7, 64, 64, l5);
2767 }
2768 }
2769
2770 anInt1097++;
2771 if (anInt1097 > 160) {
2772 anInt1097 = 0;
2773 stream.createFrame(238);
2774 stream.writeWordBigEndian(96);
2775 }
2776 stream.createFrame(0);
2777 for (int i6 = 0; i6 < k2; i6++) {
2778 byte abyte1[] = landScapeData[i6];
2779 if (abyte1 != null) {
2780 int l8 = (chunkUIDs[i6] >> 8) * 64 - baseX;
2781 int k9 = (chunkUIDs[i6] & 0xff) * 64 - baseY;
2782 objectManager.loadObjects(l8, collisionMap, k9, landScape, abyte1);
2783 }
2784 }
2785
2786 }
2787 if (loadingReceivedMap) {
2788 for (int j3 = 0; j3 < 4; j3++) {
2789 for (int k4 = 0; k4 < 13; k4++) {
2790 for (int j6 = 0; j6 < 13; j6++) {
2791 int l7 = regionChunkUIDs[j3][k4][j6];
2792 if (l7 != -1) {
2793 int i9 = l7 >> 24 & 3;
2794 int l9 = l7 >> 1 & 3;
2795 int j10 = l7 >> 14 & 0x3ff;
2796 int l10 = l7 >> 3 & 0x7ff;
2797 int j11 = (j10 / 8 << 8) + l10 / 8;
2798 for (int l11 = 0; l11 < chunkUIDs.length; l11++) {
2799 if (chunkUIDs[l11] != j11 || objectScapeData[l11] == null) {
2800 continue;
2801 }
2802 objectManager.loadLand1(i9, l9, collisionMap, k4 * 8, (j10 & 7) * 8, objectScapeData[l11], (l10 & 7) * 8, j3, j6 * 8);
2803 break;
2804 }
2805
2806 }
2807 }
2808
2809 }
2810
2811 }
2812
2813 for (int l4 = 0; l4 < 13; l4++) {
2814 for (int k6 = 0; k6 < 13; k6++) {
2815 int i8 = regionChunkUIDs[0][l4][k6];
2816 if (i8 == -1) {
2817 objectManager.sewEdges(k6 * 8, 8, 8, l4 * 8);
2818 }
2819 }
2820
2821 }
2822
2823 stream.createFrame(0);
2824 for (int l6 = 0; l6 < 4; l6++) {
2825 for (int j8 = 0; j8 < 13; j8++) {
2826 for (int j9 = 0; j9 < 13; j9++) {
2827 int i10 = regionChunkUIDs[l6][j8][j9];
2828 if (i10 != -1) {
2829 int k10 = i10 >> 24 & 3;
2830 int i11 = i10 >> 1 & 3;
2831 int k11 = i10 >> 14 & 0x3ff;
2832 int i12 = i10 >> 3 & 0x7ff;
2833 int j12 = (k11 / 8 << 8) + i12 / 8;
2834 for (int k12 = 0; k12 < chunkUIDs.length; k12++) {
2835 if (chunkUIDs[k12] != j12 || landScapeData[k12] == null) {
2836 continue;
2837 }
2838 objectManager.loadObjects(collisionMap, landScape, k10, j8 * 8, (i12 & 7) * 8, l6, landScapeData[k12], (k11 & 7) * 8, i11, j9 * 8);
2839 break;
2840 }
2841
2842 }
2843 }
2844
2845 }
2846
2847 }
2848
2849 }
2850 stream.createFrame(0);
2851 objectManager.createLand(collisionMap, landScape);
2852 inGameScreen.initDrawingArea();
2853 stream.createFrame(0);
2854 int k3 = ObjectManager.minPlane;
2855 if (k3 > plane) {
2856 k3 = plane;
2857 }
2858 if (k3 < plane - 1) {
2859 k3 = plane - 1;
2860 }
2861 if (lowMem) {
2862 landScape.setPlane(ObjectManager.minPlane);
2863 }
2864 else {
2865 landScape.setPlane(0);
2866 }
2867 for (int i5 = 0; i5 < 104; i5++) {
2868 for (int i7 = 0; i7 < 104; i7++) {
2869 spawnGroundItem(i5, i7);
2870 }
2871
2872 }
2873
2874 anInt1051++;
2875 if (anInt1051 > 98) {
2876 anInt1051 = 0;
2877 stream.createFrame(150);
2878 }
2879 handleSpawnedObjects();
2880 }
2881 catch (Exception exception) {
2882 exception.printStackTrace();
2883 }
2884 ObjectDefinition.mruNodes1.unlinkAll();
2885 if (super.gameFrame != null) {
2886 stream.createFrame(210);
2887 stream.writeDWord(0x3f008edd);
2888 }
2889 System.gc();
2890 Rasterizer.setupTextures();
2891 onDemandFetcher.clearPassive();
2892 int k = (regionX - 6) / 8 - 1;
2893 int j1 = (regionX + 6) / 8 + 1;
2894 int i2 = (regionY - 6) / 8 - 1;
2895 int l2 = (regionY + 6) / 8 + 1;
2896 if (regionIsRestricted) {
2897 k = 49;
2898 j1 = 50;
2899 i2 = 49;
2900 l2 = 50;
2901 }
2902 for (int l3 = k; l3 <= j1; l3++) {
2903 for (int j5 = i2; j5 <= l2; j5++) {
2904 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
2905 int j7 = onDemandFetcher.getRegionUID(0, j5, l3);
2906 if (j7 != -1) {
2907 onDemandFetcher.sendPassively(j7, 3);
2908 }
2909 int k8 = onDemandFetcher.getRegionUID(1, j5, l3);
2910 if (k8 != -1) {
2911 onDemandFetcher.sendPassively(k8, 3);
2912 }
2913 }
2914 }
2915
2916 }
2917
2918 }
2919
2920 private void unlinkMRUNodes() {
2921 ObjectDefinition.mruNodes1.unlinkAll();
2922 ObjectDefinition.mruNodes2.unlinkAll();
2923 EntityDefinition.mruNodes.unlinkAll();
2924 ItemDefinition.mruNodes2.unlinkAll();
2925 ItemDefinition.mruNodes1.unlinkAll();
2926 Player.mruNodes.unlinkAll();
2927 SpotAnim.models.unlinkAll();
2928 }
2929
2930 private void createLandImage(int i) {
2931 int ai[] = landImage.myPixels;
2932 int j = ai.length;
2933 for (int k = 0; k < j; k++) {
2934 ai[k] = 0;
2935 }
2936
2937 for (int l = 1; l < 103; l++) {
2938 int i1 = 24628 + (103 - l) * 512 * 4;
2939 for (int k1 = 1; k1 < 103; k1++) {
2940 if ((byteGroundArray[i][k1][l] & 0x18) == 0) {
2941 landScape.drawMinimapTile(ai, i1, i, k1, l);
2942 }
2943 if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0) {
2944 landScape.drawMinimapTile(ai, i1, i + 1, k1, l);
2945 }
2946 i1 += 4;
2947 }
2948
2949 }
2950
2951 int j1 = 0xFFFFFF;
2952 int l1 = 0xee0000;
2953 landImage.method343();
2954 for (int i2 = 1; i2 < 103; i2++) {
2955 for (int j2 = 1; j2 < 103; j2++) {
2956 if ((byteGroundArray[i][j2][i2] & 0x18) == 0) {
2957 MiniMap.drawMinimapWall(this, i2, j1, j2, l1, i);
2958 }
2959 if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0) {
2960 MiniMap.drawMinimapWall(this, i2, j1, j2, l1, i + 1);
2961 }
2962 }
2963
2964 }
2965
2966 inGameScreen.initDrawingArea();
2967 objectIconCount = 0;
2968 for (int k2 = 0; k2 < 104; k2++) {
2969 for (int l2 = 0; l2 < 104; l2++) {
2970 int i3 = landScape.getGroundDecorationUID(plane, k2, l2);
2971 if (i3 != 0) {
2972 i3 = i3 >> 14 & 0x7fff;
2973 int j3 = ObjectDefinition.forId(i3).icon;
2974 if (j3 >= 0) {
2975 if (j3 >= 15 && j3 <= 67) {
2976 j3 -= 2;
2977 }
2978 else if (j3 >= 68 && j3 <= 84) {
2979 j3 -= 1;
2980 }
2981 objectIcon[objectIconCount] = mapFunctions[j3];
2982 objectIconX[objectIconCount] = k2;
2983 objectIconY[objectIconCount] = l2;
2984 objectIconCount++;
2985 }
2986 }
2987 }
2988
2989 }
2990
2991 }
2992
2993 public final static String[] foodNames =
2994 {"manta ray", "shark", "anglerfish", "dark crab", "swordfish", "saradomin brew", "super restore", "potion", "serum", "karambwan", "pizza", "lobster", "monkfish", "guthix rest", "shrimps", "trout", "tuna", "salmon", "bone",};
2995
2996 protected void spawnGroundItem(int i, int j) {
2997 NodeList class19 = groundArray[plane][i][j];
2998
2999 if (class19 == null) {
3000 landScape.removeItemPile(plane, i, j);
3001 return;
3002 }
3003 long k = 0xfa0a1f01; // same as -99999999, if kept at 0, loot piles will bug out and always leave a shark and bone for example when pking.
3004
3005 Object obj = null;
3006
3007 for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
3008 long value = ItemPrice.getValueDropsOnly(item.itemId, item.amount);
3009 if (value > k) {
3010 k = value;
3011 obj = item;
3012 }
3013 }
3014
3015 class19.insertTail(((Node) (obj)));
3016 Object obj1 = null;
3017 Object obj2 = null;
3018 for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetNext()) {
3019 if (class30_sub2_sub4_sub2_1.itemId != ((Item) (obj)).itemId && obj1 == null) {
3020 obj1 = class30_sub2_sub4_sub2_1;
3021 }
3022 if (class30_sub2_sub4_sub2_1.itemId != ((Item) (obj)).itemId && class30_sub2_sub4_sub2_1.itemId != ((Item) (obj1)).itemId && obj2 == null) {
3023 obj2 = class30_sub2_sub4_sub2_1;
3024 }
3025 }
3026
3027 int i1 = i + (j << 7) + 0x60000000;
3028 landScape.addItemPile(i, i1, ((SceneNode) (obj1)), getLand(plane, j * 128 + 64, i * 128 + 64), ((SceneNode) (obj2)), ((SceneNode) (obj)), plane, j);
3029 }
3030
3031 private void drawNPCs(boolean flag) {
3032 for (int j = 0; j < npcCount; j++) {
3033 Npc npc = npcArray[npcIndices[j]];
3034 int k = 0x20000000 + (npcIndices[j] << 14);
3035 if (npc == null || !npc.isVisible() || npc.desc.hasRenderPriority != flag)
3036 continue;
3037 int l = npc.x >> 7;
3038 int i1 = npc.y >> 7;
3039 if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) {
3040 continue;
3041 }
3042 if (npc.size == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
3043 if (tileCycleMap[l][i1] == sceneCycle) {
3044 continue;
3045 }
3046 tileCycleMap[l][i1] = sceneCycle;
3047 }
3048 if (!npc.desc.interactable) {
3049 k += 0x80000000;
3050 }
3051 landScape.add(plane, npc.yaw, getLand(plane, npc.y, npc.x), k, npc.y, (npc.size - 1) * 64 + 60, npc.x, npc, npc.canRotate);
3052 }
3053 }
3054
3055 private int bankOffsetXResizable;
3056
3057 private int bankOffsetYResizable;
3058
3059 private int actionButtonMultiInterfaceIdToHover;
3060
3061 private void buildInterfaceMenu(int xOffset, RSInterface interfaceId, int mouseX, int yOffset, int mouseY, int scrollPosition, boolean isChild) {
3062 interfaceHoverId = 0;
3063 if (!isChild) {
3064 bankOffsetXResizable = xOffset;
3065 bankOffsetYResizable = yOffset;
3066 }
3067 if (interfaceId == null || interfaceId.getType() != 0 || interfaceId.children == null || interfaceId.invisible) {
3068 return;
3069 }
3070 if (mouseX < xOffset || mouseY < yOffset || mouseX > xOffset + interfaceId.width || mouseY > yOffset + interfaceId.height) {
3071 return;
3072 }
3073 int k1 = interfaceId.children.length;
3074 for (int l1 = 0; l1 < k1; l1++) {
3075 int childX = interfaceId.childX[l1] + xOffset;
3076 int childY = (interfaceId.childY[l1] + yOffset) - scrollPosition;
3077 RSInterface child = RSInterface.interfaceCache[interfaceId.children[l1]];
3078
3079 if(child == null) {
3080 continue;
3081 }
3082 if (child.childInvisibilitySupported && child.invisible) {
3083 continue;
3084 }
3085 childX += child.offsetX;
3086 childY += child.offsetY;
3087
3088 if (child.actionButtonMultiSpriteHover != null && child.sprite1Number != -1) {
3089 if (mouseX >= childX && mouseX <= childX + child.width && mouseY>= childY && mouseY <= childY + child.height) {
3090 actionButtonMultiInterfaceIdToHover = child.id;
3091 }
3092 }
3093 if ((child.isMouseoverTriggered >= 0 || child.hoverColorDisabled != 0) && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3094 if (child.isMouseoverTriggered >= 0) {
3095 setFrameFocusedInterface(child.isMouseoverTriggered);
3096 }
3097 else {
3098 setFrameFocusedInterface(child.id);
3099 }
3100 }
3101
3102 if (child.getType() == 9 && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3103 anInt1315 = child.id;
3104 }
3105 if (child.getType() == 0) {
3106 buildInterfaceMenu(childX, child, mouseX, childY, mouseY, child.scrollPosition, true);
3107 if (child.scrollMax > child.height) {
3108 handleScrollbarMouse(childX + child.width, child.height, mouseX, mouseY, child, childY, true, child.scrollMax);
3109 }
3110 }
3111 else {
3112 if (child.atActionType == 1 && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3113 boolean flag = false;
3114 if (child.actionType != 0) {
3115 flag = FriendSystem.buildFriendsListMenu(child, this);
3116 }
3117 if (!flag) {
3118 if (child.tooltips != null && child.tooltips.length > 0) {
3119 for (int u = child.tooltips.length - 1; u >= 0; u--) {
3120 if (ClientDebugConfiguration.DEBUG_MODE) {
3121 menuActionName[menuActionRow] = child.tooltips[u] + ", " + child.id;
3122 }
3123 else {
3124 menuActionName[menuActionRow] = child.tooltips[u];
3125 }
3126 interfaceHoverId = child.id;
3127 menuActionID[menuActionRow] = 315;
3128 menuActionCmd3[menuActionRow] = child.id + u;
3129 menuActionRow++;
3130 }
3131 }
3132 else {
3133 if (ClientDebugConfiguration.DEBUG_MODE) {
3134 menuActionName[menuActionRow] = child.tooltip + ", " + child.id;
3135 }
3136 else {
3137 menuActionName[menuActionRow] = child.tooltip;
3138 }
3139 interfaceHoverId = child.id;
3140 menuActionID[menuActionRow] = 315;
3141 menuActionCmd3[menuActionRow] = child.id;
3142 menuActionRow++;
3143 }
3144 }
3145 }
3146 if (child.atActionType == 2 && spellSelected == 0 && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3147 String s = child.selectedActionName;
3148 if (s.indexOf(" ") != -1) {
3149 s = s.substring(0, s.indexOf(" "));
3150 }
3151 if (Config.PRE_EOC) {
3152 menuActionName[menuActionRow] = s + " @gre@" + child.spellName + " "
3153 + (ClientDebugConfiguration.DEBUG_INTERFACES ? child.id + "" : "");
3154 menuActionID[menuActionRow] = 626;
3155 menuActionCmd3[menuActionRow] = child.id;
3156 menuActionRow++;
3157 interfaceHoverId = child.id;
3158 if (child.spellName.contains("Rush") || child.spellName.contains("Burst")
3159 || child.spellName.contains("Blitz") || child.spellName.contains("Barrage")
3160 || child.spellName.contains("strike") || child.spellName.contains("bolt")
3161 || child.spellName.contains("Crumble undead") || child.spellName.contains("blast")
3162 || child.spellName.contains("Surge") || child.spellName.contains("wave")
3163 || child.spellName.contains("Claws of Guthix")
3164 || child.spellName.contains("Flames of Zamorak")
3165 || child.spellName.contains("Magic Dart")) {
3166 menuActionName[menuActionRow] = "Autocast @gre@" + child.spellName;
3167 menuActionID[menuActionRow] = 104;
3168 menuActionCmd3[menuActionRow] = child.id;
3169 menuActionRow++;
3170 interfaceHoverId = child.id;
3171 }
3172 } else {
3173 if (child.spellName.contains("Rush") || child.spellName.contains("Burst")
3174 || child.spellName.contains("Blitz") || child.spellName.contains("Barrage")
3175 || child.spellName.contains("strike") || child.spellName.contains("bolt")
3176 || child.spellName.contains("Crumble undead") || child.spellName.contains("blast")
3177 || child.spellName.contains("Surge") || child.spellName.contains("wave")
3178 || child.spellName.contains("Claws of Guthix")
3179 || child.spellName.contains("Flames of Zamorak")
3180 || child.spellName.contains("Magic Dart")) {
3181 menuActionName[menuActionRow] = "Autocast @gre@" + child.spellName;
3182 menuActionID[menuActionRow] = 104;
3183 menuActionCmd3[menuActionRow] = child.id;
3184 menuActionRow++;
3185 interfaceHoverId = child.id;
3186 }
3187 menuActionName[menuActionRow] = s + " @gre@" + child.spellName + " "
3188 + (ClientDebugConfiguration.DEBUG_INTERFACES ? child.id + "" : "");
3189 menuActionID[menuActionRow] = 626;
3190 menuActionCmd3[menuActionRow] = child.id;
3191 menuActionRow++;
3192 interfaceHoverId = child.id;
3193 }
3194 }
3195 if (child.atActionType == 3 && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3196 menuActionName[menuActionRow] = "Close";
3197 menuActionID[menuActionRow] = 200;
3198 menuActionCmd3[menuActionRow] = child.id;
3199 menuActionRow++;
3200 interfaceHoverId = child.id;
3201 }
3202 if (child.atActionType == 4 && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3203 if (ClientDebugConfiguration.DEBUG_MODE) {
3204 menuActionName[menuActionRow] = child.tooltip + ", " + child.id + ", " + RSInterface.getConfigID(child.id);
3205 }
3206 else {
3207 menuActionName[menuActionRow] = child.tooltip;
3208 }
3209 menuActionID[menuActionRow] = 169;
3210 menuActionCmd3[menuActionRow] = child.id;
3211 menuActionRow++;
3212 interfaceHoverId = child.id;
3213 }
3214
3215 // This only called for Combat interface buttons that say "Select"
3216 if (child.atActionType == 5 && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3217 if (ClientDebugConfiguration.DEBUG_MODE) {
3218 menuActionName[menuActionRow] = child.tooltip + ", " + child.id + ", " + RSInterface.getConfigID(child.id);
3219 }
3220 else {
3221 menuActionName[menuActionRow] = child.tooltip;
3222 }
3223 if (Client.getTabId() == 0) {
3224 if (menuActionName[menuActionRow].contains("Select")) {
3225 timeCombatInterfaceHovered = System.currentTimeMillis();
3226 combatInterfaceHoverString = child.id;
3227 }
3228 }
3229
3230 menuActionID[menuActionRow] = 646;
3231 menuActionCmd3[menuActionRow] = child.id;
3232 menuActionRow++;
3233 interfaceHoverId = child.id;
3234 }
3235 if (child.atActionType == 6 && !isDialogueOptionsShowing() && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3236 if (ClientDebugConfiguration.DEBUG_MODE) {
3237 menuActionName[menuActionRow] = child.tooltip + ", " + child.id + ", " + RSInterface.getConfigID(child.id);
3238 }
3239 else {
3240 menuActionName[menuActionRow] = child.tooltip;
3241 }
3242 menuActionID[menuActionRow] = 679;
3243 menuActionCmd3[menuActionRow] = child.id;
3244 menuActionRow++;
3245 interfaceHoverId = child.id;
3246 }
3247 if (child.atActionType == 9 && !dialogueOptionsShowing && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3248 menuActionName[menuActionRow] = child.tooltip;
3249 menuActionID[menuActionRow] = 1100;
3250 menuActionCmd3[menuActionRow] = child.id;
3251 menuActionRow++;
3252 }
3253 if (child.atActionType == 10 && !dialogueOptionsShowing && mouseX >= childX && mouseY >= childY && mouseX < childX + child.width && mouseY < childY + child.height) {
3254 menuActionName[menuActionRow] = child.getMenuItem().getText();
3255 menuActionID[menuActionRow] = 1200;
3256 menuActionCmd3[menuActionRow] = child.id;
3257 menuActionRow++;
3258 }
3259 if (mouseX >= childX && mouseY >= childY && mouseX < childX + (child.getType() == 4 ? 100 : child.width) && mouseY < childY + child.height) {
3260 if (child.actions != null) {
3261 if ((child.getType() == 4 && child.message.length() > 0) || child.getType() == 5) {
3262 for (int action = child.actions.length - 1; action >= 0; action--) {
3263 if (child.actions[action] != null) {
3264 menuActionName[menuActionRow] = child.actions[action] + (child.getType() == 4 ? " " + child.message : "");
3265 if (child.id >= 24600 && child.id <= 24699) {
3266 menuActionID[menuActionRow] = 4500;
3267 menuActionCmd2[menuActionRow] = action;
3268 menuActionCmd3[menuActionRow] = child.id;
3269 menuActionRow++;
3270 }
3271 else {
3272 menuActionID[menuActionRow] = 647;
3273 menuActionCmd2[menuActionRow] = action;
3274 menuActionCmd3[menuActionRow] = child.id;
3275 menuActionRow++;
3276 }
3277 interfaceHoverId = child.id;
3278 }
3279 }
3280 }
3281 }
3282 }
3283 if (child.getType() == 2) {
3284 int k2 = interfaceId.invStartIndex;
3285 for (int l2 = 0; l2 < child.height; l2++) {
3286 for (int i3 = 0; i3 < child.width; i3++) {
3287 if (k2 >= child.inv.length)
3288 continue;
3289
3290 int xStart = childX + i3 * (32 + child.invSpritePadX);
3291 int yStart = childY + l2 * (32 + child.invSpritePadY);
3292 if (k2 < 20) {
3293 xStart += child.spritesX[k2];
3294 yStart += child.spritesY[k2];
3295 }
3296 if (mouseX >= xStart && mouseY >= yStart && mouseX < xStart + 32 && mouseY < yStart + 32) {
3297 mouseInvInterfaceIndex = k2;
3298 lastActiveInvInterface = child.id;
3299 if (child.inv[k2] > 0) {
3300 ItemDefinition itemDef = ItemDefinition.forId(child.inv[k2] - 1);
3301
3302 if (itemDef == null) {
3303 continue;
3304 }
3305 if (itemSelected == 1 && child.isInventoryInterface) {
3306 if (child.id != anInt1284 || k2 != anInt1283) {
3307 menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
3308 menuActionID[menuActionRow] = 870;
3309 menuActionCmd1[menuActionRow] = itemDef.itemId;
3310 menuActionCmd2[menuActionRow] = k2;
3311 menuActionCmd3[menuActionRow] = child.id;
3312 menuActionRow++;
3313 interfaceHoverId = child.id;
3314 }
3315 }
3316 else if (spellSelected == 1 && child.isInventoryInterface) {
3317 if ((spellUsableOn & 0x10) == 16) {
3318 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
3319 menuActionID[menuActionRow] = 543;
3320 menuActionCmd1[menuActionRow] = itemDef.itemId;
3321 menuActionCmd2[menuActionRow] = k2;
3322 menuActionCmd3[menuActionRow] = child.id;
3323 menuActionRow++;
3324 interfaceHoverId = child.id;
3325 }
3326 }
3327 else {
3328 if (child.isInventoryInterface) {
3329 for (int l3 = 4; l3 >= 3; l3--)
3330 if (itemDef.inventoryOptions != null && itemDef.inventoryOptions[l3] != null) {
3331 menuActionName[menuActionRow] = itemDef.inventoryOptions[l3] + " @lre@" + itemDef.name;
3332 if (l3 == 3) {
3333 menuActionID[menuActionRow] = 493;
3334 }
3335 if (l3 == 4) {
3336 menuActionID[menuActionRow] = 847;
3337 }
3338 menuActionCmd1[menuActionRow] = itemDef.itemId;
3339 menuActionCmd2[menuActionRow] = k2;
3340 menuActionCmd3[menuActionRow] = child.id;
3341 menuActionRow++;
3342 interfaceHoverId = child.id;
3343 }
3344 else if (l3 == 4) {
3345 menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
3346 menuActionID[menuActionRow] = 847;
3347 menuActionCmd1[menuActionRow] = itemDef.itemId;
3348 menuActionCmd2[menuActionRow] = k2;
3349 menuActionCmd3[menuActionRow] = child.id;
3350 menuActionRow++;
3351 interfaceHoverId = child.id;
3352 }
3353
3354 }
3355 if (child.usableItemInterface) {
3356 menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
3357 menuActionID[menuActionRow] = 447;
3358 menuActionCmd1[menuActionRow] = itemDef.itemId;
3359 // k2 = inventory spot
3360 menuActionCmd2[menuActionRow] = k2;
3361 menuActionCmd3[menuActionRow] = child.id;
3362 menuActionRow++;
3363 interfaceHoverId = child.id;
3364 }
3365 if (child.isInventoryInterface && itemDef.inventoryOptions != null) {
3366 for (int i4 = 2; i4 >= 0; i4--) {
3367 if (itemDef.inventoryOptions[i4] != null) {
3368 menuActionName[menuActionRow] = itemDef.inventoryOptions[i4] + " @lre@" + itemDef.name;
3369 if (i4 == 0) {
3370 menuActionID[menuActionRow] = 74;
3371 }
3372 if (i4 == 1) {
3373 menuActionID[menuActionRow] = 454;
3374 }
3375 if (i4 == 2) {
3376 menuActionID[menuActionRow] = 539;
3377 }
3378 menuActionCmd1[menuActionRow] = itemDef.itemId;
3379 menuActionCmd2[menuActionRow] = k2;
3380 menuActionCmd3[menuActionRow] = child.id;
3381 menuActionRow++;
3382 interfaceHoverId = child.id;
3383 }
3384 }
3385
3386 }
3387 if (child.actions != null) {
3388 for (int j4 = child.parentId == 5292 ? 8 : 4; j4 >= 0; j4--) {
3389 if (child.parentId == 5292) {
3390 if (itemDef != null && child.invStackSizes[k2] >= 1) {
3391 child.actions = new String[]{
3392 "Withdraw 1", "Withdraw 5", "Withdraw 10",
3393 "Withdraw All", "Withdraw X", "Withdraw " + lastXAmount,
3394 "Withdraw All but one", "Placeholder", "Examine"
3395 };
3396 } else if (itemDef != null && child.invStackSizes[k2] == 0) {
3397 child.actions = new String[] {
3398 "Release Placeholder", "Examine"
3399 };
3400 }
3401 }
3402 if (j4 > child.actions.length - 1) {
3403 continue;
3404 }
3405 boolean done = false;
3406
3407 if (itemDef != null && itemDef.operateOptions != null && (menuActionRow - 1) <= itemDef.operateOptions.length - 1) {
3408 if (itemDef.operateOptions[menuActionRow - 1] != null && child.id == 1688) {
3409 if (itemDef.operateOptions[menuActionRow - 1] != null) {
3410 menuActionName[menuActionRow] = itemDef.operateOptions[menuActionRow - 1] + " @lre@" + itemDef.name;
3411 interfaceHoverId = child.id;
3412 }
3413 else {
3414 if (child.actions[j4] != null) {
3415 menuActionName[menuActionRow] = child.actions[j4] + " @lre@" + itemDef.name;
3416 interfaceHoverId = child.id;
3417 }
3418 }
3419 if (j4 == 0)
3420 menuActionID[menuActionRow] = 632; // remove
3421 if (j4 == 1)
3422 menuActionID[menuActionRow] = 661; // operate 1
3423 if (j4 == 2)
3424 menuActionID[menuActionRow] = 662; // operate 2
3425 if (j4 == 3)
3426 menuActionID[menuActionRow] = 663; //operate 3
3427 if (j4 == 4)
3428 menuActionID[menuActionRow] = 664; //operate 4
3429 menuActionCmd1[menuActionRow] = itemDef.itemId;
3430 menuActionCmd2[menuActionRow] = k2;
3431 menuActionCmd3[menuActionRow] = child.id;
3432 menuActionRow++;
3433 done = true;
3434 }
3435 }
3436
3437 if (!done && child.parentId == 5292
3438 && itemDef != null && child.invStackSizes[k2] == 0) {
3439 menuActionName[menuActionRow] = child.actions[j4] + " @lre@" + itemDef.name;
3440 interfaceHoverId = child.id;
3441 if (j4 == 0) {
3442 menuActionID[menuActionRow] = 1126;
3443 }
3444 menuActionCmd1[menuActionRow] = itemDef.itemId;
3445 menuActionCmd2[menuActionRow] = k2;
3446 menuActionCmd3[menuActionRow] = child.id;
3447 menuActionRow++;
3448 done = true;
3449 } else if (!done && child.parentId == 5292 && itemDef != null
3450 && child.invStackSizes[k2] == 1 && variousSettings[835] == 1) {
3451 menuActionName[menuActionRow] = child.actions[j4] + " @lre@" + itemDef.name;
3452 interfaceHoverId = child.id;
3453 if (j4 == 0) {
3454 menuActionID[menuActionRow] = 1126;
3455 }
3456 menuActionCmd1[menuActionRow] = itemDef.itemId;
3457 menuActionCmd2[menuActionRow] = k2;
3458 menuActionCmd3[menuActionRow] = child.id;
3459 menuActionRow++;
3460 done = true;
3461 }
3462 if (child.actions[j4] != null && itemDef != null && !done) {
3463 menuActionName[menuActionRow] = child.actions[j4] + " @lre@" + itemDef.name;
3464 interfaceHoverId = child.id;
3465
3466 if (j4 == 0) {
3467 menuActionID[menuActionRow] = 632;
3468 }
3469 if (j4 == 1) {
3470 menuActionID[menuActionRow] = 78;
3471 }
3472 if (j4 == 2) {
3473 menuActionID[menuActionRow] = 867;
3474 }
3475 if (j4 == 3) {
3476 menuActionID[menuActionRow] = 431;
3477 }
3478 if (j4 == 4) {
3479 menuActionID[menuActionRow] = 53;
3480 }
3481
3482 if (child.parentId == 5292) {
3483 if (j4 == 5) {
3484 menuActionID[menuActionRow] = 1054;
3485 }
3486 if (j4 == 6) {
3487 menuActionID[menuActionRow] = 1053;
3488 }
3489 if (j4 == 7) {
3490 menuActionID[menuActionRow] = 1126;
3491 }
3492 if (j4 == 8) {
3493 menuActionID[menuActionRow] = 1125;
3494 }
3495 }
3496 menuActionCmd1[menuActionRow] = itemDef.itemId;
3497 menuActionCmd2[menuActionRow] = k2;
3498 menuActionCmd3[menuActionRow] = child.id;
3499 menuActionRow++;
3500 }
3501
3502 }
3503 }
3504 if (child.parentId != 5292 && itemDef != null && itemDef.itemId > 0) {
3505
3506 if (myUsername.equalsIgnoreCase("Michael")) {
3507 menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name
3508 + "@whi@ ( " + itemDef.itemId + " )" + "@gre@ ( "
3509 + itemDef.inventoryModel + " )" + "@cya@ ( " + itemDef.maleModel
3510 + " )" + "@mag@ ( " + itemDef.femaleModel + " )";
3511 }
3512 else {
3513 menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name;
3514 }
3515 menuActionID[menuActionRow] = 1125;
3516 menuActionCmd1[menuActionRow] = itemDef.itemId;
3517 menuActionCmd2[menuActionRow] = k2;
3518 menuActionCmd3[menuActionRow] = child.id;
3519 menuActionRow++;
3520 interfaceHoverId = child.id;
3521 }
3522 }
3523 }
3524 }
3525 k2++;
3526 }
3527
3528 }
3529
3530 }
3531 }
3532 }
3533 drawInterfaceIdHover();
3534 }
3535
3536 /**
3537 * Incomplete hovers similair to https://i.imgur.com/f7e0uiP.png
3538 */
3539 private void drawInterfaceIdHover() {
3540 if (interfaceHoverId > 0) {
3541 }
3542 }
3543
3544 public void drawScrollbar(int j, int k, int l, int i1, int j1) {
3545
3546 if(Config.PRE_EOC) {
3547 drawNewScrollbar(j,k,l,i1,j1);
3548 return;
3549 }
3550 scrollBar1.drawSprite(i1, l);
3551 scrollBar2.drawSprite(i1, (l + j) - 16);
3552 DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 16);
3553 DrawingArea.drawPixels(j - 32, l + 16, i1, 0x3d3426, 15);
3554 DrawingArea.drawPixels(j - 32, l + 16, i1, 0x342d21, 13);
3555 DrawingArea.drawPixels(j - 32, l + 16, i1, 0x2e281d, 11);
3556 DrawingArea.drawPixels(j - 32, l + 16, i1, 0x29241b, 10);
3557 DrawingArea.drawPixels(j - 32, l + 16, i1, 0x252019, 9);
3558 DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 1);
3559 int k1 = ((j - 32) * j) / j1;
3560 if (k1 < 8) {
3561 k1 = 8;
3562 }
3563 int l1 = ((j - 32 - k1) * k) / (j1 - j);
3564 DrawingArea.drawPixels(k1, l + 16 + l1, i1, barFillColor, 16);
3565 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x000001, k1, i1);
3566 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x817051, k1, i1 + 1);
3567 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x73654a, k1, i1 + 2);
3568 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x6a5c43, k1, i1 + 3);
3569 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x6a5c43, k1, i1 + 4);
3570 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x655841, k1, i1 + 5);
3571 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x655841, k1, i1 + 6);
3572 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x61553e, k1, i1 + 7);
3573 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x61553e, k1, i1 + 8);
3574 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x5d513c, k1, i1 + 9);
3575 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x5d513c, k1, i1 + 10);
3576 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x594e3a, k1, i1 + 11);
3577 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x594e3a, k1, i1 + 12);
3578 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x514635, k1, i1 + 13);
3579 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x4b4131, k1, i1 + 14);
3580 DrawingArea.method339(l + 16 + l1, 0x000001, 15, i1);
3581 DrawingArea.method339(l + 17 + l1, 0x000001, 15, i1);
3582 DrawingArea.method339(l + 17 + l1, 0x655841, 14, i1);
3583 DrawingArea.method339(l + 17 + l1, 0x6a5c43, 13, i1);
3584 DrawingArea.method339(l + 17 + l1, 0x6d5f48, 11, i1);
3585 DrawingArea.method339(l + 17 + l1, 0x73654a, 10, i1);
3586 DrawingArea.method339(l + 17 + l1, 0x76684b, 7, i1);
3587 DrawingArea.method339(l + 17 + l1, 0x7b6a4d, 5, i1);
3588 DrawingArea.method339(l + 17 + l1, 0x7e6e50, 4, i1);
3589 DrawingArea.method339(l + 17 + l1, 0x817051, 3, i1);
3590 DrawingArea.method339(l + 17 + l1, 0x000001, 2, i1);
3591 DrawingArea.method339(l + 18 + l1, 0x000001, 16, i1);
3592 DrawingArea.method339(l + 18 + l1, 0x564b38, 15, i1);
3593 DrawingArea.method339(l + 18 + l1, 0x5d513c, 14, i1);
3594 DrawingArea.method339(l + 18 + l1, 0x625640, 11, i1);
3595 DrawingArea.method339(l + 18 + l1, 0x655841, 10, i1);
3596 DrawingArea.method339(l + 18 + l1, 0x6a5c43, 7, i1);
3597 DrawingArea.method339(l + 18 + l1, 0x6e6046, 5, i1);
3598 DrawingArea.method339(l + 18 + l1, 0x716247, 4, i1);
3599 DrawingArea.method339(l + 18 + l1, 0x7b6a4d, 3, i1);
3600 DrawingArea.method339(l + 18 + l1, 0x817051, 2, i1);
3601 DrawingArea.method339(l + 18 + l1, 0x000001, 1, i1);
3602 DrawingArea.method339(l + 19 + l1, 0x000001, 16, i1);
3603 DrawingArea.method339(l + 19 + l1, 0x514635, 15, i1);
3604 DrawingArea.method339(l + 19 + l1, 0x564b38, 14, i1);
3605 DrawingArea.method339(l + 19 + l1, 0x5d513c, 11, i1);
3606 DrawingArea.method339(l + 19 + l1, 0x61553e, 9, i1);
3607 DrawingArea.method339(l + 19 + l1, 0x655841, 7, i1);
3608 DrawingArea.method339(l + 19 + l1, 0x6a5c43, 5, i1);
3609 DrawingArea.method339(l + 19 + l1, 0x6e6046, 4, i1);
3610 DrawingArea.method339(l + 19 + l1, 0x73654a, 3, i1);
3611 DrawingArea.method339(l + 19 + l1, 0x817051, 2, i1);
3612 DrawingArea.method339(l + 19 + l1, 0x000001, 1, i1);
3613 DrawingArea.method339(l + 20 + l1, 0x000001, 16, i1);
3614 DrawingArea.method339(l + 20 + l1, 0x4b4131, 15, i1);
3615 DrawingArea.method339(l + 20 + l1, 0x544936, 14, i1);
3616 DrawingArea.method339(l + 20 + l1, 0x594e3a, 13, i1);
3617 DrawingArea.method339(l + 20 + l1, 0x5d513c, 10, i1);
3618 DrawingArea.method339(l + 20 + l1, 0x61553e, 8, i1);
3619 DrawingArea.method339(l + 20 + l1, 0x655841, 6, i1);
3620 DrawingArea.method339(l + 20 + l1, 0x6a5c43, 4, i1);
3621 DrawingArea.method339(l + 20 + l1, 0x73654a, 3, i1);
3622 DrawingArea.method339(l + 20 + l1, 0x817051, 2, i1);
3623 DrawingArea.method339(l + 20 + l1, 0x000001, 1, i1);
3624 DrawingArea.drawVerticalLineNew(l + 16 + l1, 0x000001, k1, i1 + 15);
3625 DrawingArea.method339(l + 15 + l1 + k1, 0x000001, 16, i1);
3626 DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 15, i1);
3627 DrawingArea.method339(l + 14 + l1 + k1, 0x3f372a, 14, i1);
3628 DrawingArea.method339(l + 14 + l1 + k1, 0x443c2d, 10, i1);
3629 DrawingArea.method339(l + 14 + l1 + k1, 0x483e2f, 9, i1);
3630 DrawingArea.method339(l + 14 + l1 + k1, 0x4a402f, 7, i1);
3631 DrawingArea.method339(l + 14 + l1 + k1, 0x4b4131, 4, i1);
3632 DrawingArea.method339(l + 14 + l1 + k1, 0x564b38, 3, i1);
3633 DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 2, i1);
3634 DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 16, i1);
3635 DrawingArea.method339(l + 13 + l1 + k1, 0x443c2d, 15, i1);
3636 DrawingArea.method339(l + 13 + l1 + k1, 0x4b4131, 11, i1);
3637 DrawingArea.method339(l + 13 + l1 + k1, 0x514635, 9, i1);
3638 DrawingArea.method339(l + 13 + l1 + k1, 0x544936, 7, i1);
3639 DrawingArea.method339(l + 13 + l1 + k1, 0x564b38, 6, i1);
3640 DrawingArea.method339(l + 13 + l1 + k1, 0x594e3a, 4, i1);
3641 DrawingArea.method339(l + 13 + l1 + k1, 0x625640, 3, i1);
3642 DrawingArea.method339(l + 13 + l1 + k1, 0x6a5c43, 2, i1);
3643 DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 1, i1);
3644 DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 16, i1);
3645 DrawingArea.method339(l + 12 + l1 + k1, 0x443c2d, 15, i1);
3646 DrawingArea.method339(l + 12 + l1 + k1, 0x4b4131, 14, i1);
3647 DrawingArea.method339(l + 12 + l1 + k1, 0x544936, 12, i1);
3648 DrawingArea.method339(l + 12 + l1 + k1, 0x564b38, 11, i1);
3649 DrawingArea.method339(l + 12 + l1 + k1, 0x594e3a, 10, i1);
3650 DrawingArea.method339(l + 12 + l1 + k1, 0x5d513c, 7, i1);
3651 DrawingArea.method339(l + 12 + l1 + k1, 0x61553e, 4, i1);
3652 DrawingArea.method339(l + 12 + l1 + k1, 0x6e6046, 3, i1);
3653 DrawingArea.method339(l + 12 + l1 + k1, 0x7b6a4d, 2, i1);
3654 DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 1, i1);
3655 DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 16, i1);
3656 DrawingArea.method339(l + 11 + l1 + k1, 0x4b4131, 15, i1);
3657 DrawingArea.method339(l + 11 + l1 + k1, 0x514635, 14, i1);
3658 DrawingArea.method339(l + 11 + l1 + k1, 0x564b38, 13, i1);
3659 DrawingArea.method339(l + 11 + l1 + k1, 0x594e3a, 11, i1);
3660 DrawingArea.method339(l + 11 + l1 + k1, 0x5d513c, 9, i1);
3661 DrawingArea.method339(l + 11 + l1 + k1, 0x61553e, 7, i1);
3662 DrawingArea.method339(l + 11 + l1 + k1, 0x655841, 5, i1);
3663 DrawingArea.method339(l + 11 + l1 + k1, 0x6a5c43, 4, i1);
3664 DrawingArea.method339(l + 11 + l1 + k1, 0x73654a, 3, i1);
3665 DrawingArea.method339(l + 11 + l1 + k1, 0x7b6a4d, 2, i1);
3666 DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 1, i1);
3667 }
3668
3669 private void drawNewScrollbar(int barHeight, int scrollPos, int yPos, int xPos, int contentHeight) {
3670 int backingAmount = (barHeight - 32) / 5;
3671 int scrollPartHeight = (barHeight - 32) * barHeight / contentHeight;
3672 if (scrollPartHeight < 10)
3673 scrollPartHeight = 10;
3674 int scrollPartAmount = scrollPartHeight / 5 - 2;
3675 int scrollPartPos = (barHeight - 32 - scrollPartHeight) * scrollPos / (contentHeight - barHeight) + 16 + yPos;
3676 /* Bar fill */
3677 for (int i = 0, yyPos = yPos + 15; i <= backingAmount; i++, yyPos += 5) {
3678 cacheSprite[1089].drawSprite(xPos, yyPos);
3679 }
3680 /* Top of bar */
3681 cacheSprite[1086].drawSprite(xPos, scrollPartPos);
3682 scrollPartPos += 5;
3683 /* Middle of bar */
3684 for (int i = 0; i <= scrollPartAmount; i++) {
3685 cacheSprite[1087].drawSprite(xPos , scrollPartPos);
3686 scrollPartPos += 5;
3687 }
3688 scrollPartPos = (barHeight - 32 - scrollPartHeight) * scrollPos / (contentHeight - barHeight) + 16 + yPos
3689 + scrollPartHeight - 6;
3690 cacheSprite[1088].drawSprite(xPos, scrollPartPos);
3691 cacheSprite[1084].drawAdvancedSprite(xPos, yPos);
3692 cacheSprite[1085].drawAdvancedSprite(xPos, yPos + barHeight - 16);
3693 }
3694
3695 public int cButtonHPos;
3696
3697 public int cButtonCPos;
3698
3699 public static int musicVolume = 0;
3700
3701 public static String starterType = "VETERAN";
3702
3703 public static boolean isWithIn(int xStart, int xEnd, int yStart, int yEnd) {
3704 // TODO #FULLSCREEN ADJUST interfaces, hover over bank button.
3705 int x = isFixedScreen() ? 0 : (Client.getClientWidth() / 2) - 256;
3706 int y = isFixedScreen() ? 0 : (Client.getClientHeight() / 2) - 271;
3707 if (Client.instance.mouseX >= xStart + x && Client.instance.mouseX <= xEnd + x && Client.instance.mouseY >= yStart + y && Client.instance.mouseY <= yEnd + y) {
3708 return true;
3709 }
3710 return false;
3711 }
3712
3713 static int clickedX;
3714
3715 static int clickedY;
3716
3717 /**
3718 * This boolean is used because, this updates Client.instance.clickMode2, then the isWithInClicked method, then Client.instance.saveClickX.
3719 * Which means that if i do not use this boolean, it's going to use the old saveClickX coordinates.
3720 */
3721 public static boolean clickPositionUpdateRequired;
3722
3723 /**
3724 * If mouse clicked point is within the given values.
3725 */
3726 public static boolean isWithInClicked(int xStart, int xEnd, int yStart, int yEnd, boolean equipmentInterface) {
3727 if (clickPositionUpdateRequired) {
3728 return false;
3729 }
3730 if (Client.instance.saveClickX == clickedX && Client.instance.saveClickY == clickedY) {
3731 return false;
3732 }
3733 int saveClickX = Client.isFixedScreen() ? Client.instance.saveClickX : Client.instance.saveClickX - (Client.getClientWidth() / 2) + (equipmentInterface ? 260 : 375);
3734 int saveClickY = Client.isFixedScreen() ? Client.instance.saveClickY : Client.instance.saveClickY - (equipmentInterface ? (Client.getClientHeight() / 2) - 267 : 0);
3735 if (Client.instance.clickMode2 == 1 && saveClickX >= xStart && saveClickX <= xEnd && saveClickY >= yStart && saveClickY <= yEnd) {
3736 clickedX = Client.instance.saveClickX;
3737 clickedY = Client.instance.saveClickY;
3738 return true;
3739 }
3740 return false;
3741 }
3742
3743 public void handleVarp(int i) {
3744 if (ClientDebugConfiguration.DEBUG_MODE) {
3745 Utility.print("Varp: " + i);
3746 }
3747 if (i == 19) {
3748 loop = !loop;
3749 Settings.saveSettings();
3750 }
3751 else if (i == 18) {
3752 autoMusic = !autoMusic;
3753 Settings.saveSettings();
3754 }
3755 if (i > Varp.cache.length - 1) {
3756 return;
3757 }
3758 int action = Varp.cache[i].anInt709;
3759 if (action == 0) {
3760 return;
3761 }
3762
3763 int config = variousSettings[i];
3764 if (ClientDebugConfiguration.DEBUG_MODE) {
3765 Utility.print("Setting: " + i + ", Config: " + config + ", action: " + action);
3766 }
3767 if (action == 1) {
3768 if (config == 1) {
3769 Rasterizer.setupPalette(0.90000000000000002D);
3770 if (isLoggedIn()) {
3771 brightness = ClientConstants.BRIGHTNESS_VERY_DARK;
3772 Settings.saveSettings();
3773 }
3774 }
3775 if (config == 2) {
3776 Rasterizer.setupPalette(0.80000000000000004D);
3777 if (isLoggedIn()) {
3778 brightness = ClientConstants.BRIGHTNESS_DARK;
3779 Settings.saveSettings();
3780 }
3781 }
3782 if (config == 3) {
3783 Rasterizer.setupPalette(0.69999999999999996D);
3784 if (isLoggedIn()) {
3785 brightness = ClientConstants.BRIGHTNESS_NORMAL;
3786 Settings.saveSettings();
3787 }
3788 }
3789 if (config == 4) {
3790 Rasterizer.setupPalette(0.59999999999999998D);
3791 if (isLoggedIn()) {
3792 brightness = ClientConstants.BRIGHTNESS_BRIGHT;
3793 Settings.saveSettings();
3794 }
3795 }
3796 ItemDefinition.mruNodes1.unlinkAll();
3797 welcomeScreenRaised = true;
3798 }
3799 if (action == 3) {
3800 boolean flag1 = musicEnabled;
3801 if (config == 0) {
3802 Music.setMidiVolume(256);
3803 musicVolume = 4;
3804 musicEnabled = true;
3805 }
3806 if (config == 1) {
3807 Music.setMidiVolume(192);
3808 musicVolume = 3;
3809 musicEnabled = true;
3810 }
3811 if (config == 2) {
3812 Music.setMidiVolume(128);
3813 musicVolume = 2;
3814 musicEnabled = true;
3815 }
3816 if (config == 3) {
3817 Music.setMidiVolume(64);
3818 musicVolume = 1;
3819 musicEnabled = true;
3820 }
3821 if (config == 4) {
3822 musicVolume = 0;
3823 musicEnabled = false;
3824 Music.stopMidi();
3825 sendFrame126("No music selected.", 4439);
3826 Client.instance.sendCommandPacket("::nomusicselected");
3827 currentSong = -1;
3828 }
3829 if (musicEnabled != flag1) {
3830 if (musicEnabled) {
3831 nextSong = currentSong;
3832 onDemandFetcher.sendImmediately(2, nextSong);
3833 }
3834 else {
3835 Music.stopMidi();
3836 }
3837 previousSong = 0;
3838 }
3839 Settings.saveSettings();
3840 }
3841 if (action == 4) {
3842 SoundPlayer.setVolume(config, false, true);
3843 }
3844 if (action == 5) {
3845 useOneMouseButton = config;
3846 }
3847 if (action == 6) {
3848 showSpokenEffects = config;
3849 }
3850 if (action == 8) {
3851 splitPrivateChat = config;
3852 setUpdateChatAreaPending(true);
3853 }
3854 if (action == 9) {
3855 anInt913 = config;
3856 }
3857 }
3858
3859 private void updateTextures(int j) {
3860 if (lowMem) {
3861 return;
3862 }
3863 if (Rasterizer.textureCycle[17] >= j) {
3864 Background background = Rasterizer.textures[17]; // Water sprinkle effect, such as on fountains
3865 int k = background.width * background.height - 1;
3866 int j1 = background.width * animCycle * 2;
3867 byte abyte0[] = background.data;
3868 byte abyte3[] = tmpTexture;
3869 for (int i2 = 0; i2 <= k; i2++) {
3870 abyte3[i2] = abyte0[i2 - j1 & k];
3871 }
3872
3873 background.data = abyte3;
3874 tmpTexture = abyte0;
3875 Rasterizer.updateTexture(17);
3876 anInt854++;
3877 if (anInt854 > 1235) {
3878 anInt854 = 0;
3879 /*stream.createFrame(226);
3880 stream.writeWordBigEndian(0);
3881 int l2 = stream.currentOffset;
3882 stream.writeWord(58722);
3883 stream.writeWordBigEndian(240);
3884 stream.writeWord((int) (Math.random() * 65536D));
3885 stream.writeWordBigEndian((int) (Math.random() * 256D));
3886 if ((int) (Math.random() * 2D) == 0) {
3887 stream.writeWord(51825);
3888 }
3889 stream.writeWordBigEndian((int) (Math.random() * 256D));
3890 stream.writeWord((int) (Math.random() * 65536D));
3891 stream.writeWord(7130);
3892 stream.writeWord((int) (Math.random() * 65536D));
3893 stream.writeWord(61657);
3894 stream.writeBytes(stream.currentOffset - l2);*/
3895 }
3896 }
3897 if (Rasterizer.textureCycle[24] >= j) { // Moving water
3898 Background background_1 = Rasterizer.textures[24];
3899 int l = background_1.width * background_1.height - 1;
3900 int k1 = background_1.width * animCycle;
3901 byte abyte1[] = background_1.data;
3902 byte abyte4[] = tmpTexture;
3903 for (int j2 = 0; j2 <= l; j2++) {
3904 abyte4[j2] = abyte1[j2 - k1 & l];
3905 }
3906
3907 background_1.data = abyte4;
3908 tmpTexture = abyte1;
3909 Rasterizer.updateTexture(24);
3910 }
3911 if (Rasterizer.textureCycle[34] >= j) { // Magic tree
3912 Background background_2 = Rasterizer.textures[34];
3913 int i1 = background_2.width * background_2.height - 1;
3914 int l1 = background_2.width * animCycle;
3915 byte abyte2[] = background_2.data;
3916 byte abyte5[] = tmpTexture;
3917 for (int k2 = 0; k2 <= i1; k2++) {
3918 abyte5[k2] = abyte2[k2 - l1 & i1];
3919 }
3920 background_2.data = abyte5;
3921 tmpTexture = abyte2;
3922 Rasterizer.updateTexture(34);
3923 }
3924 if (Rasterizer.textureCycle[40] >= j) { // Fire cape (lava)
3925 Background background_2 = Rasterizer.textures[40];
3926 int i1 = background_2.width * background_2.height - 1;
3927 int l1 = background_2.width * animCycle * 2;
3928 byte abyte2[] = background_2.data;
3929 byte abyte5[] = tmpTexture;
3930 for (int k2 = 0; k2 <= i1; k2++) {
3931 abyte5[k2] = abyte2[k2 - l1 & i1];
3932 }
3933 background_2.data = abyte5;
3934 tmpTexture = abyte2;
3935 Rasterizer.updateTexture(40);
3936 }
3937 if (Rasterizer.textureCycle[59] >= j) { // Infernal cape texture
3938 Background background_2 = Rasterizer.textures[59];
3939 if (background_2 == null) {
3940 return;
3941 }
3942 int i1 = background_2.width * background_2.height - 1;
3943 int l1 = background_2.width * animCycle * 1;
3944 byte abyte2[] = background_2.data;
3945 byte abyte5[] = tmpTexture;
3946 for (int k2 = 0; k2 <= i1; k2++) {
3947 abyte5[k2] = abyte2[k2 - l1 & i1];
3948 }
3949 background_2.data = abyte5;
3950 tmpTexture = abyte2;
3951 Rasterizer.updateTexture(59);
3952 }
3953 }
3954
3955 private void handleSpoken() {
3956 for (int i = -1; i < playerCount; i++) {
3957 int j;
3958 if (i == -1) {
3959 j = myPlayerIndex;
3960 }
3961 else {
3962 j = playerIndices[i];
3963 }
3964 Player player = playerArray[j];
3965 if (player != null && player.textCycle > 0) {
3966 player.textCycle--;
3967 if (player.textCycle == 0) {
3968 player.textSpoken = null;
3969 }
3970 }
3971 }
3972 for (int k = 0; k < npcCount; k++) {
3973 int l = npcIndices[k];
3974 Npc npc = npcArray[l];
3975 if (npc != null && npc.textCycle > 0) {
3976 npc.textCycle--;
3977 if (npc.textCycle == 0) {
3978 npc.textSpoken = null;
3979 }
3980 }
3981 }
3982 }
3983
3984 private void calcCameraPos() {
3985 int i = cutsceneLocalX * 128 + 64;
3986 int j = cutsceneLocalY * 128 + 64;
3987 int k = getLand(plane, j, i) - cutsceneZ;
3988 if (xCameraPos < i) {
3989 xCameraPos += cutsceneSpeed + ((i - xCameraPos) * cutsceneSpeedMul) / 1000;
3990 if (xCameraPos > i) {
3991 xCameraPos = i;
3992 }
3993 }
3994 if (xCameraPos > i) {
3995 xCameraPos -= cutsceneSpeed + ((xCameraPos - i) * cutsceneSpeedMul) / 1000;
3996 if (xCameraPos < i) {
3997 xCameraPos = i;
3998 }
3999 }
4000 if (zCameraPos < k) {
4001 zCameraPos += cutsceneSpeed + ((k - zCameraPos) * cutsceneSpeedMul) / 1000;
4002 if (zCameraPos > k) {
4003 zCameraPos = k;
4004 }
4005 }
4006 if (zCameraPos > k) {
4007 zCameraPos -= cutsceneSpeed + ((zCameraPos - k) * cutsceneSpeedMul) / 1000;
4008 if (zCameraPos < k) {
4009 zCameraPos = k;
4010 }
4011 }
4012 if (yCameraPos < j) {
4013 yCameraPos += cutsceneSpeed + ((j - yCameraPos) * cutsceneSpeedMul) / 1000;
4014 if (yCameraPos > j) {
4015 yCameraPos = j;
4016 }
4017 }
4018 if (yCameraPos > j) {
4019 yCameraPos -= cutsceneSpeed + ((yCameraPos - j) * cutsceneSpeedMul) / 1000;
4020 if (yCameraPos < j) {
4021 yCameraPos = j;
4022 }
4023 }
4024 i = cutsceneFocusLocalX * 128 + 64;
4025 j = cutsceneFocusLocalY * 128 + 64;
4026 k = getLand(plane, j, i) - cutsceneFocusZ;
4027 int l = i - xCameraPos;
4028 int i1 = k - zCameraPos;
4029 int j1 = j - yCameraPos;
4030 int k1 = (int) Math.sqrt(l * l + j1 * j1);
4031 int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
4032 int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
4033 if (l1 < 128) {
4034 l1 = 128;
4035 }
4036 if (l1 > 383) {
4037 l1 = 383;
4038 }
4039 if (yCameraCurve < l1) {
4040 yCameraCurve += cutsceneRotateSpeed + ((l1 - yCameraCurve) * cutsceneRotateMul) / 1000;
4041 if (yCameraCurve > l1) {
4042 yCameraCurve = l1;
4043 }
4044 }
4045 if (yCameraCurve > l1) {
4046 yCameraCurve -= cutsceneRotateSpeed + ((yCameraCurve - l1) * cutsceneRotateMul) / 1000;
4047 if (yCameraCurve < l1) {
4048 yCameraCurve = l1;
4049 }
4050 }
4051 int j2 = i2 - xCameraCurve;
4052 if (j2 > 1024) {
4053 j2 -= 2048;
4054 }
4055 if (j2 < -1024) {
4056 j2 += 2048;
4057 }
4058 if (j2 > 0) {
4059 xCameraCurve += cutsceneRotateSpeed + (j2 * cutsceneRotateMul) / 1000;
4060 xCameraCurve &= 0x7ff;
4061 }
4062 if (j2 < 0) {
4063 xCameraCurve -= cutsceneRotateSpeed + (-j2 * cutsceneRotateMul) / 1000;
4064 xCameraCurve &= 0x7ff;
4065 }
4066 int k2 = i2 - xCameraCurve;
4067 if (k2 > 1024) {
4068 k2 -= 2048;
4069 }
4070 if (k2 < -1024) {
4071 k2 += 2048;
4072 }
4073 if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0) {
4074 xCameraCurve = i2;
4075 }
4076 }
4077
4078 void drawMenu() {
4079 if (saveRightClickCoordinates) {
4080 Landscape.clickX = super.mouseX - 4;
4081 Landscape.clickY = super.mouseY - 4;
4082 appendSavedCoordinated = true;
4083 saveRightClickCoordinates = false;
4084 }
4085 // TODO #FULLSCREEN ADJUST menu right click hover
4086 int yOffset = (isFixedScreen() ? 4 : 8);
4087 if (contextMenu.equals("NEW")) {
4088 int i = menuOffsetX;
4089 int j = menuOffsetY;
4090 int k = menuWidth;
4091 int l = menuHeight + 1; // anInt952
4092 DrawingArea.drawPixels(l - 4, j + 2, i, 0x706a5e, k);
4093 DrawingArea.drawPixels(l - 2, j + 1, i + 1, 0x706a5e, k - 2);
4094 DrawingArea.drawPixels(l, j, i + 2, 0x706a5e, k - 4);
4095 DrawingArea.drawPixels(l - 2, j + 1, i + 3, 0x2d2822, k - 6);
4096 DrawingArea.drawPixels(l - 4, j + 2, i + 2, 0x2d2822, k - 4);
4097 DrawingArea.drawPixels(l - 6, j + 3, i + 1, 0x2d2822, k - 2);
4098 DrawingArea.drawPixels(l - 22, j + 19, i + 2, 0x524a3d, k - 4);
4099 DrawingArea.drawPixels(l - 22, j + 20, i + 3, 0x524a3d, k - 6);
4100 DrawingArea.drawPixels(l - 23, j + 20, i + 3, 0x2b271c, k - 6);
4101 DrawingArea.fillPixels(i + 3, k - 6, 1, 0x2a291b, j + 2);
4102 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x2a261b, j + 3);
4103 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x252116, j + 4);
4104 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x211e15, j + 5);
4105 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x1e1b12, j + 6);
4106 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x1a170e, j + 7);
4107 DrawingArea.fillPixels(i + 2, k - 4, 2, 0x15120b, j + 8);
4108 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x100d08, j + 10);
4109 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 11);
4110 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x080703, j + 12);
4111 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 13);
4112 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x070802, j + 14);
4113 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 15);
4114 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x070802, j + 16);
4115 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 17);
4116 DrawingArea.fillPixels(i + 2, k - 4, 1, 0x2a291b, j + 18);
4117 DrawingArea.fillPixels(i + 3, k - 6, 1, 0x564943, j + 19);
4118 chatTextDrawingArea.method385(0xc6b895, "Choose Option", i + 3, j + 15);
4119 int j1 = super.mouseX;
4120 int k1 = super.mouseY + yOffset;
4121 if (getMenuScreenArea() == 0) {
4122 j1 -= 4;
4123 k1 -= 4;
4124 }
4125 if (getMenuScreenArea() == 1) {
4126 j1 -= 519;
4127 k1 -= 168;
4128 }
4129 if (getMenuScreenArea() == 2) {
4130 j1 -= 17;
4131 k1 -= 338;
4132 }
4133 if (getMenuScreenArea() == 3) {
4134 j1 -= 515;
4135 k1 -= 0;
4136 }
4137
4138 for (int l1 = 0; l1 < menuActionRow; l1++) {
4139 int i2 = j + 35 + (menuActionRow - 1 - l1) * 15;
4140 int j2 = 0xc6b895;
4141 if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) {
4142 DrawingArea.drawPixels(15, i2 - 15, i + 3, 0x6f695d, menuWidth - 6);
4143 j2 = 0xeee5c6;
4144 }
4145 if (menuActionName[l1] != null) {
4146 menuActionName[l1] = RSFont.replaceOldWithCol(menuActionName[l1]);
4147 }
4148 yellowClanName(l1);
4149 newBoldFont.drawBasicString1(menuActionName[l1], i + 3, i2 - 4, true, j2, false);
4150 }
4151 }
4152 else {
4153 int x = menuOffsetX;
4154 int y = menuOffsetY;
4155 int width = menuWidth;
4156 int height = menuHeight + 1;
4157 int colour = 0x5d5447;
4158 DrawingArea.drawPixels(height, y, x, colour, width);
4159 DrawingArea.drawPixels(16, y + 1, x + 1, 0, width - 2);
4160 DrawingArea.fillPixels(x + 1, width - 2, height - 19, 0, y + 18);
4161 chatTextDrawingArea.method385(colour, "Choose Option", x + 3, y + 14);
4162 int j1 = super.mouseX;
4163 int k1 = super.mouseY + yOffset;
4164 if (getMenuScreenArea() == 0) {
4165 j1 -= 4;
4166 k1 -= 4;
4167 }
4168 if (getMenuScreenArea() == 1) {
4169
4170 j1 -= 519;
4171 k1 -= 168;
4172 }
4173 if (getMenuScreenArea() == 2) {
4174 j1 -= 17;
4175 k1 -= 338;
4176 }
4177 if (getMenuScreenArea() == 3) {
4178 j1 -= 519;
4179 k1 -= 0;
4180 }
4181 for (int l1 = 0; l1 < menuActionRow; l1++) {
4182 int i2 = y + 35 + (menuActionRow - 1 - l1) * 15;
4183 int j2 = 0xffffff;
4184 if (j1 > x && j1 < x + width && k1 > i2 - 13 && k1 < i2 + 3) {
4185 if (contextMenu.equals("OLD HOVER")) {
4186 DrawingArea.drawPixels(15, i2 - 15, x + 3, 0x6f695d, menuWidth - 6);
4187 }
4188 j2 = 0xffff00;
4189 }
4190 if (menuActionName[l1] != null) {
4191 menuActionName[l1] = RSFont.replaceOldWithCol(menuActionName[l1]);
4192 }
4193 yellowClanName(l1);
4194 newBoldFont.drawBasicString1(menuActionName[l1], x + 3, i2 - 4, true, j2, false);
4195 }
4196 }
4197 }
4198
4199 public final static String CLAN_NAME_COLOUR = "<col=bc0eb8>";
4200
4201 private void yellowClanName(int l1) {
4202 if (menuActionName[l1].contains("Attack <col=ffffff>") || menuActionName[l1].contains("Cast <col=65280>")) {
4203 int start = 0;
4204 int end = -1;
4205 try {
4206 String name = menuActionName[l1];
4207 start = name.indexOf("<col=ebebeb>") + 12;
4208 boolean after = name.contains("<col=ffff00><col=ebebeb>");
4209 String combatColour = "ffff00";
4210 if (after) {
4211 end = name.lastIndexOf(" <col=ED700E>");
4212 if (end == -1) {
4213 end = name.lastIndexOf("<col=ED700E>");
4214 }
4215 }
4216 else {
4217 // It changes colour depending on combat level difference to me.
4218 end = name.lastIndexOf("<col=ffff00> (level: ");
4219 if (end == -1) {
4220 end = name.lastIndexOf("<col=ff0000> (level: ");
4221 combatColour = "ff0000";
4222 }
4223 if (end == -1) {
4224 end = name.lastIndexOf("<col=ff3000> (level: ");
4225 combatColour = "ff3000";
4226 }
4227 if (end == -1) {
4228 end = name.lastIndexOf("<col=ff7000> (level: ");
4229 combatColour = "ff7000";
4230 }
4231 if (end == -1) {
4232 end = name.lastIndexOf("<col=ffb000> (level: ");
4233 combatColour = "ffb000";
4234 }
4235 if (end == -1) {
4236 end = name.lastIndexOf("<col=65280> (level: ");
4237 combatColour = "65280";
4238 }
4239 if (end == -1) {
4240 end = name.lastIndexOf("<col=40ff00> (level: ");
4241 combatColour = "40ff00";
4242 }
4243 if (end == -1) {
4244 end = name.lastIndexOf("<col=80ff00> (level: ");
4245 combatColour = "80ff00";
4246 }
4247 if (end == -1) {
4248 end = name.lastIndexOf("<col=c0ff00> (level: ");
4249 combatColour = "c0ff00";
4250 }
4251 }
4252 if (end >= 0) {
4253 name = name.substring(start, end);
4254 for (int b = 0; b < clanList.length; b++) {
4255 if (clanList[b] == null) {
4256 continue;
4257 }
4258 if (clanList[b].equalsIgnoreCase(name)) {
4259 if (after) {
4260 menuActionName[l1] = menuActionName[l1].replace("<col=ebebeb>" + name + " <col=ED700E>", CLAN_NAME_COLOUR + name + " <col=ED700E>");
4261 menuActionName[l1] = menuActionName[l1].replace("<col=ebebeb>" + name + "<col=ED700E> ", CLAN_NAME_COLOUR + name + " <col=ED700E>");
4262 menuActionName[l1] = menuActionName[l1].replace("<col=ebebeb>" + name + "<col=ED700E>", CLAN_NAME_COLOUR + name + " <col=ED700E>");
4263 }
4264 else {
4265 menuActionName[l1] = menuActionName[l1].replace("<col=ebebeb>" + name + "<col=" + combatColour + "> (level: ", CLAN_NAME_COLOUR + name + "<col=" + combatColour + "> (level: ");
4266 }
4267 }
4268 }
4269 }
4270 }
4271 catch (Exception e) {
4272 e.printStackTrace();
4273 }
4274 }
4275
4276 }
4277
4278 protected int getLand(int i, int j, int k) {
4279 int l = k >> 7;
4280 int i1 = j >> 7;
4281 if (l < 0 || i1 < 0 || l > 103 || i1 > 103) {
4282 return 0;
4283 }
4284 int j1 = i;
4285 if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2) {
4286 j1++;
4287 }
4288 int k1 = k & 0x7f;
4289 int l1 = j & 0x7f;
4290 int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
4291 int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
4292 return i2 * (128 - l1) + j2 * l1 >> 7;
4293 }
4294
4295 private static String intToKOrMil(int amount, int parentId) {
4296 if (parentId == 3824) {
4297 return Utility.formatRunescapeStyle(amount);
4298 }
4299 else {
4300 if (amount <= 0) // Infinite
4301 {
4302 return "0";
4303 }
4304 if (amount < 0x186a0) {
4305 return String.valueOf(amount);
4306 }
4307 if (amount < 0x989680) {
4308 return amount / 1000 + "K";
4309 }
4310 else {
4311 return amount / 0xf4240 + "M";
4312 }
4313 }
4314 }
4315
4316 protected void logOutUpdate() {
4317 try {
4318 if (socketStream != null) {
4319 socketStream.close();
4320 }
4321 }
4322 catch (Exception e) {
4323 e.printStackTrace();
4324 }
4325 showXpBonusInterface = false;
4326 rigourUnlocked = false;
4327 auguryUnlocked = false;
4328 OverlayTimers.clearAllTimers();
4329 blackScreenSaved = false;
4330 showCountdown = false;
4331 drawTabs = false;
4332 staminaEffect = false;
4333 setDisconnected(false);
4334 playerUpdateCompleted = false;
4335 setInteractingWithEntityId(0);
4336 alwaysRightClickAttack = false;
4337 socketStream = null;
4338 setLoggedIn(false);
4339 loginScreenCursorPos = 0;
4340 unlinkMRUNodes();
4341 landScape.initToNull();
4342 for (int i = 0; i < 4; i++) {
4343 collisionMap[i].reset();
4344 }
4345 System.gc();
4346 Music.stopMidi();
4347 setLoginMessage1("");
4348 setLoginMessage2("");
4349 if (Config.ECO) {
4350 Client.instance.setLoginMessage1("Enter your username & password.");
4351 }
4352 currentSong = -1;
4353 nextSong = -1;
4354 previousSong = 0;
4355 noClip = false;
4356 poisoned = false;
4357 venomed = false;
4358 permissionToPlayNextSong = false;
4359 Music.playLogInScreenMusic();
4360 ArrowTutorial.cancelTutorial();
4361
4362 clearTextClicked();
4363
4364 // Reset title interface text colours to red.
4365 for (int j = 19384; j < 19424; j++) {
4366 RSInterface.interfaceCache[j].textColour = 16711680;
4367 }
4368
4369 // Reset Achievement interface text colours to red.
4370 for (int j = 22295; j < 22335; j++) {
4371 RSInterface.interfaceCache[j].textColour = 16711680;
4372 }
4373
4374
4375 if (!Client.isFixedScreen()) {
4376 ClientFrame.frame.setResizable(false);
4377 }
4378
4379 }
4380
4381 private void resetCharacterCreation() {
4382 updateCharacterCreation = true;
4383 for (int j = 0; j < 7; j++) {
4384 clotheIds[j] = -1;
4385 for (int k = 0; k < IdentityKit.length; k++) {
4386 if (IdentityKit.cache[k].disableDisplay || IdentityKit.cache[k].partId != j + (selectedMaleIdentityKit ? 0 : 7)) {
4387 continue;
4388 }
4389 clotheIds[j] = k;
4390 break;
4391 }
4392 }
4393 }
4394
4395 public void processGameLoop() {
4396 if (rsAlreadyLoaded || loadingError || genericLoadingError) {
4397 return;
4398 }
4399 loopCycle++;
4400 LogInScreen.logInScreenFirstPageAction();
4401 loginThenLogout();
4402 if (!isLoggedIn()) {
4403 LogInScreen.logInScreenSecondPage(true);
4404 if (Client.logInScreenPage.equals("SECOND")) {
4405 LogInScreen.updateUsernameAndPassword();
4406 }
4407 }
4408 else {
4409 mainGameProcessor();
4410 }
4411 processOnDemandQueue();
4412 Music.playNextSong();
4413 }
4414
4415 private void drawPlayers(boolean isMyPlayer) {
4416 if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY) {
4417 destX = 0;
4418 }
4419 int j = playerCount;
4420 if (isMyPlayer) {
4421 j = 1;
4422 }
4423 for (int l = 0; l < j; l++) {
4424 Player player;
4425 int i1;
4426 if (isMyPlayer) {
4427 player = myPlayer;
4428 i1 = myPlayerIndex << 14;
4429 }
4430 else {
4431 player = playerArray[playerIndices[l]];
4432 i1 = playerIndices[l] << 14;
4433 }
4434 if (player == null || !player.isVisible()) {
4435 continue;
4436 }
4437
4438 if (!isMyPlayer && botsOff) {
4439 if (player.gameModeTitle.contains("[Bot]") && (System.currentTimeMillis() - player.lastCombatTime) >= 5000) {
4440 continue;
4441 }
4442 }
4443
4444 int interact = myPlayer.interactingEntity - 32768;
4445 if (getInteractingWithEntityId() == 0 && interact > 0) {
4446 setInteractingWithEntityId(interact);
4447 alwaysRightClickAttack = false;
4448 }
4449 if (getInteractingWithEntityId() > 0) {
4450 if (interact > 0) {
4451 setInteractingWithEntityId(interact);
4452 alwaysRightClickAttack = false;
4453 }
4454 // Do not draw the player i am interacting with, because it is drawn already because prioritization.
4455 Player interactingPlayer = playerArray[getInteractingWithEntityId()];
4456 if (player == interactingPlayer) {
4457 continue;
4458 }
4459 }
4460
4461 // If players in region is more than 50 and is low mem, then make their animations all stand animation.......
4462 //player.ignoreSequences = (lowMem && playerCount > 50 || playerCount > 200) && !isMyPlayer && player.moveSequence == player.standAnimation;
4463 int j1 = player.x >> 7;
4464 int k1 = player.y >> 7;
4465 if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) {
4466 continue;
4467 }
4468 if (player.aModel_1714 != null && loopCycle >= player.objectStartCycle && loopCycle < player.objectEndCycle) {
4469 player.ignoreSequences = false;
4470 player.z = getLand(plane, player.y, player.x);
4471 landScape.add(plane, player.y, player, player.yaw, player.objectY1, player.x, player.z, player.objectX0, player.objectY0, i1, player.objectX1);
4472 continue;
4473 }
4474 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
4475 if (tileCycleMap[j1][k1] == sceneCycle) {
4476 continue;
4477 }
4478 tileCycleMap[j1][k1] = sceneCycle;
4479 }
4480 player.z = getLand(plane, player.y, player.x);
4481 landScape.add(plane, player.yaw, player.z, i1, player.y, 60, player.x, player, player.canRotate);
4482 }
4483 if (isMyPlayer) {
4484 //Draw the player we're interacting with
4485 //Interacting includes combat, following, etc.
4486 int interact = myPlayer.interactingEntity - 32768;
4487 if (getInteractingWithEntityId() == 0 && interact > 0) {
4488 setInteractingWithEntityId(interact);
4489 alwaysRightClickAttack = false;
4490 }
4491 if (getInteractingWithEntityId() > 0) {
4492 if (interact > 0) {
4493 setInteractingWithEntityId(interact);
4494 alwaysRightClickAttack = false;
4495 }
4496 Player player = playerArray[getInteractingWithEntityId()];
4497 showPlayer(player, getInteractingWithEntityId() << 14, false);
4498 }
4499 }
4500 }
4501
4502 private void showPlayer(Player player, int i1, boolean isMyPlayer) {
4503 if (player == null || !player.isVisible()) {
4504 return;
4505 }
4506 //player.ignoreSequences = (lowMem && playerCount > 50 || playerCount > 200) && !isMyPlayer && player.moveSequence == player.standAnimation;
4507 int j1 = player.x >> 7;
4508 int k1 = player.y >> 7;
4509 if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) {
4510 return;
4511 }
4512 if (player.aModel_1714 != null && loopCycle >= player.objectStartCycle && loopCycle < player.objectEndCycle) {
4513 player.ignoreSequences = false;
4514 player.z = getLand(plane, player.y, player.x);
4515 landScape.add(plane, player.y, player, player.yaw, player.objectY1, player.x, player.z, player.objectX0, player.objectY0, i1, player.objectX1);
4516 }
4517 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
4518 if (tileCycleMap[j1][k1] == sceneCycle) {
4519 return;
4520 }
4521 tileCycleMap[j1][k1] = sceneCycle;
4522 }
4523 player.z = getLand(plane, player.y, player.x);
4524 landScape.add(plane, player.yaw, player.z, i1, player.y, 60, player.x, player, player.canRotate);
4525 }
4526
4527 protected boolean promptUserForInput(RSInterface class9) {
4528 int contentType = class9.actionType;
4529 if (friendserverState == 2) {
4530 if (contentType == 201) {
4531 setUpdateChatAreaPending(true);
4532 inputDialogState = 0;
4533 setMessagePromptRaised(true, false);
4534 setChatAreaInputBoxPlayerInput("");
4535 bankSearchSent = "";
4536 friendsListAction = 1;
4537 setChatAreaInputBoxTitle("Enter name of friend to add to list");
4538 }
4539 if (contentType == 202) {
4540 setUpdateChatAreaPending(true);
4541 inputDialogState = 0;
4542 setMessagePromptRaised(true, false);
4543 setChatAreaInputBoxPlayerInput("");
4544 bankSearchSent = "";
4545 friendsListAction = 2;
4546 setChatAreaInputBoxTitle("Enter name of friend to delete from list");
4547 }
4548 }
4549 if (contentType == 205) {
4550 logoutCycle = 250;
4551 return true;
4552 }
4553 if (contentType == 501) {
4554 setUpdateChatAreaPending(true);
4555 inputDialogState = 0;
4556 setMessagePromptRaised(true, false);
4557 setChatAreaInputBoxPlayerInput("");
4558 bankSearchSent = "";
4559 friendsListAction = 4;
4560 setChatAreaInputBoxTitle("Enter name of player to add to list");
4561 }
4562 if (contentType == 502) {
4563 setUpdateChatAreaPending(true);
4564 inputDialogState = 0;
4565 setMessagePromptRaised(true, false);
4566 setChatAreaInputBoxPlayerInput("");
4567 bankSearchSent = "";
4568 friendsListAction = 5;
4569 setChatAreaInputBoxTitle("Enter name of player to delete from list");
4570 }
4571 if (contentType >= 300 && contentType <= 313) {
4572 int bodyPartIndex = (contentType - 300) / 2;
4573 int direction = contentType & 1;
4574 int newClothe = clotheIds[bodyPartIndex];
4575 if (newClothe != -1) {
4576 do {
4577 if (direction == 0 && --newClothe < 0) {
4578 newClothe = IdentityKit.length - 1;
4579 }
4580 if (direction == 1 && ++newClothe >= IdentityKit.length) {
4581 newClothe = 0;
4582 }
4583 }
4584 while (IdentityKit.cache[newClothe].disableDisplay || IdentityKit.cache[newClothe].partId != bodyPartIndex + (selectedMaleIdentityKit ? 0 : 7));
4585 clotheIds[bodyPartIndex] = newClothe;
4586 updateCharacterCreation = true;
4587 }
4588 }
4589 if (contentType >= 314 && contentType <= 323) {
4590 // 0 for hair colour, 1 for Torso, 2 for legs, 3 for feet, 4 for skin colour.
4591 int colourType = (contentType - 314) / 2;
4592 int k1 = contentType & 1;
4593 int colourIndex = selectedIdentityKitColor[colourType];
4594 if (k1 == 0 && --colourIndex < 0) {
4595 colourIndex = ClientConstants.CLOTHES_COLOUR[colourType].length - 1;
4596 }
4597 if (k1 == 1 && ++colourIndex >= ClientConstants.CLOTHES_COLOUR[colourType].length) {
4598 colourIndex = 0;
4599 }
4600 selectedIdentityKitColor[colourType] = colourIndex;
4601 updateCharacterCreation = true;
4602 }
4603 if (contentType == 324 && !selectedMaleIdentityKit) {
4604 selectedMaleIdentityKit = true;
4605 resetCharacterCreation();
4606 }
4607 if (contentType == 325 && selectedMaleIdentityKit) {
4608 selectedMaleIdentityKit = false;
4609 resetCharacterCreation();
4610 }
4611 if (contentType == 326) {
4612 if (Config.PRE_EOC) {
4613 stream.createFrame(101);
4614 stream.writeDWord(selectedMaleIdentityKit ? 0 : 1);
4615 for (int i1 = 0; i1 < 7; i1++) {
4616 stream.writeDWord(clotheIds[i1]);
4617 }
4618
4619 for (int l1 = 0; l1 < 5; l1++) {
4620 stream.writeDWord(selectedIdentityKitColor[l1]);
4621 }
4622 }
4623 else {
4624 stream.createFrame(101);
4625 stream.writeWordBigEndian(selectedMaleIdentityKit ? 0 : 1);
4626 for (int i1 = 0; i1 < 7; i1++) {
4627 stream.writeWordBigEndian(clotheIds[i1]);
4628 }
4629
4630 for (int l1 = 0; l1 < 5; l1++) {
4631 stream.writeWordBigEndian(selectedIdentityKitColor[l1]);
4632 }
4633 }
4634
4635 return true;
4636 }
4637 if (contentType == 613) {
4638 canMute = !canMute;
4639 }
4640 if (contentType >= 601 && contentType <= 612) {
4641 clearTopInterfaces();
4642 }
4643 return false;
4644 }
4645
4646 public void loadTitleScreen() {
4647 for (int index = 0; index < backgroundSprite.length; index++) {
4648 backgroundSprite[index] = new Sprite("background " + index);
4649 }
4650 drawLoadingText(0, loadingGameString());
4651 if (!updateFlames) {
4652 drawFlames = true;
4653 updateFlames = true;
4654 startRunnable(this, 2);
4655 }
4656 }
4657
4658 public static void setWorldGraphics(String detail) {
4659 switch (detail) {
4660 case "HIGH":
4661 Landscape.lowMem = false;
4662 lowMem = false;
4663 ObjectManager.lowMem = false;
4664 ObjectDefinition.lowMem = false;
4665 break;
4666
4667 case "MEDIUM":
4668 Landscape.lowMem = false;
4669 lowMem = true; //Low mem and ObjectManager.lowMem both have to be the same. Or else
4670 //when i go up and down stairs, the floor will be invis.
4671 ObjectManager.lowMem = true;
4672 ObjectDefinition.lowMem = false;
4673 break;
4674
4675 case "LOW":
4676 Landscape.lowMem = true;
4677 lowMem = true;
4678 ObjectManager.lowMem = true;
4679 ObjectDefinition.lowMem = true;
4680 break;
4681 }
4682 }
4683
4684 private void loadingStages() {
4685 if (getLoadingStage() == 2) {
4686 blackScreenSaved = false;
4687
4688 if (System.currentTimeMillis() - timeReceivedPacket >= 14000 && !isDisconnected()) {
4689 Utility.print("Kicked9: Logged out due to 14 seconds since last packet received.");
4690 logOutUpdate();
4691 }
4692
4693 }
4694 if (getLoadingStage() != 2 && System.currentTimeMillis() - timeDisconnected > 20000) {
4695 if (!blackScreenSaved) {
4696 timeBlackScreen = System.currentTimeMillis();
4697 blackScreenSaved = true;
4698 }
4699 else {
4700 if (System.currentTimeMillis() - timeBlackScreen >= 7000) {
4701 Utility.print("Kicked4: 7 seconds since black screen");
4702 Client.instance.sendCommandPacket("::forcelogout");
4703 logOutUpdate();
4704 }
4705 }
4706 }
4707 if (lowMem && getLoadingStage() == 2 && ObjectManager.buildPlane != plane) {
4708 inGameScreen.initDrawingArea();
4709 Content.loadingPleaseWait();
4710 inGameScreen.drawGraphics(isFixedScreen() ? 4 : 0, super.graphics, isFixedScreen() ? 4 : 0);
4711 setLoadingStage(1);
4712 aLong824 = System.currentTimeMillis();
4713 }
4714 if (getLoadingStage() == 1) {
4715 int j = handleSceneState();
4716 if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
4717 SignLink.reporterror(myUsername + " glcfb " + serverSeed + "," + j + "," + lowMem + "," + decompressors[0] + "," + onDemandFetcher.getNodeCount() + "," + plane + "," + regionX + "," + regionY);
4718 aLong824 = System.currentTimeMillis();
4719 }
4720 }
4721 if (getLoadingStage() == 2 && plane != lastPlane) {
4722 lastPlane = plane;
4723 createLandImage(plane);
4724 }
4725 }
4726
4727 private int handleSceneState() {
4728 if (!floorData.equals("") || !ObjectData.equals("")) {
4729 floorData = "";
4730 ObjectData = "";
4731 }
4732 for (int i = 0; i < objectScapeData.length; i++) {
4733
4734 floorData += " " + objectScapeUIDs[i];
4735 ObjectData += " " + landScapeUIDs[i];
4736
4737 if (ClientDebugConfiguration.DEBUG_MODE) {
4738
4739 boolean skip = false;
4740 for (int index = 0; index < KeyBoardAction.test.size(); index++) {
4741 if (KeyBoardAction.test.get(index).equals(objectScapeUIDs[i] + "")) {
4742 skip = true;
4743 break;
4744 }
4745 }
4746 if (!skip) {
4747 KeyBoardAction.test.add(objectScapeUIDs[i] + "");
4748 }
4749 skip = false;
4750 for (int index = 0; index < KeyBoardAction.test.size(); index++) {
4751 if (KeyBoardAction.test.get(index).equals(landScapeUIDs[i] + "")) {
4752 skip = true;
4753 break;
4754 }
4755 }
4756 if (!skip) {
4757 KeyBoardAction.test.add(landScapeUIDs[i] + "");
4758 }
4759
4760 }
4761
4762 if (objectScapeData[i] == null && objectScapeUIDs[i] != -1) {
4763 return -1;
4764 }
4765 if (landScapeData[i] == null && landScapeUIDs[i] != -1) {
4766 return -2;
4767 }
4768 }
4769 boolean flag = true;
4770 for (int j = 0; j < objectScapeData.length; j++) {
4771 byte abyte0[] = landScapeData[j];
4772 if (abyte0 != null) {
4773 int k = (chunkUIDs[j] >> 8) * 64 - baseX;
4774 int l = (chunkUIDs[j] & 0xff) * 64 - baseY;
4775 if (loadingReceivedMap) {
4776 k = 10;
4777 l = 10;
4778 }
4779 flag &= ObjectManager.allObjectsLoaded(k, abyte0, l);
4780 }
4781 }
4782 if (!flag) {
4783 return -3;
4784 }
4785 if (sceneIsLoading) {
4786 return -4;
4787 }
4788 else {
4789 setLoadingStage(2);
4790 ObjectManager.buildPlane = plane;
4791 loadScene();
4792 stream.createFrame(121);
4793 return 0;
4794 }
4795 }
4796
4797 private void drawProjectiles() {
4798 for (SceneProjectile class30_sub2_sub4_sub4 = (SceneProjectile) projectiles.reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (SceneProjectile) projectiles.reverseGetNext())
4799 if (class30_sub2_sub4_sub4.plane != plane || loopCycle > class30_sub2_sub4_sub4.endCycle) {
4800 class30_sub2_sub4_sub4.unlink();
4801 }
4802 else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
4803 if (class30_sub2_sub4_sub4.target > 0) {
4804 Npc npc = npcArray[class30_sub2_sub4_sub4.target - 1];
4805 if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312) {
4806 class30_sub2_sub4_sub4.update(loopCycle, npc.y, getLand(class30_sub2_sub4_sub4.plane, npc.y, npc.x) - class30_sub2_sub4_sub4.anInt1583, npc.x);
4807 }
4808 }
4809 if (class30_sub2_sub4_sub4.target < 0) {
4810 int j = -class30_sub2_sub4_sub4.target - 1;
4811 Player player;
4812 if (j == unknownInt10) {
4813 player = myPlayer;
4814 }
4815 else {
4816 player = playerArray[j];
4817 }
4818 if (player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312) {
4819 class30_sub2_sub4_sub4.update(loopCycle, player.y, getLand(class30_sub2_sub4_sub4.plane, player.y, player.x) - class30_sub2_sub4_sub4.anInt1583, player.x);
4820 }
4821 }
4822 class30_sub2_sub4_sub4.update(animCycle);
4823 landScape.add(plane, class30_sub2_sub4_sub4.yaw, (int) class30_sub2_sub4_sub4.startElevation, -1, (int) class30_sub2_sub4_sub4.startY, 60, (int) class30_sub2_sub4_sub4.startX, class30_sub2_sub4_sub4, false);
4824 }
4825
4826 }
4827
4828 public AppletContext getAppletContext() {
4829 if (SignLink.mainapp != null)
4830 return SignLink.mainapp.getAppletContext();
4831 else
4832 return super.getAppletContext();
4833 }
4834
4835 private void processOnDemandQueue() {
4836 do {
4837 OnDemandData onDemandData;
4838 do {
4839 onDemandData = onDemandFetcher.getNextNode();
4840 if (onDemandData == null) {
4841 return;
4842 }
4843
4844 if (onDemandData.dataType == 0) {
4845 Model.method460(onDemandData.buffer, onDemandData.ID);
4846 }
4847 if (onDemandData.dataType == 1) {
4848 if (Config.PRE_EOC) {
4849 Frames.loadPreEoc(onDemandData.ID, onDemandData.buffer);
4850 }
4851 else {
4852 Frames.loadOsrs(onDemandData.ID, onDemandData.buffer);
4853 if (ClientDebugConfiguration.DEBUG_MODE) {
4854 System.out.println("Loading osrs animation file: " + onDemandData.ID);
4855 }
4856 }
4857 }
4858
4859 if (onDemandData.dataType == 4) {
4860 Texture.decode(onDemandData.ID, onDemandData.buffer);
4861
4862 }
4863
4864 if (onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null) {
4865 Music.playMidi(onDemandData.buffer);
4866 }
4867 if (onDemandData.dataType == 3 && getLoadingStage() == 1) {
4868 for (int i = 0; i < objectScapeData.length; i++) {
4869 if (objectScapeUIDs[i] == onDemandData.ID) {
4870 objectScapeData[i] = onDemandData.buffer;
4871 if (onDemandData.buffer == null) {
4872 objectScapeUIDs[i] = -1;
4873 }
4874 break;
4875 }
4876 if (landScapeUIDs[i] != onDemandData.ID) {
4877 continue;
4878 }
4879 landScapeData[i] = onDemandData.buffer;
4880 if (onDemandData.buffer == null) {
4881 landScapeUIDs[i] = -1;
4882 }
4883 break;
4884 }
4885
4886 }
4887 }
4888 while (onDemandData.dataType != 93 || !onDemandFetcher.regionIsLoaded(onDemandData.ID));
4889 ObjectManager.evaluateObjects(new Stream(onDemandData.buffer), onDemandFetcher);
4890 }
4891 while (true);
4892 }
4893
4894 protected static void resetInterfaceSequence(int i) {
4895 try {
4896 RSInterface class9 = RSInterface.interfaceCache[i];
4897 if (class9 == null || class9.children == null)
4898 return;
4899 for (int j = 0; j < class9.children.length; j++) {
4900 if (class9.children[j] == -1)
4901 break;
4902 RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
4903 if (class9_1 == null)
4904 continue;
4905 if (class9_1.getType() == 1)
4906 resetInterfaceSequence(class9_1.id);
4907 class9_1.sequenceFrame = 0;
4908 class9_1.sequenceCycle = 0;
4909 }
4910 }
4911 catch (Exception e) {
4912 e.printStackTrace();
4913 }
4914 }
4915
4916 private void drawHeadIcon() {
4917 if (markType != 2) {
4918 return;
4919 }
4920 calcEntityScreenPos((markedX - baseX << 7) + anInt937, anInt936 * 2, (markedY - baseY << 7) + anInt938, "");
4921 if (spriteDrawX > -1 && loopCycle % 20 < 10) {
4922 headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
4923 }
4924 }
4925
4926 public static ArrayList<String> gambleFirst9Items = new ArrayList<String>();
4927
4928 public static ArrayList<String> gambleItems = new ArrayList<String>();
4929
4930 public static int gambleX;
4931
4932 public static boolean enableGamble;
4933
4934 public static int gambleSpeed = 1;
4935
4936 public static String gambleXAmountWon = "";
4937
4938 /**
4939 * 2511 is minimum travel
4940 * 2562 is maximum travel
4941 * 2537 is centered
4942 */
4943 public static int gambleTravelledTotal;
4944
4945 public static int randomSpeedDividerGamble;
4946
4947 public static int gambleRandomX;
4948
4949 public static int gambleOffset;
4950
4951 public static int gambleOffsetOther;
4952 //------------------------
4953
4954 public static int mysteryBoxWinningItemId;
4955
4956 public static int mysteryBoxWinningItemOffset;
4957 //-----------------------
4958
4959 public static ArrayList<String> mysteryBoxFirst9Items = new ArrayList<String>();
4960
4961 public static ArrayList<String> mysteryBoxItems = new ArrayList<String>();
4962
4963 public static int mysteryBoxX;
4964
4965 public static boolean enableMysteryBox;
4966
4967 public static int mysteryBoxSpeed = 1;
4968
4969 /**
4970 * 2511 is minimum travel
4971 * 2562 is maximum travel
4972 * 2537 is centered
4973 */
4974 public static int mysteryBoxTravelledTotal;
4975
4976 public static int randomSpeedDividerMysteryBox;
4977
4978 public static int mysteryBoxRandomX;
4979
4980 public static int mysteryBoxOffset;
4981
4982 public static int mysteryBoxOffsetOther;
4983
4984 private static int loadingBarColourHex;
4985
4986 public final static int MYSTERY_BOX_SHIFT_X = 483;
4987
4988 public final static int MYSTERY_BOX_SHIFT_X_TRIGGER = -30;
4989
4990 public final static int MYSTERY_BOX_LEFT_CROP = 30;
4991
4992 public final static int MYSTERY_BOX_RIGHT_CROP = 28;
4993
4994 private void mainGameProcessor() {
4995 if (systemUpdateCycle > 1) {
4996 systemUpdateCycle--;
4997 }
4998 if (logoutCycle > 0) {
4999 logoutCycle--;
5000 }
5001 for (int j = 0; j < 5; j++) {
5002 if (!Packet.parsePacket()) {
5003 break;
5004 }
5005 }
5006 if (!isLoggedIn()) {
5007 return;
5008 }
5009 if (super.getClickMode3() != 0) {
5010 long l = (super.aLong29 - lastClickTime) / 50L;
5011 if (l > 4095L)
5012 l = 4095L;
5013 lastClickTime = super.aLong29;
5014 int k2 = super.saveClickY;
5015 if (k2 < 0) {
5016 k2 = 0;
5017 }
5018 else if (k2 > 502) {
5019 k2 = 502;
5020 }
5021 int k3 = super.saveClickX;
5022 if (k3 < 0) {
5023 k3 = 0;
5024 }
5025 else if (k3 > 764) {
5026 k3 = 764;
5027 }
5028 int k4 = k2 * 765 + k3;
5029 int j5 = 0;
5030 if (super.getClickMode3() == 2)
5031 j5 = 1;
5032 int l5 = (int) l;
5033 stream.createFrame(241);
5034 stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
5035 }
5036 if (sendCameraInfoCycle > 0) {
5037 sendCameraInfoCycle--;
5038 }
5039 if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1) {
5040 cameraSendingInfo = true;
5041 }
5042 if (cameraSendingInfo && sendCameraInfoCycle <= 0) {
5043 sendCameraInfoCycle = 20;
5044 cameraSendingInfo = false;
5045 stream.createFrame(86);
5046 stream.writeWord(chaseCameraPitch);
5047 stream.method432(viewRotation);
5048 }
5049 if (super.awtFocus && !isFocused) {
5050 isFocused = true;
5051 stream.createFrame(3);
5052 stream.writeWordBigEndian(1);
5053 }
5054 if (!super.awtFocus && isFocused) {
5055 isFocused = false;
5056 stream.createFrame(3);
5057 stream.writeWordBigEndian(0);
5058 }
5059 RSInterface.TextCountDown.handleTextCountDownReduction(Client.getInterfaceDisplayed());
5060 RSInterface.reloadInterfaces(false);
5061 ItemDefinition.reloadItems();
5062 Content.noClip();
5063 loadingStages();
5064 handleObjects();
5065 Music.soundSystem();
5066 netIdleCycles++;
5067 if (isDisconnected() && System.currentTimeMillis() - timeDroppedClient > 4000) {
5068 dropClient("time dropped client more than 4 seconds");
5069 }
5070 UpdateEntity.handlePlayers();
5071 Entity.handleNPCs(this);
5072 handleSpoken();
5073 Content.autoType();
5074 animCycle++;
5075 if (crossType != 0) {
5076 crossIndex += 20;
5077 if (crossIndex >= 400) {
5078 crossType = 0;
5079 }
5080 }
5081 if (atInventoryInterfaceType != 0) {
5082 atInventoryLoopCycle++;
5083 if (atInventoryLoopCycle >= 15) {
5084 if (atInventoryInterfaceType == 3) {
5085 setUpdateChatAreaPending(true);
5086 }
5087 atInventoryInterfaceType = 0;
5088 }
5089 }
5090 if (activeInterfaceType != 0) {
5091 dragCycle++;
5092 if (super.mouseX > pressX + 5 || super.mouseX < pressX - 5 || super.mouseY > pressY + 5 || super.mouseY < pressY - 5) {
5093 isDragging = true;
5094 }
5095 if (super.clickMode2 == 0) {
5096 if (activeInterfaceType == 3) {
5097 setUpdateChatAreaPending(true);
5098 }
5099 activeInterfaceType = 0;
5100 if (isDragging && dragCycle >= draggingSensitivity) // increase for more Click sensitivity, this has to be matched with the dragCycle variable.
5101 {
5102 lastActiveInvInterface = -1;
5103 processRightClick();
5104 // TODO #FULLSCREEN ADJUST interfaces, bank dragging into another tab.
5105 int x = isFixedScreen() ? 0 : (Client.getClientWidth() / 2) - 256;
5106 int y = isFixedScreen() ? 0 : (Client.getClientHeight() / 2) - 271;
5107 if ((focusedDragWidget == 5382 || focusedDragWidget >= 35001 && focusedDragWidget <= 35008) && super.mouseY >= 40 + y && super.mouseY <= 77 + y) { // check if bank interface
5108 if (super.mouseX >= 28 + x && super.mouseX <= 74 + x) { // tab 1
5109 stream.createFrame(213);
5110 stream.method433(focusedDragWidget);
5111 stream.method433(22024);
5112 stream.method424(0);
5113 stream.method433(dragFromSlot);
5114 stream.method431(mouseInvInterfaceIndex);
5115 }
5116 if (super.mouseX >= 75 + x && super.mouseX <= 121 + x) { // tab 1
5117 stream.createFrame(214);
5118 stream.method433(13); // tab # x 13 (originally movewindow)
5119 stream.method424(0);
5120 stream.method433(dragFromSlot); // Selected item slot
5121 stream.method431(mouseInvInterfaceIndex); // unused
5122 }
5123 if (super.mouseX >= 122 + x && super.mouseX <= 168 + x) { // tab 2
5124 stream.createFrame(214);
5125 stream.method433(26); // tab # x 13 (originally movewindow)
5126 stream.method424(0);
5127 stream.method433(dragFromSlot); // Selected item slot
5128 stream.method431(mouseInvInterfaceIndex); // unused
5129 }
5130 if (super.mouseX >= 169 + x && super.mouseX <= 215 + x) { // tab 3
5131 stream.createFrame(214);
5132 stream.method433(39); // tab # x 13 (originally movewindow)
5133 stream.method424(0);
5134 stream.method433(dragFromSlot); // Selected item slot
5135 stream.method431(mouseInvInterfaceIndex); // unused
5136 }
5137 if (super.mouseX >= 216 + x && super.mouseX <= 262 + x) { // tab 4
5138 stream.createFrame(214);
5139 stream.method433(52); // tab # x 13 (originally movewindow)
5140 stream.method424(0);
5141 stream.method433(dragFromSlot); // Selected item slot
5142 stream.method431(mouseInvInterfaceIndex); // unused
5143 }
5144 if (super.mouseX >= 263 + x && super.mouseX <= 309 + x) { // tab 5
5145 stream.createFrame(214);
5146 stream.method433(65); // tab # x 13 (originally movewindow)
5147 stream.method424(0);
5148 stream.method433(dragFromSlot); // Selected item slot
5149 stream.method431(mouseInvInterfaceIndex); // unused
5150 }
5151 if (super.mouseX >= 310 + x && super.mouseX <= 356 + x) { // tab 6
5152 stream.createFrame(214);
5153 stream.method433(78); // tab # x 13 (originally movewindow)
5154 stream.method424(0);
5155 stream.method433(dragFromSlot); // Selected item slot
5156 stream.method431(mouseInvInterfaceIndex); // unused
5157 }
5158 if (super.mouseX >= 357 + x && super.mouseX <= 403 + x) { // tab 7
5159 stream.createFrame(214);
5160 stream.method433(91); // tab # x 13 (originally movewindow)
5161 stream.method424(0);
5162 stream.method433(dragFromSlot); // Selected item slot
5163 stream.method431(mouseInvInterfaceIndex); // unused
5164 }
5165 if (super.mouseX + x >= 404 && super.mouseX <= 450 + x) { // tab 8
5166 stream.createFrame(214);
5167 stream.method433(104); // tab # x 13 (originally movewindow)
5168 stream.method424(0);
5169 stream.method433(dragFromSlot); // Selected item slot
5170 stream.method431(mouseInvInterfaceIndex); // unused
5171 }
5172 }
5173 if (lastActiveInvInterface == focusedDragWidget && mouseInvInterfaceIndex != dragFromSlot) {
5174 RSInterface class9 = RSInterface.interfaceCache[focusedDragWidget];
5175 int j1 = 0;
5176 if (anInt913 == 1 && class9.actionType == 206) {
5177 j1 = 1;
5178 }
5179 if (class9.inv[mouseInvInterfaceIndex] <= 0) {
5180 j1 = 0;
5181 }
5182 if (class9.itemsAreSwappable) {
5183 int l2 = dragFromSlot;
5184 int l3 = mouseInvInterfaceIndex;
5185 class9.inv[l3] = class9.inv[l2];
5186 class9.invStackSizes[l3] = class9.invStackSizes[l2];
5187 class9.inv[l2] = -1;
5188 class9.invStackSizes[l2] = 0;
5189 }
5190 else if (j1 == 1) {
5191 int i3 = dragFromSlot;
5192 for (int i4 = mouseInvInterfaceIndex; i3 != i4;)
5193
5194 {
5195 if (i3 > i4) {
5196 class9.swapInventoryItems(i3, i3 - 1);
5197 i3--;
5198 }
5199 else if (i3 < i4) {
5200 class9.swapInventoryItems(i3, i3 + 1);
5201 i3++;
5202 }
5203 }
5204
5205 }
5206 else {
5207 class9.swapInventoryItems(dragFromSlot, mouseInvInterfaceIndex);
5208 }
5209 stream.createFrame(214);
5210 stream.method433(focusedDragWidget);
5211 stream.method424(j1);
5212 stream.method433(dragFromSlot);
5213 stream.method431(mouseInvInterfaceIndex);
5214 } else if (lastActiveInvInterface != -1 && lastActiveInvInterface != focusedDragWidget) {
5215 RSInterface class9 = RSInterface.interfaceCache[focusedDragWidget];
5216
5217 int j1 = 0;
5218 if (anInt913 == 1 && class9.actionType == 206) {
5219 j1 = 1;
5220 }
5221 stream.createFrame(213);
5222 stream.method433(focusedDragWidget);
5223 stream.method433(lastActiveInvInterface);
5224 stream.method424(j1);
5225 stream.method433(dragFromSlot);
5226 stream.method431(mouseInvInterfaceIndex);
5227 }
5228 }
5229 else if ((useOneMouseButton == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
5230 determineMenuSize();
5231 }
5232 else if (menuActionRow > 0) {
5233 Action.doAction(menuActionRow - 1);
5234 }
5235 atInventoryLoopCycle = 10;
5236 super.setClickMode3(0);
5237 }
5238 }
5239 if (Landscape.clickLocalX != -1) {
5240 int x = Landscape.clickLocalX;
5241 int y = Landscape.clickLocalY;
5242
5243 int xPlayer = Client.instance.baseX + (Client.myPlayer.x - 6 >> 7);
5244 int yPlayer = Client.instance.baseY + (Client.myPlayer.y - 6 >> 7);
5245 if (yPlayer >= 3921 && yPlayer <= 3946 && xPlayer >= 3093 && xPlayer <= 3117) {
5246 // Mage arena area.
5247 }
5248 else {
5249 if (useSavedCoordinates) {
5250 x = saveRightClickX;
5251 y = saveRightClickY;
5252 useSavedCoordinates = false;
5253 }
5254 }
5255 boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, y, myPlayer.smallX[0], true, x);
5256 Landscape.clickLocalX = -1;
5257 if (flag) {
5258 crossX = super.saveClickX;
5259 crossY = super.saveClickY;
5260 crossType = 1;
5261 crossIndex = 0;
5262 }
5263 }
5264 if (super.getClickMode3() == 1 && notifyMessage != null) {
5265 notifyMessage = null;
5266 setUpdateChatAreaPending(true);
5267 super.setClickMode3(0);
5268 }
5269 if (!processMenuClick()) {
5270 MiniMap.clickOnMiniMap();
5271 InventoryTab.processTabClick(this);
5272 ChatArea.channelButtonApplyHoverOld(this);
5273 ChatArea.channelButtonApplyHoverNew(this);
5274 }
5275 if (super.clickMode2 == 1 || super.getClickMode3() == 1) {
5276 clickCycle++;
5277 }
5278 if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
5279 if (menuHoveredTimer < 50 && !menuOpen) {
5280 menuHoveredTimer++;
5281 if (menuHoveredTimer == 50) {
5282 if (anInt1500 != 0) {
5283 setUpdateChatAreaPending(true);
5284 }
5285 }
5286 }
5287 }
5288 else if (menuHoveredTimer > 0) {
5289 menuHoveredTimer--;
5290 }
5291 if (getLoadingStage() == 2) {
5292 handleCamera();
5293 }
5294 if (getLoadingStage() == 2 && inCutsceneMode) {
5295 calcCameraPos();
5296 }
5297 for (int i1 = 0; i1 < 5; i1++) {
5298 cameraEffectCycles[i1]++;
5299 }
5300
5301 KeyBoardAction.handleKeyboard();
5302 super.idleTime++;
5303 if (super.idleTime > 4500) {
5304 logoutCycle = 250;
5305 super.idleTime -= 500;
5306 stream.createFrame(202);
5307 }
5308 heartbeatCycle++;
5309 if (heartbeatCycle > 50) {
5310 stream.createFrame(0);
5311 }
5312 try {
5313 if (socketStream != null && stream.currentOffset > 0) {
5314 socketStream.queueBytes(stream.currentOffset, stream.buffer);
5315 stream.currentOffset = 0;
5316 heartbeatCycle = 0;
5317 }
5318 }
5319 catch (IOException e) {
5320 if (ClientDebugConfiguration.PRINT_ALL_EXCEPTION) {
5321 e.printStackTrace();
5322 }
5323 dropClient("main game processor IOException");
5324 }
5325 catch (Exception e) {
5326 e.printStackTrace();
5327 Utility.print("Kicked5 due to Exception: " + getLoadingStage());
5328 logOutUpdate();
5329 }
5330 }
5331
5332 private void handleSpawnedObjects() {
5333 TemporaryObject class30_sub1 = (TemporaryObject) objects.reverseGetFirst();
5334 for (; class30_sub1 != null; class30_sub1 = (TemporaryObject) objects.reverseGetNext())
5335 if (class30_sub1.cycle == -1) {
5336 class30_sub1.spawnCycle = 0;
5337 handleTemporaryObjects(class30_sub1);
5338 }
5339 else {
5340 class30_sub1.unlink();
5341 }
5342
5343 }
5344
5345 public void resetImageProducers() {
5346 if (aRSImageProducer_1107 != null) {
5347 return;
5348 }
5349 super.fullGameScreen = null;
5350 chatBackImage = null;
5351 mapBackImage = null;
5352 inventoryBackImage = null;
5353 inGameScreen = null;
5354 aRSImageProducer_1107 = constructGraphicsBuffer(509, 171, getGameComponent());
5355 DrawingArea.setAllPixelsToZero();
5356 aRSImageProducer_1109 = constructGraphicsBuffer(getClientWidth(), getClientHeight(), getGameComponent());
5357 DrawingArea.setAllPixelsToZero();
5358 if (titleStreamLoader != null) {
5359 loadTitleScreen();
5360 }
5361 welcomeScreenRaised = true;
5362 }
5363
5364 public void drawLoadingText(int i, String s) {
5365 if (interfacesReloaded) {
5366 return;
5367 }
5368 anInt1079 = i;
5369 aString1049 = s;
5370 resetImageProducers();
5371 if (titleStreamLoader == null) {
5372 super.drawLoadingText(i, s);
5373 return;
5374 }
5375 aRSImageProducer_1109.initDrawingArea();
5376 char c = '\u0168';
5377 char c1 = '\310';
5378 byte byte1 = 20;
5379 aRSImageProducer_1109.drawGraphics(getClientWidth(), super.graphics, getClientHeight());
5380
5381 if (Config.ECO) {
5382 PreEocScreen.drawLoadingScreen(i, s);
5383 } else {
5384 backgroundSprite[Config.currentServer].drawSprite(0, 0);
5385
5386 int j1 = 480; // Loading bars position
5387 DrawingArea.fillPixels(-1, 767, 32, 0, j1);
5388 DrawingArea.fillPixels(-1, 767, 34, 0, j1);
5389 int color = Client.loadingBarColourHex;
5390 int color2 = 0;
5391
5392 while (color2 <= 30) {
5393 DrawingArea.drawPixels(30 - color2, j1 + -1, 0, color, 767); // Loading
5394 // bar.
5395 color += 65536 * 2;
5396 color2 += 1;
5397 }
5398 DrawingArea.drawPixels(30, j1 + -1, 0 + i, 0, 767);
5399 chatTextDrawingArea.drawText(0xFFFFFF, s, c1 / 2 + 415 - byte1, c + 30);
5400 }
5401 aRSImageProducer_1109.drawGraphics(0, super.graphics, 0);
5402 welcomeScreenRaised = false;
5403 }
5404
5405 private void handleScrollbarMouse(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag, int j1) {
5406 if (scrollUp) {
5407 class9.scrollPosition = 0;
5408 scrollUp = false;
5409 return;
5410 }
5411 int anInt992;
5412 if (aBoolean972) {
5413 anInt992 = 32;
5414 }
5415 else {
5416 anInt992 = 0;
5417 }
5418 aBoolean972 = false;
5419 if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
5420 class9.scrollPosition -= clickCycle * 4;
5421 }
5422 else if (k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
5423 class9.scrollPosition += clickCycle * 4;
5424 }
5425 else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < (i1 + j) - 16 && clickCycle > 0) {
5426 int l1 = ((j - 32) * j) / j1;
5427 if (l1 < 8) {
5428 l1 = 8;
5429 }
5430 int i2 = l - i1 - 16 - l1 / 2;
5431 int j2 = j - 32 - l1;
5432 class9.scrollPosition = ((j1 - j) * i2) / j2;
5433 aBoolean972 = true;
5434 }
5435 }
5436
5437 protected boolean interactWithObject(int i, int j, int k) {
5438 int i1 = i >> 14 & 0x7fff;
5439 int j1 = landScape.getArrangement(plane, k, j, i);
5440 if (j1 == -1) {
5441 return false;
5442 }
5443 int k1 = j1 & 0x1f;
5444 int l1 = j1 >> 6 & 3;
5445 if (k1 == 10 || k1 == 11 || k1 == 22) {
5446 ObjectDefinition class46 = ObjectDefinition.forId(i1);
5447 int i2;
5448 int j2;
5449 if (l1 == 0 || l1 == 2) {
5450 i2 = class46.sizeX;
5451 j2 = class46.sizeY;
5452 }
5453 else {
5454 i2 = class46.sizeY;
5455 j2 = class46.sizeX;
5456 }
5457 int k2 = class46.rotationFlags;
5458 if (l1 != 0) {
5459 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
5460 }
5461 doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
5462 }
5463 else {
5464 doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
5465 }
5466 crossX = super.saveClickX;
5467 crossY = super.saveClickY;
5468 crossType = 2;
5469 crossIndex = 0;
5470 return true;
5471 }
5472
5473 public StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k) {
5474 byte abyte0[] = null;
5475 int l = 5;
5476 try {
5477 if (decompressors[0] != null) {
5478 if (Config.PRE_EOC) {
5479 abyte0 = decompressors[0].get(i).array();
5480 }
5481 else {
5482 abyte0 = decompressors[0].decompressOsrs(i);
5483 }
5484 }
5485 }
5486 catch (Exception e) {
5487 e.printStackTrace();
5488 }
5489 if (abyte0 != null) {
5490 StreamLoader streamLoader = new StreamLoader(abyte0);
5491 return streamLoader;
5492 }
5493 int j1 = 0;
5494 while (abyte0 == null) {
5495 String s2 = "Unknown error";
5496 try {
5497 int k1 = 0;
5498 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
5499 byte abyte1[] = new byte[6];
5500 datainputstream.readFully(abyte1, 0, 6);
5501 Stream stream = new Stream(abyte1);
5502 stream.currentOffset = 3;
5503 int i2 = stream.read3Bytes() + 6;
5504 int j2 = 6;
5505 abyte0 = new byte[i2];
5506 System.arraycopy(abyte1, 0, abyte0, 0, 6);
5507
5508 while (j2 < i2) {
5509 int l2 = i2 - j2;
5510 if (l2 > 1000) {
5511 l2 = 1000;
5512 }
5513 int j3 = datainputstream.read(abyte0, j2, l2);
5514 if (j3 < 0) {
5515 s2 = "Length error: " + j2 + "/" + i2;
5516 throw new IOException("EOF");
5517 }
5518 j2 += j3;
5519 int k3 = (j2 * 100) / i2;
5520 if (k3 != k1) {
5521 drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
5522 }
5523 k1 = k3;
5524 }
5525 datainputstream.close();
5526 try {
5527 if (decompressors[0] != null) {
5528 if (Config.PRE_EOC) {
5529 decompressors[0].put(abyte0.length, java.nio.ByteBuffer.wrap(abyte0), i);
5530 }
5531 else {
5532 decompressors[0].method234Osrs(abyte0.length, abyte0, i);
5533 }
5534 }
5535 }
5536 catch (Exception e) {
5537 e.printStackTrace();
5538 decompressors[0] = null;
5539 }
5540 }
5541 catch (IOException exception) {
5542 if (s2.equals("Unknown error")) {
5543 s2 = "Please restart your client.";
5544 Content.scheduleCacheDelete();
5545 }
5546 abyte0 = null;
5547 exception.printStackTrace();
5548 }
5549 catch (NullPointerException e) {
5550 e.printStackTrace();
5551 s2 = "Null error";
5552 abyte0 = null;
5553 if (!SignLink.reporterror) {
5554 return null;
5555 }
5556 }
5557 catch (ArrayIndexOutOfBoundsException e) {
5558 e.printStackTrace();
5559 s2 = "Bounds error";
5560 abyte0 = null;
5561 if (!SignLink.reporterror) {
5562 return null;
5563 }
5564 }
5565 catch (Exception e) {
5566 e.printStackTrace();
5567 s2 = "Unexpected error";
5568 abyte0 = null;
5569 if (!SignLink.reporterror) {
5570 return null;
5571 }
5572 }
5573 if (abyte0 == null) {
5574 for (int l1 = l; l1 > 0; l1--) {
5575 if (j1 >= 3) {
5576 drawLoadingText(k, "Game updated - please reload page");
5577 l1 = 10;
5578 }
5579 else {
5580 drawLoadingText(k, s2 + "");
5581 }
5582 try {
5583 Thread.sleep(1000L);
5584 }
5585 catch (Exception e) {
5586 e.printStackTrace();
5587 }
5588 }
5589
5590 l *= 2;
5591 if (l > 60) {
5592 l = 60;
5593 }
5594 useJagGrab = !useJagGrab;
5595 }
5596
5597 }
5598
5599 StreamLoader streamLoader_1 = new StreamLoader(abyte0);
5600 return streamLoader_1;
5601 }
5602
5603 private boolean disconnected;
5604
5605 long timeDisconnected;
5606
5607 long timeDroppedClient;
5608
5609 private static boolean ignorePromptInputReset;
5610
5611 protected void dropClient(String reason) {
5612 Utility.print(reason + ", " + logoutCycle);
5613 if (logoutCycle > 0) {
5614 Utility.print("Kicked1 drop client: " + getLoadingStage() + ", " + logoutCycle + ", reason: " + reason);
5615 logOutUpdate();
5616 return;
5617 }
5618 timeDroppedClient = System.currentTimeMillis();
5619 if (!isDisconnected()) {
5620 timeDisconnected = System.currentTimeMillis();
5621 }
5622 setDisconnected(true);
5623 minimapState = 0;
5624 destX = 0;
5625 RSSocket rsSocket = socketStream;
5626 Content.connectionLostAlert();
5627 if (Client.canReconnect()) {
5628 login(myUsername, myPassword, true);
5629 }
5630 if (!isLoggedIn()) {
5631 Utility.print("Kicked2: " + getLoadingStage());
5632 logOutUpdate();
5633 }
5634 try {
5635 rsSocket.close();
5636 }
5637 catch (Exception e) {
5638 e.printStackTrace();
5639 }
5640
5641 if (isDisconnected() && System.currentTimeMillis() - timeDisconnected > (Client.canReconnect() ? 17000 : 6000)) {
5642 Utility.print("Kicked3: " + getLoadingStage() + ", " + (System.currentTimeMillis() - timeDisconnected));
5643 logOutUpdate();
5644 return;
5645 }
5646 }
5647
5648 public void sendCommandPacket(String data) {
5649 String previous = Client.instance.inputString;
5650 inputString = data;
5651 stream.createFrame(103);
5652 stream.writeWordBigEndian(this.inputString.length() - 1);
5653 stream.writeString(this.inputString.substring(2));
5654 Client.instance.inputString = previous;
5655 inputValue = -1;
5656 }
5657
5658 public static void setToFixed() {
5659 // Change resizable button to un-clicked.
5660 Client.instance.sendFrame36(200, 0);
5661 Client.displayMode = "FIXED";
5662 Client.setFixedScreen(true);
5663 Client.isFixedScreenSaved = true;
5664 Client.instance.welcomeScreenRaised = true;
5665 ClientFrame.rebuild(false);
5666 Client.setBounds();
5667 Client.CameraPos1 = 3;
5668 Settings.saveSettings();
5669 setInterfaceClicked(20200, 20203, true, true);
5670
5671 }
5672
5673 private void handleMessageState() {
5674 messagesAreIgnored = 0;
5675 int j = (myPlayer.x >> 7) + baseX;
5676 int k = (myPlayer.y >> 7) + baseY;
5677 if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136) {
5678 messagesAreIgnored = 1;
5679 }
5680 if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535) {
5681 messagesAreIgnored = 1;
5682 }
5683 if (messagesAreIgnored == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062) {
5684 messagesAreIgnored = 0;
5685 }
5686 }
5687
5688 public void run() {
5689 if (!drawFlames) {
5690 super.run();
5691 }
5692 }
5693
5694 private void build3dScreenMenu() {
5695 if (itemSelected == 0 && spellSelected == 0) {
5696 menuActionName[menuActionRow] = "Walk here";
5697 menuActionID[menuActionRow] = 516;
5698 menuActionCmd2[menuActionRow] = super.mouseX;
5699 menuActionCmd3[menuActionRow] = super.mouseY;
5700 menuActionRow++;
5701 }
5702 int j = -1;
5703 boolean drawInteractedPlayer = false;
5704
5705 // It loops through all visible models on the screen, from furthest to nearest.
5706 for (int k = 0; k < Model.anInt1687; k++) {
5707 int l = Model.anIntArray1688[k];
5708 int i1 = l & 0x7f;
5709 int j1 = l >> 7 & 0x7f;
5710 int k1 = l >> 29 & 3;
5711 int arrayIndex = l >> 14 & 0x7fff;
5712 if (l == j) {
5713 continue;
5714 }
5715 j = l;
5716 if (k1 == 2 && landScape.getArrangement(plane, i1, j1, l) >= 0) {
5717 ObjectDefinition object = ObjectDefinition.forId(arrayIndex);
5718 if (object.childrenIDs != null) {
5719 object = object.getOverride();
5720 }
5721 if (object == null) {
5722 continue;
5723 }
5724 if (itemSelected == 1) {
5725 menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + object.name;
5726 menuActionID[menuActionRow] = 62;
5727 menuActionCmd1[menuActionRow] = l;
5728 menuActionCmd2[menuActionRow] = i1;
5729 menuActionCmd3[menuActionRow] = j1;
5730 menuActionRow++;
5731 }
5732 else if (spellSelected == 1) {
5733 if ((spellUsableOn & 4) == 4) {
5734 menuActionName[menuActionRow] = spellTooltip + " @cya@" + object.name;
5735 menuActionID[menuActionRow] = 956;
5736 menuActionCmd1[menuActionRow] = l;
5737 menuActionCmd2[menuActionRow] = i1;
5738 menuActionCmd3[menuActionRow] = j1;
5739 menuActionRow++;
5740 }
5741 }
5742 else {
5743 if (object.actions != null) {
5744 for (int i2 = 4; i2 >= 0; i2--) {
5745 if (object.actions[i2] != null) {
5746 menuActionName[menuActionRow] = object.actions[i2] + " @cya@" + object.name;
5747 if (i2 == 0) {
5748 menuActionID[menuActionRow] = 502;
5749 }
5750 if (i2 == 1) {
5751 menuActionID[menuActionRow] = 900;
5752 }
5753 if (i2 == 2) {
5754 menuActionID[menuActionRow] = 113;
5755 }
5756 if (i2 == 3) {
5757 menuActionID[menuActionRow] = 872;
5758 }
5759 if (i2 == 4) {
5760 menuActionID[menuActionRow] = 1062;
5761 }
5762 menuActionCmd1[menuActionRow] = l;
5763 menuActionCmd2[menuActionRow] = i1;
5764 menuActionCmd3[menuActionRow] = j1;
5765 menuActionRow++;
5766 }
5767 }
5768
5769 }
5770 if (myUsername.equalsIgnoreCase("pichu")
5771 || myUsername.equalsIgnoreCase("Fezo")
5772 || myUsername.equalsIgnoreCase("Michael")) {
5773 menuActionName[menuActionRow] = "Examine @cya@" + object.name
5774 + "@whi@ (" + object.type + ")";
5775 }
5776
5777 else {
5778 menuActionName[menuActionRow] = "Examine @cya@" + object.name;
5779 }
5780 menuActionID[menuActionRow] = 1226;
5781 menuActionCmd1[menuActionRow] = object.type << 14;
5782 menuActionCmd2[menuActionRow] = i1;
5783 menuActionCmd3[menuActionRow] = j1;
5784 menuActionRow++;
5785 }
5786 }
5787 if (k1 == 1) {
5788 Npc npc = npcArray[arrayIndex];
5789 if (npc.desc.size == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
5790 for (int index = 0; index < npcCount; index++) {
5791 Npc npc2 = npcArray[npcIndices[index]];
5792 if (npc2 != null && npc2 != npc && npc2.desc.size == 1 && npc2.x == npc.x && npc2.y == npc.y) {
5793 buildAtNPCMenu(npc2.desc, npcIndices[index], j1, i1, index);
5794 }
5795 }
5796
5797 for (int l2 = 0; l2 < playerCount; l2++) {
5798 Player player = playerArray[playerIndices[l2]];
5799 if (player != null && player.x == npc.x && player.y == npc.y) {
5800 buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
5801 }
5802 }
5803
5804 }
5805 buildAtNPCMenu(npc.desc, arrayIndex, j1, i1, arrayIndex);
5806 }
5807 if (k1 == 0) {
5808 Player playerOnTop = playerArray[arrayIndex]; // The player ontop.
5809 Player interactingPlayer = playerArray[getInteractingWithEntityId()];
5810 if ((playerOnTop.x & 0x7f) == 64 && (playerOnTop.y & 0x7f) == 64) {
5811 for (int k2 = 0; k2 < npcCount; k2++) {
5812 Npc npc = npcArray[npcIndices[k2]];
5813 try {
5814 if (npc != null && npc.desc.size == 1 && npc.x == playerOnTop.x && npc.y == playerOnTop.y) {
5815 buildAtNPCMenu(npc.desc, npcIndices[k2], j1, i1, arrayIndex);
5816 }
5817 }
5818 catch (Exception e) {
5819 e.printStackTrace();
5820 }
5821 }
5822
5823 for (int i3 = 0; i3 < playerCount; i3++) {
5824 Player loop = playerArray[playerIndices[i3]];
5825 if (loop != null && loop != playerOnTop && loop.x == playerOnTop.x && loop.y == playerOnTop.y) {
5826 buildAtPlayerMenu(i1, playerIndices[i3], loop, j1);
5827 }
5828 }
5829
5830 }
5831 // These two is called on players.
5832 if (interactingPlayer != null) {
5833 if (!interactingPlayer.getName().equals(playerOnTop.getName())) {
5834 buildAtPlayerMenu(i1, arrayIndex, playerOnTop, j1); // Only called for the person that is ontop of my mouse.
5835 }
5836 else {
5837 drawInteractedPlayer = true;
5838 }
5839 }
5840 else {
5841 buildAtPlayerMenu(i1, arrayIndex, playerOnTop, j1); // Only called for the person that is ontop of my mouse.
5842 }
5843
5844 }
5845 if (k1 == 3) {
5846 NodeList class19 = groundArray[plane][i1][j1];
5847 if (class19 != null) {
5848 for (Node next = class19.getFirst(); next != null; next = class19.getNext()) {
5849 Item item = (Item) next;
5850 ItemDefinition itemDef = ItemDefinition.forId(item.itemId);
5851 if (menuActionRow > menuActionName.length - 1) {
5852 continue;
5853 }
5854 if (itemSelected == 1) {
5855 menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
5856 menuActionID[menuActionRow] = 511;
5857 menuActionCmd1[menuActionRow] = item.itemId;
5858 menuActionCmd2[menuActionRow] = i1;
5859 menuActionCmd3[menuActionRow] = j1;
5860 menuActionRow++;
5861 }
5862 else if (spellSelected == 1) {
5863 if ((spellUsableOn & 1) == 1) {
5864 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
5865 menuActionID[menuActionRow] = 94;
5866 menuActionCmd1[menuActionRow] = item.itemId;
5867 menuActionCmd2[menuActionRow] = i1;
5868 menuActionCmd3[menuActionRow] = j1;
5869 menuActionRow++;
5870 }
5871 }
5872 else {
5873 for (int j3 = 4; j3 >= 0; j3--)
5874 if (itemDef.groundOptions != null && itemDef.groundOptions[j3] != null) {
5875 menuActionName[menuActionRow] = itemDef.groundOptions[j3] + " @lre@" + itemDef.name;
5876 if (j3 == 0) {
5877 menuActionID[menuActionRow] = 652;
5878 }
5879 if (j3 == 1) {
5880 menuActionID[menuActionRow] = 567;
5881 }
5882 if (j3 == 2) {
5883 menuActionID[menuActionRow] = 234;
5884 }
5885 if (j3 == 3) {
5886 menuActionID[menuActionRow] = 244;
5887 }
5888 if (j3 == 4) {
5889 menuActionID[menuActionRow] = 213;
5890 }
5891 menuActionCmd1[menuActionRow] = item.itemId;
5892 menuActionCmd2[menuActionRow] = i1;
5893 menuActionCmd3[menuActionRow] = j1;
5894 menuActionCmd4[menuActionRow] = (int) item.amount;
5895 menuActionRow++;
5896 }
5897 else if (j3 == 2) {
5898 long price = ItemPrice.getNormalValue(item.itemId, item.amount);
5899 boolean moreThanOne = displayGroundItemAmount && item.amount > 1;
5900 String amount = moreThanOne ? " (x" + Utility.formatNumber(item.amount) + ")" : "";
5901 String colour = GroundItemsOverlay.getDropColour(price, false);
5902 menuActionName[menuActionRow] = "Take @lre@" + colour + itemDef.name + amount;
5903 menuActionID[menuActionRow] = 234;
5904 menuActionCmd1[menuActionRow] = item.itemId;
5905 menuActionCmd2[menuActionRow] = i1;
5906 menuActionCmd3[menuActionRow] = j1;
5907 menuActionCmd4[menuActionRow] = (int) item.amount;
5908
5909
5910 menuActionRow++;
5911 }
5912 long price = ItemPrice.getNormalValue(item.itemId, item.amount);
5913 String colour = GroundItemsOverlay.getDropColour(price, false);
5914 menuActionName[menuActionRow] = "Examine @lre@" + colour + itemDef.name;
5915 menuActionID[menuActionRow] = 1448;
5916 menuActionCmd1[menuActionRow] = item.itemId;
5917 menuActionCmd2[menuActionRow] = i1;
5918 menuActionCmd3[menuActionRow] = j1;
5919 menuActionRow++;
5920 }
5921 }
5922
5923 }
5924 }
5925 }
5926
5927 if (drawInteractedPlayer) {
5928 Player interactingPlayer = playerArray[getInteractingWithEntityId()];
5929 if (interactingPlayer != null) {
5930 buildAtPlayerMenu(0, getInteractingWithEntityId(), interactingPlayer, 0); // Only called for the person that is ontop of my mouse.
5931 }
5932 }
5933
5934 }
5935
5936 public void cleanUpForQuit() {
5937 SignLink.reporterror = false;
5938 try {
5939 if (socketStream != null) {
5940 socketStream.close();
5941 }
5942 }
5943 catch (Exception e) {
5944 e.printStackTrace();
5945 }
5946 socketStream = null;
5947 Music.stopMidi();
5948 onDemandFetcher.disable();
5949 onDemandFetcher = null;
5950 aStream_834 = null;
5951 stream = null;
5952 aStream_847 = null;
5953 inStream = null;
5954 chunkUIDs = null;
5955 objectScapeData = null;
5956 landScapeData = null;
5957 objectScapeUIDs = null;
5958 landScapeUIDs = null;
5959 intGroundArray = null;
5960 byteGroundArray = null;
5961 landScape = null;
5962 collisionMap = null;
5963 pathWaypoint = null;
5964 pathDistance = null;
5965 bigX = null;
5966 bigY = null;
5967 tmpTexture = null;
5968 inventoryBackImage = null;
5969 leftFrame = null;
5970 topFrame = null;
5971 rightFrame = null;
5972 mapBackImage = null;
5973 inGameScreen = null;
5974 chatBackImage = null;
5975 chatButtons = null;
5976 backgroundSprite = null;
5977 compass = null;
5978 hitMarks = null;
5979 headIcons = null;
5980 skullIcons = null;
5981 headIconsHint = null;
5982 crosses = null;
5983 mapDotItem = null;
5984 mapDotNpc = null;
5985 mapDotPlayer = null;
5986 mapDotFriend = null;
5987 mapDotTeam = null;
5988 mapScenes = null;
5989 mapFunctions = null;
5990 tileCycleMap = null;
5991 playerArray = null;
5992 playerIndices = null;
5993 entityIndices = null;
5994 aStreamArray895s = null;
5995 entityUpdateIndices = null;
5996 npcArray = null;
5997 npcIndices = null;
5998 groundArray = null;
5999 objects = null;
6000 projectiles = null;
6001 spotanims = null;
6002 menuActionCmd2 = null;
6003 menuActionCmd3 = null;
6004 menuActionCmd4 = null;
6005 menuActionID = null;
6006 menuActionCmd1 = null;
6007 menuActionName = null;
6008 variousSettings = null;
6009 objectIconX = null;
6010 objectIconY = null;
6011 objectIcon = null;
6012 landImage = null;
6013 friendsList = null;
6014 friendsListAsLongs = null;
6015 friendsNodeIds = null;
6016 aRSImageProducer_1107 = null;
6017 aRSImageProducer_1109 = null;
6018 multiOverlay = null;
6019 nullLoader();
6020 ObjectDefinition.nullLoader();
6021 EntityDefinition.nullLoader();
6022 ItemDefinition.nullLoader();
6023 FloorDefinition.underlays = null;
6024 FloorDefinition.overlays = null;
6025 IdentityKit.cache = null;
6026 RSInterface.interfaceCache = null;
6027 Sequences.anims = null;
6028 SpotAnim.cache = null;
6029 SpotAnim.models = null;
6030 Varp.cache = null;
6031 super.fullGameScreen = null;
6032 Player.mruNodes = null;
6033 Rasterizer.nullLoader();
6034 Landscape.nullLoader();
6035 Model.nullLoader();
6036 Frames.nullLoader();
6037 System.gc();
6038 }
6039
6040 public Component getGameComponent() {
6041 if (SignLink.mainapp != null)
6042 return SignLink.mainapp;
6043 if (super.gameFrame != null)
6044 return super.gameFrame;
6045 else
6046 return this;
6047 }
6048
6049 private void buildPublicChat(int j) {
6050 int l = 0;
6051 for (int i1 = 0; i1 < 500; i1++) {
6052 if (chatMessages[i1] == null)
6053 continue;
6054 if (chatTypeView != 1)
6055 continue;
6056 int chatType = chatTypes[i1];
6057 String s = chatNames[i1];
6058 String chatNameRaw = chatNamesRaw[i1];
6059 if (chatNameRaw == null) {
6060 chatNameRaw = "";
6061 }
6062 int k1 = (70 - l * 14 + 42) + chatScrollAmount + 4 + 5;
6063 if (k1 < -23)
6064 break;
6065 if (s != null && s.startsWith("@cr1@"))
6066 s = s.substring(5);
6067 if (s != null && s.startsWith("@cr2@"))
6068 s = s.substring(5);
6069 if (s != null && s.startsWith("@cr3@"))
6070 s = s.substring(5);
6071 if (s != null && s.startsWith("@don@"))
6072 s = s.substring(5);
6073
6074 s = s.replace("<col=0>", "<col=ffffff>");
6075 if ((chatType == ClientConstants.CHAT_TYPE_OTHER_PLAYERS || chatType == ClientConstants.CHAT_TYPE_MY_PLAYER) && (ClientConstants.isModeratorOrAbove(chatRights[i1]) || publicChatMode == ClientConstants.PUBLIC_ON || publicChatMode == ClientConstants.PUBLIC_FRIENDS && isFriendOrSelf(chatNameRaw))) {
6076 if (myPlayer.getName() != null && j > k1 - 14 && j <= k1 && !chatNameRaw.equals(myPlayer.getName())) {
6077 menuActionName[menuActionRow] = "Add ignore @whi@" + s;
6078 menuActionID[menuActionRow] = 42;
6079 menuActionRow++;
6080 menuActionName[menuActionRow] = "Add friend @whi@" + s;
6081 menuActionID[menuActionRow] = 337;
6082 menuActionRow++;
6083 hoveredName = chatNameRaw;
6084 }
6085 l++;
6086 }
6087 }
6088 }
6089
6090 private void buildDuelorTrade(int j) {
6091 int l = 0;
6092 for (int i1 = 0; i1 < 500; i1++) {
6093 if (chatMessages[i1] == null)
6094 continue;
6095 if (chatTypeView != 3 && chatTypeView != 4)
6096 continue;
6097 int chatType = chatTypes[i1];
6098 String s = chatNames[i1];
6099 int k1 = (70 - l * 14 + 42) + chatScrollAmount + 4 + 5;
6100 if (k1 < -23)
6101 break;
6102 if (s != null && s.startsWith("@cr1@"))
6103 s = s.substring(5);
6104 if (s != null && s.startsWith("@cr2@"))
6105 s = s.substring(5);
6106 if (s != null && s.startsWith("@cr3@"))
6107 s = s.substring(5);
6108 if (s != null && s.startsWith("@don@"))
6109 s = s.substring(5);
6110 String chatNameRaw = chatNamesRaw[i1];
6111 if (chatNameRaw == null) {
6112 chatNameRaw = "";
6113 }
6114 if (chatTypeView == ClientConstants.CHAT_TYPE_PRIVATE_MESSAGE_RECEIVED_NORMAL && chatType == ClientConstants.CHAT_TYPE_TRADE && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(chatNameRaw))) {
6115 if (j > k1 - 14 && j <= k1) {
6116 menuActionName[menuActionRow] = "Accept trade @whi@" + s;
6117 menuActionID[menuActionRow] = 484;
6118 menuActionRow++;
6119 }
6120 l++;
6121 }
6122 if (chatTypeView == ClientConstants.CHAT_TYPE_PRIVATE_MESSAGE_RECEIVED_NORMAL && chatType == ClientConstants.CHAT_TYPE_DUEL && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(chatNameRaw))) {
6123 if (j > k1 - 14 && j <= k1) {
6124 menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
6125 menuActionID[menuActionRow] = 6;
6126 menuActionRow++;
6127 }
6128 l++;
6129 }
6130 }
6131 }
6132
6133 static void buildClanChatChat(int j, Client client) {
6134 int l = 0;
6135 for (int i1 = 0; i1 < 500; i1++) {
6136 if (client.chatMessages[i1] == null)
6137 continue;
6138 int chatType = client.chatTypes[i1];
6139 String s = client.chatNames[i1];
6140 String chatNameRaw = client.chatNamesRaw[i1];
6141 if (chatNameRaw == null) {
6142 chatNameRaw = "";
6143 }
6144 int k1 = (70 - l * 14 + 42) + Client.chatScrollAmount + 4 + 5;
6145 if (k1 < -23)
6146 break;
6147 if (s != null && s.startsWith("@cr1@"))
6148 s = s.substring(5);
6149 if (s != null && s.startsWith("@cr2@"))
6150 s = s.substring(5);
6151 if (s != null && s.startsWith("@cr3@"))
6152 s = s.substring(5);
6153 if (s != null && s.startsWith("@don@"))
6154 s = s.substring(5);
6155
6156 if (chatType == ClientConstants.CHAT_TYPE_CLAN && (instance.publicChatMode == ClientConstants.PUBLIC_ON || instance.publicChatMode == ClientConstants.PUBLIC_FRIENDS && instance.isFriendOrSelf(chatNameRaw))) {
6157 if (myPlayer.getName() != null && j > k1 - 14 && j <= k1 && !chatNameRaw.equals(myPlayer.getName())) {
6158 client.menuActionName[client.menuActionRow] = "Add ignore @whi@" + s;
6159 client.menuActionID[client.menuActionRow] = 42;
6160 client.menuActionRow++;
6161 client.menuActionName[client.menuActionRow] = "Add friend @whi@" + s;
6162 client.menuActionID[client.menuActionRow] = 337;
6163 client.menuActionRow++;
6164 hoveredName = chatNameRaw;
6165 }
6166 l++;
6167 }
6168 }
6169 }
6170
6171 static void buildGameChat(int j, Client client) {
6172 int l = 0;
6173 for (int i1 = 0; i1 < 500; i1++) {
6174 if (client.chatMessages[i1] == null)
6175 continue;
6176 int chatType = client.chatTypes[i1];
6177 String s = client.chatNames[i1];
6178 String chatNameRaw = client.chatNamesRaw[i1];
6179 if (chatNameRaw == null) {
6180 chatNameRaw = "";
6181 }
6182 int k1 = (70 - l * 14 + 42) + Client.chatScrollAmount + 4 + 5;
6183 if (k1 < -23)
6184 break;
6185 if (s != null && s.startsWith("@cr1@"))
6186 s = s.substring(5);
6187 if (s != null && s.startsWith("@cr2@"))
6188 s = s.substring(5);
6189 if (s != null && s.startsWith("@cr3@"))
6190 s = s.substring(5);
6191 if (s != null && s.startsWith("@don@"))
6192 s = s.substring(5);
6193
6194 if (chatType == ClientConstants.CHAT_TYPE_GAME_MESSAGE) {
6195 l++;
6196 }
6197 if (chatType == ClientConstants.CHAT_TYPE_YELL && Client.yellMode == ClientConstants.YELL_MODE_ON || chatType == ClientConstants.CHAT_TYPE_YELL && Client.yellMode == ClientConstants.YELL_MODE_FRIENDS && Client.instance.isFriendOrSelf(chatNameRaw)) {
6198 if (myPlayer.getName() != null && j > k1 - 14 && j <= k1 && !chatNameRaw.equals(myPlayer.getName())) {
6199 client.menuActionName[client.menuActionRow] = "Add ignore @whi@" + s;
6200 client.menuActionID[client.menuActionRow] = 42;
6201 client.menuActionRow++;
6202 client.menuActionName[client.menuActionRow] = "Add friend @whi@" + s;
6203 client.menuActionID[client.menuActionRow] = 337;
6204 client.menuActionRow++;
6205 hoveredName = chatNameRaw;
6206 }
6207 l++;
6208 }
6209 }
6210 }
6211
6212 public static String hoveredName = "";
6213
6214 private void buildChatAreaMenu(int y) {
6215 int l = 0;
6216 for (int i1 = 0; i1 < 500; i1++) {
6217 if (chatMessages[i1] == null)
6218 continue;
6219 int chatType = chatTypes[i1];
6220 // Cannot change to 56 or it will be all bugged.
6221 int otherY = (70 - l * 14 + 42) + chatScrollAmount + 4 + 5;
6222 otherY -= 4;
6223 if (otherY < -23)
6224 break;
6225 String s = chatNames[i1];
6226 String chatNameRaw = chatNamesRaw[i1];
6227 if (chatNameRaw == null) {
6228 chatNameRaw = "";
6229 }
6230 if (chatTypeView == 1) {
6231 buildPublicChat(y);
6232 break;
6233 }
6234 if (chatTypeView == 2) {
6235 FriendSystem.buildFriendChat(y, this);
6236 break;
6237 }
6238 if (chatTypeView == 3 || chatTypeView == 4) {
6239 buildDuelorTrade(y);
6240 break;
6241 }
6242 if (chatTypeView == 5) {
6243 buildGameChat(y, this);
6244 break;
6245 }
6246 if (chatTypeView == 11) {
6247 buildClanChatChat(y, this);
6248 break;
6249 }
6250 if (s != null && s.startsWith("@cr1@")) {
6251 s = s.substring(5);
6252 }
6253 if (s != null && s.startsWith("@cr2@")) {
6254 s = s.substring(5);
6255 }
6256 if (s != null && s.startsWith("@cr3@")) {
6257 s = s.substring(5);
6258 }
6259 if (s != null && s.startsWith("@don@")) {
6260 s = s.substring(5);
6261 }
6262 s = s.replace("<col=0>", "<col=ebebeb>");
6263 if (chatType == ClientConstants.CHAT_TYPE_GAME_MESSAGE) {
6264 l++;
6265 }
6266 if (chatType == ClientConstants.CHAT_TYPE_YELL && Client.yellMode == ClientConstants.YELL_MODE_ON || chatType == ClientConstants.CHAT_TYPE_YELL && Client.yellMode == ClientConstants.YELL_MODE_FRIENDS && isFriendOrSelf(chatNameRaw) || (chatType == ClientConstants.CHAT_TYPE_OTHER_PLAYERS || chatType == ClientConstants.CHAT_TYPE_MY_PLAYER || chatType == ClientConstants.CHAT_TYPE_CLAN) && (ClientConstants.isModeratorOrAbove(chatRights[i1]) || publicChatMode == ClientConstants.PUBLIC_ON || publicChatMode == ClientConstants.PUBLIC_FRIENDS && isFriendOrSelf(chatNameRaw))) {
6267 if (myPlayer.getName() != null && y > otherY - 14 && y <= otherY && !chatNameRaw.equals(myPlayer.getName())) {
6268 String modified;
6269 modified = s.replaceAll("1e44ff", "5873fa");
6270 modified = s.replaceAll("c70000", "ca2f2f");
6271 modified = s.replaceAll("477847", "619261");
6272 menuActionName[menuActionRow] = "Add ignore @whi@" + modified;
6273 menuActionID[menuActionRow] = 42;
6274 menuActionRow++;
6275 menuActionName[menuActionRow] = "Add friend @whi@" + modified;
6276 menuActionID[menuActionRow] = 337;
6277 menuActionRow++;
6278 hoveredName = chatNameRaw;
6279 }
6280 l++;
6281 }
6282 if ((chatType == ClientConstants.CHAT_TYPE_PRIVATE_MESSAGE_RECEIVED_NORMAL || chatType == ClientConstants.CHAT_TYPE_PRIVATE_MESSAGE_RECEIVED_MOD) && splitPrivateChat == 0 && (chatType == ClientConstants.CHAT_TYPE_PRIVATE_MESSAGE_RECEIVED_MOD || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(chatNameRaw))) {
6283 if (y > otherY - 14 && y <= otherY) {
6284 menuActionName[menuActionRow] = "Add ignore @whi@" + s;
6285 menuActionID[menuActionRow] = 42;
6286 menuActionRow++;
6287 menuActionName[menuActionRow] = "Add friend @whi@" + s;
6288 menuActionID[menuActionRow] = 337;
6289 menuActionRow++;
6290 hoveredName = chatNameRaw;
6291 }
6292 l++;
6293 }
6294 if (chatType == ClientConstants.CHAT_TYPE_TRADE && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(chatNameRaw))) {
6295 if (y > otherY - 14 && y <= otherY) {
6296 menuActionName[menuActionRow] = "Accept trade @whi@" + s;
6297 menuActionID[menuActionRow] = 484;
6298 menuActionRow++;
6299 }
6300 l++;
6301 }
6302 if ((chatType == ClientConstants.CHAT_TYPE_PRIVATE_MESSAGE_LOGGED_IN_OR_OUT || chatType == ClientConstants.CHAT_TYPE_PRIVATE_MESSAGE_SENT) && privateChatMode < 2) {
6303 l++;
6304 }
6305 if (chatType == ClientConstants.CHAT_TYPE_DUEL && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(chatNameRaw))) {
6306 if (y > otherY - 14 && y <= otherY) {
6307 menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
6308 menuActionID[menuActionRow] = 6;
6309 menuActionRow++;
6310 }
6311 l++;
6312 }
6313 }
6314 }
6315
6316 private void drawFriendsListOrWelcomeScreen(RSInterface class9) {
6317 int j = class9.actionType;
6318
6319 if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
6320 if (j == 1 && friendserverState == 0) {
6321 class9.message = "Loading friend list";
6322 class9.atActionType = 0;
6323 return;
6324 }
6325 if (j == 1 && friendserverState == 1) {
6326 class9.message = "Connecting to friendserver";
6327 class9.atActionType = 0;
6328 return;
6329 }
6330 if (j == 2 && friendserverState != 2) {
6331 class9.message = "Please wait...";
6332 class9.atActionType = 0;
6333 return;
6334 }
6335 int k = friendsCount;
6336 if (friendserverState != 2) {
6337 k = 0;
6338 }
6339 if (j > 700) {
6340 j -= 601;
6341 }
6342 else {
6343 j--;
6344 }
6345 if (j >= k) {
6346 class9.message = "";
6347 class9.atActionType = 0;
6348 return;
6349 }
6350 else {
6351 class9.message = friendsList[j];
6352 class9.atActionType = 1;
6353 return;
6354 }
6355 }
6356 if (j == 901) {
6357 class9.message = friendsCount + " / 200";
6358 return;
6359 }
6360 if (j == 902) {
6361 class9.message = ignoreCount + " / 100";
6362 return;
6363 }
6364 if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
6365 int l = friendsCount;
6366 if (friendserverState != 2) {
6367 l = 0;
6368 }
6369 if (j > 800) {
6370 j -= 701;
6371 }
6372 else {
6373 j -= 101;
6374 }
6375 if (j >= l) {
6376 class9.message = "";
6377 class9.atActionType = 0;
6378 return;
6379 }
6380 if (friendsNodeIds[j] == 0) {
6381 class9.message = "@red@Offline";
6382 }
6383 else if (friendsNodeIds[j] == nodeID) {
6384 class9.message = "@gre@Online" /* + (friendsNodeIDs[j] - 9) */
6385 ;
6386 }
6387 else {
6388 class9.message = "@red@Offline" /* + (friendsNodeIDs[j] - 9) */
6389 ;
6390 }
6391 class9.atActionType = 1;
6392 return;
6393 }
6394 if (j == 203) {
6395 int i1 = friendsCount;
6396 if (friendserverState != 2) {
6397 i1 = 0;
6398 }
6399 class9.scrollMax = i1 * 15 + 20;
6400 if (class9.scrollMax <= class9.height) {
6401 class9.scrollMax = class9.height + 1;
6402 }
6403 return;
6404 }
6405 if (j >= 401 && j <= 500) {
6406 if ((j -= 401) == 0 && friendserverState == 0) {
6407 class9.message = "Loading ignore list";
6408 class9.atActionType = 0;
6409 return;
6410 }
6411 if (j == 1 && friendserverState == 0) {
6412 class9.message = "Please wait...";
6413 class9.atActionType = 0;
6414 return;
6415 }
6416 int j1 = ignoreCount;
6417 if (friendserverState == 0) {
6418 j1 = 0;
6419 }
6420 if (j >= j1) {
6421 class9.message = "";
6422 class9.atActionType = 0;
6423 return;
6424 }
6425 else {
6426 class9.message = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
6427 class9.atActionType = 1;
6428 return;
6429 }
6430 }
6431 if (j == 503) {
6432 class9.scrollMax = ignoreCount * 15 + 20;
6433 if (class9.scrollMax <= class9.height) {
6434 class9.scrollMax = class9.height + 1;
6435 }
6436 return;
6437 }
6438 if (j == 327) {
6439 class9.modelRotationY = 150;
6440 class9.modelRotationX = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
6441 if (updateCharacterCreation) {
6442 for (int k1 = 0; k1 < 7; k1++) {
6443 int l1 = clotheIds[k1];
6444 if (l1 >= 0 && !IdentityKit.cache[l1].modelIsValid()) {
6445 return;
6446 }
6447 }
6448
6449 updateCharacterCreation = false;
6450 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
6451 int i2 = 0;
6452 for (int j2 = 0; j2 < 7; j2++) {
6453 int k2 = clotheIds[j2];
6454 if (k2 >= 0) {
6455 aclass30_sub2_sub4_sub6s[i2++] = IdentityKit.cache[k2].getModel();
6456 }
6457 }
6458
6459 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
6460 for (int l2 = 0; l2 < 5; l2++) {
6461 if (selectedIdentityKitColor[l2] != 0) {
6462 model.setColour(ClientConstants.CLOTHES_COLOUR[l2][0], ClientConstants.CLOTHES_COLOUR[l2][selectedIdentityKitColor[l2]]);
6463 if (l2 == 1) {
6464 model.setColour(ClientConstants.anIntArray1204[0], ClientConstants.anIntArray1204[selectedIdentityKitColor[l2]]);
6465 }
6466 }
6467 }
6468 model.method469();
6469 final Sequences animation = Sequences.get(myPlayer.standAnimation);
6470 model.method470(animation.primary[0]);
6471 model.method479(64, 850, -30, -50, -30, true, true);
6472 class9.modelTypeDisabled = 5;
6473 class9.mediaID = 0;
6474 RSInterface.method208(aBoolean994, model);
6475 }
6476 return;
6477 }
6478
6479 // Rotating model on interface, like the Mystery box one
6480 if (j == 329) {
6481 RSInterface rsInterface = class9;
6482 ItemDefinition itemDef = ItemDefinition.forId(mysteryBoxWinningItemId);
6483 boolean noted = itemDef.unNotedId > 0 && itemDef.notedItemTemplate > 0;
6484 if (noted) {
6485 itemDef = ItemDefinition.forId(itemDef.unNotedId);
6486 }
6487 if (mysteryBoxWinningItemId == 0) {
6488 RSInterface.method208(aBoolean994, null);
6489 return;
6490 }
6491 displayMysteryBoxWinningItem3d(rsInterface, itemDef);
6492 return;
6493 }
6494
6495 // Equipment interface.
6496 if (j == 328) {
6497 RSInterface rsInterface = class9;
6498 rsInterface.modelZoom = class9.modelZoom;
6499 rsInterface.modelRotationY = 75;
6500
6501 // Completionist cape interface.
6502 if (getInterfaceDisplayed() == 22060) {
6503 rsInterface.modelRotationX = 1023;
6504 }
6505
6506 else if (getInterfaceDisplayed() == 24280 || getInterfaceDisplayed() == 15106 || getInterfaceDisplayed() == 15150) {
6507 if (rsInterface.modelRotationX >= 2040) {
6508 rsInterface.modelRotationX = 0;
6509 }
6510 else if (rsInterface.modelRotationX >= 0) {
6511 rsInterface.modelRotationX += 10;
6512 }
6513 }
6514
6515 Model characterDisplay = myPlayer.getBuiltModel();
6516 if (characterDisplay == null) {
6517 return;
6518 }
6519 for (int l2 = 0; l2 < 5; l2++) {
6520 if (selectedIdentityKitColor[l2] != 0) {
6521 characterDisplay.setColour(ClientConstants.CLOTHES_COLOUR[l2][0], ClientConstants.CLOTHES_COLOUR[l2][selectedIdentityKitColor[l2]]);
6522 if (l2 == 1) {
6523 characterDisplay.setColour(ClientConstants.anIntArray1204[0], ClientConstants.anIntArray1204[selectedIdentityKitColor[l2]]);
6524 }
6525 }
6526 }
6527 int staticFrame = myPlayer.standAnimation;
6528 characterDisplay.method469();
6529 characterDisplay.method470(Sequences.anims[staticFrame].primary[0]);
6530 rsInterface.modelTypeDisabled = 5;
6531 rsInterface.mediaID = 0;
6532 RSInterface.method208(aBoolean994, characterDisplay);
6533 return;
6534 }
6535 if (j == 324) {
6536 if (aClass30_Sub2_Sub1_Sub1_931 == null) {
6537 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
6538 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
6539 }
6540 if (selectedMaleIdentityKit) {
6541 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
6542 return;
6543 }
6544 else {
6545 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
6546 return;
6547 }
6548 }
6549 if (j == 325) {
6550 if (aClass30_Sub2_Sub1_Sub1_931 == null) {
6551 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
6552 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
6553 }
6554 if (selectedMaleIdentityKit) {
6555 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
6556 return;
6557 }
6558 else {
6559 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
6560 return;
6561 }
6562 }
6563 if (j == 613) {
6564 class9.message = "";
6565 }
6566 }
6567
6568 private void displayMysteryBoxWinningItem3d(RSInterface rsInterface, ItemDefinition itemDef) {
6569 Model modelToDisplay = Model.getModel(itemDef.inventoryModel);
6570 if (modelToDisplay == null) {
6571 return;
6572 }
6573 // Rotation.
6574 if (rsInterface.modelRotationX >= 2040) {
6575 rsInterface.modelRotationX = 0;
6576 } else if (rsInterface.modelRotationX >= 0) {
6577 rsInterface.modelRotationX += 10;
6578 }
6579 rsInterface.modelZoom = itemDef.zoom - (int) (itemDef.zoom / 3.50);
6580 rsInterface.modelRotationY = itemDef.rotationY;
6581 if (itemDef.modelColourToEdit != null) {
6582 for (int i1 = 0; i1 < itemDef.modelColourToEdit.length; i1++) {
6583 modelToDisplay.setColour(itemDef.modelColourToEdit[i1], itemDef.newModelColourProduced[i1]);
6584 }
6585 }
6586 modelToDisplay.method469();
6587 rsInterface.modelTypeDisabled = 5;
6588 rsInterface.mediaID = 0;
6589 rsInterface.mediaIdOffset1 = mysteryBoxWinningItemOffset;
6590 modelToDisplay.method479(64, 850, -30, -50, -30, true, true);
6591 RSInterface.method208(aBoolean994, modelToDisplay);
6592 }
6593 public void pushMessage(String text, int chatType, String chatName, String chatNameRaw) {
6594 if (chatType == 0 && dialogId != -1) {
6595 notifyMessage = text;
6596 super.setClickMode3(0);
6597 }
6598 if (backDialogueId == -1) {
6599 setUpdateChatAreaPending(true);
6600 }
6601 for (int j = 499; j > 0; j--) {
6602 chatTypes[j] = chatTypes[j - 1];
6603 chatNames[j] = chatNames[j - 1];
6604 chatNamesRaw[j] = chatNamesRaw[j - 1];
6605 chatMessages[j] = chatMessages[j - 1];
6606 chatRights[j] = chatRights[j - 1];
6607 }
6608 chatTypes[0] = chatType;
6609 chatNames[0] = chatName;
6610 chatNamesRaw[0] = chatNameRaw;
6611 chatMessages[0] = text;
6612 chatRights[0] = rights;
6613 }
6614
6615 public int tabHPos;
6616
6617 public static String addressMac;
6618
6619 public static String addressUid = "";
6620
6621 public static int clientIdVersion;
6622
6623 public static long lastSoundTime;
6624
6625 private void resetImageProducers2() {
6626 if (chatBackImage != null) {
6627 return;
6628 }
6629 nullLoader();
6630 super.fullGameScreen = null;
6631 aRSImageProducer_1107 = null;
6632 aRSImageProducer_1109 = null;
6633 chatBackImage = constructGraphicsBuffer(516, 168, getGameComponent());
6634 mapBackImage = constructGraphicsBuffer(249, 168, getGameComponent());
6635 DrawingArea.setAllPixelsToZero();
6636 if (is474GameFrame) {
6637 cacheSprite[Client.is317GameFrame ? 919 : 82].drawSprite(0, 0);
6638 }
6639 else if (is498GameFrame) {
6640 cacheSprite[83].drawSprite(0, 0);
6641 }
6642 else {
6643 cacheSprite[84].drawSprite(0, 0);
6644 }
6645 inventoryBackImage = constructGraphicsBuffer(250, 337, getGameComponent()); // Changed to 336 from 335 to fix white line at bottom of inventory tab after switching to fullscreen and back.
6646 inGameScreen = constructGraphicsBuffer(getGameScreenWidth(), getGameScreenHeight(), getGameComponent());
6647
6648 DrawingArea.setAllPixelsToZero();
6649 welcomeScreenRaised = true;
6650 }
6651
6652 public String getDocumentBaseHost() {
6653 if (SignLink.mainapp != null) {
6654 return SignLink.mainapp.getDocumentBase().getHost().toLowerCase();
6655 }
6656 if (super.gameFrame != null) {
6657 return "";
6658 }
6659 else {
6660 return "";
6661 }
6662 }
6663
6664 public static int getIndexOfSprite(Sprite sprite) {
6665 Objects.requireNonNull(sprite, "Sprite parameter is null.");
6666
6667 for (int index = 0; index < cacheSprite.length; index++) {
6668 if (sprite == cacheSprite[index]) {
6669 return index;
6670 }
6671 }
6672 return -1;
6673 }
6674
6675 public void uLinkNodes() {
6676 EntityDefinition.mruNodes.unlinkAll();
6677 ItemDefinition.mruNodes2.unlinkAll();
6678 ItemDefinition.mruNodes1.unlinkAll();
6679 Player.mruNodes.unlinkAll();
6680 }
6681
6682 public void processRightClick() {
6683 if (activeInterfaceType != 0) {
6684 return;
6685 }
6686 menuActionName[0] = "Cancel";
6687 menuActionID[0] = 1107;
6688 menuActionRow = 1;
6689 if (fullscreenInterfaceID != -1 && isFixedScreen()) {
6690 setFrameFocusedInterface(0);
6691 anInt1315 = 0;
6692 buildInterfaceMenu(8, RSInterface.interfaceCache[fullscreenInterfaceID], super.mouseX, 8, super.mouseY, 0, false);
6693 if (getFrameFocusedInterface() != focusedViewportWidget) {
6694 focusedViewportWidget = getFrameFocusedInterface();
6695 }
6696 if (anInt1315 != anInt1129) {
6697 anInt1129 = anInt1315;
6698 }
6699 return;
6700 }
6701 ChatArea.buildSplitPrivateChatMenu();
6702 setFrameFocusedInterface(0);
6703 actionButtonMultiInterfaceIdToHover = 0;
6704 anInt1315 = 0;
6705 if (super.mouseX >= 515 && super.mouseX <= getClientWidth() && super.mouseY >= 0 && super.mouseY <= 167 && isFixedScreen()) {
6706 if (getInterfaceDisplayed() != -1) {
6707 buildInterfaceMenu(0, RSInterface.interfaceCache[getInterfaceDisplayed()], super.mouseX, 0, super.mouseY, 0, false);
6708 }
6709 }
6710 if (getFrameFocusedInterface() != focusedViewportWidget) {
6711 focusedViewportWidget = getFrameFocusedInterface();
6712 }
6713 setFrameFocusedInterface(0);
6714 anInt1315 = 0;
6715 if (super.mouseX > 0 && super.mouseX < (isFixedScreen() ? 516 : getClientWidth()) && super.mouseY > 0 && super.mouseY < (isFixedScreen() ? 338 : getClientHeight())) {
6716 boolean skip = false;
6717 if (!Client.isFixedScreen()) {
6718 skip = isNotTileClickingArea();
6719 }
6720 if (walkableInterfaceId == ClientConstants.ZOMBIE_READY_INTERFACE) {
6721 int offset = !Client.isFixedScreen() ? 4 : 0;
6722 if (super.mouseX >= 228 + (Client.isFixedScreen() ? 0 : (Client.getClientWidth() / 2) - 267) && super.mouseX <= 293 + (Client.isFixedScreen() ? 0 : (Client.getClientWidth() / 2) - 267) && super.mouseY >= 13 - offset && super.mouseY <= 27) {
6723 skip = true;
6724 }
6725 }
6726 if (!skip) {
6727 skip = Achievements.clickAchievementPopUp(false); // Sets the skip check if i clicked on acheivement interface.
6728 Achievements.clickAchievementPopUp(true); // This does the actual closing of the interface.
6729 }
6730 if (!skip) {
6731 if (getInterfaceDisplayed() != -1) {
6732 boolean ignore = false;
6733 if (RSInterface.interfaceCache[getInterfaceDisplayed()].interfaceEndX != 0) {
6734 if (super.mouseX >= RSInterface.interfaceCache[getInterfaceDisplayed()].interfaceStartX + (!Client.isFixedScreen() ? (Client.getClientWidth() / 2) - 260 : 0) && super.mouseX <= RSInterface.interfaceCache[getInterfaceDisplayed()].interfaceEndX + (!Client.isFixedScreen() ? (Client.getClientWidth() / 2) - 260 : 0) && super.mouseY >= RSInterface.interfaceCache[getInterfaceDisplayed()].interfaceStartY + (!Client.isFixedScreen() ? (Client.getClientHeight() / 2) - 271 : 0) && super.mouseY <= RSInterface.interfaceCache[getInterfaceDisplayed()].interfaceEndY + (!Client.isFixedScreen() ? (Client.getClientHeight() / 2) - 271 : 0)) {
6735 }
6736 else {
6737 ignore = true;
6738 }
6739 }
6740 if (!ignore) {
6741 //TODO #FULLSCREEN ADJUST interfaces hovering/actions on 3d screen
6742 int x1 = isFixedScreen() ? 4 : (Client.getClientWidth() / 2) - 256;
6743 int y1 = isFixedScreen() ? 4 : (Client.getClientHeight() / 2) - 267;
6744 buildInterfaceMenu(x1, RSInterface.interfaceCache[getInterfaceDisplayed()], super.mouseX, y1, super.mouseY, 0, false);
6745 }
6746 else {
6747 build3dScreenMenu();
6748 }
6749 }
6750 //@formatter:off
6751 else if (showDonatorNotification)
6752 {
6753 //@formatter:on
6754 int x1 = isFixedScreen() ? 4 : (Client.getClientWidth() / 2) - 256;
6755 int y1 = isFixedScreen() ? 4 : (Client.getClientHeight() / 2) - 267;
6756 boolean ignore = false;
6757 RSInterface instance = RSInterface.interfaceCache[33200];
6758 if (super.mouseX >= instance.interfaceStartX + (!Client.isFixedScreen() ? (Client.getClientWidth() / 2) - 260 : 0) && super.mouseX <= instance.interfaceEndX + (!Client.isFixedScreen() ? (Client.getClientWidth() / 2) - 260 : 0) && super.mouseY >= instance.interfaceStartY + (!Client.isFixedScreen() ? (Client.getClientHeight() / 2) - 271 : 0) && super.mouseY <= instance.interfaceEndY + (!Client.isFixedScreen() ? (Client.getClientHeight() / 2) - 271 : 0)) {
6759 }
6760 else {
6761 ignore = true;
6762 }
6763 if (!ignore) {
6764 buildInterfaceMenu(x1, RSInterface.interfaceCache[33200], super.mouseX, y1, super.mouseY, 0, false);
6765 }
6766 else {
6767 build3dScreenMenu();
6768 }
6769 }
6770 else {
6771 build3dScreenMenu();
6772 }
6773 }
6774 }
6775 if (getFrameFocusedInterface() != focusedViewportWidget) {
6776 focusedViewportWidget = getFrameFocusedInterface();
6777 }
6778 if (anInt1315 != anInt1129) {
6779 anInt1129 = anInt1315;
6780 }
6781 setFrameFocusedInterface(0);
6782 anInt1315 = 0;
6783
6784 int x = super.mouseX;
6785
6786 int y = super.mouseY;
6787 if (!Client.isFixedScreen()) {
6788 x = super.mouseX - (Client.getClientWidth() - Client.getFullscreenModeMinimapX(761));
6789 y = super.mouseY - (Client.getClientHeight() - Client.getFullscreenModeChatAreaY(550));
6790 if (Client.getInventoryLayout("DOUBLE STACK")) {
6791 y += 38;
6792 }
6793 else if (Client.getInventoryLayout("OLD")) {
6794 x += 20;
6795 y -= 3;
6796 }
6797
6798 if (Client.is562GameFrame || Client.is562PlusGameFrame) {
6799 y -= 2;
6800 }
6801 }
6802 // TODO #FULLSCREEN ADJUST inventory tab hovering and actions of interfaces.
6803 if (x > 548 && y > 207 && x < 760 && y < 468) {
6804 boolean show = true;
6805 if (hideInventoryInterfaceAction && !Client.isFixedScreen()) {
6806 show = false;
6807 }
6808 if (show) {
6809 if (Client.is317GameFrame) {
6810 x -= 6;
6811 }
6812 if (getInvOverlayInterfaceID() != -1) {
6813 buildInterfaceMenu(548, RSInterface.interfaceCache[getInvOverlayInterfaceID()], x, 207, y, 0, false);
6814 }
6815 else if (tabInterfaceId[getTabId()] != -1) {
6816 buildInterfaceMenu(548, RSInterface.interfaceCache[tabInterfaceId[getTabId()]], x, 207, y, 0, false);
6817 }
6818 }
6819 }
6820 if (getFrameFocusedInterface() != focusedSidebarWidget)
6821
6822 {
6823 setTabAreaAltered(true);
6824 focusedSidebarWidget = getFrameFocusedInterface();
6825 }
6826 if (anInt1315 != anInt1044)
6827
6828 {
6829 setTabAreaAltered(true);
6830 anInt1044 = anInt1315;
6831 }
6832 setFrameFocusedInterface(0);
6833 anInt1315 = 0;
6834
6835 //TODO #FULLSCREEN ADJUST chatbox right clicking/hovering/actions.
6836 int mouseY = Client.isFixedScreen() ? super.mouseY : super.mouseY - (Client.getClientHeight() - Client.getFullscreenModeChatAreaY(542));
6837 if (super.mouseX > 0 && mouseY > 338 && super.mouseX < 490 && mouseY < 463) {
6838 if (backDialogueId != -1) {
6839 buildInterfaceMenu(20, RSInterface.interfaceCache[backDialogueId], super.mouseX, 358, mouseY, 0, false);
6840 }
6841 else if (mouseY < 463 && super.mouseX < 490) {
6842 buildChatAreaMenu(mouseY - 338);
6843 }
6844 }
6845 if (backDialogueId != -1 && getFrameFocusedInterface() != focusedChatWidget) {
6846 setUpdateChatAreaPending(true);
6847 focusedChatWidget = getFrameFocusedInterface();
6848 }
6849 if (backDialogueId != -1 && anInt1315 != anInt1500) {
6850 setUpdateChatAreaPending(true);
6851 anInt1500 = anInt1315;
6852 }
6853 ChatArea.chatAreaTextOld(this);
6854 ChatArea.chatAreaTextNew(this);
6855 if (experienceOrb) {
6856 Orbs.experienceOrbButtonAndHover();
6857 }
6858 Orbs.specialOrbClick();
6859 MiniMap.processMinimapActions(this);
6860 InventoryTab.determineTopTabs(this);
6861 InventoryTab.determineBottomTabs(this);
6862
6863 boolean flag = false;
6864 while (!flag) {
6865 flag = true;
6866 for (int j = 0; j < menuActionRow - 1; j++) {
6867 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
6868 String s = menuActionName[j];
6869 menuActionName[j] = menuActionName[j + 1];
6870 menuActionName[j + 1] = s;
6871 int k = menuActionID[j];
6872 menuActionID[j] = menuActionID[j + 1];
6873 menuActionID[j + 1] = k;
6874 k = menuActionCmd2[j];
6875 menuActionCmd2[j] = menuActionCmd2[j + 1];
6876 menuActionCmd2[j + 1] = k;
6877 k = menuActionCmd3[j];
6878 menuActionCmd3[j] = menuActionCmd3[j + 1];
6879 menuActionCmd3[j + 1] = k;
6880 k = menuActionCmd1[j];
6881 menuActionCmd1[j] = menuActionCmd1[j + 1];
6882 menuActionCmd1[j + 1] = k;
6883 k = menuActionCmd4[j];
6884 menuActionCmd4[j] = menuActionCmd4[j + 1];
6885 menuActionCmd4[j + 1] = k;
6886 flag = false;
6887 }
6888 }
6889 }
6890 }
6891
6892 public boolean isNotTileClickingArea() {
6893
6894 // TODO #FULLSCREEN ADJUST tile clicking, prevent from clicking on minimap and this is also used for mouse scrolling zooming.
6895 // Minimap area.
6896 int x = super.mouseX - (Client.getClientWidth() - Client.getFullscreenModeMinimapX(787));
6897 int y = super.mouseY;
6898 if (Client.is474GameFrame) {
6899 // Minimap
6900 if (x >= 602 && x <= 769 && y >= 0 && y <= 165) {
6901 return true;
6902 }
6903 }
6904 else {
6905 if (x >= 599 && x <= 769 && y >= 0 && y <= 169) {
6906 return true;
6907 }
6908 }
6909 // Inventory area.
6910 x = super.mouseX - (Client.getClientWidth() - Client.getFullscreenModeMinimapX(787));
6911 y = super.mouseY - (Client.getClientHeight() - Client.getFullscreenModeChatAreaY(543));
6912
6913 if (Client.getInventoryLayout("DOUBLE STACK")) {
6914 // Tabs.
6915 if (x >= 526 && y >= 429 && x <= Client.getClientWidth() && y <= Client.getClientHeight()) {
6916 return true;
6917 }
6918
6919 // Inventory opened interface.
6920 else if (x >= 567 && y >= 155 && x <= Client.getClientWidth() && y <= Client.getClientHeight()) {
6921 if (!Client.hideInventoryInterfaceAction && !Client.isFixedScreen()) {
6922 return true;
6923 }
6924 }
6925 }
6926 else if (Client.getInventoryLayout("LANDSCAPE")) {
6927 // Tabs.
6928 if (x >= 526 && y >= 429 && x <= Client.getClientWidth() && y <= Client.getClientHeight()) {
6929 return true;
6930 }
6931
6932 // Inventory opened interface.
6933 else if (x >= 567 && y >= 192 && x <= Client.getClientWidth() && y <= Client.getClientHeight()) {
6934 if (!Client.hideInventoryInterfaceAction && !Client.isFixedScreen()) {
6935 return true;
6936 }
6937 }
6938
6939 }
6940 else {
6941 // The whole inventory tab area with the tab interface.
6942 if (x >= 530 && y >= 168 && x <= Client.getClientWidth() && y <= Client.getClientHeight()) {
6943 return true;
6944 }
6945 }
6946
6947 // Chatbox area.
6948 if (super.mouseX >= 0 && super.mouseX <= 519 && super.mouseY <= Client.getClientHeight() && mouseY >= Client.getClientHeight() - Client.getFullscreenModeChatAreaY(205)) {
6949 return true;
6950 }
6951 return false;
6952 }
6953
6954 void login(String s, String s1, boolean flag) {
6955 setLoginMessage3("");
6956 SignLink.errorname = s;
6957 try {
6958 if (rememberMe) {
6959 savedUsername = myUsername;
6960 savedPassword = encrypt(myPassword);
6961 Settings.saveSettings();
6962 }
6963
6964 if (myUsername.length() == 0) {
6965 setLoginMessage1("Please enter a username");
6966 return;
6967 }
6968 else if (myPassword.length() == 0) {
6969 setLoginMessage1("Please enter a password");
6970 return;
6971 }
6972 if (!flag) {
6973 setLoginMessage1("Connecting...");
6974 }
6975 socketStream = new RSSocket(this, openSocket(WebsiteRead.port + portOff));
6976 long l = TextClass.longForName(s);
6977 int i = (int) (l >> 16 & 31L);
6978 stream.currentOffset = 0;
6979 stream.writeWordBigEndian(14);
6980 stream.writeWordBigEndian(i);
6981 socketStream.queueBytes(2, stream.buffer);
6982 for (int j = 0; j < 8; j++) {
6983 socketStream.read();
6984 }
6985
6986 int k = socketStream.read();
6987
6988 int i1 = k;
6989 if (ClientDebugConfiguration.PRINT_ALL_EXCEPTION) {
6990 Utility.print("Log in block: " + k + ", " + i);
6991 }
6992 if (k == 0) {
6993 socketStream.flushInputStream(inStream.buffer, 8);
6994 inStream.currentOffset = 0;
6995 serverSeed = inStream.readQWord();
6996 int ai[] = new int[4];
6997 ai[0] = (int) (Math.random() * 99999999D);
6998 ai[1] = (int) (Math.random() * 99999999D);
6999 ai[2] = (int) (serverSeed >> 32);
7000 ai[3] = (int) serverSeed;
7001 stream.currentOffset = 0;
7002 try {
7003
7004 stream.writeWordBigEndian(10);
7005 stream.writeDWord(ai[0]);
7006 stream.writeDWord(ai[1]);
7007 stream.writeDWord(ai[2]);
7008 stream.writeDWord(ai[3]);
7009 stream.writeDWord(clientIdVersion);
7010 stream.writeString(WhatIsBAN()); // mac this looks really suspicious
7011 stream.writeString(WhatIsBAN());//uidAddress
7012 stream.writeDWord(333);//client version
7013 stream.writeString(WhatIsBAN());
7014 stream.writeString(WhatIsBAN());
7015 stream.writeString(WhatIsBAN());
7016 stream.writeString(WhatIsBAN());
7017 stream.writeString(WhatIsBAN());
7018 stream.writeString(WhatIsBAN());
7019 stream.writeString(WhatIsBAN());
7020 stream.writeString(WhatIsBAN());
7021
7022 stream.writeWordBigEndian(identifierSet.hardDiskSerial.size());
7023 for (int index = 0; index < identifierSet.hardDiskSerial.size(); index++) {
7024 stream.writeString(WhatIsBAN());
7025 }
7026 stream.writeWordBigEndian(identifierSet.fileStoreUuid.size());
7027 for (int index = 0; index < identifierSet.fileStoreUuid.size(); index++) {
7028 stream.writeString(WhatIsBAN());
7029 }
7030
7031 Collection<UUID> uuids = cachedUUIDGroup.values();
7032 stream.writeWordBigEndian(uuids.size());
7033 uuids.forEach(uuid -> sendStuff(stream, uuid));
7034 } catch (Exception e) {
7035 e.printStackTrace();
7036 }
7037 stream.writeString(s);//username
7038 stream.writeString(s1);
7039 stream.doKeys();
7040 aStream_847.currentOffset = 0;
7041 if (flag) {
7042 aStream_847.writeWordBigEndian(18);
7043 } else {
7044 aStream_847.writeWordBigEndian(16);
7045 }
7046 aStream_847.writeWord(stream.currentOffset + 36 + 1 + 1 + 2);
7047 aStream_847.writeWordBigEndian(255);
7048 aStream_847.writeWord(317);
7049 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
7050 for (int l1 = 0; l1 < 9; l1++) {
7051 aStream_847.writeDWord(expectedCRCs[l1]);
7052 }
7053
7054 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
7055 stream.encryption = new ISAACRandomGen(ai);
7056 for (int j2 = 0; j2 < 4; j2++) {
7057 ai[j2] += 50;
7058 }
7059
7060 encryption = new ISAACRandomGen(ai);
7061 socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
7062 k = socketStream.read();
7063 if (k > 1) {
7064 boolean availableMessage = socketStream.read() == 1;
7065 if (availableMessage) {
7066 String responseText = socketStream.readString();
7067 setLoginMessage3(responseText);
7068 }
7069 }
7070 }
7071 if (k == 1) {
7072 try {
7073 Thread.sleep(2000L);
7074 }
7075 catch (Exception e) {
7076 e.printStackTrace();
7077 }
7078 login(s, s1, flag);
7079 return;
7080 }
7081 if (k == 2) {
7082 myPrivilege = socketStream.read();
7083 socketStream.read(); // Must leave here, it was used by the mouse movement tracker by Jagex.
7084 lastClickTime = 0L;
7085 super.awtFocus = true;
7086 isFocused = true;
7087 setLoggedIn(true);
7088 stream.currentOffset = 0;
7089 inStream.currentOffset = 0;
7090 packetType = -1;
7091 ptype0 = -1;
7092 ptype1 = -1;
7093 ptype2 = -1;
7094 pktSize = 0;
7095 netIdleCycles = 0;
7096 systemUpdateCycle = 0;
7097 logoutCycle = 0;
7098 markType = 0;
7099 menuActionRow = 0;
7100 menuOpen = false;
7101 super.idleTime = 0;
7102 for (int j1 = 0; j1 < 500; j1++) // Fix chat box, It will remove old chat messages after you relog.
7103 {
7104 chatMessages[j1] = null;
7105 }
7106 itemSelected = 0;
7107 spellSelected = 0;
7108 setLoadingStage(0);
7109 currentSound = 0;
7110 cameraOffsetX = 0;
7111 cameraOffsetY = 0;
7112 viewRotationOffset = 0;
7113 minimapRotation = 0;
7114 minimapZoom = 0;
7115 viewRotation = 0;
7116 minimapState = 0;
7117 lastPlane = -1;
7118 destX = 0;
7119 destY = 0;
7120 playerCount = 0;
7121 npcCount = 0;
7122 for (int i2 = 0; i2 < maxPlayers; i2++) {
7123 playerArray[i2] = null;
7124 aStreamArray895s[i2] = null;
7125 }
7126
7127 for (int k2 = 0; k2 < 16384; k2++) {
7128 npcArray[k2] = null;
7129 }
7130 myPlayer = playerArray[myPlayerIndex] = new Player();
7131 projectiles.removeAll();
7132 spotanims.removeAll();
7133 for (int l2 = 0; l2 < 4; l2++) {
7134 for (int i3 = 0; i3 < 104; i3++) {
7135 for (int k3 = 0; k3 < 104; k3++) {
7136 groundArray[l2][i3][k3] = null;
7137 }
7138
7139 }
7140
7141 }
7142
7143 objects = new NodeList();
7144 fullscreenInterfaceID = -1;
7145 friendserverState = 0;
7146 friendsCount = 0;
7147 dialogId = -1;
7148 backDialogueId = -1;
7149 setInterfaceDisplayed(-1);
7150 setInvOverlayInterfaceID(-1);
7151 walkableInterfaceId = -1;
7152 setDialogueOptionsShowing(false);
7153 setTabId(3, true);
7154 inputDialogState = 0;
7155 menuOpen = false;
7156 setMessagePromptRaised(false, false);
7157 Client.setUpdateChatAreaPending(true);
7158 notifyMessage = null;
7159 anInt1055 = 0;
7160 flashingSidebarTab = -1;
7161 selectedMaleIdentityKit = true;
7162 resetCharacterCreation();
7163 for (int j3 = 0; j3 < 5; j3++) {
7164 selectedIdentityKitColor[j3] = 0;
7165 }
7166
7167 for (int l3 = 0; l3 < 5; l3++) {
7168 atPlayerActions[l3] = null;
7169 atPlayerArray[l3] = false;
7170 }
7171
7172 anInt1175 = 0;
7173 anInt1134 = 0;
7174 anInt986 = 0;
7175 anInt1288 = 0;
7176 anInt924 = 0;
7177 anInt1188 = 0;
7178 anInt1155 = 0;
7179 anInt1226 = 0;
7180 resetImageProducers2();
7181 logInUpdate();
7182 return;
7183 }
7184 if (k == 3) {
7185 if (Config.PRE_EOC) {
7186 PreEocScreen.wrongPass = true;
7187 }
7188 setLoginMessage1("Account is taken or invalid password.");
7189 setLoginMessage2("In-game accounts and forum accounts are not connected!");
7190 setLoginMessage3("You can ::recoverpass lostAccountNameHere, type this in-game.");
7191 return;
7192 }
7193 if (k == 4) {
7194 setLoginMessage1("Invalid username characters: do not use dashes or underscores - _");
7195 return;
7196 }
7197 if (k == 5) {
7198 setLoginMessage1("Your account is logged in, try again in 60 seconds.");
7199 return;
7200 }
7201 if (k == 6) {
7202 return;
7203 }
7204 if (k == 7) {
7205 setLoginMessage1("This world is full.");
7206 return;
7207 }
7208 if (k == 8) {
7209 setLoginMessage1("Unable to connect, login server offline.");
7210 return;
7211 }
7212 if (k == 9) {
7213 setLoginMessage1("Login limit exceeded.");
7214 return;
7215 }
7216 if (k == 10) {
7217 setLoginMessage1("You are banned for breaking a serious rule & you will not be unbanned unless you pay the 15m Osrs fine.");
7218 setLoginMessage2("Pay the 15m to any Mod on ::staff or ::discord, visit Runecessor.com/forum to find out the steps/links.");
7219 return;
7220 }
7221 if (k == 11) {
7222 setLoginMessage1("Server is busy, please wait 5 seconds and try again.");
7223 return;
7224 }
7225 if (k == 12) {
7226 setLoginMessage1("You need a members account to login to this world.");
7227 return;
7228 }
7229 if (k == 13) {
7230 setLoginMessage1("Could not complete login.");
7231 return;
7232 }
7233 if (k == 14) {
7234 setLoginMessage1("The server is being updated, please wait 1 minute and try again.");
7235 return;
7236 }
7237 if (k == 15) {
7238 setLoggedIn(true);
7239 stream.currentOffset = 0;
7240 inStream.currentOffset = 0;
7241 packetType = -1;
7242 ptype0 = -1;
7243 ptype1 = -1;
7244 ptype2 = -1;
7245 pktSize = 0;
7246 netIdleCycles = 0;
7247 systemUpdateCycle = 0;
7248 menuActionRow = 0;
7249 menuOpen = false;
7250 aLong824 = System.currentTimeMillis();
7251 return;
7252 }
7253 if (k == 16) {
7254 setLoginMessage1("You cannot access any account for 1 minute due");
7255 setLoginMessage2("to too many invalid log-in attempts!");
7256 return;
7257 }
7258 if (k == 17) {
7259 setLoginMessage1("You are standing in a members-only area.");
7260 return;
7261 }
7262 if (k == 18) {
7263 setLoginMessage1("You are not allowed to log into other people's accounts.");
7264 setLoginMessage2("Try again in 24 hours.");
7265 return;
7266 }
7267 if (k == 19) {
7268 setLoginMessage1("This account name is offensive.");
7269 return;
7270 }
7271 if (k == 20) {
7272 setLoginMessage1("Invalid loginserver requested");
7273 return;
7274 }
7275 if (k == 21) {
7276 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
7277 setLoginMessage1("You have only just left another world");
7278 Content.drawLoginScreen();
7279 try {
7280 Thread.sleep(1000L);
7281 }
7282 catch (Exception e) {
7283 e.printStackTrace();
7284 }
7285 }
7286 login(s, s1, flag);
7287 return;
7288 }
7289 if (k == 24) {
7290 setLoginMessage1("Outdated client, please reload the client.");
7291 return;
7292 }
7293 if (k == -1) {
7294 if (i1 == 0) {
7295 try {
7296 Thread.sleep(2000L);
7297 }
7298 catch (Exception e) {
7299 e.printStackTrace();
7300 }
7301 login(s, s1, flag);
7302 return;
7303 }
7304 else {
7305 setLoginMessage1("Error connecting.");
7306 return;
7307 }
7308 }
7309 else {
7310 setLoginMessage1("Unexpected server response: " + k);
7311 return;
7312 }
7313 }
7314 catch (IOException e) {
7315 setLoginMessage1("");
7316 if (ClientDebugConfiguration.PRINT_ALL_EXCEPTION || ClientLiveConfiguration.LIVE_GAME) {
7317 e.printStackTrace();
7318 }
7319 }
7320 setLoginMessage1("Failed to connect.");
7321
7322 // If player fails to connect, read the latest server ip incase i switched dedicated servers.
7323 // WebsiteRead.readWebsiteData();
7324
7325 }
7326
7327 public String WhatIsBAN() {
7328 String ran = rand();
7329 System.out.println(ran);
7330 return ran;
7331 }
7332 public String rand() {
7333 return RandomStringUtils.randomAlphanumeric(ranNum());
7334 }
7335 public int ranNum() {
7336 Random random = new Random();
7337 return (random.nextInt(14 - 6 + 1) + 6);
7338 }
7339 public void sendStuff(Stream stream, UUID uuid) {
7340 System.out.println(rand()+"-"+rand());
7341 stream.writeString(rand()+"-"+rand());
7342 }
7343 protected boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, int k2) {
7344 Client.closeAllInterfaces();
7345 byte byte0 = 104;
7346 byte byte1 = 104;
7347 for (int l2 = 0; l2 < byte0; l2++) {
7348 for (int i3 = 0; i3 < byte1; i3++) {
7349 pathWaypoint[l2][i3] = 0;
7350 pathDistance[l2][i3] = 0x5f5e0ff;
7351 }
7352 }
7353 int j3 = j2;
7354 int k3 = j1;
7355 try {
7356 pathWaypoint[j2][j1] = 99;
7357 pathDistance[j2][j1] = 0;
7358 }
7359 catch (Exception e) {
7360 e.printStackTrace();
7361 return false;
7362 }
7363 int l3 = 0;
7364 int i4 = 0;
7365 bigX[l3] = j2;
7366 bigY[l3++] = j1;
7367 boolean flag1 = false;
7368 int j4 = bigX.length;
7369 int ai[][] = collisionMap[plane].flags;
7370 while (i4 != l3) {
7371 j3 = bigX[i4];
7372 k3 = bigY[i4];
7373 i4 = (i4 + 1) % j4;
7374 if (j3 == k2 && k3 == i2) {
7375 flag1 = true;
7376 break;
7377 }
7378 if (i1 != 0) {
7379 if ((i1 < 5 || i1 == 10) && collisionMap[plane].atWall(k2, j3, k3, j, i1 - 1, i2)) {
7380 flag1 = true;
7381 break;
7382 }
7383 if (i1 < 10 && collisionMap[plane].atDecoration(k2, i2, k3, i1 - 1, j, j3)) {
7384 flag1 = true;
7385 break;
7386 }
7387 }
7388 if (k1 != 0 && k != 0 && collisionMap[plane].atObject(i2, k2, j3, k, l1, k1, k3)) {
7389 flag1 = true;
7390 break;
7391 }
7392 int l4 = pathDistance[j3][k3] + 1;
7393 if (j3 > 0 && pathWaypoint[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0) {
7394 bigX[l3] = j3 - 1;
7395 bigY[l3] = k3;
7396 l3 = (l3 + 1) % j4;
7397 pathWaypoint[j3 - 1][k3] = 2;
7398 pathDistance[j3 - 1][k3] = l4;
7399 }
7400 if (j3 < byte0 - 1 && pathWaypoint[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0) {
7401 bigX[l3] = j3 + 1;
7402 bigY[l3] = k3;
7403 l3 = (l3 + 1) % j4;
7404 pathWaypoint[j3 + 1][k3] = 8;
7405 pathDistance[j3 + 1][k3] = l4;
7406 }
7407 if (k3 > 0 && pathWaypoint[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
7408 bigX[l3] = j3;
7409 bigY[l3] = k3 - 1;
7410 l3 = (l3 + 1) % j4;
7411 pathWaypoint[j3][k3 - 1] = 1;
7412 pathDistance[j3][k3 - 1] = l4;
7413 }
7414 if (k3 < byte1 - 1 && pathWaypoint[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
7415 bigX[l3] = j3;
7416 bigY[l3] = k3 + 1;
7417 l3 = (l3 + 1) % j4;
7418 pathWaypoint[j3][k3 + 1] = 4;
7419 pathDistance[j3][k3 + 1] = l4;
7420 }
7421 if (j3 > 0 && k3 > 0 && pathWaypoint[j3 - 1][k3 - 1] == 0 && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
7422 bigX[l3] = j3 - 1;
7423 bigY[l3] = k3 - 1;
7424 l3 = (l3 + 1) % j4;
7425 pathWaypoint[j3 - 1][k3 - 1] = 3;
7426 pathDistance[j3 - 1][k3 - 1] = l4;
7427 }
7428 if (j3 < byte0 - 1 && k3 > 0 && pathWaypoint[j3 + 1][k3 - 1] == 0 && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
7429 bigX[l3] = j3 + 1;
7430 bigY[l3] = k3 - 1;
7431 l3 = (l3 + 1) % j4;
7432 pathWaypoint[j3 + 1][k3 - 1] = 9;
7433 pathDistance[j3 + 1][k3 - 1] = l4;
7434 }
7435 if (j3 > 0 && k3 < byte1 - 1 && pathWaypoint[j3 - 1][k3 + 1] == 0 && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
7436 bigX[l3] = j3 - 1;
7437 bigY[l3] = k3 + 1;
7438 l3 = (l3 + 1) % j4;
7439 pathWaypoint[j3 - 1][k3 + 1] = 6;
7440 pathDistance[j3 - 1][k3 + 1] = l4;
7441 }
7442 if (j3 < byte0 - 1 && k3 < byte1 - 1 && pathWaypoint[j3 + 1][k3 + 1] == 0 && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
7443 bigX[l3] = j3 + 1;
7444 bigY[l3] = k3 + 1;
7445 l3 = (l3 + 1) % j4;
7446 pathWaypoint[j3 + 1][k3 + 1] = 12;
7447 pathDistance[j3 + 1][k3 + 1] = l4;
7448 }
7449 }
7450 anInt1264 = 0;
7451 if (!flag1) {
7452 if (flag) {
7453 int i5 = 100;
7454 for (int k5 = 1; k5 < 2; k5++) {
7455 for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
7456 for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
7457 if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && pathDistance[i6][l6] < i5) {
7458 i5 = pathDistance[i6][l6];
7459 j3 = i6;
7460 k3 = l6;
7461 anInt1264 = 1;
7462 flag1 = true;
7463 }
7464
7465 }
7466
7467 if (flag1)
7468 break;
7469 }
7470
7471 }
7472 if (!flag1)
7473 return false;
7474 }
7475 i4 = 0;
7476 bigX[i4] = j3;
7477 bigY[i4++] = k3;
7478 int l5;
7479 for (int j5 = l5 = pathWaypoint[j3][k3]; j3 != j2 || k3 != j1; j5 = pathWaypoint[j3][k3]) {
7480 if (j5 != l5) {
7481 l5 = j5;
7482 bigX[i4] = j3;
7483 bigY[i4++] = k3;
7484 }
7485 if ((j5 & 2) != 0)
7486 j3++;
7487 else if ((j5 & 8) != 0)
7488 j3--;
7489 if ((j5 & 1) != 0)
7490 k3++;
7491 else if ((j5 & 4) != 0)
7492 k3--;
7493 }
7494 // if(cancelWalk) { return i4 > 0; }
7495 if (i4 > 0) {
7496 int k4 = i4;
7497 if (k4 > 25) {
7498 k4 = 25;
7499 }
7500 i4--;
7501 int k6 = bigX[i4];
7502 int i7 = bigY[i4];
7503 anInt1288 += k4;
7504 if (anInt1288 >= 92) {
7505 stream.createFrame(36);
7506 stream.writeDWord(0);
7507 anInt1288 = 0;
7508 }
7509 if (i == 0) {
7510 stream.createFrame(164);
7511 stream.writeWordBigEndian(k4 + k4 + 3);
7512 }
7513 if (i == 1) {
7514 stream.createFrame(248);
7515 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
7516 }
7517 if (i == 2) {
7518 stream.createFrame(98);
7519 stream.writeWordBigEndian(k4 + k4 + 3);
7520 }
7521 stream.method433(k6 + baseX);
7522 destX = bigX[0];
7523 destY = bigY[0];
7524 for (int j7 = 1; j7 < k4; j7++) {
7525 i4--;
7526 stream.writeWordBigEndian(bigX[i4] - k6);
7527 stream.writeWordBigEndian(bigY[i4] - i7);
7528 }
7529
7530 stream.method431(i7 + baseY);
7531 stream.method424(super.keyArray[5] != 1 ? 0 : 1);
7532 return true;
7533 }
7534 return i != 1;
7535 }
7536
7537
7538 private void buildAtNPCMenu(EntityDefinition entityDef, int a, int j, int k, int npcArrayIndex) {
7539 if (menuActionRow >= 400)
7540 return;
7541 if (entityDef.childrenIDs != null)
7542 entityDef = entityDef.getOverride();
7543 if (entityDef == null)
7544 return;
7545 if (!entityDef.interactable)
7546 return;
7547 String npcName = entityDef.name;
7548 if (entityDef.combatLevel > 0) {
7549 npcName = npcName + Content.combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level: " + entityDef.combatLevel + ")";
7550 }
7551
7552 // If pet does not belong to me, then do not show pick up option or anything at all.
7553 if (entityDef.actions != null) {
7554 for (int l = 4; l >= 0; l--) {
7555 // Is not an attack option.
7556 if (entityDef.actions[l] != null) {
7557 if (entityDef.actions[l].equalsIgnoreCase("Pick-up")) {
7558 if (npcPetId != npcArrayIndex && npcSecondPetId != npcArrayIndex) {
7559 return;
7560 }
7561 }
7562 }
7563 }
7564 }
7565 if (itemSelected == 1) {
7566 menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + npcName;
7567 menuActionID[menuActionRow] = 582;
7568 menuActionCmd1[menuActionRow] = a;
7569 menuActionCmd2[menuActionRow] = k;
7570 menuActionCmd3[menuActionRow] = j;
7571 menuActionRow++;
7572 return;
7573 }
7574 if (spellSelected == 1) {
7575 if ((spellUsableOn & 2) == 2) {
7576
7577 // Stop the player from being able to use a spell on his own pet.
7578 if (npcPetId == npcArrayIndex || npcSecondPetId == npcArrayIndex) {
7579 return;
7580 }
7581 menuActionName[menuActionRow] = spellTooltip + " @yel@" + npcName;
7582 menuActionID[menuActionRow] = 413;
7583 menuActionCmd1[menuActionRow] = a;
7584 menuActionCmd2[menuActionRow] = k;
7585 menuActionCmd3[menuActionRow] = j;
7586 menuActionRow++;
7587 }
7588 }
7589 else {
7590 boolean enableExamine = true;
7591 boolean isPet = false;
7592 if (!entityDef.showOnMinimap) {
7593 if (entityDef.actions != null) {
7594 for (int index = 4; index >= 0; index--) {
7595 if (entityDef.actions[index] != null) {
7596 if (entityDef.actions[index].contains("Pick-up")) {
7597 isPet = true;
7598 // Add the examine option
7599 if (myUsername.equalsIgnoreCase("pichu")
7600 || myUsername.equalsIgnoreCase("Fezo")
7601 || myUsername.equalsIgnoreCase("Michael")) {
7602 menuActionName[menuActionRow] = "Examine @yel@" + npcName
7603 + "@whi@ (" + entityDef.type + ")";
7604 }
7605
7606 else {
7607 menuActionName[menuActionRow] = "Examine @yel@" + npcName;
7608 }
7609 menuActionID[menuActionRow] = 1025;
7610 menuActionCmd1[menuActionRow] = a;
7611 menuActionCmd2[menuActionRow] = k;
7612 menuActionCmd3[menuActionRow] = j;
7613 menuActionRow++;
7614 break;
7615 }
7616 }
7617 }
7618 }
7619 }
7620 if (entityDef.actions != null) {
7621 for (int l = 4; l >= 0; l--) {
7622 // Is not an attack option.
7623 if (entityDef.actions[l] != null && !entityDef.actions[l].equalsIgnoreCase("attack")) {
7624 char c = '\0';
7625 if (isPet) {
7626 c = '\u07D0';
7627
7628 enableExamine = false;
7629 }
7630 menuActionName[menuActionRow] = entityDef.actions[l] + " @yel@" + npcName;
7631 if (l == 0)
7632 menuActionID[menuActionRow] = 20 + c;
7633 if (l == 1)
7634 menuActionID[menuActionRow] = 412 + c;
7635 if (l == 2)
7636 menuActionID[menuActionRow] = 225 + c;
7637 if (l == 3)
7638 menuActionID[menuActionRow] = 965 + c;
7639 if (l == 4)
7640 menuActionID[menuActionRow] = 478 + c;
7641 menuActionCmd1[menuActionRow] = a;
7642 menuActionCmd2[menuActionRow] = k;
7643 menuActionCmd3[menuActionRow] = j;
7644 menuActionRow++;
7645 }
7646 }
7647
7648 }
7649 if (entityDef.actions != null) {
7650 for (int i1 = 4; i1 >= 0; i1--) {
7651 if (entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack")) {
7652 char c = '\0';
7653 switch (npcAttackOptions) {
7654 case 0: // Default
7655 if (entityDef.combatLevel > myPlayer.combatLevel) {
7656 c = '\u07D0';
7657 }
7658 break;
7659 case 1 : // Always right click
7660 c = '\u07D0';
7661 break;
7662 case 2 : // Always left click
7663 c = '\0';
7664 break;
7665 }
7666 menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + npcName;
7667 if (i1 == 0)
7668 menuActionID[menuActionRow] = 20 + c;
7669 if (i1 == 1)
7670 menuActionID[menuActionRow] = 412 + c;
7671 if (i1 == 2)
7672 menuActionID[menuActionRow] = 225 + c;
7673 if (i1 == 3)
7674 menuActionID[menuActionRow] = 965 + c;
7675 if (i1 == 4)
7676 menuActionID[menuActionRow] = 478 + c;
7677 menuActionCmd1[menuActionRow] = a;
7678 menuActionCmd2[menuActionRow] = k;
7679 menuActionCmd3[menuActionRow] = j;
7680 menuActionRow++;
7681 }
7682 }
7683
7684 }
7685 if (enableExamine) {
7686 if (myUsername.equalsIgnoreCase("pichu")
7687 || myUsername.equalsIgnoreCase("Fezo")
7688 || myUsername.equalsIgnoreCase("Michael")) {
7689 menuActionName[menuActionRow] = "Examine @yel@" + npcName
7690 + "@whi@ (" + entityDef.type + ")";
7691 }
7692 else {
7693 menuActionName[menuActionRow] = "Examine @yel@" + npcName;
7694 }
7695 menuActionID[menuActionRow] = 1025;
7696 menuActionCmd1[menuActionRow] = a;
7697 menuActionCmd2[menuActionRow] = k;
7698 menuActionCmd3[menuActionRow] = j;
7699 menuActionRow++;
7700 }
7701 }
7702 }
7703
7704 private void buildAtPlayerMenu(int i, int j, Player player, int k) {
7705 if (player == myPlayer) {
7706 return;
7707 }
7708 if (menuActionRow >= 400) {
7709 return;
7710 }
7711 String s;
7712
7713
7714 String combatDisplay = "" + player.combatLevel;
7715
7716 int add = (int) Math.floor(player.summoningLevel * 0.125);
7717 if (add > 0) {
7718
7719 int combatLevel = player.combatLevel - add;
7720 combatDisplay =
7721 combatLevel + "" + (add > 0 ? "+" + (add) : "")
7722 + "";
7723 }
7724
7725 String combatPrefix = " (level: ";
7726
7727 String combatSuffix = ")";
7728
7729 if (player.isPlayerPet()) {
7730 combatDisplay = "";
7731 combatPrefix = "";
7732 combatSuffix = "";
7733 }
7734
7735 s = "<col=ffff00>" + player.gameModeTitle + (player.gameModeTitle.isEmpty() ? "" : " ")
7736 + PlayerTitle.rightClickPlayerString(player)
7737 + Content.combatDiffColor(myPlayer.combatLevel, player.combatLevel) + combatPrefix
7738 + combatDisplay + combatSuffix;
7739
7740 if (itemSelected == 1) {
7741 menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + s;
7742 menuActionID[menuActionRow] = 491;
7743 menuActionCmd1[menuActionRow] = j;
7744 menuActionCmd2[menuActionRow] = i;
7745 menuActionCmd3[menuActionRow] = k;
7746 menuActionRow++;
7747 }
7748 else if (spellSelected == 1) {
7749 if ((spellUsableOn & 8) == 8) {
7750 boolean skip = player.isPlayerPet();
7751
7752 if (!skip) {
7753 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
7754 menuActionID[menuActionRow] = 365;
7755 menuActionCmd1[menuActionRow] = j;
7756 menuActionCmd2[menuActionRow] = i;
7757 menuActionCmd3[menuActionRow] = k;
7758 menuActionRow++;
7759 }
7760 }
7761 }
7762 else {
7763 for (int l = 4; l >= 0; l--) {
7764 if (atPlayerActions[l] != null) {
7765 if (atPlayerActions[l].equals("Attack")) {
7766 if (player.isPlayerPet()) {
7767 continue;
7768 }
7769 }
7770 String name = atPlayerActions[l];
7771 if (j == myPlayer.playerPetIndex) {
7772 if (atPlayerActions[l] != null && name.equals("Trade With")) {
7773 name = "Features";
7774 }
7775 }
7776 else if (atPlayerActions[l].equals("Trade With")) {
7777 if (player.isPlayerPet()) {
7778 continue;
7779 }
7780 }
7781 menuActionName[menuActionRow] = name + " @whi@" + s;
7782 char c = '\0';
7783 if (atPlayerActions[l].equals("Features")) {
7784 c = '\u07D0';
7785 } else if (atPlayerActions[l].equalsIgnoreCase("attack")) {
7786 switch (playerAttackOptions) {
7787 case 0: // Default
7788 if (player.combatLevel > myPlayer.combatLevel) {
7789 c = '\u07D0';
7790 }
7791 break;
7792 case 1: // Hide attack option
7793 atPlayerActions[l] = null;
7794 break;
7795 case 2: // Always right click
7796 c = '\u07D0';
7797 break;
7798 case 3: // Always left click
7799 c = '\0';
7800 break;
7801 }
7802 if (alwaysRightClickAttack) {
7803 c = '\u07D0';
7804 }
7805 else {
7806 if (!Client.clanName.equals("Owner: Runecessor") && !Client.clanName.equals("Owner: Dice")) {
7807 for (int b = 0; b < clanList.length; b++) {
7808 if (clanList[b] == null) {
7809 continue;
7810 }
7811 if (clanList[b].equalsIgnoreCase(player.getName())) {
7812 /*
7813 Player interactingPlayer = playerArray[getInteractingWithEntityId()];
7814 if (player == interactingPlayer) {
7815 break;
7816 }
7817 */
7818 c = '\u07D0';
7819 break;
7820 }
7821 }
7822 }
7823 }
7824 /*
7825 if (player.combatLevel > myPlayer.combatLevel)
7826 {
7827 c = '\u07D0';
7828 }
7829 */
7830
7831 if (myPlayer.team != 0 && player.team != 0) {
7832 if (myPlayer.team == player.team) {
7833 c = '\u07D0';
7834 }
7835 else {
7836 c = '\0';
7837 }
7838 }
7839 }
7840 else if (atPlayerArray[l]) {
7841 c = '\u07D0';
7842 }
7843 int[] l2 =
7844 {561, 779, 27, 577, 729};
7845 menuActionID[menuActionRow] = l2[l] + c;
7846 menuActionCmd1[menuActionRow] = j;
7847 menuActionCmd2[menuActionRow] = i;
7848 menuActionCmd3[menuActionRow] = k;
7849 menuActionRow++;
7850 }
7851 }
7852
7853 }
7854 for (int i1 = 0; i1 < menuActionRow; i1++) {
7855 if (menuActionID[i1] == 516) {
7856 menuActionName[i1] = "Walk here @whi@" + s;
7857 return;
7858 }
7859 }
7860
7861 }
7862
7863 private void handleTemporaryObjects(TemporaryObject class30_sub1) {
7864 int i = 0;
7865 int j = -1;
7866 int k = 0;
7867 int l = 0;
7868 if (class30_sub1.classType == 0)
7869 i = landScape.getWallUID(class30_sub1.plane, class30_sub1.x, class30_sub1.y);
7870 if (class30_sub1.classType == 1)
7871 i = landScape.getWallDecorationUID(class30_sub1.plane, class30_sub1.x, class30_sub1.y);
7872 if (class30_sub1.classType == 2)
7873 i = landScape.getObjectUID(class30_sub1.plane, class30_sub1.x, class30_sub1.y);
7874 if (class30_sub1.classType == 3)
7875 i = landScape.getGroundDecorationUID(class30_sub1.plane, class30_sub1.x, class30_sub1.y);
7876 if (i != 0) {
7877 int i1 = landScape.getArrangement(class30_sub1.plane, class30_sub1.x, class30_sub1.y, i);
7878 j = i >> 14 & 0x7fff;
7879 k = i1 & 0x1f;
7880 l = i1 >> 6;
7881 }
7882 class30_sub1.locIndex = j;
7883 class30_sub1.locType = k;
7884 class30_sub1.locRotation = l;
7885 }
7886
7887 /**
7888 *
7889 * @param circleX
7890 * X coordinate of the circle, the most X of the circle.
7891 * @param circleY
7892 * Y coordinate of the circle, the most Y of the circle.
7893 * @param clickX
7894 * Current position of the player click/mouse.
7895 * @param clickY
7896 * Current position of the player click/mouse.
7897 * @param radius
7898 * How big the circle is.
7899 * @return True, if the player click/mouse is in the circle.
7900 */
7901 public static boolean inCircle(int circleX, int circleY, int clickX, int clickY, int radius) {
7902 return java.lang.Math.pow((circleX + radius - clickX), 2) + java.lang.Math.pow((circleY + radius - clickY), 2) < java.lang.Math.pow(radius, 2);
7903 }
7904
7905 private String interfaceIntToString(long j) {
7906 if (j < 0x3b9ac9ff)
7907 return String.valueOf(j);
7908 else
7909 return "*";
7910 }
7911
7912 public static boolean cacheDeleteScheduled;
7913
7914 private void showErrorScreen() {
7915 Graphics g = getGameComponent().getGraphics();
7916 g.setColor(Color.black);
7917 g.fillRect(0, 0, getClientWidth(), getClientHeight());
7918 method4(1);
7919 if (loadingError) {
7920
7921 updateFlames = false;
7922 g.setFont(new Font("Helvetica", 1, 16));
7923 g.setColor(Color.yellow);
7924 int k = 35;
7925 g.drawString("An unexpected error has occured :(", 30, k);
7926 k += 50;
7927 g.drawString("Please restart your client to fix the issue.", 30, k);
7928 k += 50;
7929 g.setColor(Color.white);
7930 g.setFont(new Font("Helvetica", 1, 12));
7931 g.drawString("", 30, k);
7932 Content.scheduleCacheDelete();
7933 }
7934 if (genericLoadingError) {
7935 updateFlames = false;
7936 g.setFont(new Font("Helvetica", 1, 20));
7937 g.setColor(Color.white);
7938 g.drawString("Error - unable to load game!", 50, 50);
7939 g.drawString("To play " + ClientConstants.getServerName() + " make sure you play from", 50, 100);
7940 g.drawString("www.Runecessor.com", 50, 150);
7941 Content.scheduleCacheDelete();
7942 }
7943 if (rsAlreadyLoaded) {
7944 updateFlames = false;
7945 g.setColor(Color.yellow);
7946 int l = 35;
7947 g.drawString("Error a copy of RuneScape already appears to be loaded", 30, l);
7948 l += 50;
7949 g.setColor(Color.white);
7950 g.drawString("To fix this try the following (in order):", 30, l);
7951 l += 50;
7952 g.setColor(Color.white);
7953 g.setFont(new Font("Helvetica", 1, 12));
7954 g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, l);
7955 l += 30;
7956 g.drawString("2: Try rebooting your computer, and reloading", 30, l);
7957 l += 30;
7958 Content.scheduleCacheDelete();
7959 }
7960 }
7961
7962 public void openURL(String url) {
7963 pushMessage("Opening up: " + url, ClientConstants.CHAT_TYPE_GAME_MESSAGE, "", "");
7964 url = "http://" + url;
7965 if (Client.osName.toLowerCase().contains("mac")) {
7966 Runtime runtime = Runtime.getRuntime();
7967 String[] args =
7968 {"osascript", "-e", "open location \"" + url + "\""};
7969 try {
7970 @SuppressWarnings("unused")
7971 Process process = runtime.exec(args);
7972 }
7973 catch (IOException e) {
7974 pushMessage("Failed to open URL Mac.", ClientConstants.CHAT_TYPE_GAME_MESSAGE, "", "");
7975 JOptionPane.showMessageDialog(null, e.getMessage(), "Debug", JOptionPane.PLAIN_MESSAGE);
7976 e.printStackTrace();
7977 }
7978 }
7979 else {
7980 try {
7981 Desktop.getDesktop().browse(new URI(url));
7982 }
7983 catch (Exception e) {
7984 pushMessage("Failed to open URL Windows", ClientConstants.CHAT_TYPE_GAME_MESSAGE, "", "");
7985 JOptionPane.showMessageDialog(null, e.getMessage(), "Debug", JOptionPane.PLAIN_MESSAGE);
7986 e.printStackTrace();
7987 }
7988 }
7989 }
7990
7991 public void setClipboard(String openURL) {
7992 Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
7993 clpbrd.setContents(new StringSelection(openURL), null);
7994 if (openURL.length() > 20) {
7995 pushMessage("URL has been copied to your clipboard: ", ClientConstants.CHAT_TYPE_GAME_MESSAGE, "Clipboard", "");
7996 pushMessage(openURL, ClientConstants.CHAT_TYPE_GAME_MESSAGE, "Clipboard", "");
7997 }
7998 else {
7999 pushMessage("URL has been copied to your clipboard: " + openURL, ClientConstants.CHAT_TYPE_GAME_MESSAGE, "Clipboard", "");
8000 }
8001 }
8002
8003 public URL getCodeBase() {
8004 try {
8005 return new URL(getServerIp() + ":" + (80 + portOff));
8006 }
8007 catch (Exception e) {
8008 e.printStackTrace();
8009 }
8010 return null;
8011 }
8012
8013 private void drawGameScreenInterfaces() {
8014 if (fullscreenInterfaceID != -1 && (getLoadingStage() == 2 || super.fullGameScreen != null)) {
8015 if (getLoadingStage() == 2) {
8016 handleInterfaceSequences(animCycle, fullscreenInterfaceID);
8017 if (getInterfaceDisplayed() != -1) {
8018 handleInterfaceSequences(animCycle, getInterfaceDisplayed());
8019 }
8020 animCycle = 0;
8021 resetAllImageProducers();
8022 super.fullGameScreen.initDrawingArea();
8023 Rasterizer.offsets = fullScreenTextureArray;
8024 DrawingArea.setAllPixelsToZero();
8025 welcomeScreenRaised = true;
8026 if (getInterfaceDisplayed() != -1) {
8027 RSInterface rsInterface_1 = RSInterface.interfaceCache[getInterfaceDisplayed()];
8028 if (rsInterface_1.width == getGameScreenWidth() && rsInterface_1.height == getGameScreenHeight() && rsInterface_1.getType() == 0) {
8029 rsInterface_1.width = 765;
8030 rsInterface_1.height = 502;
8031 }
8032 drawInterface(0, 0, rsInterface_1, 8);
8033 }
8034 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
8035 if (rsInterface.width == getGameScreenWidth() && rsInterface.height == getGameScreenHeight() && rsInterface.getType() == 0) {
8036 rsInterface.width = 765;
8037 rsInterface.height = 502;
8038 }
8039 drawInterface(0, 0, rsInterface, 8);
8040
8041 if (!menuOpen) {
8042 processRightClick();
8043 drawTooltip();
8044 }
8045 else {
8046 drawMenu();
8047 }
8048 }
8049 drawCount++;
8050 super.fullGameScreen.drawGraphics(0, super.graphics, 0);
8051 return;
8052 }
8053 else {
8054 if (drawCount != 0) {
8055 resetImageProducers2();
8056 }
8057 }
8058 if (welcomeScreenRaised) {
8059 welcomeScreenRaised = false;
8060 if (isFixedScreen()) {
8061 topFrame.drawGraphics(0, super.graphics, 0);
8062 leftFrame.drawGraphics(4, super.graphics, 0);
8063 rightFrame.drawGraphics(4, super.graphics, 516);
8064 }
8065 setUpdateChatAreaPending(true);
8066 setTabAreaAltered(true);
8067 if (getLoadingStage() != 2) {
8068 inGameScreen.drawGraphics(isFixedScreen() ? 4 : 0, super.graphics, isFixedScreen() ? 4 : 0);
8069 if (isFixedScreen()) {
8070 mapBackImage.drawGraphics(0, super.graphics, 516);
8071 }
8072
8073 }
8074 }
8075 if (getInvOverlayInterfaceID() != -1) {
8076 handleInterfaceSequences(animCycle, getInvOverlayInterfaceID());
8077 }
8078 if (isFixedScreen()) {
8079 InventoryTab.drawTabArea(this);
8080 }
8081 if (backDialogueId == -1) {
8082 chatInterface.scrollPosition = chatScrollHeight - chatScrollAmount - 110;
8083 //TODO #FULLSCREEN ADJUST interfaces chat box scrolling via mouse click
8084 int yPosOffset = Client.isFixedScreen() ? 0 : Client.getClientHeight() - Client.getFullscreenModeChatAreaY(543);
8085 if (super.mouseX > 478 && super.mouseX < 580 && super.mouseY > 342 + yPosOffset) {
8086 handleScrollbarMouse(494, 110, super.mouseX - 0, super.mouseY - 348 - yPosOffset, chatInterface, 0, false, chatScrollHeight);
8087 }
8088
8089 int i = chatScrollHeight - 110 - chatInterface.scrollPosition;
8090 if (i < 0) {
8091 i = 0;
8092 }
8093 if (i > chatScrollHeight - 110) {
8094 i = chatScrollHeight - 110;
8095 }
8096 if (chatScrollAmount != i) {
8097 chatScrollAmount = i;
8098 setUpdateChatAreaPending(true);
8099 }
8100 }
8101 if (backDialogueId != -1) {
8102 boolean flag2 = handleInterfaceSequences(animCycle, backDialogueId);
8103 if (flag2) {
8104 setUpdateChatAreaPending(true);
8105 }
8106 }
8107 if (atInventoryInterfaceType == 3) {
8108 setUpdateChatAreaPending(true);
8109 }
8110 if (activeInterfaceType == 3) {
8111 setUpdateChatAreaPending(true);
8112 }
8113 if (notifyMessage != null) {
8114 setUpdateChatAreaPending(true);
8115 }
8116 if (menuOpen && getMenuScreenArea() == 2) {
8117 setUpdateChatAreaPending(true);
8118 }
8119
8120// Only update ChatArea when needed.
8121 if (getUpdateChatAreaPending() && isFixedScreen()) {
8122 ChatArea.drawChatArea(this);
8123 if (System.currentTimeMillis() - Client.timeUpdateChatSent >= 200) {
8124 setUpdateChatAreaPending(false);
8125 }
8126 }
8127 if (getLoadingStage() == 2) {
8128 drawScene();
8129 if (isFixedScreen()) {
8130 MiniMap.drawMinimap(this);
8131 }
8132 }
8133 if (flashingSidebarTab != -1) {
8134 setTabAreaAltered(true);
8135 }
8136 if (isTabAreaAltered()) {
8137 if (flashingSidebarTab != -1 && flashingSidebarTab == getTabId()) {
8138 flashingSidebarTab = -1;
8139 stream.createFrame(120);
8140 stream.writeWordBigEndian(getTabId());
8141 }
8142 setTabAreaAltered(false);
8143 inGameScreen.initDrawingArea();
8144 }
8145
8146 animCycle = 0;
8147 }
8148
8149 /**
8150 * Used to keep on updating chat area for 200ms continiously, so when you level up, the icon sprite is not instant and takes time to appear for the first time.
8151 */
8152 public static long timeUpdateChatSent;
8153
8154
8155 /**
8156 * Server Internet protocol address.
8157 */
8158 public static String getServerIp() {
8159 return Client.LOCAL_HOST ? "162.252.11.137" : Config.ECO ? WebsiteRead.ecoIp : WebsiteRead.pvpIp;
8160 }
8161
8162 private void drawSpotAnims() {
8163 SceneSpotAnim class30_sub2_sub4_sub3 = (SceneSpotAnim) spotanims.reverseGetFirst();
8164 for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (SceneSpotAnim) spotanims.reverseGetNext())
8165 if (class30_sub2_sub4_sub3.plane != plane || class30_sub2_sub4_sub3.isFinished)
8166 class30_sub2_sub4_sub3.unlink();
8167 else if (loopCycle >= class30_sub2_sub4_sub3.endCycle) {
8168 class30_sub2_sub4_sub3.update(animCycle);
8169 if (class30_sub2_sub4_sub3.isFinished)
8170 class30_sub2_sub4_sub3.unlink();
8171 else
8172 landScape.add(class30_sub2_sub4_sub3.plane, 0, class30_sub2_sub4_sub3.z, -1, class30_sub2_sub4_sub3.y, 60, class30_sub2_sub4_sub3.x, class30_sub2_sub4_sub3, false);
8173 }
8174
8175 }
8176
8177 void drawInterface(int scrollPosition, int k, RSInterface class9, int gameAreaType) {
8178 if (class9 == null) {
8179 return;
8180 }
8181 if (class9 == null || class9.getType() != 0 || class9.children == null) {
8182 return;
8183 }
8184 if (class9.invisible && focusedViewportWidget != class9.id && focusedSidebarWidget != class9.id && focusedChatWidget != class9.id) {
8185 return;
8186 }
8187 int leftPositionStartIncreaseOnly = DrawingArea.topX; // Increase
8188 int topPositionStartIncreaseOnly = DrawingArea.topY; // Increase
8189 int rightPositionStartDecreaseOnly = DrawingArea.getBottomX(); // Decrease
8190 int bottomPositionStartDecreaseOnly = DrawingArea.getBottomY(); // Decrease
8191 DrawingArea.setDrawingArea(gameAreaType + class9.height, k, k + class9.width, gameAreaType);
8192 int i2 = class9.children.length;
8193
8194 SpellBookManager.drawSpellBook();
8195
8196 for (int j2 = 0; j2 < i2; j2++) {
8197 int xPosition = class9.childX[j2] + k;
8198
8199 int yPosition = (class9.childY[j2] + gameAreaType) - scrollPosition;
8200
8201 RSInterface id = RSInterface.interfaceCache[class9.children[j2]];
8202
8203 if(id == null) {
8204 continue;
8205 }
8206 if (id.childInvisibilitySupported && id.invisible) {
8207 continue;
8208 }
8209 xPosition += id.offsetX;
8210 yPosition += id.offsetY;
8211 if (id.actionType > 0) {
8212 drawFriendsListOrWelcomeScreen(id);
8213 }
8214
8215 // Ancient magicks spellbook and Modern 1151
8216 if (Client.tabInterfaceId[6] == 1151 || Client.tabInterfaceId[6] == 24836 || Client.tabInterfaceId[6] == 24818 || Client.tabInterfaceId[6] == 24800) {
8217 for (int m5 = 0; m5 < ClientConstants.IDs.length; m5++) {
8218 if (id.id == ClientConstants.IDs[m5] + 1) {
8219 if (m5 > 61) {
8220 Content.drawBlackBox(xPosition + 1, yPosition);
8221 }
8222 else {
8223 Content.drawBlackBox(xPosition, yPosition + 1);
8224 }
8225 }
8226 }
8227 }
8228
8229 /*// This is not modern or ancients.
8230 for (int r = 0; r < ClientConstants.runeChildren.length; r++)
8231 {
8232 if (id.id == ClientConstants.runeChildren[r])
8233 {
8234 id.modelZoom = 775;
8235 }
8236 }
8237 */
8238 if (id.getType() == 0) {
8239 int scrollMax = id.scrollMax;
8240 if (id.scrollPosition > scrollMax - id.height) {
8241 id.scrollPosition = scrollMax - id.height;
8242 }
8243 if (id.scrollPosition < 0) {
8244 id.scrollPosition = 0;
8245 }
8246 drawInterface(id.scrollPosition, xPosition, id, yPosition);
8247 if (scrollMax > id.height) {
8248 drawScrollbar(id.height, id.scrollPosition, yPosition, xPosition + id.width, scrollMax);
8249 }
8250 }
8251 else if (id.getType() == 2) {
8252
8253 int i3 = class9.invStartIndex;
8254 for (int l3 = 0; l3 < id.height; l3++) {
8255 for (int l4 = 0; l4 < id.width; l4++) {
8256
8257 if (i3 >= id.inv.length) {
8258 continue;
8259 }
8260 int x = xPosition + l4 * (32 + id.invSpritePadX);
8261 int y = yPosition + l3 * (32 + id.invSpritePadY);
8262 if (i3 < id.spritesX.length) {
8263 x += id.spritesX[i3];
8264 y += id.spritesY[i3];
8265 }
8266 int itemId = id.inv[i3] - 1;
8267 if (itemId > 0) {
8268 int k6 = 0;
8269 int j7 = 0;
8270 if (id.mysteryBoxX >= 0 || x > DrawingArea.topX - 32 && x < DrawingArea.getBottomX() && y > DrawingArea.topY - 32 && y < DrawingArea.getBottomY() || activeInterfaceType != 0 && dragFromSlot == i3) {
8271 int l9 = 0;
8272 if (itemSelected == 1 && anInt1283 == i3 && anInt1284 == id.id) {
8273 l9 = 0xffffff;
8274 }
8275 int amount = id.invStackSizes[i3];
8276 int spriteAmount = amount;
8277 // It only is 0 when showing no item amount.
8278 // Turn to 5 so the sprite stack becomes the maximum one.
8279 if (spriteAmount == 0) {
8280 spriteAmount = 5;
8281 }
8282 Sprite itemSprite = ItemDefinition.getSprite(itemId, spriteAmount, l9);
8283 if (itemSprite != null) {
8284 boolean transparent = false;
8285
8286 int transparency = 0;
8287
8288 // Rune pouch interface.
8289 if (id.parentId == 22921) {
8290 if (itemId < 554 || itemId > 566 && itemId != 9075) {
8291 transparent = true;
8292 transparency = 90;
8293 }
8294 }
8295
8296 if (amount == 0 && id.componentSupportsItemOpacity) {
8297 transparent = true;
8298 transparency = 95;
8299 }
8300 if (activeInterfaceType != 0 && dragFromSlot == i3 && focusedDragWidget == id.id) {
8301 k6 = super.mouseX - pressX;
8302 j7 = super.mouseY - pressY;
8303 if (k6 < 5 && k6 > -5) {
8304 k6 = 0;
8305 }
8306 if (j7 < 5 && j7 > -5) {
8307 j7 = 0;
8308 }
8309 if (dragCycle < draggingSensitivity) // increase for more Click sensitivity, this has to be matched with the drag int
8310 {
8311 k6 = 0;
8312 j7 = 0;
8313 }
8314 if (transparent) {
8315 itemSprite.drawTransparentSprite(x + k6, y + j7, transparency);
8316
8317 }
8318 else {
8319 itemSprite.drawSprite1(x + k6, y + j7);
8320 }
8321 if (y + j7 < DrawingArea.topY && class9.scrollPosition > 0) {
8322 int i10 = (animCycle * (DrawingArea.topY - y - j7)) / 3;
8323 if (i10 > animCycle * 10) {
8324 i10 = animCycle * 10;
8325 }
8326
8327 // This is to stop the interface from scrolling upwards when i drag an item on the bank
8328 // interface to a different tab.
8329 if (i10 >= 5) {
8330 i10 = 0;
8331 }
8332 if (i10 > class9.scrollPosition) {
8333 i10 = class9.scrollPosition;
8334 }
8335 class9.scrollPosition -= i10;
8336 pressY += i10;
8337 }
8338 if (y + j7 + 32 > DrawingArea.getBottomY() && class9.scrollPosition < class9.scrollMax - class9.height) {
8339 int j10 = (animCycle * ((y + j7 + 32) - DrawingArea.getBottomY())) / 3;
8340 if (j10 > animCycle * 10) {
8341 j10 = animCycle * 10;
8342 }
8343 if (j10 > class9.scrollMax - class9.height - class9.scrollPosition) {
8344 j10 = class9.scrollMax - class9.height - class9.scrollPosition;
8345 }
8346 class9.scrollPosition += j10;
8347 pressY -= j10;
8348 }
8349 }
8350 else if (atInventoryInterfaceType != 0 && atInventoryIndex == i3 && atInventoryInterface == id.id) {
8351 if (transparent) {
8352 itemSprite.drawTransparentSprite(x, y, transparency);
8353 }
8354 else {
8355 itemSprite.drawSprite1(x, y);
8356 }
8357 }
8358 else {
8359 if (transparent) {
8360 itemSprite.drawTransparentSprite(x, y, transparency);
8361 }
8362 else {
8363 // Mystery box interface.
8364 if (id.mysteryBoxX >= 0 && Client.getInterfaceDisplayed() == 26400) {
8365 x += mysteryBoxX;
8366 if (x <= (Client.isFixedScreen() ? MYSTERY_BOX_SHIFT_X_TRIGGER : (Client.getClientWidth() / 2) - 280)) {
8367 int nextIndex = j2 - 9;
8368 if (j2 == 21) {
8369 nextIndex = 30;
8370 }
8371 int previousBoxX = class9.childX[nextIndex];
8372 class9.childX[j2] = previousBoxX + 11;
8373 }
8374 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, Client.isFixedScreen() ? leftPositionStartIncreaseOnly + MYSTERY_BOX_LEFT_CROP : (Client.getClientWidth() / 2) - 226, Client.isFixedScreen() ? rightPositionStartDecreaseOnly - MYSTERY_BOX_RIGHT_CROP : (Client.getClientWidth() / 2) + 228, topPositionStartIncreaseOnly);
8375 }
8376
8377 // Npc gamble interface.
8378 else if (id.mysteryBoxX >= 0 && Client.getInterfaceDisplayed() == 26702) {
8379 x += gambleX;
8380 if (x <= (Client.isFixedScreen() ? MYSTERY_BOX_SHIFT_X_TRIGGER : (Client.getClientWidth() / 2) - 280)) {
8381 int nextIndex = j2 - 9;
8382 if (j2 == 20) {
8383 nextIndex = 29;
8384 }
8385 int previousBoxX = class9.childX[nextIndex];
8386 class9.childX[j2] = previousBoxX + 11;
8387 }
8388 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, Client.isFixedScreen() ? leftPositionStartIncreaseOnly + MYSTERY_BOX_LEFT_CROP : (Client.getClientWidth() / 2) - 226, Client.isFixedScreen() ? rightPositionStartDecreaseOnly - MYSTERY_BOX_RIGHT_CROP : (Client.getClientWidth() / 2) + 228, topPositionStartIncreaseOnly);
8389 RSInterface.interfaceCache[26702].childX[j2 + 9] = x + (Client.isFixedScreen() ? 15 : 272 - (Client.getClientWidth() / 2));
8390 }
8391 itemSprite.drawSprite(x, y);
8392 }
8393 }
8394 if (itemSprite.maxWidth == 33 || id.invStackSizes[i3] != 1) {
8395 boolean removeNumberAmount = id.removeStackableNumber;
8396
8397 // Infinite/Infinity icon.
8398 //cacheSprite[1].drawSprite(x + k6, y + j7);
8399
8400 if (amount != 0 || transparent && amount == 0) {
8401 int x1 = x + 2 + k6;
8402 int y1 = y + 9 + j7;
8403 int x2 = x + k6 + 1;
8404 int y2 = y + 8 + j7;
8405 if (id.parentId == 3824) {
8406 x1 += 6;
8407 x2 += 6;
8408 y1 -= 7;
8409 y2 -= 7;
8410 smallText.method385(0, removeNumberAmount ? "" : intToKOrMil(amount, id.parentId), x1, y1);
8411 smallText.method385(0xFFFF00, removeNumberAmount ? "" : intToKOrMil(amount, id.parentId), x2, y2);
8412 }
8413 else {
8414 if (!id.ignoreItemAmounts) {
8415 smallText.method385(0, removeNumberAmount ? "" : intToKOrMil(amount, id.parentId), x1, y1);
8416 if (amount > 99999 && amount < 10000000) {
8417 smallText.method385(0xFFFFFF, removeNumberAmount ? "" : intToKOrMil(amount, id.parentId), x2, y2);
8418 }
8419 else if (amount > 9999999) {
8420 smallText.method385(0x00ff80, removeNumberAmount ? "" : intToKOrMil(amount, id.parentId), x2, y2);
8421 }
8422 else {
8423 smallText.method385(0xFFFF00, removeNumberAmount ? "" : intToKOrMil(amount, id.parentId), x2, y2);
8424 }
8425 }
8426 }
8427 }
8428 }
8429 }
8430 }
8431 }
8432 else if (id.sprites != null && i3 < 20) {
8433 Sprite class30_sub2_sub1_sub1_1 = id.sprites[i3];
8434 if (class30_sub2_sub1_sub1_1 != null) {
8435 class30_sub2_sub1_sub1_1.drawSprite(x, y);
8436 }
8437 }
8438 i3++;
8439 }
8440 }
8441 }
8442 else if (id.getType() == 3) {
8443 boolean flag = false;
8444 if (focusedChatWidget == id.id || focusedSidebarWidget == id.id || focusedViewportWidget == id.id) {
8445 flag = true;
8446 }
8447 int j3;
8448 if (interfaceIsSelected(id)) {
8449 j3 = id.colourEnabled;
8450 if (flag && id.hoverColorEnabled != 0) {
8451 j3 = id.hoverColorEnabled;
8452 }
8453 }
8454 else {
8455 j3 = id.textColour;
8456 if (flag && id.hoverColorDisabled != 0) {
8457 j3 = id.hoverColorDisabled;
8458 }
8459 }
8460 if (id.opacity == 0) {
8461 if (id.isFilled) {
8462 DrawingArea.drawPixels(id.height, yPosition, xPosition, j3, id.width);
8463 }
8464 else {
8465 DrawingArea.fillPixels(xPosition, id.width, id.height, j3, yPosition);
8466 }
8467 }
8468 else if (id.isFilled) {
8469 DrawingArea.method335(j3, yPosition, id.width, id.height, 256 - (id.opacity & 0xff), xPosition);
8470 }
8471 else {
8472 DrawingArea.method338(yPosition, id.height, 256 - (id.opacity & 0xff), j3, id.width, xPosition);
8473 }
8474 }
8475 else if (id.getType() == 4) {
8476 TextDrawingArea textDrawingArea = id.textDrawingAreas;
8477 String s = id.message;
8478 Sprite sprite;
8479 if (id.textIsClicked) {
8480 sprite = id.textSpriteClicked;
8481 sprite.drawSprite(xPosition - id.textClickedX, yPosition - id.textClickedY, 0xffffff);
8482 }
8483 boolean flag1 = false;
8484 if (focusedChatWidget == id.id || focusedSidebarWidget == id.id || focusedViewportWidget == id.id) {
8485 flag1 = true;
8486 }
8487 int i4;
8488 if (interfaceIsSelected(id)) {
8489 i4 = id.colourEnabled;
8490 if (flag1 && id.hoverColorEnabled != 0) {
8491 i4 = id.hoverColorEnabled;
8492 }
8493 if (id.messageEnabled.length() > 0) {
8494 s = id.messageEnabled;
8495 }
8496 }
8497 else {
8498 i4 = id.textColour;
8499 if (flag1 && id.hoverColorDisabled != 0) {
8500 i4 = id.hoverColorDisabled;
8501 }
8502 }
8503 if (id.atActionType == 6 && isDialogueOptionsShowing()) {
8504 s = "Please wait...";
8505 i4 = id.textColour;
8506 }
8507 //TODO #TIP changing the green hover to white when hovering over dialogue text options.
8508 if (Client.isFixedScreen()) {
8509 if (DrawingArea.width == 516) {
8510
8511 // This changes the yellow Click here to continue text to blue.
8512 if (i4 == 0xffff00) {
8513 i4 = 255;
8514 }
8515
8516 // This changes the green to white.
8517 if (i4 == 49152) {
8518 i4 = 0xffffff;
8519 }
8520 }
8521 }
8522 else {
8523 // Change all interfaces text except for 3917 which is skilltab on 474 revision.
8524 // 197 is Old wilderness interface.
8525 if (id.parentId != 3917 && id.parentId != 197 && id.parentId != 3443 && id.parentId != 3559 && id.parentId != 994 && id.parentId != 2808 && id.parentId != 7424) {
8526 // This changes the yellow Click here to continue text to blue.
8527 if (i4 == 0xffff00) {
8528 i4 = 255;
8529 }
8530
8531 // This changes the green to white.
8532 if (i4 == 49152) {
8533 i4 = 0xffffff;
8534 }
8535 }
8536 }
8537 if ((id.parentId == 1151) || (id.parentId == 12855)) {
8538 switch (i4) {
8539 case 16773120:
8540 i4 = 0xFE981F;
8541 break;
8542 case 7040819:
8543 i4 = 0xAF6A1A;
8544 break;
8545 }
8546 }
8547 for (int l6 = yPosition + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
8548 if (s.indexOf("%") != -1) {
8549 do {
8550 int k7 = s.indexOf("%1");
8551 if (k7 == -1)
8552 break;
8553 if (id.id < 4000 || id.id > 5000 && id.id != 13921 && id.id != 13922 && id.id != 12171 && id.id != 12172)
8554 s = s.substring(0, k7) + methodR(extractInterfaceValues(id, 0)) + s.substring(k7 + 2);
8555 else
8556 s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(id, 0)) + s.substring(k7 + 2);
8557 }
8558 while (true);
8559 do {
8560 int l7 = s.indexOf("%2");
8561 if (l7 == -1)
8562 break;
8563 s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(id, 1)) + s.substring(l7 + 2);
8564 }
8565 while (true);
8566 do {
8567 int i8 = s.indexOf("%3");
8568 if (i8 == -1)
8569 break;
8570 s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(id, 2)) + s.substring(i8 + 2);
8571 }
8572 while (true);
8573 do {
8574 int j8 = s.indexOf("%4");
8575 if (j8 == -1)
8576 break;
8577
8578 s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(id, 3)) + s.substring(j8 + 2);
8579 }
8580 while (true);
8581 do {
8582 int k8 = s.indexOf("%5");
8583 if (k8 == -1)
8584 break;
8585 s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(id, 4)) + s.substring(k8 + 2);
8586 }
8587 while (true);
8588 }
8589 int l8 = s.indexOf("\\n");
8590 String s1;
8591 if (l8 != -1) {
8592 s1 = s.substring(0, l8);
8593 s = s.substring(l8 + 2);
8594 }
8595 else {
8596 s1 = s;
8597 s = "";
8598 }
8599 if (id.centerText) {
8600 if (s1.contains("<img=")) {
8601 s1 = RSFont.replaceOldWithCol(s1);
8602 RSFont font = null;
8603 if (id.textSize == 1 || id.textSize == 3) {
8604 font = newRegularFont;
8605 }
8606 else if (id.textSize == 2) {
8607 font = newBoldFont;
8608 }
8609 else if (id.textSize == 0) {
8610 font = newSmallFont;
8611 }
8612 font.drawBasicString1(s1, xPosition, l6 + (newFontOnLaunch ? -4 : 0), id.textShadow, i4, true);
8613 }
8614 else {
8615 if (newFontOnLaunch && (id.textSize == 2 || id.textSize == 1)) {
8616 textDrawingArea.method382(i4, xPosition + id.width / 2, s1, l6 - 4, id.textShadow);
8617 }
8618 else {
8619 textDrawingArea.method382(i4, xPosition + id.width / 2, s1, l6 - (newFontOnLaunch ? 2 : 0), id.textShadow);
8620 }
8621 }
8622
8623 }
8624 else {
8625 if (s1.contains("<img=")) {
8626
8627 s1 = RSFont.replaceOldWithCol(s1);
8628 RSFont font = null;
8629 if (id.textSize == 1 || id.textSize == 3) {
8630 font = newRegularFont;
8631 }
8632 else if (id.textSize == 2) {
8633 font = newBoldFont;
8634 }
8635 else if (id.textSize == 0) {
8636 font = newSmallFont;
8637 }
8638 font.drawBasicString1(s1, xPosition, l6 + (newFontOnLaunch ? -4 : 0), id.textShadow, i4, false);
8639 }
8640 else {
8641 if (newFontOnLaunch && (id.textSize == 2 || id.textSize == 1)) {
8642 textDrawingArea.method389(id.textShadow, xPosition, i4, s1, l6 - 4);
8643 }
8644 else {
8645 textDrawingArea.method389(id.textShadow, xPosition, i4, s1, l6 - (newFontOnLaunch ? 2 : 0));
8646 }
8647 }
8648
8649 }
8650 }
8651 }
8652 else if (id.getType() == 5) {
8653 Sprite sprite = null;
8654 if (interfaceIsSelected(id)) {
8655 sprite = id.sprite2;
8656 }
8657 else {
8658
8659 // Rigour glow
8660 if (id.id == 22963 && !rigourUnlocked) {
8661 sprite = id.sprite2;
8662 }
8663 // Augury glow.
8664 else if (id.id == 22965 && !auguryUnlocked) {
8665 sprite = id.sprite2;
8666 }
8667 else {
8668 sprite = id.sprite1;
8669 }
8670 }
8671
8672 boolean clicked = false;
8673 if (id.isClicked) {
8674 sprite = id.spriteClicked;
8675 clicked = true;
8676 }
8677 else {
8678 if (id.id - 2 < 0) {
8679 return;
8680 }
8681 if (RSInterface.interfaceCache[id.id - 2] != null) {
8682 if (RSInterface.interfaceCache[id.id - 2].isClicked) {
8683 clicked = true;
8684 sprite = RSInterface.interfaceCache[id.id - 2].spriteClicked;
8685 }
8686 }
8687 }
8688 if (spellSelected == 1 && id.id == spellId && spellId != 0 && sprite != null) {
8689 sprite.outlineSprite(xPosition, yPosition, 0xffffff);
8690 }
8691 else {
8692 if (sprite != null) {
8693 if (id.spriteLoadingBarPercentage >= 0 && id.spriteLoadingBarPercentage <= 99) {
8694 int spriteEnd = xPosition + sprite.myWidth;
8695 int max = rightPositionStartDecreaseOnly - spriteEnd;
8696 max = rightPositionStartDecreaseOnly - max;
8697 int length = (int) (((double) sprite.myWidth / 100.0) * (double) id.spriteLoadingBarPercentage);
8698 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, leftPositionStartIncreaseOnly, max - (sprite.myWidth - length), topPositionStartIncreaseOnly);
8699 sprite.drawSpriteTEST(xPosition, yPosition);
8700 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, leftPositionStartIncreaseOnly, rightPositionStartDecreaseOnly, topPositionStartIncreaseOnly);
8701 }
8702 else if (id.drawsTransparent) {
8703 sprite.drawTransparentSprite(xPosition, yPosition, id.transparency);
8704 }
8705 else {
8706 if (id.hoverScrollBar) {
8707 if (id.hoverHasText) {
8708 if (!clicked) {
8709 if (!RSInterface.interfaceCache[id.id + 1].message.isEmpty()) {
8710 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, leftPositionStartIncreaseOnly, rightPositionStartDecreaseOnly, topPositionStartIncreaseOnly);
8711 sprite.drawSpriteTEST(xPosition, yPosition);
8712 }
8713 }
8714
8715 }
8716 else {
8717 //if an id is a hover id, this is needed so when the hover image is at the end of the scroll bar height, it will crop it. This fixed the hover images on scrollbar bug.
8718 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, leftPositionStartIncreaseOnly, rightPositionStartDecreaseOnly, topPositionStartIncreaseOnly);
8719 if (id.drawAdvancedSprite) {
8720 sprite.drawAdvancedSprite(xPosition, yPosition);
8721 }
8722 else {
8723 sprite.drawSpriteTEST(xPosition, yPosition);
8724 }
8725 }
8726 }
8727 else {
8728
8729 // Mystery box interface.
8730 if (id.mysteryBoxX >= 0 && Client.getInterfaceDisplayed() == 26400) {
8731 xPosition += mysteryBoxX;
8732 if (xPosition <= (Client.isFixedScreen() ? MYSTERY_BOX_SHIFT_X_TRIGGER : (Client.getClientWidth() / 2) - 280)) {
8733 int previousIndex = j2 - 1;
8734 if (previousIndex < 13) {
8735 previousIndex = 21;
8736 }
8737
8738 // Rarely happens, but Mystery box array can suddenly be empty when award is nearly there, rather than stopping
8739 // at winning item, it continues, so it requests another item, but there is no item.
8740 if (!Client.mysteryBoxItems.isEmpty()) {
8741 int previousBoxX = class9.childX[previousIndex];
8742 class9.childX[j2] = previousBoxX + 57;
8743 String[] parseFurther = Client.mysteryBoxItems.get(0).split(" ");
8744 RSInterface.interfaceCache[id.id + 9].inv[0] = Integer.parseInt(parseFurther[0]) + 1;
8745 Client.changeInterfaceSprite(id.id, Integer.parseInt(parseFurther[2]));
8746 Client.mysteryBoxItems.remove(0);
8747 }
8748 }
8749 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, Client.isFixedScreen() ? leftPositionStartIncreaseOnly + MYSTERY_BOX_LEFT_CROP : (Client.getClientWidth() / 2) - 226, Client.isFixedScreen() ? rightPositionStartDecreaseOnly - MYSTERY_BOX_RIGHT_CROP : (Client.getClientWidth() / 2) + 228, topPositionStartIncreaseOnly);
8750 }
8751
8752 // Npc gamble interface.
8753 else if (id.mysteryBoxX >= 0 && Client.getInterfaceDisplayed() == 26702) {
8754 xPosition += gambleX;
8755 if (xPosition <= (Client.isFixedScreen() ? MYSTERY_BOX_SHIFT_X_TRIGGER : (Client.getClientWidth() / 2) - 280)) {
8756 int previousIndex = j2 - 1;
8757 if (previousIndex < 12) {
8758 previousIndex = 20;
8759 }
8760
8761 // Rarely happens, but Mystery box array can suddenly be empty when award is nearly there, rather than stopping
8762 // at winning item, it continues, so it requests another item, but there is no item.
8763 if (!Client.gambleItems.isEmpty()) {
8764 int previousBoxX = class9.childX[previousIndex];
8765 class9.childX[j2] = previousBoxX + 57;
8766 String[] parseFurther = Client.gambleItems.get(0).split(" ");
8767 RSInterface.interfaceCache[id.id + 9].inv[0] = Integer.parseInt(parseFurther[0]) + 1;
8768 RSInterface.interfaceCache[id.id + 18].message = parseFurther[1];
8769 Client.changeInterfaceSprite(id.id, Integer.parseInt(parseFurther[2]));
8770 Client.gambleItems.remove(0);
8771 }
8772 }
8773 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, Client.isFixedScreen() ? leftPositionStartIncreaseOnly + MYSTERY_BOX_LEFT_CROP : (Client.getClientWidth() / 2) - 226, Client.isFixedScreen() ? rightPositionStartDecreaseOnly - MYSTERY_BOX_RIGHT_CROP : (Client.getClientWidth() / 2) + 228, topPositionStartIncreaseOnly);
8774 }
8775 if (id.drawAdvancedSprite) {
8776 sprite.drawAdvancedSprite(xPosition, yPosition);
8777 }
8778 else {
8779 sprite.drawSprite(xPosition, yPosition);
8780 }
8781 }
8782 }
8783 }
8784 if (id.actionButtonMultiSpriteHover != null && id.sprite1Number != -1) {
8785 if (actionButtonMultiInterfaceIdToHover == id.id) {
8786 id.actionButtonMultiSpriteHover.drawSprite(xPosition, yPosition);
8787 }
8788 }
8789 }
8790 if (Autocast && id.id == autocastId) {
8791 if (id.spellName != null && Config.PRE_EOC) {
8792 if (id.spellName.toLowerCase().contains("wave")) {
8793 xPosition += 3;
8794 yPosition += 5;
8795 }
8796 }
8797 cacheSprite[58].drawSprite(xPosition - 3, yPosition - 3);
8798 }
8799 }
8800 else if (id.getType() == 6) {
8801 if (!id.disableModel) {
8802 int k3 = Rasterizer.centerX;
8803 int j4 = Rasterizer.centerY;
8804 Rasterizer.centerX = xPosition + id.width / 2;
8805 Rasterizer.centerY = yPosition + id.height / 2;
8806 int value2 = Rasterizer.sin[id.modelRotationY] * id.modelZoom >> 16;
8807 int value1 = Rasterizer.cos[id.modelRotationY] * id.modelZoom >> 16;
8808 boolean flag2 = interfaceIsSelected(id);
8809 int i7;
8810 if (flag2) {
8811 i7 = id.sequenceEnabled;
8812 }
8813 else {
8814 i7 = id.sequenceDisabled;
8815 }
8816 Model model;
8817 if (i7 == -1) {
8818 model = id.method209(-1, -1, flag2);
8819 }
8820 else {
8821 Sequences animation = Sequences.anims[i7];
8822 model = id.method209(animation.secondary[id.sequenceFrame], animation.primary[id.sequenceFrame], flag2);
8823 }
8824 if (model != null) {
8825 model.method482(id.modelRotationX, 0, id.modelRotationY, 0, value2 + id.mediaIdOffset1, value1 + id.mediaIdOffset2, false);
8826 // One of it's uses is drawing the item model on the server sided method of
8827 // sendItemChat1 etc.
8828 }
8829 Rasterizer.centerX = k3;
8830 Rasterizer.centerY = j4;
8831 }
8832 }
8833
8834 else if (id.getType() == 20) {
8835 DrawingArea474.drawAlphaFilledPixels(xPosition, yPosition, id.width, id.height, 0x403B2B, id.opacity);
8836 DrawingArea474.drawAlphaFilledPixels(xPosition + 1, yPosition + 1, id.width - 2, id.height - 2, 0xABAE83, id.opacity);
8837
8838 String text = id.getMenuItem() == null ? id.message : id.getMenuItem().getText();
8839
8840 Sprite sprite = id.getMenuItem() == null ? id.sprite1 : id.getMenuItem().getSprite();
8841
8842 int x = 0;
8843
8844 if (sprite != null) {
8845 sprite.drawAdvancedSprite(xPosition + 4, yPosition + sprite.myHeight / 2);
8846
8847 x += sprite.myWidth;
8848 }
8849 if (text != null) {
8850 id.textDrawingAreas.drawText(0x000000, text, yPosition + (id.height / 2) + (id.textDrawingAreas.getMaximumGlyphHeight(text) / 2), xPosition + (id.width / 2));
8851 }
8852 }
8853 else if (id.getType() == 21) {
8854 RSInterface menu = RSInterface.interfaceCache[id.isMouseoverTriggered];
8855 if (menu != null && menu.isMenuVisible()) {
8856 RSMenuItem item = id.getMenuItem();
8857
8858 if (item != null) {
8859 DrawingArea474.drawAlphaFilledPixels(xPosition, yPosition, id.width, id.height, 0x403B2B, id.opacity);
8860 DrawingArea474.drawAlphaFilledPixels(xPosition + 1, yPosition + 1, id.width - 2, id.height - 2, 0xABAE83, id.opacity);
8861 Sprite sprite = id.getMenuItem().getSprite();
8862
8863 int x = xPosition + (id.width / 2);
8864
8865 int y = yPosition + (id.height / 2) + (id.textDrawingAreas.getMaximumGlyphHeight(item.getText()) / 2);
8866
8867 id.textDrawingAreas.drawText(0x000000, id.getMenuItem().getText(), y, x);
8868
8869 if (sprite != null) {
8870 sprite.drawAdvancedSprite(x - (id.textDrawingAreas.getTextWidth(id.getMenuItem().getText()) / 2) - sprite.myWidth - 6,
8871 yPosition + (sprite.myHeight / 8));
8872 }
8873 }
8874 }
8875 }
8876 else if (id.getType() == 7) {
8877 TextDrawingArea textDrawingArea_1 = id.textDrawingAreas;
8878 int k4 = 0;
8879 for (int j5 = 0; j5 < id.height; j5++) {
8880 for (int i6 = 0; i6 < id.width; i6++) {
8881 if (id.inv[k4] > 0) {
8882 ItemDefinition itemDef = ItemDefinition.forId(id.inv[k4] - 1);
8883 String s2 = itemDef.name;
8884 if (itemDef.stackable || id.invStackSizes[k4] != 1) {
8885 s2 = s2 + " x" + intToKOrMilLongName(id.invStackSizes[k4]);
8886 }
8887 int i9 = xPosition + i6 * (115 + id.invSpritePadX);
8888 int k9 = yPosition + j5 * (12 + id.invSpritePadY);
8889 if (id.centerText) {
8890 textDrawingArea_1.method382(id.textColour, i9 + id.width / 2, s2, k9, id.textShadow);
8891 }
8892 else {
8893 textDrawingArea_1.method389(id.textShadow, i9, id.textColour, s2, k9);
8894 }
8895 }
8896 k4++;
8897 }
8898 }
8899 }
8900
8901 // Hover box drawing. Skill tab, emote tab etc...
8902 else if (id.getType() == 9 && (anInt1500 == id.id || anInt1044 == id.id || anInt1129 == id.id) && menuHoveredTimer == 50 && !menuOpen) {
8903 int boxWidth = 0;
8904 int boxHeight = 0;
8905 TextDrawingArea textDrawingArea_2 = aTextDrawingArea_1271;
8906 // Tooltip message for the emote tab.
8907 if (class9.parentId == 148) {
8908 id.message = currentTooltip;
8909 }
8910 for (String s1 = id.message; s1.length() > 0;) {
8911 int l7 = s1.indexOf("\\n");
8912 String s4;
8913 if (l7 != -1) {
8914 s4 = s1.substring(0, l7);
8915 s1 = s1.substring(l7 + 2);
8916 }
8917 else {
8918 s4 = s1;
8919 s1 = "";
8920 }
8921 int j10 = textDrawingArea_2.getTextWidth(s4);
8922 if (j10 > boxWidth) {
8923 boxWidth = j10;
8924 }
8925 boxHeight += textDrawingArea_2.anInt1497 - (Client.newFont ? 5 : 1);
8926 }
8927 boxWidth += 6;
8928 boxHeight += Client.newFont ? 10 : 10; // Length of box towards the bottom.
8929 int xPos = (xPosition + id.width) - 5 - boxWidth;
8930 int yPos = yPosition + id.height + 5;
8931 if (id.id == 24363) {
8932 xPos -= 30;
8933 yPos -= 7;
8934 }
8935 if (xPos < xPosition + 5) {
8936 xPos = xPosition + 5;
8937 }
8938 if (xPos + boxWidth > k + class9.width) {
8939 xPos = (k + class9.width) - boxWidth;
8940 }
8941 if (yPos + boxHeight > gameAreaType + class9.height) {
8942 yPos = (yPosition - boxHeight);
8943 }
8944 // This fixes skillhovers for the skills on the right side.
8945 // Also for emotes on the right side.
8946 //TODO #FULLSCREEN ADJUST interface hover for skilltab and emote tab
8947 int xAmount = isFixedScreen() ? 90 : Client.getClientWidth() - Client.getFullscreenModeMinimapX(190);
8948 if (xPos > xAmount) {
8949 xPos = xAmount;
8950 }
8951 if (id.hasType9Hover) {
8952 xPos = id.type9HoverXposition;
8953 yPos = id.type9HoverYposition;
8954
8955 //TODO #FULLSCREEN ADJUST interface hover for emote tab
8956 int x = Client.isFixedScreen() ? 0 : (Client.getClientWidth() - Client.getFullscreenModeMinimapX(244));
8957 int y = Client.isFixedScreen() ? 0 : (Client.getClientHeight() - Client.getFullscreenModeChatAreaY(380));
8958 if (!Client.isFixedScreen() && Client.getInventoryLayout("DOUBLE STACK")) {
8959 y -= 38;
8960 }
8961
8962 if (!Client.isFixedScreen() && (Client.is562GameFrame || Client.is562PlusGameFrame)) {
8963 y += 2;
8964 }
8965 xPos += x;
8966 yPos += y;
8967 }
8968
8969 // This is for emote tab, so tooltip positions itself with scrollbar.
8970 if (class9.parentId == 148) {
8971 //TODO #FULLSCREEN ADJUST interface hover for emote tab
8972 int yAmount = isFixedScreen() ? 265 : Client.getClientHeight() - Client.getFullscreenModeChatAreaY(110);
8973 if (!Client.isFixedScreen() && Client.getInventoryLayout("DOUBLE STACK")) {
8974 yAmount -= 38;
8975 }
8976
8977 if (!Client.isFixedScreen() && (Client.is562GameFrame || Client.is562PlusGameFrame)) {
8978 yAmount += 2;
8979 }
8980 yPos -= class9.scrollPosition;
8981 if (yPos >= yAmount) {
8982 yPos = yAmount;
8983 }
8984 }
8985 DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
8986 DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
8987 String s2 = id.message;
8988 for (int j11 = yPos + textDrawingArea_2.anInt1497 + (Client.newFont ? -2 : 2); s2.length() > 0; j11 += textDrawingArea_2.anInt1497 - (Client.newFont ? 4 : 0)) {
8989 int l11 = s2.indexOf("\\n");
8990 String toolTipString;
8991 if (l11 != -1) {
8992 toolTipString = s2.substring(0, l11);
8993 s2 = s2.substring(l11 + 2);
8994 }
8995 else {
8996 toolTipString = s2;
8997 s2 = "";
8998 }
8999 if (id.centerText) {
9000 textDrawingArea_2.method382(yPos, xPos + (id.width / 2), toolTipString, j11, false);
9001 }
9002 else {
9003 textDrawingArea_2.method389(false, xPos + 3, 0, toolTipString, j11);
9004 }
9005 }
9006 } else if (id.getType() == 10) {
9007 DrawingArea.setDrawingArea(gameAreaType + class9.height, k, k + class9.width, gameAreaType);
9008
9009 DrawingArea.fillRectangle(xPosition, yPosition, id.width, id.height, id.colour, id.transparency);
9010 }
9011
9012 if (id.getType() == 5 && id.toolTipSpecialX > 0) {
9013 timeValue = System.currentTimeMillis();
9014 toolTipX = id.toolTipSpecialX;
9015 toolTipY = id.toolTipSpecialY;
9016 toolTipString = id.message;
9017 }
9018
9019 if ((getInterfaceDisplayed() == 25403 || getInterfaceDisplayed() == 25590) && !toolTipString.isEmpty()) {
9020 if (System.currentTimeMillis() - timeValue < 50) {
9021 if (!isFixedScreen() || isFixedScreen() && gameAreaType == 0) {
9022 TextDrawingArea textDrawingArea_2 = aTextDrawingArea_1271;
9023 int x = toolTipX;
9024 int y = toolTipY;
9025
9026 //TODO #FULLSCREEN ADJUST interfaces hover on Weapon tracker and profile skilling tab.
9027 int x1 = isFixedScreen() ? 0 : (Client.getClientWidth() / 2) - 256;
9028 int y1 = isFixedScreen() ? 0 : (Client.getClientHeight() / 2) - 267;
9029 x += x1;
9030 y += y1;
9031 int width = toolTipString.contains("Total Xp:") ? 135 : 105;
9032 int height = 20;
9033 if (toolTipString.contains("Used")) {
9034 y += 13;
9035 width = 70;
9036 }
9037
9038 boolean decrease = x < 40 && toolTipString.contains("Xp") ? true : false;
9039
9040 // Box brown outline for skill icons on Profile skilling interface tab.
9041 if (!toolTipString.contains("Total Xp") && !toolTipString.contains("Used")) {
9042 DrawingArea.fillPixels(x + 18, 105 - 60, 20 + 10, 0x564f42, y + 21); // Outline.
9043 }
9044
9045 if (toolTipString.contains("Used")) {
9046 x += 16;
9047 }
9048 // X, width, length, colour, Y
9049 DrawingArea.fillPixels((x - (17)) + (decrease ? 22 : 0), width + 2, height + 2, 0, y - 1); // Outline.
9050 // length, y, x, colour, width
9051 DrawingArea.drawPixels(height, y, (x - (16)) + (decrease ? 22 : 0), 0xFFFFA0, width); // Background.
9052 if (toolTipString.contains("Used")) {
9053 x -= 16;
9054 }
9055 // Colour, x, String, Y, Shadow.
9056 if (toolTipString.contains("Total Xp:")) {
9057 textDrawingArea_2.method382(0, ((x + 36) + (decrease ? 22 : 0)) + 17, toolTipString.substring(0, 10) + Long.parseLong(toolTipString.substring(10)) + " million", y + 15, false);
9058 }
9059 else if (toolTipString.startsWith("Xp:")) {
9060 textDrawingArea_2.method382(0, ((x + 36) + (decrease ? 22 : 0)) + 0, toolTipString.substring(0, 4) + "" + formatNumber(Integer.parseInt(toolTipString.substring(4))), y + 15, false);
9061 }
9062 else {
9063 textDrawingArea_2.method382(0, ((x + 36) + (decrease ? 22 : 0)) + 0, toolTipString.substring(0, 4) + ": " + formatNumber(Integer.parseInt(toolTipString.substring(5))), y + 15, false);
9064 }
9065 }
9066 }
9067 }
9068
9069 if (id.isDebug() && ClientDebugConfiguration.DEBUG_MODE) {
9070 DrawingArea.setDrawingArea(gameAreaType + class9.height, k, k + class9.width, gameAreaType);
9071 //DrawingArea.fillRectangle(xPosition - 1, yPosition + 1, id.width + 1, id.height + 1, 0x00FF00, 8);
9072 DrawingArea.drawPixels(id.height, yPosition, xPosition, 0x00FF00, id.width);
9073 smallText.method382(0x000000, xPosition, Integer.toString(id.id), yPosition, true);
9074 }
9075 }
9076 DrawingArea.setDrawingArea(bottomPositionStartDecreaseOnly, leftPositionStartIncreaseOnly, rightPositionStartDecreaseOnly, topPositionStartIncreaseOnly);
9077 }
9078
9079 private long timeValue;
9080
9081 private int toolTipX;
9082
9083 private int toolTipY;
9084
9085 private String toolTipString = "";
9086
9087 /**
9088 * True to connect the client to local host.
9089 */
9090 public static boolean LOCAL_HOST = false;
9091
9092 private void handleCamera() {
9093 try {
9094 int j = myPlayer.x + cameraOffsetX;
9095 int k = myPlayer.y + cameraOffsetY;
9096 if (chaseCameraX - j < -500 || chaseCameraX - j > 500 || chaseCameraY - k < -500 || chaseCameraY - k > 500) {
9097 chaseCameraX = j;
9098 chaseCameraY = k;
9099 }
9100 if (chaseCameraX != j) {
9101 chaseCameraX += (j - chaseCameraX) / 16;
9102 }
9103 if (chaseCameraY != k) {
9104 chaseCameraY += (k - chaseCameraY) / 16;
9105 }
9106
9107 //24, 12 original.
9108
9109 // Left arrow key.
9110 if (super.keyArray[1] == 1) {
9111 if (customCameraPosition) {
9112 xCameraPos -= 10;
9113 }
9114 else {
9115 cameraYawTranslate += (-Camera.getCameraSpeed("X") - cameraYawTranslate) / 2;
9116 }
9117 }
9118
9119 // Right arrow key.
9120 else if (super.keyArray[2] == 1) {
9121 if (customCameraPosition) {
9122 xCameraPos += 10;
9123 }
9124 else {
9125 cameraYawTranslate += (Camera.getCameraSpeed("X") - cameraYawTranslate) / 2;
9126 }
9127 }
9128 else {
9129 cameraYawTranslate /= 2;
9130 }
9131
9132 // Up arrow key.
9133 if (super.keyArray[3] == 1) {
9134 if (customCameraPosition) {
9135 yCameraPos += 10;
9136 }
9137 else {
9138 cameraPitchTranslate += (Camera.getCameraSpeed("Y") - cameraPitchTranslate) / 2;
9139 }
9140 }
9141
9142 // Down arrow key.
9143 else if (super.keyArray[4] == 1) {
9144 if (customCameraPosition) {
9145 yCameraPos -= 10;
9146 }
9147 else {
9148 cameraPitchTranslate += (-Camera.getCameraSpeed("Y") - cameraPitchTranslate) / 2;
9149 }
9150 }
9151 else {
9152 cameraPitchTranslate /= 2;
9153 }
9154 viewRotation = viewRotation + cameraYawTranslate / 2 & 0x7ff;
9155 chaseCameraPitch += cameraPitchTranslate / 2;
9156 if (chaseCameraPitch < 128) {
9157 chaseCameraPitch = 128;
9158 }
9159 if (chaseCameraPitch > 383) {
9160 chaseCameraPitch = 383;
9161 }
9162 int l = chaseCameraX >> 7;
9163 int i1 = chaseCameraY >> 7;
9164 int j1 = getLand(plane, chaseCameraY, chaseCameraX);
9165 int k1 = 0;
9166 if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
9167 for (int l1 = l - 4; l1 <= l + 4; l1++) {
9168 for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
9169 int l2 = plane;
9170 if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
9171 l2++;
9172 int i3 = j1 - intGroundArray[l2][l1][k2];
9173 if (i3 > k1)
9174 k1 = i3;
9175 }
9176
9177 }
9178
9179 }
9180 anInt1005++;
9181 if (anInt1005 > 1512) {
9182 anInt1005 = 0;
9183 stream.createFrame(77);
9184 stream.writeWordBigEndian(0);
9185 int i2 = stream.currentOffset;
9186 stream.writeWordBigEndian((int) (Math.random() * 256D));
9187 stream.writeWordBigEndian(101);
9188 stream.writeWordBigEndian(233);
9189 stream.writeWord(45092);
9190 if ((int) (Math.random() * 2D) == 0)
9191 stream.writeWord(35784);
9192 stream.writeWordBigEndian((int) (Math.random() * 256D));
9193 stream.writeWordBigEndian(64);
9194 stream.writeWordBigEndian(38);
9195 stream.writeWord((int) (Math.random() * 65536D));
9196 stream.writeWord((int) (Math.random() * 65536D));
9197 stream.writeBytes(stream.currentOffset - i2);
9198 }
9199 int j2 = k1 * 192;
9200 if (j2 > 0x17f00)
9201 j2 = 0x17f00;
9202 if (j2 < 32768)
9203 j2 = 32768;
9204 if (j2 > minCameraPitch) {
9205 minCameraPitch += (j2 - minCameraPitch) / 24;
9206 return;
9207 }
9208 if (j2 < minCameraPitch) {
9209 minCameraPitch += (j2 - minCameraPitch) / 80;
9210 }
9211 }
9212 catch (Exception e) {
9213 e.printStackTrace();
9214 SignLink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + chaseCameraX + "," + chaseCameraY + "," + regionX + "," + regionY + "," + baseX + "," + baseY);
9215 throw new RuntimeException("eek");
9216 }
9217 }
9218
9219 public void processDrawing() {
9220 if (rsAlreadyLoaded || loadingError || genericLoadingError) {
9221 showErrorScreen();
9222 return;
9223 }
9224 if (!isLoggedIn()) {
9225 Content.drawLoginScreen();
9226 }
9227 else {
9228 drawGameScreenInterfaces();
9229 }
9230 if (Client.clientFrameSaveNeeded) {
9231 if (initializedByStandalone) {
9232 // nothing atm.
9233 } else {
9234 if (System.currentTimeMillis() - Client.clientDimenionsSavedTime >= 3000) {
9235 if (!Client.isFixedScreenSaved && !Client.clientMaximized && !Client.isFixedScreen()) {
9236 Client.clientWidthSaved = Client.getClientWidth();
9237 Client.clientHeightSaved = Client.getClientHeight();
9238 }
9239 if (Client.isFixedScreen() && Client.maximizable) {
9240 Client.maximizableWidth = ClientFrame.frame.getWidth();
9241 Client.maximizableHeight = ClientFrame.frame.getHeight();
9242 }
9243 Settings.saveSettingsJframe();
9244 Client.clientFrameSaveNeeded = false;
9245 Client.clientDimenionsSavedTime = System.currentTimeMillis();
9246 }
9247 }
9248 }
9249 if (graphicsRequiresUpdate) {
9250 graphicsRequiresUpdate = false;
9251 graphics = getGameComponent().getGraphics();
9252 }
9253 if (Client.clientMaximizedPreviously && !Client.isFixedScreen() && !Client.clientMaximized) {
9254 Client.clientMaximizedPreviously = false;
9255 ClientFrame.frame.setLocation((int) Client.clientResizedLocationX, (int) Client.clientResizedLocationY);
9256 }
9257 if (clickMode2 == 0) {
9258 clickedX = -1;
9259 clickedY = -1;
9260 }
9261 clickCycle = 0;
9262 }
9263
9264 public boolean isFriendOrSelf(String s) {
9265 if (s == null)
9266 return false;
9267 for (int i = 0; i < friendsCount; i++)
9268 if (s.equalsIgnoreCase(friendsList[i]))
9269 return true;
9270
9271 return s.equalsIgnoreCase(myPlayer.getName());
9272 }
9273
9274 private void draw3dScreen() {
9275
9276 if (fadingScreen != null && fadingScreen.state != 0) {
9277 fadingScreen.draw();
9278 }
9279
9280 MiniMap.drawSplitPrivateChat();
9281 int clickPosition = isFixedScreen() ? 12 : 9;
9282 if (crossType == 1) {
9283 if (newClick) {
9284 cacheSprite[(crossIndex / 100) + 123].drawAdvancedSprite(crossX - clickPosition, crossY - clickPosition);
9285 }
9286 else {
9287 crosses[crossIndex / 100].drawSprite(crossX - clickPosition, crossY - clickPosition);
9288 }
9289 anInt1142++;
9290 if (anInt1142 > 67) {
9291 anInt1142 = 0;
9292 stream.createFrame(78);
9293 }
9294 }
9295 if (crossType == 2) {
9296 if (newClick) {
9297 cacheSprite[(4 + crossIndex / 100) + 123].drawAdvancedSprite(crossX - clickPosition, crossY - clickPosition);
9298 }
9299 else {
9300
9301 crosses[4 + crossIndex / 100].drawSprite(crossX - clickPosition, crossY - clickPosition);
9302 }
9303 }
9304 //Content.characterRotation();
9305 /*
9306 if (timeReceivedPacket > 0) {
9307 if (System.currentTimeMillis() - timeReceivedPacket >= 800 && System.currentTimeMillis() - timeReceivedPacket <= 2000 && System.currentTimeMillis() - Client.packetLossLight >= 10000) {
9308 Client.packetLossLight = System.currentTimeMillis();
9309 Client.instance.sendCommandPacket("::packetloss567");
9310 }
9311 if (System.currentTimeMillis() - timeReceivedPacket >= 2001 && System.currentTimeMillis() - Client.packetLossHeavy >= 10000) {
9312 Client.packetLossHeavy = System.currentTimeMillis();
9313 Client.instance.sendCommandPacket("::packetloss568");
9314 }
9315 }
9316 */
9317
9318
9319 int x1 = 0;
9320 int y1 = 0;
9321
9322 if (snowParticles) {
9323 handleInterfaceSequences(animCycle, 11877);
9324 drawInterface(0, 0 + x1, RSInterface.interfaceCache[11877], 0 + y1);
9325 }
9326 if (kdrOverlay) {
9327 //@formatter:off
9328 if (walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_OSRS ||
9329 walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_PRE_EOC_TOP_RIGHT ||
9330 walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_PRE_EOC_BOTTOM_RIGHT)
9331 {
9332 //@formatter:on
9333 handleInterfaceSequences(animCycle, 14250);
9334 drawInterface(0, 0 + x1, RSInterface.interfaceCache[14250], 0 + y1);
9335 }
9336 }
9337 if (showDonatorNotification) {
9338 x1 = isFixedScreen() ? 4 : (Client.getClientWidth() / 2) - 256;
9339 y1 = isFixedScreen() ? 4 : (Client.getClientHeight() / 2) - 267;
9340 handleInterfaceSequences(animCycle, 33200);
9341 drawInterface(0, 0 + x1, RSInterface.interfaceCache[33200], 0 + y1);
9342 }
9343 if (showXpBonusInterface) {
9344 x1 = isFixedScreen() ? 4 : (Client.getClientWidth() / 2);
9345 y1 = isFixedScreen() ? 4 : (Client.getClientHeight() / 2);
9346 handleInterfaceSequences(animCycle, 21370);
9347 drawInterface(0, 0 + x1, RSInterface.interfaceCache[21370], 0 + y1);
9348 RSInterface.TextCountDown.handleTextCountDownReduction(21370);
9349 }
9350 //TODO #FULLSCREEN ADJUST interfaces on 3d screen, walkable interfaces.
9351 if (walkableInterfaceId != -1) {
9352 //@formatter:off
9353 if (walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_PRE_EOC_BOTTOM_RIGHT ||
9354 walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_PRE_EOC_TOP_RIGHT ||
9355 walkableInterfaceId == ClientConstants.CITY_PKING_SAFE_ZONE_INTERFACE ||
9356
9357 walkableInterfaceId == ClientConstants.CITY_PKING_DANGEROUS_ZONE_INTERFACE ||
9358 walkableInterfaceId == ClientConstants.GOD_WARS_DUNGEON_INTERFACE ||
9359 walkableInterfaceId == ClientConstants.ZOMBIE_INTERFACE ||
9360 walkableInterfaceId == ClientConstants.ZOMBIE_READY_INTERFACE && !Client.isFixedScreen())
9361 {
9362 //@formatter:on
9363 x1 = isFixedScreen() ? 0 : Client.getClientWidth() - Client.getFullscreenModeMinimapX(780);
9364 y1 = 0;
9365
9366 if (walkableInterfaceId == ClientConstants.ZOMBIE_READY_INTERFACE) {
9367 x1 = (Client.getClientWidth() / 2) - 263;
9368 }
9369 if (Client.counterOn) {
9370 //@formatter:off
9371 if ((walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_PRE_EOC_BOTTOM_RIGHT ||
9372 walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_PRE_EOC_TOP_RIGHT ||
9373 walkableInterfaceId == ClientConstants.CITY_PKING_SAFE_ZONE_INTERFACE ||
9374 walkableInterfaceId == ClientConstants.CITY_PKING_DANGEROUS_ZONE_INTERFACE) && !Client.isFixedScreen())
9375 {
9376 //@formatter:on
9377 y1 += 25;
9378 }
9379 else if (walkableInterfaceId == ClientConstants.ZOMBIE_INTERFACE) {
9380 if (!Client.isFixedScreen()) {
9381 x1 -= 66;
9382 if (Client.is474GameFrame) {
9383 y1 -= 1;
9384 x1 -= 18;
9385 }
9386 }
9387 else {
9388 if (Client.is474GameFrame) {
9389 y1 -= 1;
9390 x1 -= 120;
9391 }
9392 }
9393 }
9394 }
9395 }
9396
9397 else if (walkableInterfaceId == ClientConstants.BARROWS_INTERFACE || walkableInterfaceId == ClientConstants.DUEL_ARENA_INTERFACE) {
9398 x1 = isFixedScreen() ? 0 : Client.getClientWidth() - Client.getFullscreenModeMinimapX(780);
9399 y1 = isFixedScreen() ? 0 : Client.getClientHeight() - Client.getFullscreenModeChatAreaY(539);
9400 }
9401 else if (walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_OSRS) {
9402 x1 = isFixedScreen() ? 0 : Client.getClientWidth() - Client.getFullscreenModeMinimapX(570);
9403 y1 = isFixedScreen() ? 0 : -85;
9404 }
9405
9406 if (walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_OSRS || walkableInterfaceId == ClientConstants.WILDERNESS_INTERFACE_PRE_EOC_BOTTOM_RIGHT) {
9407 if (Client.isFixedScreen() && overlayTimers) {
9408 y1 -= 16;
9409 }
9410 }
9411 handleInterfaceSequences(animCycle, walkableInterfaceId);
9412 drawInterface(0, 0 + x1, RSInterface.interfaceCache[walkableInterfaceId], 0 + y1);
9413
9414 /*
9415 // Wilderness interfaces, draw city timer.
9416 if (walkableInterfaceId == 24395 || walkableInterfaceId == 24390 || walkableInterfaceId == 26005 || walkableInterfaceId == 26000 || walkableInterfaceId == 197)
9417 {
9418 if (cityTimer)
9419 {
9420 long timer = System.currentTimeMillis() - Client.timeCityTimerStarted;
9421 if (timer < 10000)
9422 {
9423 int time = (int) (10 - (timer / 1000));
9424 if (time == 0)
9425 {
9426 cityTimer = false;
9427 }
9428 else
9429 {
9430 sendFrame126("@red@" + time, 24396);
9431 sendFrame126("@red@" + time, 24391);
9432 sendFrame126("@red@" + time, 199);
9433 }
9434 }
9435 }
9436 }
9437 */
9438 }
9439
9440 Content.mysteryBoxLoop();
9441 Content.gambleLoop();
9442 Achievements.achievementInterface();
9443 TitleInterface.drawTitleInterfaceLoadingBar();
9444 CompletionistCapeInterface.drawMainColours();
9445 CompletionistCapeInterface.drawSubColours();
9446 Content.zombieReadyInterface();
9447 Orbs.drawExperienceCounterBar();
9448 MoneyPouchOrb.drawMoneyPouch();
9449 OverlayTimers.drawOverlayTimers();
9450 //TODO #FULLSCREEN ADJUST interfaces on 3d screen, normal interfaces.
9451 if (getInterfaceDisplayed() != -1) {
9452
9453 x1 = isFixedScreen() ? 0 : (Client.getClientWidth() / 2) - 256;
9454 y1 = isFixedScreen() ? 0 : (Client.getClientHeight() / 2) - 267;
9455 handleInterfaceSequences(animCycle, getInterfaceDisplayed());
9456 drawInterface(0, 0 + x1, RSInterface.interfaceCache[getInterfaceDisplayed()], 0 + y1);
9457 }
9458
9459 //TODO #FULLSCREEN ADJUST interfaces, multi-combat sign.
9460 if (anInt1055 == 1) {
9461 x1 = isFixedScreen() ? 0 : Client.getClientWidth() - Client.getFullscreenModeMinimapX(513);
9462 y1 = isFixedScreen() ? 0 : -120;
9463 multiOverlay.drawSprite(464 + x1, 296 + y1);
9464 }
9465 handleMessageState();
9466 CompletionistCapeInterface.drawMainClicked();
9467 CompletionistCapeInterface.drawSubClicked();
9468 Content.drawBankClickedButtons();
9469 Content.sendSearchToServer();
9470 Content.sendPopUpSearchToServer();
9471 Content.showPetMysteryBoxInterfaceActions();
9472 Profile.drawSearch();
9473 Content.drawShopSearch();
9474 Profile.drawBiography();
9475 Settings.drawResizableSettings();
9476 Achievements.drawAchievementPopUp();
9477 ArrowTutorial.drawTutorial(true);
9478
9479 if (!menuOpen) {
9480 processRightClick();
9481 drawTooltip();
9482 saveRightClickCoordinates = true;
9483 }
9484 else if (getMenuScreenArea() == 0) {
9485 drawMenu();
9486 }
9487 else {
9488 saveRightClickCoordinates = true;
9489 }
9490 int yPosOffset = Client.isFixedScreen() ? 0 : Client.getClientHeight() - Client.getFullscreenModeChatAreaY(540);
9491 if (fpsOn && !clientData) {
9492 aTextDrawingArea_1271.method385(0xffff00, "Fps: " + super.fps, 5, 324 + yPosOffset);
9493 if (super.fps < 10) {
9494 if (System.currentTimeMillis() - fpsLagTime >= 1000) {
9495 fpsLagTime = System.currentTimeMillis();
9496 Utility.print("Fps drop: " + super.fps);
9497 }
9498 }
9499 }
9500 int x = baseX + (myPlayer.x - 6 >> 7);
9501 int y = baseY + (myPlayer.y - 6 >> 7);
9502 if (coordinatesDisplay) {
9503 String[] data = {
9504 "Coordinates: " + x + ", " + y,
9505 };
9506 drawScreenData(data);
9507 } else if (clientData) {
9508 if (ClientDebugConfiguration.DEBUG_MODE) {
9509 String[] data =
9510 {
9511 "Camera: " + xCameraPos + ", " + yCameraPos + ", " + xCameraCurve + ", " + yCameraCurve,
9512 "Fps: " + super.fps,
9513 "Coordinates: " + x + ", " + y,
9514 "Local: " + myPlayer.smallX[0] + ", " + myPlayer.smallY[0],
9515 "Tab x: " + (super.mouseX - 549) + ", Tab y: " + (super.mouseY - 208),
9516 "Client original: 512, 334",
9517 "Client width: " + getClientWidth(),
9518 "Client height: " + getClientHeight(),
9519 "Floor:" + floorData,
9520 "Object:" + ObjectData,
9521 "Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY,};
9522 drawScreenData(data);
9523 }
9524 else {
9525 String[] data =
9526 {
9527
9528 "Fps: " + super.fps,
9529 "Coordinates: " + x + ", " + y,};
9530 drawScreenData(data);
9531 }
9532 }
9533 if (systemUpdateCycle != 0) {
9534 int j = systemUpdateCycle / 50;
9535 int l = j / 60;
9536 j %= 60;
9537 if (j < 10) {
9538 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":0" + j, 4, 329);
9539 }
9540 else {
9541 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":" + j, 4, 329);
9542 }
9543 systemUpdateHeartbeat++;
9544 if (systemUpdateHeartbeat > 75) {
9545 systemUpdateHeartbeat = 0;
9546 stream.createFrame(148);
9547 }
9548 }
9549 }
9550
9551 static long timeShopSearchSent;
9552
9553 /**
9554 * The shop string sent to the server.
9555 */
9556 public static String shopStringSent = "";
9557
9558 private void drawScreenData(String[] data) {
9559
9560 for (int index = 0; index < data.length; index++) {
9561 aTextDrawingArea_1271.method385(0xffff00, data[index], 5, 440 - (index * 16) + (Client.isFixedScreen() ? -113 : (Client.getClientHeight() - Client.getFullscreenModeChatAreaY(650))));
9562 }
9563
9564 }
9565
9566 public static String bankSearchSent = "";
9567
9568 private void handleObjects() {
9569 if (getLoadingStage() == 2) {
9570 if (Client.forceObjectUpdate) {
9571
9572 for (TemporaryObject temp = (TemporaryObject) objects.reverseGetFirst(); temp != null; temp = (TemporaryObject) objects.reverseGetNext()) {
9573 boolean delete = false;
9574 if (!temp.global && temp.isCustom()) {
9575 if (temp.instancedHeight >= 4) {
9576 if (Client.playerHeight != temp.instancedHeight) {
9577 delete = true;
9578 }
9579 } else {
9580 if (Client.playerHeight != temp.plane) {
9581 delete = true;
9582 }
9583 }
9584 }
9585 if (delete) {
9586 int type = temp.classType;
9587 if (temp.objectId == 1902) {
9588 type = temp.type;
9589 }
9590 addObject(temp.y, temp.plane, temp.locRotation, temp.locType, temp.x, type, -1);
9591 }
9592 }
9593 loadCustomObjects();
9594 Client.forceObjectUpdate = false;
9595 }
9596 for (TemporaryObject temp = (TemporaryObject) objects.reverseGetFirst(); temp != null; temp = (TemporaryObject) objects.reverseGetNext()) {
9597 if (temp.cycle > 0) {
9598 temp.cycle--;
9599 }
9600 if (temp.cycle == 0) {
9601 if (temp.locIndex < 0 || ObjectManager.objectIsValid(temp.locIndex, temp.locType)) {
9602 if (!temp.global && temp.isCustom()) {
9603 if (temp.instancedHeight >= 4) {
9604 if (Client.playerHeight != temp.instancedHeight) {
9605 continue;
9606 }
9607 }
9608 else {
9609 if (Client.playerHeight != temp.plane) {
9610 continue;
9611 }
9612 }
9613 }
9614 addObject(temp.y, temp.plane, temp.locRotation, temp.locType, temp.x, temp.classType, temp.locIndex);
9615 temp.unlink();
9616 }
9617 }
9618 else {
9619 if (temp.spawnCycle > 0) {
9620 temp.spawnCycle--;
9621 }
9622 if (temp.spawnCycle == 0 && temp.x >= 1 && temp.y >= 1 && temp.x <= 102 && temp.y <= 102 && (temp.objectId < 0 || ObjectManager.objectIsValid(temp.objectId, temp.type))) {
9623 /**
9624 * DISABLED (Apr 13, 2018 - Jason) This unfortunately forces any objects sent server sided to only appear on heights 0 through 3 (inclusive).
9625 */
9626 if (!temp.global && temp.isCustom()) {
9627 if (temp.instancedHeight >= 4) {
9628 if (Client.playerHeight != temp.instancedHeight) {
9629 continue;
9630 }
9631 } else {
9632 if (Client.playerHeight != temp.plane) {
9633 continue;
9634 }
9635 }
9636 }
9637 addObject(temp.y, temp.plane, temp.rotation, temp.type, temp.x, temp.classType, temp.objectId);
9638 temp.spawnCycle = -1;
9639 if (temp.objectId == temp.locIndex && temp.locIndex == -1) {
9640 temp.unlink();
9641 }
9642 else if (temp.objectId == temp.locIndex && temp.rotation == temp.locRotation && temp.type == temp.locType) {
9643 temp.unlink();
9644 }
9645 }
9646 }
9647 }
9648
9649 }
9650 }
9651
9652 private void determineMenuSize() {
9653 int i = chatTextDrawingArea.getTextWidth("Choose Option");
9654 for (int j = 0; j < menuActionRow; j++) {
9655 int k = chatTextDrawingArea.getTextWidth(menuActionName[j]);
9656 if (k > i) {
9657 i = k;
9658 }
9659 }
9660
9661 i += 8;
9662 int l = 15 * menuActionRow + 21;
9663 if (isFixedScreen()) {
9664 if (super.saveClickX > 4 && super.saveClickY > 4 && super.saveClickX < getGameScreenWidth() + 6 && super.saveClickY < getGameScreenHeight() + 4) {
9665 int i1 = super.saveClickX - 4 - i / 2;
9666 if (i1 + i > getGameScreenWidth()) {
9667 i1 = getGameScreenWidth() - i;
9668 }
9669 if (i1 < 0) {
9670 i1 = 0;
9671 }
9672 int l1 = super.saveClickY - 4;
9673 if (l1 + l > getGameScreenHeight()) {
9674 l1 = getGameScreenHeight() - l;
9675 }
9676 if (l1 < 0) {
9677 l1 = 0;
9678 }
9679 menuOpen = true;
9680 setMenuScreenArea(0);
9681 menuOffsetX = i1;
9682 menuOffsetY = l1;
9683 menuWidth = i;
9684 menuHeight = 15 * menuActionRow + 22;
9685 }
9686 if (super.saveClickX > 519 && super.saveClickY > 168 && super.saveClickX < getClientWidth() && super.saveClickY < 502) {
9687 int j1 = super.saveClickX - 519 - i / 2;
9688 if (j1 < 0)
9689 j1 = 0;
9690 else if (j1 + i > 245)
9691 j1 = 245 - i;
9692 int i2 = super.saveClickY - 168;
9693 if (i2 < 0)
9694 i2 = 0;
9695 else if (i2 + l > 333)
9696 i2 = 333 - l;
9697 menuOpen = true;
9698 setMenuScreenArea(1);
9699 menuOffsetX = j1;
9700 menuOffsetY = i2;
9701 menuWidth = i;
9702 menuHeight = 15 * menuActionRow + 22;
9703 }
9704
9705 if (super.saveClickX > 0 && super.saveClickY > 338 && super.saveClickX < 516 && super.saveClickY < 502) {
9706 int k1 = super.saveClickX - 0 - i / 2;
9707 if (k1 < 0)
9708 k1 = 0;
9709 else if (k1 + i > 516)
9710 k1 = 516 - i;
9711 int j2 = super.saveClickY - 338;
9712 if (j2 < 0)
9713 j2 = 0;
9714 else if (j2 + l > 165)
9715 j2 = 165 - l;
9716 menuOpen = true;
9717 setMenuScreenArea(2);
9718 menuOffsetX = k1;
9719 menuOffsetY = j2;
9720 menuWidth = i;
9721 menuHeight = 15 * menuActionRow + 22;
9722 }
9723 if (super.saveClickX >= 515 && super.saveClickX <= getClientWidth() && super.saveClickY >= 0 && super.saveClickY <= 169) {
9724 int x = super.saveClickX - 515 - i / 2;
9725 if (x < 0) {
9726 x = 0;
9727 }
9728 else if (x + i > 249) {
9729 x = 249 - i;
9730 }
9731
9732 int y = super.saveClickY;
9733 if (y < 0) {
9734 y = 0;
9735 }
9736 else if (y + l > 165) {
9737 y = 165 - l;
9738 }
9739 menuOpen = true;
9740 setMenuScreenArea(3);
9741 menuOffsetX = x;
9742 menuOffsetY = y;
9743 menuWidth = i;
9744 menuHeight = 15 * menuActionRow + 22;
9745 }
9746 }
9747 else {
9748 //TODO #FULLSCREEN ADJUST menu right click size, so it does not no-clip out of screen.
9749 if (super.saveClickX > 0 && super.saveClickY > 0 && super.saveClickX < Client.getClientWidth() && super.saveClickY < Client.getClientHeight()) {
9750 int i1 = super.saveClickX - 0 - i / 2;
9751 if (i1 + i > Client.getClientWidth() - Client.getFullscreenModeMinimapX(16)) {
9752 i1 = Client.getClientWidth() - i - Client.getFullscreenModeMinimapX(16);
9753 }
9754 if (i1 < 0) {
9755 i1 = 0;
9756 }
9757 int l1 = super.saveClickY - 0;
9758 if (l1 + l > Client.getClientHeight() - Client.getFullscreenModeChatAreaY(41)) {
9759 l1 = Client.getClientHeight() - l - Client.getFullscreenModeChatAreaY(41);
9760 }
9761 if (l1 < 0) {
9762 l1 = 0;
9763 }
9764 menuOpen = true;
9765 menuScreenArea = 0;
9766 menuOffsetX = i1;
9767 menuOffsetY = l1;
9768 menuWidth = i;
9769 menuHeight = 15 * menuActionRow + 22;
9770 }
9771 }
9772 }
9773
9774 private void nullLoader() {
9775 updateFlames = false;
9776 }
9777
9778 private boolean handleInterfaceSequences(int i, int j) {
9779 boolean flag1 = false;
9780 if (j > RSInterface.interfaceCache.length - 1) {
9781 return true;
9782 }
9783 RSInterface class9 = RSInterface.interfaceCache[j];
9784 if (class9 == null || class9.children == null) {
9785 return true;
9786 }
9787 for (int k = 0; k < class9.children.length; k++) {
9788 if (class9.children[k] == -1) {
9789 break;
9790 }
9791 RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
9792 if(class9_1 == null) {
9793 continue;
9794 }
9795 if (class9_1.getType() == 1) {
9796 flag1 |= handleInterfaceSequences(i, class9_1.id);
9797 }
9798 if (class9_1.getType() == 6 && (class9_1.sequenceDisabled != -1 || class9_1.sequenceEnabled != -1)) {
9799 boolean flag2 = interfaceIsSelected(class9_1);
9800 int l;
9801 if (flag2) {
9802 l = class9_1.sequenceEnabled;
9803 }
9804 else {
9805 l = class9_1.sequenceDisabled;
9806 }
9807 if (l != -1) {
9808 if (l > Sequences.anims.length - 1) {
9809 continue;
9810 }
9811 Sequences animation = Sequences.anims[l];
9812 for (class9_1.sequenceCycle += i; class9_1.sequenceCycle > animation.getDuration(class9_1.sequenceFrame);) {
9813 class9_1.sequenceCycle -= animation.getDuration(class9_1.sequenceFrame) + 1;
9814 class9_1.sequenceFrame++;
9815 if (class9_1.sequenceFrame >= animation.length) {
9816 class9_1.sequenceFrame -= animation.padding;
9817 if (class9_1.sequenceFrame < 0 || class9_1.sequenceFrame >= animation.length) {
9818 class9_1.sequenceFrame = 0;
9819 }
9820 }
9821 flag1 = true;
9822 }
9823
9824 }
9825 }
9826 }
9827
9828 return flag1;
9829 }
9830
9831 private int getTopPlane() {
9832 if (!enableRoof) {
9833 return plane;
9834 }
9835 int j = 3;
9836 if (yCameraCurve < 310) {
9837 int k = xCameraPos >> 7;
9838 int l = yCameraPos >> 7;
9839 int i1 = myPlayer.x >> 7;
9840 int j1 = myPlayer.y >> 7;
9841 if ((byteGroundArray[plane][k][l] & 4) != 0)
9842 j = plane;
9843 int k1;
9844 if (i1 > k)
9845 k1 = i1 - k;
9846 else
9847 k1 = k - i1;
9848 int l1;
9849 if (j1 > l)
9850 l1 = j1 - l;
9851 else
9852 l1 = l - j1;
9853 if (k1 > l1) {
9854 int i2 = (l1 * 0x10000) / k1;
9855 int k2 = 32768;
9856 while (k != i1) {
9857 if (k < i1)
9858 k++;
9859 else if (k > i1)
9860 k--;
9861 if ((byteGroundArray[plane][k][l] & 4) != 0)
9862 j = plane;
9863 k2 += i2;
9864 if (k2 >= 0x10000) {
9865 k2 -= 0x10000;
9866 if (l < j1)
9867 l++;
9868 else if (l > j1)
9869 l--;
9870 if ((byteGroundArray[plane][k][l] & 4) != 0)
9871 j = plane;
9872 }
9873 }
9874 }
9875 else {
9876 if (l1 == 0) {
9877 return plane;
9878 }
9879 int j2 = (k1 * 0x10000) / l1;
9880 int l2 = 32768;
9881 while (l != j1) {
9882 if (l < j1)
9883 l++;
9884 else if (l > j1)
9885 l--;
9886 if ((byteGroundArray[plane][k][l] & 4) != 0)
9887 j = plane;
9888 l2 += j2;
9889 if (l2 >= 0x10000) {
9890 l2 -= 0x10000;
9891 if (k < i1)
9892 k++;
9893 else if (k > i1)
9894 k--;
9895 if ((byteGroundArray[plane][k][l] & 4) != 0)
9896 j = plane;
9897 }
9898 }
9899 }
9900 }
9901 if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
9902 j = plane;
9903 return j;
9904 }
9905
9906 private int getTopCutscenePlane() {
9907 if (!enableRoof) {
9908 return plane;
9909 }
9910 int j = getLand(plane, yCameraPos, xCameraPos);
9911 if (j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
9912 return plane;
9913 else
9914 return 3;
9915 }
9916
9917 public void chatJoin(long l) {
9918 try {
9919 if (l == 0L)
9920 return;
9921
9922 stream.createFrame(60);
9923 stream.writeQWord(l);
9924 return;
9925 }
9926 catch (RuntimeException runtimeexception) {
9927 runtimeexception.printStackTrace();
9928 SignLink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
9929 }
9930 throw new RuntimeException();
9931
9932 }
9933
9934 public String getParameter(String s) {
9935 if (SignLink.mainapp != null)
9936 return SignLink.mainapp.getParameter(s);
9937 else
9938 return super.getParameter(s);
9939 }
9940
9941 private long extractInterfaceValues(RSInterface interfaceData, long value) {
9942 if (interfaceData.valueIndexArray == null || value >= interfaceData.valueIndexArray.length)
9943 return -2;
9944 try {
9945 int ai[] = interfaceData.valueIndexArray[(int) value];
9946 long k = 0;
9947 int l = 0;
9948 int i1 = 0;
9949 do {
9950 int j1 = ai[l++];
9951 long k1 = 0;
9952 byte byte0 = 0;
9953 if (j1 == 0) {
9954 return k;
9955 }
9956 if (j1 == 1) {
9957 k1 = baseSkillLevel[ai[l++]];
9958 }
9959 if (j1 == 2) {
9960 k1 = maxStats[ai[l++]];
9961 }
9962 if (j1 == 3) {
9963 k1 = skillExperience[ai[l++]];
9964 }
9965 if (j1 == 4) {
9966
9967 // This is used to make the spellbook spells become lit up when the runes are ready for it.
9968 RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
9969 int itemRequested = ai[l++];
9970 if (itemRequested >= 0 && itemRequested < ItemDefinition.totalItems && (!ItemDefinition.forId(itemRequested).membersObject || isMembers)) {
9971 for (int index = 0; index < class9_1.inv.length; index++) {
9972
9973 boolean confirm = false;
9974 int item = class9_1.inv[index] - 1;
9975
9976 if (!Config.PRE_EOC) {
9977 // If item requested is Zamorak staff, also scan for Sotd and Tsotd
9978 if (itemRequested == 2417) {
9979 // Staff of the dead
9980 if (item == 11791) {
9981 confirm = true;
9982 }
9983 // Toxic staff of the dead
9984 else if (item == 12904) {
9985 confirm = true;
9986 }
9987 }
9988
9989 // If item requested is Saradomin staff, also scan for Staff of light
9990 else if (itemRequested == 2415) {
9991 // Staff of light
9992 if (item == 22296) {
9993 confirm = true;
9994 }
9995 }
9996
9997 // Water rune
9998 else if (itemRequested == 555) {
9999 // Equipment interface
10000 RSInterface class9_2 = RSInterface.interfaceCache[1688];
10001 // Kodai wand
10002 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 21006 + 1) {
10003 k1 = 0x3b9ac9ff;
10004 }
10005 // Mist battlestaff
10006 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 20730 + 1) {
10007 k1 = 0x3b9ac9ff;
10008 }
10009 // Steam battlestaff
10010 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 11787 + 1) {
10011 k1 = 0x3b9ac9ff;
10012 }
10013 }
10014
10015 // Fire rune
10016 else if (itemRequested == 554) {
10017 // Equipment interface
10018 RSInterface class9_2 = RSInterface.interfaceCache[1688];
10019 // Tome of fire
10020 if (class9_2.inv[ClientConstants.PLAYER_SHIELD_SLOT] == 20714 + 1) {
10021 k1 = 0x3b9ac9ff;
10022 }
10023 // Smoke battlestaff
10024 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 11998 + 1) {
10025 k1 = 0x3b9ac9ff;
10026 }
10027 // Steam battlestaff
10028 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 11787 + 1) {
10029 k1 = 0x3b9ac9ff;
10030 }
10031 // Lava battlestaff (or)
10032 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 21198 + 1) {
10033 k1 = 0x3b9ac9ff;
10034 }
10035 }
10036
10037 // Air rune
10038 else if (itemRequested == 556) {
10039 // Equipment interface
10040 RSInterface class9_2 = RSInterface.interfaceCache[1688];
10041 // Mist battlestaff
10042 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 20730 + 1) {
10043 k1 = 0x3b9ac9ff;
10044 }
10045 // Dust battlestaff
10046 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 20736 + 1) {
10047 k1 = 0x3b9ac9ff;
10048 }
10049 // Smoke battlestaff
10050 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 11998 + 1) {
10051 k1 = 0x3b9ac9ff;
10052 }
10053 }
10054
10055 // Earth rune
10056 else if (itemRequested == 557) {
10057 // Equipment interface
10058 RSInterface class9_2 = RSInterface.interfaceCache[1688];
10059 // Dust battlestaff
10060 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 20736 + 1) {
10061 k1 = 0x3b9ac9ff;
10062 }
10063 // Dust battlestaff
10064 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 20736 + 1) {
10065 k1 = 0x3b9ac9ff;
10066 }
10067 // Lava battlestaff (or)
10068 if (class9_2.inv[ClientConstants.PLAYER_WEAPON_SLOT] == 21198 + 1) {
10069 k1 = 0x3b9ac9ff;
10070 }
10071 }
10072 }
10073
10074 if (confirm) {
10075 k1 += class9_1.invStackSizes[index];
10076 }
10077 if (class9_1.inv[index] == itemRequested + 1) {
10078 k1 += class9_1.invStackSizes[index];
10079 }
10080 else if (class9_1.inv[index] == 12791 + 1) {
10081 // Search rune pouch for runes.
10082 RSInterface class9_2 = RSInterface.interfaceCache[22917];
10083 for (int i = 0; i < class9_2.inv.length; i++) {
10084 if (class9_2.inv[i] == itemRequested + 1) {
10085 k1 += class9_2.invStackSizes[i];
10086 }
10087
10088 }
10089 }
10090 }
10091
10092 }
10093 }
10094 if (j1 == 5) {
10095 k1 = variousSettings[ai[l++]];
10096 }
10097 if (j1 == 6) {
10098 int index = ai[l++];
10099 if (maxStats[index] <= 98) {
10100 k1 = XP_LOOKUP[maxStats[index] - 1] - skillExperience[index];
10101 }
10102 else {
10103 k1 = 0;
10104 }
10105 }
10106 if (j1 == 7) {
10107 k1 = (variousSettings[ai[l++]] * 100) / 46875;
10108 }
10109 if (j1 == 8) {
10110 k1 = myPlayer.combatLevel;
10111 }
10112 if (j1 == 9) {
10113 for (int l1 = 0; l1 < Skills.SKILL_COUNT; l1++) {
10114 if (Config.PRE_EOC ? Skills.SKILLS_ENABLED_PRE_EOC[l1] : Skills.SKILLS_ENABLED[l1]) {
10115 k1 += maxStats[l1];
10116 }
10117 }
10118
10119 }
10120 if (j1 == 10) {
10121 RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
10122 int l2 = ai[l++] + 1;
10123 if (l2 >= 0 && l2 < ItemDefinition.totalItems && (!ItemDefinition.forId(l2).membersObject || isMembers)) {
10124 for (int k3 = 0; k3 < class9_2.inv.length; k3++) {
10125 if (class9_2.inv[k3] != l2)
10126 continue;
10127 k1 = 0x3b9ac9ff;
10128 break;
10129 }
10130
10131 }
10132 }
10133 if (j1 == 12) {
10134 k1 = weight;
10135 }
10136 if (j1 == 13) {
10137 int i2 = variousSettings[ai[l++]];
10138 int i3 = ai[l++];
10139 k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
10140 }
10141 if (j1 == 14) {
10142 int j2 = ai[l++];
10143 VarBit varBit = VarBit.cache[j2];
10144 int l3 = varBit.setting;
10145 int i4 = varBit.startbit;
10146 int j4 = varBit.endbit;
10147 int k4 = BIT_MASK[j4 - i4];
10148 k1 = variousSettings[l3] >> i4 & k4;
10149 }
10150 if (j1 == 15) {
10151 byte0 = 1;
10152 }
10153 if (j1 == 16) {
10154 byte0 = 2;
10155 }
10156 if (j1 == 17) {
10157 byte0 = 3;
10158 }
10159 if (j1 == 18) {
10160 k1 = (myPlayer.x >> 7) + baseX;
10161 }
10162 if (j1 == 19) {
10163 k1 = (myPlayer.y >> 7) + baseY;
10164 }
10165 if (j1 == 20) {
10166 k1 = ai[l++];
10167 }
10168 if (byte0 == 0) {
10169 if (i1 == 0) {
10170 k += k1;
10171 }
10172 if (i1 == 1) {
10173 k -= k1;
10174 }
10175 if (i1 == 2 && k1 != 0) {
10176 k /= k1;
10177 }
10178 if (i1 == 3) {
10179 k *= k1;
10180 }
10181 i1 = 0;
10182 }
10183 else {
10184 i1 = byte0;
10185 }
10186 }
10187 while (true);
10188 }
10189 catch (Exception e) {
10190 e.printStackTrace();
10191 return -1;
10192 }
10193 }
10194
10195 private void drawTooltip() {
10196 // If i change menuActionRow to 1, 'cancel' will always be the hover for literally everything that is not clickable.
10197 if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
10198 autoCastSpellTooltip = false;
10199 return;
10200 }
10201 String s1;
10202 if (itemSelected == 1 && menuActionRow < 2) {
10203 s1 = "Use " + selectedItemName + " with...";
10204 }
10205 else if (spellSelected == 1 && menuActionRow < 2) {
10206 s1 = spellTooltip + "...";
10207 }
10208 else {
10209 s1 = menuActionName[menuActionRow - 1];
10210
10211 }
10212 if (menuActionRow > 2) {
10213 s1 = s1 + "@whi@ / " + (menuActionRow - 2) + " more options";
10214 }
10215 if (s1.contains("Autocast Spell")) {
10216 autoCastSpellTooltip = true;
10217 }
10218 else {
10219 autoCastSpellTooltip = false;
10220 }
10221 s1 = RSFont.replaceOldWithCol(s1);
10222 boolean textShadow = true;
10223 currentTooltip = s1;
10224 newBoldFont.drawBasicString1(s1, 4, 11, textShadow, 0xffffff, false);
10225 }
10226
10227 private static String currentTooltip = "";
10228
10229 public void npcScreenPos(Entity entity, int i, String npcName) {
10230 calcEntityScreenPos(entity.x, i, entity.y, npcName);
10231 }
10232
10233 public void calcEntityScreenPos(int i, int j, int l, String npcName) {
10234 if (i < 128 || l < 128 || i > 13056 || l > 13056) {
10235 spriteDrawX = -1;
10236 spriteDrawY = -1;
10237 return;
10238 }
10239 int i1 = getLand(plane, l, i) - j;
10240 i -= xCameraPos;
10241 i1 -= zCameraPos;
10242 l -= yCameraPos;
10243 int j1 = Model.modelIntArray1[yCameraCurve];
10244 int k1 = Model.modelIntArray2[yCameraCurve];
10245 int l1 = Model.modelIntArray1[xCameraCurve];
10246 int i2 = Model.modelIntArray2[xCameraCurve];
10247 int j2 = l * l1 + i * i2 >> 16;
10248 l = l * i2 - i * l1 >> 16;
10249 i = j2;
10250 j2 = i1 * k1 - l * j1 >> 16;
10251 l = i1 * j1 + l * k1 >> 16;
10252 i1 = j2;
10253 if (l >= 50) {
10254 spriteDrawX = Rasterizer.centerX + (i << viewDistance) / l;
10255 spriteDrawY = Rasterizer.centerY + (i1 << viewDistance) / l + 4;
10256 }
10257 else {
10258 spriteDrawX = -1;
10259 spriteDrawY = -1;
10260 }
10261 }
10262
10263 private void addTemporaryObject(int j, int objectId, int face, int i1, int y, int type, int height, int x, int j2, int instancedHeight, boolean global, boolean custom) {
10264 TemporaryObject tempObject = null;
10265 for (TemporaryObject class30_sub1_1 = (TemporaryObject) objects.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (TemporaryObject) objects.reverseGetNext()) {
10266 if (class30_sub1_1.plane != height || class30_sub1_1.x != x || class30_sub1_1.y != y || class30_sub1_1.classType != i1) {
10267 continue;
10268 }
10269 tempObject = class30_sub1_1;
10270 break;
10271 }
10272 if (tempObject == null) {
10273 tempObject = new TemporaryObject();
10274 tempObject.plane = height;
10275 tempObject.classType = i1;
10276 tempObject.x = x;
10277 tempObject.y = y;
10278 handleTemporaryObjects(tempObject);
10279 objects.insertHead(tempObject);
10280 }
10281 tempObject.objectId = objectId;
10282 tempObject.type = type;
10283 tempObject.global = global;
10284 tempObject.rotation = face;
10285 tempObject.spawnCycle = j2;
10286 tempObject.instancedHeight = instancedHeight;
10287 tempObject.cycle = j;
10288 tempObject.setCustom(custom);
10289 }
10290
10291 private boolean interfaceIsSelected(RSInterface rsi) {
10292 if (rsi.scriptCompareType == null) {
10293 return false;
10294 }
10295 for (int i = 0; i < rsi.scriptCompareType.length; i++) {
10296 long j = extractInterfaceValues(rsi, i);
10297 int valueRequired = rsi.scriptCompareValue[i];
10298 if (rsi.scriptCompareType[i] == 2) {
10299 if (j >= valueRequired) {
10300 return false;
10301 }
10302 }
10303 else if (rsi.scriptCompareType[i] == 3) {
10304 if (j <= valueRequired) {
10305 return false;
10306 }
10307 }
10308 else if (rsi.scriptCompareType[i] == 4) {
10309 if (j == valueRequired) {
10310 return false;
10311 }
10312 }
10313 else if (j != valueRequired) {
10314 return false;
10315 }
10316 }
10317
10318 return true;
10319 }
10320
10321 private DataInputStream openJagGrabInputStream(String s) throws IOException {
10322 if (jaggrabSocket != null) {
10323 try {
10324 jaggrabSocket.close();
10325 }
10326 catch (Exception e) {
10327 e.printStackTrace();
10328 }
10329 jaggrabSocket = null;
10330 }
10331 jaggrabSocket = openSocket(WebsiteRead.port);
10332 jaggrabSocket.setSoTimeout(10000);
10333 java.io.InputStream inputstream = jaggrabSocket.getInputStream();
10334 OutputStream outputstream = jaggrabSocket.getOutputStream();
10335 outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
10336 return new DataInputStream(inputstream);
10337 }
10338
10339
10340 public void raiseWelcomeScreen() {
10341 welcomeScreenRaised = true;
10342 }
10343
10344 protected void handleSecondaryPacket(Stream stream, int j) {
10345 //44 = drop an item
10346 //156 remove an item
10347 // Ground item packet.
10348 if (j == 84) {
10349 int k = stream.readUnsignedByte();
10350 int j3 = anInt1268 + (k >> 4 & 7);
10351 int i6 = anInt1269 + (k & 7);
10352 int l8 = stream.readUnsignedWord();
10353 int k11 = stream.readUnsignedWord();
10354 int l13 = stream.readUnsignedWord();
10355 if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
10356 NodeList class19_1 = groundArray[plane][j3][i6];
10357 if (class19_1 != null) {
10358 for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1.reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1.reverseGetNext()) {
10359 if (class30_sub2_sub4_sub2_3.itemId != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.amount != k11)
10360 continue;
10361 class30_sub2_sub4_sub2_3.amount = l13;
10362 break;
10363 }
10364
10365 spawnGroundItem(j3, i6);
10366 }
10367 }
10368 return;
10369 }
10370 if (j == 105) {
10371 int l = stream.readUnsignedByte();
10372 int k3 = anInt1268 + (l >> 4 & 7);
10373 int j6 = anInt1269 + (l & 7);
10374 int i9 = stream.readUnsignedWord();
10375 int l11 = stream.readUnsignedByte();
10376 int i14 = l11 >> 4 & 0xf;
10377 int i16 = l11 & 7;
10378 if (myPlayer.smallX[0] >= k3 - i14 && myPlayer.smallX[0] <= k3 + i14 && myPlayer.smallY[0] >= j6 - i14 && myPlayer.smallY[0] <= j6 + i14 && soundsAreEnabled && !lowMem && currentSound < 50) {
10379 sound[currentSound] = i9;
10380 soundType[currentSound] = i16;
10381 soundDelay[currentSound] = WaveSound.delays[i9];
10382 currentSound++;
10383 }
10384 }
10385 //156 remove an item
10386 if (j == 156) {
10387 int j1 = stream.method426();
10388 int i4 = anInt1268 + (j1 >> 4 & 7);
10389 int l6 = anInt1269 + (j1 & 7);
10390 int itemId = stream.readUnsignedWord();
10391 if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
10392 NodeList class19 = groundArray[plane][i4][l6];
10393 if (class19 != null) {
10394 for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
10395 if (item.itemId != (itemId & 0x7fff)) {
10396 continue;
10397 }
10398 item.unlink();
10399 break;
10400 }
10401
10402 if (class19.reverseGetFirst() == null) {
10403 groundArray[plane][i4][l6] = null;
10404 }
10405 spawnGroundItem(i4, l6);
10406 }
10407 }
10408 return;
10409 }
10410 if (j == 160) {
10411 int k1 = stream.method428();
10412 int j4 = anInt1268 + (k1 >> 4 & 7);
10413 int i7 = anInt1269 + (k1 & 7);
10414 int l9 = stream.method428();
10415 int j12 = l9 >> 2;
10416 int k14 = l9 & 3;
10417 int j16 = ClientConstants.anIntArray1177[j12];
10418 int animation = stream.method435();
10419 if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
10420 int j18 = intGroundArray[plane][j4][i7];
10421 int i19 = intGroundArray[plane][j4 + 1][i7];
10422 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
10423 int k20 = intGroundArray[plane][j4][i7 + 1];
10424 if (j16 == 0) {
10425 WallLoc class10 = landScape.getWall(plane, j4, i7);
10426 if (class10 != null) {
10427 int k21 = class10.uid >> 14 & 0x7fff;
10428 if (j12 == 2) {
10429 class10.root = new SceneObject(k21, 4 + k14, 2, i19, l19, j18, k20, animation, false);
10430 class10.extension = new SceneObject(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, animation, false);
10431 }
10432 else {
10433 class10.root = new SceneObject(k21, k14, j12, i19, l19, j18, k20, animation, false);
10434 }
10435 }
10436 }
10437 if (j16 == 1) {
10438 WallDecoration class26 = landScape.getWallDecoration(j4, i7, plane);
10439 if (class26 != null)
10440 class26.node = new SceneObject(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, animation, false);
10441 }
10442 if (j16 == 2) {
10443 StaticObject class28 = landScape.getObject(j4, i7, plane);
10444 if (j12 == 11)
10445 j12 = 10;
10446 if (class28 != null)
10447 class28.node = new SceneObject(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, animation, false);
10448 }
10449 if (j16 == 3) {
10450 GroundDecoration class49 = landScape.getGroundDecoration(i7, j4, plane);
10451 if (class49 != null)
10452 class49.node = new SceneObject(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, animation, false);
10453 }
10454 }
10455 return;
10456 }
10457 if (j == 147) {
10458 int l1 = stream.method428();
10459 int k4 = anInt1268 + (l1 >> 4 & 7);
10460 int j7 = anInt1269 + (l1 & 7);
10461 int i10 = stream.readUnsignedWord();
10462 byte byte0 = stream.method430();
10463 int l14 = stream.method434();
10464 byte byte1 = stream.method429();
10465 int k17 = stream.readUnsignedWord();
10466 int k18 = stream.method428();
10467 int j19 = k18 >> 2;
10468 int i20 = k18 & 3;
10469 int l20 = ClientConstants.anIntArray1177[j19];
10470 byte byte2 = stream.readSignedByte();
10471 int l21 = stream.readUnsignedWord();
10472 byte byte3 = stream.method429();
10473 Player player;
10474 if (i10 == unknownInt10)
10475 player = myPlayer;
10476 else
10477 player = playerArray[i10];
10478 if (player != null) {
10479 ObjectDefinition class46 = ObjectDefinition.forId(l21);
10480 int i22 = intGroundArray[plane][k4][j7];
10481 int j22 = intGroundArray[plane][k4 + 1][j7];
10482 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
10483 int l22 = intGroundArray[plane][k4][j7 + 1];
10484 Model model = class46.getAdjustedModel(j19, i20, i22, j22, k22, l22, -1);
10485 if (model != null) {
10486 addTemporaryObject(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1, 0, false, false);
10487 player.objectStartCycle = l14 + loopCycle;
10488 player.objectEndCycle = k17 + loopCycle;
10489 player.aModel_1714 = model;
10490 int i23 = class46.sizeX;
10491 int j23 = class46.sizeY;
10492 if (i20 == 1 || i20 == 3) {
10493 i23 = class46.sizeY;
10494 j23 = class46.sizeX;
10495 }
10496 player.objectX = k4 * 128 + i23 * 64;
10497 player.objectY = j7 * 128 + j23 * 64;
10498 player.objectZ = getLand(plane, player.objectY, player.objectX);
10499 if (byte2 > byte0) {
10500 byte byte4 = byte2;
10501 byte2 = byte0;
10502 byte0 = byte4;
10503 }
10504 if (byte3 > byte1) {
10505 byte byte5 = byte3;
10506 byte3 = byte1;
10507 byte1 = byte5;
10508 }
10509 player.objectX0 = k4 + byte2;
10510 player.objectY0 = k4 + byte0;
10511 player.objectX1 = j7 + byte3;
10512 player.objectY1 = j7 + byte1;
10513 }
10514 }
10515 }
10516 if (j == 151) {
10517 int i2 = stream.method426();
10518 int l4 = anInt1268 + (i2 >> 4 & 7);
10519 int k7 = anInt1269 + (i2 & 7);
10520 int objectId = stream.method434();
10521 int k12 = stream.method428();
10522 int type = k12 >> 2;
10523 int k16 = k12 & 3;
10524 int l17 = ClientConstants.anIntArray1177[type];
10525 if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104) {
10526 addTemporaryObject(-1, objectId, k16, l17, k7, type, plane, l4, 0, 0, false, false);
10527 }
10528 return;
10529 }
10530 if (j == 4) {
10531 int j2 = stream.readUnsignedByte();
10532 int i5 = anInt1268 + (j2 >> 4 & 7);
10533 int l7 = anInt1269 + (j2 & 7);
10534 int k10 = stream.readUnsignedWord();
10535 int l12 = stream.readUnsignedByte();
10536 int j15 = stream.readUnsignedWord();
10537 if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
10538 i5 = i5 * 128 + 64;
10539 l7 = l7 * 128 + 64;
10540 SceneSpotAnim class30_sub2_sub4_sub3 = new SceneSpotAnim(plane, loopCycle, j15, k10, getLand(plane, l7, i5) - l12, l7, i5);
10541 spotanims.insertHead(class30_sub2_sub4_sub3);
10542 }
10543 return;
10544 }
10545
10546 //44 = drop an item
10547 if (j == 44) {
10548 int itemId = stream.method436();
10549 int amount = stream.readUnsignedWord();
10550 int i8 = stream.readUnsignedByte();
10551 int regionX = anInt1268 + (i8 >> 4 & 7);
10552 int regionY = anInt1269 + (i8 & 7);
10553 if (regionX >= 0 && regionY >= 0 && regionX < 104 && regionY < 104) {
10554 Item groundItem = new Item();
10555 groundItem.itemId = itemId;
10556 groundItem.amount = amount;
10557 groundItem.value = ItemPrice.getValueDropsOnly(itemId, amount);
10558 groundItem.setLocal(regionX, regionY);
10559 if (groundArray[plane][regionX][regionY] == null)
10560 groundArray[plane][regionX][regionY] = new NodeList();
10561 groundArray[plane][regionX][regionY].insertHead(groundItem);
10562 spawnGroundItem(regionX, regionY);
10563 groundArray[plane][regionX][regionY].sort(COMPARE_ITEM_BY_VALUE);
10564 }
10565 return;
10566 }
10567 if (j == 101) {
10568 int l2 = stream.method427();
10569 int k5 = l2 >> 2;
10570 int j8 = l2 & 3;
10571 int i11 = ClientConstants.anIntArray1177[k5];
10572 int j13 = stream.readUnsignedByte();
10573 int xConverted = anInt1268 + (j13 >> 4 & 7);
10574 int yConverted = anInt1269 + (j13 & 7);
10575
10576 if (xConverted >= 0 && yConverted >= 0 && xConverted < 104 && yConverted < 104) {
10577 addTemporaryObject(-1, -1, j8, i11, yConverted, k5, plane, xConverted, 0, 0, false, false);
10578 }
10579 return;
10580 }
10581 if (j == 117) {
10582 int i3 = stream.readUnsignedByte();
10583 int l5 = anInt1268 + (i3 >> 4 & 7);
10584 int k8 = anInt1269 + (i3 & 7);
10585 int j11 = l5 + stream.readSignedByte();
10586 int k13 = k8 + stream.readSignedByte();
10587 int l15 = stream.readSignedWord();
10588 int projectileId = stream.readUnsignedWord();
10589 int i18 = stream.readUnsignedByte() * 4;
10590 int l18 = stream.readUnsignedByte() * 4;
10591 int k19 = stream.readUnsignedWord();
10592 int j20 = stream.readUnsignedWord();
10593 int i21 = stream.readUnsignedByte();
10594 int j21 = stream.readUnsignedByte();
10595 if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && projectileId != 65535) {
10596 l5 = l5 * 128 + 64;
10597 k8 = k8 * 128 + 64;
10598 j11 = j11 * 128 + 64;
10599 k13 = k13 * 128 + 64;
10600 SceneProjectile class30_sub2_sub4_sub4 = new SceneProjectile(i21, l18, k19 + loopCycle, j20 + loopCycle, j21, plane, getLand(plane, k8, l5) - i18, k8, l5, l15, projectileId);
10601 class30_sub2_sub4_sub4.update(k19 + loopCycle, k13, getLand(plane, k13, j11) - l18, j11);
10602 projectiles.insertHead(class30_sub2_sub4_sub4);
10603 }
10604 }
10605 }
10606
10607 private void addObject(int y, int j, int k, int l, int x, int type, int objectId) {
10608 if (x >= 1 && y >= 1 && x <= 102 && y <= 102) {
10609 if (lowMem && j != plane) {
10610 return;
10611 }
10612 int i2 = 0;
10613 if (type == 0) {
10614 i2 = landScape.getWallUID(j, x, y);
10615 }
10616 if (type == 1) {
10617 i2 = landScape.getWallDecorationUID(j, x, y);
10618 }
10619 if (type == 2) {
10620 i2 = landScape.getObjectUID(j, x, y);
10621 }
10622 if (type == 3) {
10623 i2 = landScape.getGroundDecorationUID(j, x, y);
10624 }
10625 if (i2 != 0) {
10626 int i3 = landScape.getArrangement(j, x, y, i2);
10627 int j2 = i2 >> 14 & 0x7fff;
10628 int k2 = i3 & 0x1f;
10629 int l2 = i3 >> 6;
10630 if (type == 0) {
10631 landScape.removeWall(x, j, y, (byte) -119);
10632 ObjectDefinition class46 = ObjectDefinition.forId(j2);
10633 if (class46.blocksWalk) {
10634 collisionMap[j].removeWall(l2, k2, class46.blocksProjectiles, x, y);
10635 }
10636 }
10637 if (type == 1) {
10638 landScape.removeWallDecoration(y, j, x);
10639 }
10640 if (type == 2) {
10641 landScape.removeObjects(j, x, y);
10642 ObjectDefinition class46_1 = ObjectDefinition.forId(j2);
10643 if (x + class46_1.sizeX > 103 || y + class46_1.sizeX > 103 || x + class46_1.sizeY > 103 || y + class46_1.sizeY > 103) {
10644 return;
10645 }
10646 if (class46_1.blocksWalk) {
10647 collisionMap[j].removeObject(l2, class46_1.sizeX, x, y, class46_1.sizeY, class46_1.blocksProjectiles);
10648 }
10649 }
10650 if (type == 3) {
10651 landScape.removeGroundDecoration(j, y, x);
10652 ObjectDefinition class46_2 = ObjectDefinition.forId(j2);
10653 if (class46_2.blocksWalk && class46_2.hasActions) {
10654 collisionMap[j].method218(y, x);
10655 }
10656 }
10657 }
10658 if (objectId >= 0) {
10659 int j3 = j;
10660 if (j3 < 3 && (byteGroundArray[1][x][y] & 2) == 2) {
10661 j3++;
10662 }
10663 ObjectManager.addObject(landScape, k, y, l, j3, collisionMap[j], intGroundArray, x, objectId, j);
10664 }
10665 }
10666 }
10667
10668 public static boolean customCameraPosition;
10669
10670
10671 private void setCameraPos(int value1, int value2, int value3, int value4, int value5, int value6) {
10672 if (customCameraPosition) {
10673 return;
10674 }
10675 int l1 = 2048 - value2 & 0x7ff;
10676 int i2 = 2048 - value5 & 0x7ff;
10677 int j2 = 0;
10678 int k2 = 0;
10679 int l2 = value1;
10680 // value3 == x position on the map, value6 is y position
10681 if (l1 != 0) {
10682 int i3 = Model.modelIntArray1[l1];
10683 int k3 = Model.modelIntArray2[l1];
10684 int i4 = k2 * k3 - l2 * i3 >> 16;
10685 l2 = k2 * i3 + l2 * k3 >> 16;
10686 k2 = i4;
10687 }
10688 if (i2 != 0) {
10689 int j3 = Model.modelIntArray1[i2];
10690 int l3 = Model.modelIntArray2[i2];
10691 int j4 = l2 * j3 + j2 * l3 >> 16;
10692 l2 = l2 * l3 - j2 * j3 >> 16;
10693 j2 = j4;
10694 }
10695 xCameraPos = value3 - j2;
10696 zCameraPos = value4 - k2;
10697 yCameraPos = value6 - l2;
10698 yCameraCurve = value2;
10699 xCameraCurve = value5;
10700 }
10701
10702 public void sendFrame126(String string, int interfaceId) {
10703 if (interfaceId == 4439 && musicVolume == 0) {
10704 string = "No music selected.";
10705 Client.instance.sendCommandPacket("::nomusicselected");
10706 }
10707 if (RSInterface.interfaceCache[interfaceId] == null) {
10708 if (interfaceId == 20246) // Server sends this combat level id update because it cannot detect 525 version, didn't bother to add.
10709 {
10710 return;
10711 }
10712 Utility.print("Interface frame is null: " + interfaceId + ", string: " + string);
10713 }
10714 else {
10715 RSInterface.interfaceCache[interfaceId].message = string;
10716 }
10717 }
10718
10719 public void changeColour(int id, int colour) {
10720 int i19 = colour >> 10 & 0x1f;
10721 int i22 = colour >> 5 & 0x1f;
10722 int l24 = colour & 0x1f;
10723 RSInterface.interfaceCache[id].textColour = (i19 << 19) + (i22 << 11) + (l24 << 3);
10724 }
10725
10726 public void sendPacket185(int button, int toggle, int type) {
10727 switch (type) {
10728 case 135:
10729 RSInterface class9 = RSInterface.interfaceCache[button];
10730 boolean flag8 = true;
10731 if (class9.actionType > 0)
10732 flag8 = promptUserForInput(class9);
10733 if (flag8) {
10734 stream.createFrame(185);
10735 stream.writeWord(button);
10736 }
10737 break;
10738 case 646:
10739 stream.createFrame(185);
10740 stream.writeWord(button);
10741 RSInterface class9_2 = RSInterface.interfaceCache[button];
10742 if (class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
10743 if (variousSettings[toggle] != class9_2.scriptCompareValue[0]) {
10744 variousSettings[toggle] = class9_2.scriptCompareValue[0];
10745 handleVarp(toggle);
10746 }
10747 }
10748 break;
10749 case 1100:
10750 RSInterface RSI = RSInterface.interfaceCache[button];
10751 RSI.setMenuVisible(!RSI.isMenuVisible());
10752 break;
10753 case 1200:
10754 stream.createFrame(185);
10755 stream.writeWord(button);
10756 RSInterface item = RSInterface.interfaceCache[button];
10757 RSInterface menu = RSInterface.interfaceCache[item.isMouseoverTriggered];
10758 menu.setMenuItem(item.getMenuItem());
10759 menu.setMenuVisible(false);
10760 break;
10761 case 169:
10762 stream.createFrame(185);
10763 stream.writeWord(button);
10764 RSInterface class9_3 = RSInterface.interfaceCache[button];
10765 if (class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5) {
10766 variousSettings[toggle] = 1 - variousSettings[toggle];
10767 handleVarp(toggle);
10768 }
10769 break;
10770 }
10771 }
10772
10773 public void sendFrame36(int id, int state) {
10774 anIntArray1045[id] = state;
10775 if (variousSettings[id] != state) {
10776 variousSettings[id] = state;
10777 handleVarp(id);
10778 if (dialogId != -1) {
10779 setUpdateChatAreaPending(true);
10780 }
10781 }
10782 }
10783
10784 public void sendFrame219() {
10785 if (getInvOverlayInterfaceID() != -1) {
10786 setInvOverlayInterfaceID(-1);
10787 setTabAreaAltered(true);
10788 }
10789 if (backDialogueId != -1) {
10790 backDialogueId = -1;
10791 setUpdateChatAreaPending(true);
10792 }
10793 if (inputDialogState != 0) {
10794 inputDialogState = 0;
10795 setUpdateChatAreaPending(true);
10796 }
10797 setInterfaceDisplayed(-1);
10798 setDialogueOptionsShowing(false);
10799 }
10800
10801 public void sendFrame248(int interfaceID, int sideInterfaceID) {
10802 if (backDialogueId != -1) {
10803 backDialogueId = -1;
10804 setUpdateChatAreaPending(true);
10805 }
10806 if (inputDialogState != 0) {
10807 inputDialogState = 0;
10808 setUpdateChatAreaPending(true);
10809 }
10810 setInterfaceDisplayed(interfaceID);
10811 setInvOverlayInterfaceID(sideInterfaceID);
10812 setTabAreaAltered(true);
10813 setDialogueOptionsShowing(false);
10814 }
10815
10816
10817 public static long timeReceivedPacket;
10818
10819 public static long packetLossLight;
10820
10821 public static long packetLossHeavy;
10822
10823 public static boolean packetLossShouldInformServer;
10824
10825 public void setSidebarInterface(int sidebarID, int interfaceID) {
10826 tabInterfaceId[sidebarID] = interfaceID;
10827 setTabId(sidebarID, true);
10828 setTabAreaAltered(true);
10829 }
10830
10831 private void drawScene() {
10832 sceneCycle++;
10833 drawPlayers(true);
10834 drawPlayers(false);
10835 drawNPCs(true);
10836 drawNPCs(false);
10837 drawProjectiles();
10838 drawSpotAnims();
10839 if (!inCutsceneMode) {
10840 int i = chaseCameraPitch;
10841 if (minCameraPitch / 256 > i) {
10842 i = minCameraPitch / 256;
10843 }
10844 if (cameraEffectEnabled[4] && anIntArray1203[4] + 128 > i) {
10845 i = anIntArray1203[4] + 128;
10846 }
10847 int k = viewRotation + viewRotationOffset & 0x7ff;
10848 int cameraZoom = CameraPos2;
10849 int yOffset = 0;
10850 // Adjust the camera height, without this, if i zoom in, then move camera down to as near as possible to the ground level, it will make character not in center y axis.
10851 if (Client.isFixedScreen()) {
10852 yOffset = 383 - chaseCameraPitch;
10853 yOffset /= 5;
10854 }
10855 setCameraPos(cameraZoom + i * CameraPos1, i, chaseCameraX, getLand(plane, myPlayer.y, myPlayer.x) - (50 + yOffset), k, chaseCameraY);
10856 // myPlayer.turnDirection = 1092 - k & 0x7ff; // enable this, so
10857 // when the player uses arrow keys, the character faces that
10858 // direction
10859 }
10860 int j;
10861 if (!inCutsceneMode) {
10862 j = getTopPlane();
10863 }
10864 else {
10865 j = getTopCutscenePlane();
10866 }
10867 int l = xCameraPos;
10868 int i1 = zCameraPos;
10869 int j1 = yCameraPos;
10870 int k1 = yCameraCurve;
10871 int l1 = xCameraCurve;
10872 for (int i2 = 0; i2 < 5; i2++) {
10873 if (cameraEffectEnabled[i2]) {
10874 int j2 = (int) ((Math.random() * (double) (anIntArray873[i2] * 2 + 1) - (double) anIntArray873[i2]) + Math.sin((double) cameraEffectCycles[i2] * ((double) anIntArray928[i2] / 100D)) * (double) anIntArray1203[i2]);
10875 if (i2 == 0)
10876 xCameraPos += j2;
10877 if (i2 == 1)
10878 zCameraPos += j2;
10879 if (i2 == 2)
10880 yCameraPos += j2;
10881 if (i2 == 3)
10882 xCameraCurve = xCameraCurve + j2 & 0x7ff;
10883 if (i2 == 4) {
10884 yCameraCurve += j2;
10885 if (yCameraCurve < 128)
10886 yCameraCurve = 128;
10887 if (yCameraCurve > 383)
10888 yCameraCurve = 383;
10889 }
10890 }
10891 }
10892 int k2 = Rasterizer.cycle;
10893 Model.aBoolean1684 = true;
10894 Model.anInt1687 = 0;
10895 Model.anInt1685 = super.mouseX - 4;
10896 Model.anInt1686 = super.mouseY - 4;
10897 DrawingArea.setAllPixelsToZero();
10898 DrawingArea.drawPixels(getClientHeight(), 0, 0, FogHandler.fogColour, getClientWidth()); // Gfx fix for fog.
10899 landScape.draw(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
10900 landScape.clearObj5Cache();
10901 FogHandler.renderFog(Client.instance.inGameScreen.pixels, Client.instance.inGameScreen.depthBuffer);
10902 UpdateEntity.updateEntities();
10903 CombatBox.drawCombatBox(this);
10904 drawHeadIcon();
10905 if (!isFixedScreen()) {
10906 InventoryTab.drawTabArea(this);
10907 MiniMap.drawMinimap(this);
10908 ChatArea.drawChatArea(this);
10909 }
10910 updateTextures(k2);
10911 GroundItemsOverlay.renderGroundItemNames();
10912 draw3dScreen();
10913 if (isDisconnected() && Client.canReconnect()) {
10914 newRegularFont.drawBasicString1(17 - ((System.currentTimeMillis() - timeDisconnected) / 1000) + "", contextMenu.equals("NEW") ? 187 : 101, contextMenu.equals("NEW") ? 30 : 17, false, contextMenu.equals("NEW") ? 0xc8c8c8 : 0xffffff, false);
10915 }
10916 inGameScreen.drawGraphics(isFixedScreen() ? 4 : 0, super.graphics, isFixedScreen() ? 4 : 0);
10917
10918 xCameraPos = l;
10919 zCameraPos = i1;
10920 yCameraPos = j1;
10921 yCameraCurve = k1;
10922 xCameraCurve = l1;
10923
10924 if (!initializedByStandalone) {
10925 if (Client.RESIZABLE_WIDTH != ClientFrame.frame.getWidth() || Client.RESIZABLE_HEIGHT != ClientFrame.frame.getHeight()) {
10926 if (!Client.isFixedScreen()) {
10927 Client.RESIZABLE_WIDTH = ClientFrame.frame.getWidth();
10928 Client.RESIZABLE_HEIGHT = ClientFrame.frame.getHeight();
10929 int newWidth = Client.RESIZABLE_WIDTH;
10930 int newHeight = Client.RESIZABLE_HEIGHT;
10931 if (ClientFrame.frame.getWidth() % 4 == 0) {
10932 // even
10933 } else {
10934 newWidth++;
10935 }
10936 if (ClientFrame.frame.getHeight() % 4 == 0) {
10937 // even
10938 } else {
10939 newHeight++;
10940 }
10941 ClientFrame.frame.setSize(newWidth, newHeight);
10942 setBounds();
10943 }
10944 }
10945 } else {
10946 if (!ClientFrame.frame.getSize().equals(LAST_FRAME_SIZE) && (RESIZABLE_WIDTH != ClientFrame.frame.getWidth()
10947 || RESIZABLE_HEIGHT != ClientFrame.frame.getHeight())) {
10948 if (!isFixedScreen()) {
10949 RESIZABLE_WIDTH = ClientFrame.frame.getWidth();
10950 RESIZABLE_HEIGHT = ClientFrame.frame.getHeight();
10951 RESIZABLE_HEIGHT += ClientFrame.yInsetLength;
10952
10953 LAST_FRAME_SIZE = new Dimension(ClientFrame.frame.getSize());
10954
10955 parentPanel.setSize(RESIZABLE_WIDTH, RESIZABLE_HEIGHT);//or did you mean that this fixed it a lil bit? no you waS fixed size before it was not show game,public button look here
10956 parentPanel.setPreferredSize(parentPanel.getSize());//thats prob not
10957 graphicsRequiresUpdate = true;
10958 welcomeScreenRaised = true;
10959 setBounds();
10960 }
10961 }
10962 }
10963 }
10964
10965 public Entity currentInteract;
10966 static Dimension LAST_FRAME_SIZE = new Dimension(0, 0);
10967
10968 public void clearTopInterfaces() {
10969 stream.createFrame(130);
10970 if (getInvOverlayInterfaceID() != -1) {
10971 setInvOverlayInterfaceID(-1);
10972 setDialogueOptionsShowing(false);
10973 setTabAreaAltered(true);
10974 }
10975 if (backDialogueId != -1) {
10976 backDialogueId = -1;
10977 setUpdateChatAreaPending(true);
10978 setDialogueOptionsShowing(false);
10979 }
10980 inputValue = -1;
10981 setInterfaceDisplayed(-1);
10982 fullscreenInterfaceID = -1;
10983 donatorShopSearching = false;
10984 Client.shopSearching = false;
10985 Client.searching = false;
10986 Client.profileSearching = false;
10987 }
10988
10989 public Client(JPanel panel, boolean initializedByStandalone) {
10990 try {
10991 Music.midiPlayer = new MidiPlayer();
10992 }
10993 catch (Exception e) {
10994 e.printStackTrace();
10995 }
10996 if (Music.midiPlayer == null) {
10997 Client.forceDisableMidiSystem = true;
10998 }
10999 this.parentPanel = panel;
11000 this.initializedByStandalone = initializedByStandalone;
11001 mapBack = new Background[2];
11002 xpCounter = 0;
11003 backgroundSprite = new Sprite[10];
11004 fullscreenInterfaceID = -1;
11005 chatRights = new int[500];
11006 chatTypeView = 0;
11007 clanChatMode = 0;
11008 cButtonHPos = -1;
11009 cButtonCPos = 0;
11010 crown = new Sprite[37];
11011 pathDistance = new int[104][104];
11012 friendsNodeIds = new int[200];
11013 groundArray = new NodeList[4][104][104];
11014 updateFlames = false;
11015 aStream_834 = new Stream(new byte[5000]);
11016 npcArray = new Npc[50000];
11017 npcIndices = new int[50000];
11018 entityUpdateIndices = new int[1000];
11019 aStream_847 = Stream.create();
11020 soundsAreEnabled = true;
11021 setInterfaceDisplayed(-1);
11022 skillExperience = new int[Skills.SKILL_COUNT];
11023 useJagGrab = false;
11024 anIntArray873 = new int[5];
11025 cameraEffectEnabled = new boolean[5];
11026 drawFlames = false;
11027 unknownInt10 = -1;
11028 menuOpen = false;
11029 inputString = "";
11030 maxPlayers = 2048;
11031 myPlayerIndex = 2047;
11032 playerArray = new Player[maxPlayers];
11033 playerIndices = new int[maxPlayers];
11034 entityIndices = new int[maxPlayers];
11035 aStreamArray895s = new Stream[maxPlayers];
11036 pathWaypoint = new int[104][104];
11037 tmpTexture = new byte[16384];
11038 baseSkillLevel = new int[Skills.SKILL_COUNT];
11039 ignoreListAsLongs = new long[100];
11040 loadingError = false;
11041 anIntArray928 = new int[5];
11042 tileCycleMap = new int[104][104];
11043 chatTypes = new int[500];
11044 chatNames = new String[500];
11045 chatNamesRaw = new String[500];
11046 chatMessages = new String[500];
11047 chatButtons = new Sprite[4];
11048 isFocused = true;
11049 friendsListAsLongs = new long[200];
11050 currentSong = -1;
11051 spriteDrawX = -1;
11052 spriteDrawY = -1;
11053 mapbackOffsets0 = new int[33];
11054 decompressors = new Decompressor[6];
11055 variousSettings = new int[10000];
11056 aBoolean972 = false;
11057 spokenMaxCount = 50;
11058 spokenX = new int[spokenMaxCount];
11059 spokenY = new int[spokenMaxCount];
11060 spokenOffsetY = new int[spokenMaxCount];
11061 spokenOffsetX = new int[spokenMaxCount];
11062 spokenColor = new int[spokenMaxCount];
11063 spokenEffect = new int[spokenMaxCount];
11064 spokenCycle = new int[spokenMaxCount];
11065 spokenMessage = new String[spokenMaxCount];
11066 lastPlane = -1;
11067 hitMarks = new Sprite[20];
11068 selectedIdentityKitColor = new int[5];
11069 aBoolean994 = false;
11070 amountOrNameInput = "";
11071 projectiles = new NodeList();
11072 cameraSendingInfo = false;
11073 walkableInterfaceId = -1;
11074 cameraEffectCycles = new int[5];
11075 updateCharacterCreation = false;
11076 mapFunctions = new Sprite[100];
11077 dialogId = -1;
11078 maxStats = new int[Skills.SKILL_COUNT];
11079 anIntArray1045 = new int[2000];
11080 selectedMaleIdentityKit = true;
11081 compassOffsets0 = new int[151];
11082 compassOffsets1 = new int[151];
11083 flashingSidebarTab = -1;
11084 spotanims = new NodeList();
11085 mapbackOffsets1 = new int[33];
11086 chatInterface = new RSInterface();
11087 mapScenes = new Background[100];
11088 barFillColor = 0x4d4233;
11089 clotheIds = new int[7];
11090 objectIconX = new int[1000];
11091 objectIconY = new int[1000];
11092 sceneIsLoading = false;
11093 friendsList = new String[200];
11094 inStream = Stream.create();
11095 expectedCRCs = new int[9];
11096 menuActionCmd2 = new int[500];
11097 menuActionCmd3 = new int[500];
11098 menuActionCmd4 = new int[500];
11099 menuActionID = new int[500];
11100 menuActionCmd1 = new int[500];
11101 headIcons = new Sprite[24];
11102 skullIcons = new Sprite[26];
11103 headIconsHint = new Sprite[20];
11104 setTabAreaAltered(false);
11105 setChatAreaInputBoxTitle("");
11106 atPlayerActions = new String[5];
11107 atPlayerArray = new boolean[5];
11108 regionChunkUIDs = new int[4][13][13];
11109 objectIcon = new Sprite[1000];
11110 regionIsRestricted = false;
11111 setDialogueOptionsShowing(false);
11112 crosses = new Sprite[8];
11113 musicEnabled = true;
11114 setLoggedIn(false);
11115 canMute = false;
11116 loadingReceivedMap = false;
11117 inCutsceneMode = false;
11118 myUsername = "";
11119 myPassword = "";
11120 genericLoadingError = false;
11121 reportAbuseInterfaceID = -1;
11122 objects = new NodeList();
11123 chaseCameraPitch = 128;
11124 setInvOverlayInterfaceID(-1);
11125 stream = Stream.create();
11126 menuActionName = new String[500];
11127 anIntArray1203 = new int[5];
11128 sound = new int[50];
11129 chatScrollHeight = 78;
11130 setChatAreaInputBoxPlayerInput("");
11131 bankSearchSent = "";
11132 setTabId(3, false);
11133 setUpdateChatAreaPending(false);
11134 collisionMap = new CollisionMap[4];
11135 soundType = new int[50];
11136 isDragging = false;
11137 soundDelay = new int[50];
11138 soundVolume = new int[50];
11139 rsAlreadyLoaded = false;
11140 welcomeScreenRaised = false;
11141 setMessagePromptRaised(false, false);
11142 setLoginMessage1("Enter your username and password.");
11143 backDialogueId = -1;
11144 bigX = new int[4000];
11145 bigY = new int[4000];
11146 }
11147
11148 public void resetAllImageProducers() {
11149 if (super.fullGameScreen != null) {
11150 return;
11151 }
11152 chatBackImage = null;
11153 mapBackImage = null;
11154 inventoryBackImage = null;
11155 inGameScreen = null;
11156 aRSImageProducer_1107 = null;
11157 aRSImageProducer_1109 = null;
11158 super.fullGameScreen = constructGraphicsBuffer(getClientWidth(), getClientHeight(), getGameComponent());
11159 welcomeScreenRaised = true;
11160 }
11161
11162 static {
11163 XP_LOOKUP = new int[99];
11164 int i = 0;
11165 for (int j = 0; j < 99; j++) {
11166 int l = j + 1;
11167 int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D));
11168 i += i1;
11169 XP_LOOKUP[j] = i / 4;
11170 }
11171 BIT_MASK = new int[32];
11172 i = 2;
11173 for (int k = 0; k < 32; k++) {
11174 BIT_MASK[k] = i - 1;
11175 i += i;
11176 }
11177 }
11178
11179 private static String intToKOrMilLongName(int i) {
11180 String s = String.valueOf(i);
11181 for (int k = s.length() - 3; k > 0; k -= 3) {
11182 s = s.substring(0, k) + "," + s.substring(k);
11183 }
11184
11185 if (s.length() > 8) {
11186 s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
11187 }
11188 else if (s.length() > 4) {
11189 s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
11190 }
11191 return " " + s;
11192 }
11193
11194 public static int getInterfaceDisplayed() {
11195 return interfaceDisplayed;
11196 }
11197
11198 static void setInterfaceDisplayed(int openInterfaceId) {
11199 if (Client.interfaceDisplayed == 26400 && RSInterface.interfaceCache[26435].disableModel) {
11200 return;
11201 }
11202 if (Client.interfaceDisplayed == 26702 && RSInterface.interfaceCache[26745].disableModel && Client.enableGamble) {
11203 return;
11204 }
11205 Client.interfaceDisplayed = openInterfaceId;
11206 if (openInterfaceId == -1) {
11207 Content.closeSearch(true, true);
11208 }
11209 if (openInterfaceId == 15106 || openInterfaceId == 15150) {
11210 setTabId(3, true);
11211 usingEquipmentInterface = true;
11212 setTabAreaAltered(true);
11213 }
11214 else {
11215 usingEquipmentInterface = false;
11216 }
11217 if (openInterfaceId != 24959) {
11218 Content.closeSearch(true, true);
11219 }
11220
11221 // Bank interface and shop interface and duel arena interface
11222 if (openInterfaceId == 24959 || openInterfaceId == 3824 || openInterfaceId == 6575) {
11223 setShowSettingTicks(false);
11224 }
11225 Content.drawOnBankInterface();
11226 Content.popUpSearchInterfaceDisplayedChanged(openInterfaceId, false);
11227 }
11228
11229 static int[] soundVolume = new int[50];
11230
11231 public static long timeUpdated;
11232
11233 private static int indexTest;
11234 /**
11235 * Cache downloading loading bar.
11236 * This method has to be kept here because of the image being loaded from the jar file
11237 */
11238 public void drawLoadingTextCacheDownloader(int amount, String text, boolean skip) {
11239 if (System.currentTimeMillis() - timeUpdated < 100 && !skip && amount != 100) {
11240 return;
11241 }
11242 timeUpdated = System.currentTimeMillis();
11243 if (RSApplet.shouldClearScreen) {
11244 if (Client.instance.graphics != null) {
11245 Client.instance.graphics.setColor(Color.black);
11246 Client.instance.graphics.fillRect(0, 0, Client.instance.myWidth, Client.instance.myHeight);
11247 RSApplet.shouldClearScreen = false;
11248 try {
11249 URL resource = getClass().getResource(ClientConstants.getLocalBackgroundImageLocation());
11250
11251 if (resource == null) {
11252 resource = localResourceLoader.get("http://Runecessor.net/background%200.png").getFile().toURI().toURL();
11253 }
11254
11255 Client.instance.graphics.drawImage(ImageIO.read(resource), 0, 0, 768, 506, null);
11256 } catch (Exception e) {
11257 e.printStackTrace();
11258 }
11259 }
11260 }
11261 Client.instance.drawLoadingText((int) (amount * 2.60), text);
11262 }
11263
11264 public static boolean isLoggedIn() {
11265 return loggedIn;
11266 }
11267
11268 public static void setLoggedIn(boolean loggedIn) {
11269 Client.loggedIn = loggedIn;
11270 }
11271
11272 public static boolean isShowSettingTicks() {
11273 return showSettingTicks;
11274 }
11275
11276 public static void setShowSettingTicks(boolean showSettingTicks) {
11277 Client.showSettingTicks = showSettingTicks;
11278 }
11279
11280 /**
11281 * Width of the client at fixed mode.
11282 */
11283 public static int FIXED_CLIENT_WIDTH = 764;
11284
11285 public static int FIXED_CLIENT_HEIGHT = 504;
11286
11287 /**
11288 * Width of the game screen at fixed mode.
11289 */
11290 public static int FIXED_GAME_SCREEN_WIDTH = 512;
11291
11292 public static int FIXED_GAME_SCREEN_HEIGHT = 334;
11293
11294 /**
11295 * Width of the client at resizable mode.
11296 * <p>
11297 * note: the client size and the game screen size of resizable is exactly the same.
11298 */
11299 public static int RESIZABLE_WIDTH = 1374;
11300
11301 public static int RESIZABLE_HEIGHT = 732;
11302
11303 public static String displayMode = "FIXED";
11304
11305 private static boolean isFixedScreen = displayMode.equals("FIXED");
11306
11307 public static int getGameScreenWidth() {
11308 switch (displayMode) {
11309 case "FIXED":
11310 return FIXED_GAME_SCREEN_WIDTH;
11311
11312 case "RESIZABLE":
11313 return RESIZABLE_WIDTH;
11314 }
11315
11316 return FIXED_GAME_SCREEN_WIDTH;
11317 }
11318
11319 public static int getGameScreenHeight() {
11320 switch (displayMode) {
11321 case "FIXED":
11322 return FIXED_GAME_SCREEN_HEIGHT;
11323
11324 case "RESIZABLE":
11325 return RESIZABLE_HEIGHT;
11326 }
11327
11328 return FIXED_GAME_SCREEN_HEIGHT;
11329 }
11330
11331 public static String osName = "";
11332
11333 public static int getClientHeight() {
11334 switch (displayMode) {
11335 case "FIXED":
11336 return FIXED_CLIENT_HEIGHT;
11337
11338 case "RESIZABLE":
11339 return RESIZABLE_HEIGHT + (Client.osName.equals("Windows 7") && !Client.instance.initializedByStandalone ? 11 : 0);
11340 }
11341
11342 return FIXED_CLIENT_HEIGHT;
11343 }
11344
11345 public static int getClientWidth() {
11346 switch (displayMode) {
11347 case "FIXED":
11348 return FIXED_CLIENT_WIDTH;
11349
11350 case "RESIZABLE":
11351 return RESIZABLE_WIDTH + (Client.osName.equals("Windows 7") && !Client.instance.initializedByStandalone ? 8 : 0);
11352 }
11353
11354 return FIXED_CLIENT_WIDTH;
11355 }
11356// u here?//yes try out fullscreen// now i need it with button and icon not this :)
11357 public static void setBounds() {
11358 // If this is changed, also got to change the screenshot positions.
11359 Rasterizer.prepare3d2(getClientWidth(), getClientHeight());
11360 Client.instance.fullScreenTextureArray = Rasterizer.offsets;
11361 Rasterizer.prepare3d2(isFixedScreen() ? 516 : getClientWidth(), isFixedScreen() ? 165 : getClientHeight());
11362 Client.instance.chatOffsets = Rasterizer.offsets;
11363 Rasterizer.prepare3d2(isFixedScreen() ? 250 : getClientWidth(), isFixedScreen() ? 335 : getClientHeight());
11364 Client.instance.sidebarOffsets = Rasterizer.offsets;
11365 Rasterizer.prepare3d2(getGameScreenWidth(), getGameScreenHeight());
11366 Client.instance.viewportOffsets = Rasterizer.offsets;
11367 int ai[] = new int[9];
11368 for (int i8 = 0; i8 < 9; i8++) {
11369 int k8 = 128 + i8 * 32 + 15;
11370 int l8 = 600 + k8 * 3;
11371 int i9 = Rasterizer.sin[k8];
11372 ai[i8] = l8 * i9 >> 16;
11373 }
11374 Landscape.prepare(500, 800, getGameScreenWidth(), getGameScreenHeight(), ai);
11375 if (loggedIn) {
11376 Client.instance.inGameScreen = constructGraphicsBuffer(getGameScreenWidth(), getGameScreenHeight(), Client.instance.getGameComponent());
11377 }
11378 }
11379
11380 public static ArrayList<String> npcInvisible = new ArrayList<String>();
11381
11382 private void logInUpdate() {
11383 npcInvisible.add("New log in-----------------");
11384 setDisconnected(false);
11385 if (!Client.isFixedScreenSaved) {
11386 setToResizable(true);
11387 }
11388
11389 if (!Client.isFixedScreen()) {
11390 ClientFrame.frame.setResizable(true);
11391 }
11392
11393 Music.stopMidi();
11394 Content.updateMusicVolume(); // Left here because Connor's one would crash on startup method.
11395
11396 // Inform server that the client is using 474 gameframe to use old wild interface.
11397 if (is474GameFrame) {
11398 Client.instance.sendCommandPacket("::oldgameframe");
11399 }
11400
11401 if (filtered) {
11402 Client.instance.sendCommandPacket("::filteron");
11403 }
11404 else {
11405 Client.instance.sendCommandPacket("::filteroff");
11406 }
11407 boolean autoLoop = false;
11408 if (autoLoop) {
11409 Client.interfacesReloadLoop = !Client.interfacesReloadLoop;
11410 Client.interfacesReloaded = !Client.interfacesReloaded;
11411 Client.instance.pushMessage("Interface looping: " + Client.interfacesReloadLoop, ClientConstants.CHAT_TYPE_GAME_MESSAGE, "", "");
11412 }
11413 if (ClientDebugConfiguration.FORCE_OPEN_INTERFACE > 0) {
11414 setInterfaceDisplayed(ClientDebugConfiguration.FORCE_OPEN_INTERFACE);
11415 }
11416
11417 if (Client.soundsAreEnabled) {
11418 Client.instance.sendCommandPacket("::soundson");
11419 }
11420 }
11421
11422 public static int astralRuneAmount;
11423
11424 public static int deathRuneAmount;
11425
11426 public static int earthRuneAmount;
11427
11428 public static void displayInputBox(int inputValueNumber, String inputTitle) {
11429 setUpdateChatAreaPending(true);
11430 inputDialogState = 0;
11431 setMessagePromptRaised(true, false);
11432 setChatAreaInputBoxPlayerInput("");
11433 bankSearchSent = "";
11434 inputValue = inputValueNumber;
11435 setChatAreaInputBoxTitle(inputTitle);
11436 friendsListAction = 0;
11437 }
11438
11439 public static String getMacAddress() {
11440 try {
11441 InetAddress a = InetAddress.getLocalHost();
11442 NetworkInterface n = NetworkInterface.getByInetAddress(a);
11443 if (n == null) {
11444 return "empty";
11445 }
11446 byte[] m = n.getHardwareAddress();
11447
11448 if (m == null) {
11449 return "invalid";
11450 }
11451 StringBuilder sb = new StringBuilder();
11452 for (int i = 0; i < m.length; i++) {
11453 sb.append(String.format("%02X%s", m[i], (i < m.length - 1) ? "-" : ""));
11454 }
11455 return sb.toString();
11456 }
11457 catch (Exception e) {
11458 e.printStackTrace();
11459 }
11460 return "invalid";
11461 }
11462
11463 String getLoginMessage1() {
11464 return loginMessage1;
11465 }
11466
11467 void setLoginMessage1(String loginMessage1) {
11468 this.loginMessage1 = loginMessage1;
11469 setLoginMessage2("");
11470 }
11471
11472 String getLoginMessage2() {
11473 return loginMessage2;
11474 }
11475
11476 void setLoginMessage2(String loginMessage2) {
11477 this.loginMessage2 = loginMessage2;
11478 }
11479
11480 public static boolean isTabAreaAltered() {
11481 return tabAreaAltered;
11482 }
11483
11484 public static void setTabAreaAltered(boolean tabAreaAltered) {
11485 Client.tabAreaAltered = tabAreaAltered;
11486 }
11487
11488 public static int getTutorialStage() {
11489 return tutorialStage;
11490 }
11491
11492 public static void setTutorialStage(int tutorialStage) {
11493 Client.tutorialStage = tutorialStage;
11494 }
11495
11496 public static void loadTextFonts() {
11497 Client.instance.smallText = new TextDrawingArea(false, "p11_full" + (Client.newFont ? "_new" : ""), Client.instance.titleStreamLoader);
11498 Client.instance.newSmallFont = new RSFont(false, "p11_full" + (Client.newFont ? "_new" : ""), Client.instance.titleStreamLoader);
11499 Client.instance.newRegularFont = new RSFont(false, "p12_full" + (Client.newFont ? "_new" : ""), Client.instance.titleStreamLoader);
11500 Client.instance.aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full" + (Client.newFont ? "_new" : ""), Client.instance.titleStreamLoader);
11501 Client.instance.chatTextDrawingArea = new TextDrawingArea(false, "b12_full" + (Client.newFont ? "_new" : ""), Client.instance.titleStreamLoader);
11502 Client.instance.newBoldFont = new RSFont(false, "b12_full" + (Client.newFont ? "_new" : ""), Client.instance.titleStreamLoader);
11503 }
11504
11505 /**
11506 * Dumps the item images for all items in the cache.
11507 * Put it in a command to dump images.
11508 * @param dumpByName
11509 */
11510 public static void dumpItemImages(boolean dumpByName) {
11511 for (int id = 0; id < 24000; id++) {
11512 ItemDefinition.forId(id);
11513 Sprite image = ItemDefinition.getSprite(id, id, 0);
11514 if (image != null) {
11515 dumpImage(image, dumpByName ? ItemDefinition.forId(id).name : Integer.toString(id));
11516 }
11517 else {
11518 Utility.print("Item is null.");
11519 }
11520 }
11521 }
11522
11523 static int amount = 0;
11524
11525 /**
11526 * Dumps a sprite with the specified name.
11527 * @param image
11528 */
11529 public static void dumpImage(Sprite image, String name) {
11530 File directory = new File("dump/");
11531 if (!directory.exists()) {
11532 directory.mkdir();
11533 }
11534 BufferedImage bi = new BufferedImage(image.myWidth, image.myHeight, BufferedImage.TYPE_INT_RGB);
11535 bi.setRGB(0, 0, image.myWidth, image.myHeight, image.myPixels, 0, image.myWidth);
11536 Image img = makeColorTransparent(bi, new Color(0, 0, 0));
11537 BufferedImage trans = imageToBufferedImage(img);
11538 File f = new File("dump/" + name + ".png");
11539 boolean duplicate = false;
11540 if (f.exists() && !f.isDirectory()) {
11541 amount++;
11542 duplicate = true;
11543 }
11544 try {
11545 Utility.print("Dump: " + name);
11546 if (duplicate) {
11547 File out = new File("dump/" + name + " " + amount + ".png");
11548 ImageIO.write(trans, "png", out);
11549 }
11550 else {
11551 File out = new File("dump/" + name + ".png");
11552 ImageIO.write(trans, "png", out);
11553 }
11554 }
11555 catch (Exception e) {
11556 e.printStackTrace();
11557 }
11558 }
11559
11560 /**
11561 * Turns an Image into a BufferedImage.
11562 * @param image
11563 * @return
11564 */
11565 private static BufferedImage imageToBufferedImage(Image image) {
11566 BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
11567 Graphics2D g2 = bufferedImage.createGraphics();
11568 g2.drawImage(image, 0, 0, null);
11569 g2.dispose();
11570 return bufferedImage;
11571 }
11572
11573 /**
11574 * Makes the specified color transparent in a buffered image.
11575 * @param im
11576 * @param color
11577 * @return
11578 */
11579 public static Image makeColorTransparent(BufferedImage im, final Color color) {
11580 RGBImageFilter filter = new RGBImageFilter() {
11581 public int markerRGB = color.getRGB() | 0xFF000000;
11582
11583 public final int filterRGB(int x, int y, int rgb) {
11584 if ((rgb | 0xFF000000) == markerRGB) {
11585 return 0x00FFFFFF & rgb;
11586 }
11587 else {
11588 return rgb;
11589 }
11590 }
11591 };
11592 ImageProducer ip = new FilteredImageSource(im.getSource(), filter);
11593 return Toolkit.getDefaultToolkit().createImage(ip);
11594 }
11595
11596
11597 /**
11598 * Used for storing all the clicked interfaces set to true. So when a new clicked interface is changed to true, the ones stored here
11599 * can be reset.
11600 */
11601 public static ArrayList<String> interfaceClickedList = new ArrayList<String>();
11602
11603 /**
11604 * Used for storing all the clicked texts set to true. So when a new clicked interface is changed to true, the ones stored here
11605 * can be reset.
11606 */
11607 public static ArrayList<String> textClickedList = new ArrayList<String>();
11608
11609 /**
11610 * True to update items live, to allow for live editing and results.
11611 */
11612 public static boolean itemUpdate;
11613
11614 public static long lastItemUpdate;
11615
11616 public static long timeAchievementOpened;
11617
11618 public static int playerHeight;
11619
11620 public static boolean forceObjectUpdate;
11621
11622 /**
11623 * Have a specific interface button to have the clicked sprite.
11624 * @param interfaceId
11625 * @param clicked
11626 * @param linkedButtons TODO
11627 */
11628 public static void setInterfaceClicked(int parentInterfaceId, int interfaceId, boolean clicked, boolean linkedButtons) {
11629 if (linkedButtons) {
11630 for (int index = 0; index < interfaceClickedList.size(); index++) {
11631 String[] parse = interfaceClickedList.get(index).split(" ");
11632 int parentIdParse = Integer.parseInt(parse[0]);
11633 int interfaceIdParse = Integer.parseInt(parse[1]);
11634 if (parentInterfaceId == parentIdParse) {
11635 if (RSInterface.interfaceCache[interfaceIdParse] == null) {
11636 continue;
11637 }
11638 RSInterface.interfaceCache[interfaceIdParse].isClicked = false;
11639 interfaceClickedList.remove(index);
11640 break;
11641 }
11642 }
11643 }
11644 RSInterface.interfaceCache[interfaceId].isClicked = clicked;
11645 if (clicked) {
11646 interfaceClickedList.add(parentInterfaceId + " " + interfaceId);
11647 }
11648 }
11649
11650 public static void removeAllInterfaceClickedFromParentId(int parentInterfaceId) {
11651 for (int index = 0; index < interfaceClickedList.size(); index++) {
11652 String[] parse = interfaceClickedList.get(index).split(" ");
11653 int parentIdParse = Integer.parseInt(parse[0]);
11654 int interfaceIdParse = Integer.parseInt(parse[1]);
11655 if (parentInterfaceId == parentIdParse) {
11656 if (RSInterface.interfaceCache[interfaceIdParse] == null) {
11657 continue;
11658 }
11659 RSInterface.interfaceCache[interfaceIdParse].isClicked = false;
11660 interfaceClickedList.remove(index);
11661 break;
11662 }
11663 }
11664 }
11665
11666 public static void clearTextClicked() {
11667 for (int index = 0; index < textClickedList.size(); index++) {
11668 RSInterface.interfaceCache[Integer.parseInt(textClickedList.get(index))].textIsClicked = false;
11669 }
11670 textClickedList.clear();
11671 }
11672
11673 /**
11674 * Have a specific interface text to have the clicked sprite.
11675 * @param interfaceId
11676 * @param clicked
11677 */
11678 public static void setTextClicked(int interfaceId, boolean clicked) {
11679 if (clicked && RSInterface.interfaceCache[interfaceId].message.isEmpty()) {
11680 return;
11681 }
11682 for (int index = 0; index < textClickedList.size(); index++) {
11683 RSInterface.interfaceCache[Integer.parseInt(textClickedList.get(index))].textIsClicked = false;
11684 }
11685 textClickedList.clear();
11686 RSInterface.interfaceCache[interfaceId].textIsClicked = clicked;
11687 if (clicked) {
11688 textClickedList.add("" + interfaceId);
11689 }
11690 }
11691
11692 public static void dumpidx(int cacheIndex, int startId, int endId) {
11693 Utility.print("Unpacking idx: " + cacheIndex);
11694 try {
11695 File firstFolder = new File(ClientConstants.getCacheRevisionLocation() + "/" + cacheIndex);
11696 if (!firstFolder.exists()) {
11697 firstFolder.mkdir();
11698 }
11699
11700 for (int i = startId; i < (endId + 1); i++) {
11701 try {
11702 byte[] indexByteArray = null;
11703 if (Config.PRE_EOC) {
11704 indexByteArray = Client.instance.decompressors[cacheIndex].get(i).array();
11705 }
11706 else {
11707 indexByteArray = Client.instance.decompressors[cacheIndex].decompressOsrs(i);
11708 }
11709 if (indexByteArray == null) {
11710 Utility.print("Empty at: " + i);
11711 continue;
11712 }
11713 Utility.print("Dumping: " + i);
11714 BufferedOutputStream gzip = new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(ClientConstants.getCacheRevisionLocation() + "/" + cacheIndex + "/" + i + ".gz")));
11715 if (indexByteArray.length == 0)
11716 continue;
11717 else {
11718 gzip.write(indexByteArray);
11719 gzip.close();
11720
11721 }
11722 }
11723 catch (IOException io) {
11724 throw new IOException("could not write to folder indicated");
11725 }
11726 }
11727 }
11728 catch (Exception e) {
11729 e.printStackTrace();
11730 }
11731 }
11732
11733 int getMenuScreenArea() {
11734 return menuScreenArea;
11735 }
11736
11737 void setMenuScreenArea(int menuScreenArea) {
11738 this.menuScreenArea = menuScreenArea;
11739 }
11740
11741 public static void setToResizable(boolean logIn) {
11742 if (!Client.isFixedScreen()) {
11743 return;
11744 }
11745 // Change resizable button to clicked.
11746 if (Client.CameraPos2 < 400) {
11747 Client.CameraPos2 = 400;
11748 }
11749 Client.instance.sendFrame36(200, 1);
11750 Client.isFixedScreenSaved = false;
11751 Client.displayMode = "RESIZABLE";
11752 Client.setFixedScreen(false);
11753 Client.RESIZABLE_WIDTH = Client.clientWidthSaved;
11754 Client.RESIZABLE_HEIGHT = Client.clientHeightSaved;
11755 ClientFrame.rebuild(logIn);
11756
11757 if (!Client.isFixedScreenSaved && Client.clientMaximized) {
11758 Client.clientMaximizedPreviously = true;
11759 ClientFrame.frame.setSize(Client.clientWidthSaved, Client.clientHeightSaved);
11760 ClientFrame.frame.setExtendedState(ClientFrame.frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
11761 }
11762 Client.setBounds();
11763 Client.CameraPos1 = 1;
11764
11765 }
11766
11767 public static boolean isFixedScreen() {
11768 return isFixedScreen;
11769 }
11770
11771 public static void setFixedScreen(boolean isFixedScreen) {
11772 Client.isFixedScreen = isFixedScreen;
11773 }
11774
11775 public static boolean getUpdateChatAreaPending() {
11776 return updateChatAreaPending;
11777 }
11778
11779 public static void setUpdateChatAreaPending(boolean inputTaken) {
11780 Client.updateChatAreaPending = inputTaken;
11781 }
11782
11783 public static int getTabId() {
11784 return tabId;
11785 }
11786
11787 public void mouseWheelDragged(int i, int j) {
11788 if (!mouseWheelDown)
11789 return;
11790
11791 int speed = 3;
11792 for (Camera.CameraData data : Camera.CameraData.values()) {
11793 if (Client.cameraSpeed.equals(data.toString())) {
11794 speed = 3 + data.ordinal();
11795 }
11796 }
11797 this.cameraYawTranslate += i * speed;
11798 this.cameraPitchTranslate += (j << 1);
11799 }
11800
11801 public static void setTabId(int tabId, boolean ignoreHideInventory) {
11802 if (Client.usingEquipmentInterface) {
11803 return;
11804 }
11805 setTabAreaAltered(true);
11806 if (!ignoreHideInventory && !Client.getInventoryLayout("OLD")) {
11807 if (getTabId() == tabId) {
11808 if (Client.hideInventoryInterface && !Client.isFixedScreen()) {
11809 Client.hideInventoryInterfaceAction = !Client.hideInventoryInterfaceAction;
11810 }
11811 }
11812 else {
11813 Client.hideInventoryInterfaceAction = false;
11814 }
11815 }
11816 else {
11817 Client.hideInventoryInterfaceAction = false;
11818 }
11819 Client.tabId = tabId;
11820 }
11821
11822 static int getInvOverlayInterfaceID() {
11823 return invOverlayInterfaceID;
11824 }
11825
11826 static void setInvOverlayInterfaceID(int invOverlayInterfaceID) {
11827 Client.invOverlayInterfaceID = invOverlayInterfaceID;
11828 }
11829
11830 public int getLoadingStage() {
11831 return loadingStage;
11832 }
11833
11834 public void setLoadingStage(int loadingStage) {
11835 this.loadingStage = loadingStage;
11836 }
11837
11838 boolean isDisconnected() {
11839 return disconnected;
11840 }
11841
11842 void setDisconnected(boolean disconnected) {
11843 this.disconnected = disconnected;
11844 }
11845
11846 public static boolean isDialogueOptionsShowing() {
11847 return dialogueOptionsShowing;
11848 }
11849
11850 public static void setDialogueOptionsShowing(boolean dialogueOptionsShowing) {
11851 Client.dialogueOptionsShowing = dialogueOptionsShowing;
11852 }
11853
11854 public static boolean isMessagePromptRaised() {
11855 return messagePromptRaised;
11856 }
11857
11858
11859 public static void setMessagePromptRaised(boolean messagePromptRaised, boolean enterPressed) {
11860 Client.messagePromptRaised = messagePromptRaised;
11861 if (messagePromptRaised == false) {
11862 Content.popUpSearchInterfaceDisplayedChanged(0, enterPressed);
11863 }
11864 }
11865
11866 public static int getDialogueOptionUsed() {
11867 return dialogueOptionUsed;
11868 }
11869
11870 public static void setDialogueOptionUsed(int dialogueOptionUsed) {
11871 Client.dialogueOptionUsed = dialogueOptionUsed;
11872 if (dialogueOptionUsed != 0 && !Client.isDialogueOptionsShowing() && Client.backDialogueId > 0 && Client.inputValue == -1) {
11873 try {
11874 if (Client.dialogueOptionUsed >= 2461 && Client.dialogueOptionUsed <= 2498) {
11875 RSInterface.interfaceCache[Client.dialogueOptionUsed].message = "Please wait...";
11876 Client.setUpdateChatAreaPending(true); // This has to be kept here, so when i right click on floor, then press 1 to access dialogue option 1, it says please wait..
11877 }
11878 }
11879 catch (Exception e) {
11880 e.printStackTrace();
11881 Utility.print("Error55: " + e);
11882 }
11883 }
11884 }
11885
11886
11887 /**
11888 * Where the player downloads the whole Client in a zip folder.
11889 */
11890 public static boolean ZIP_CLIENT_VERSION = false;
11891
11892 /**
11893 * True to use mouse right click fix
11894 */
11895 public static boolean mouseRightClickFix = true;
11896
11897 public static Color loadingBarColour = null;
11898
11899 public static boolean coordinatesDisplay;
11900
11901 public static boolean isLocalCacheClient() {
11902 File folder = new File("Lavapkz/Runecessor_localversion");
11903 if (folder.exists()) {
11904 return true;
11905 }
11906 return false;
11907 }
11908
11909 public static String formatNumber(int number) {
11910 // Do not use return NumberFormat.getIntegerInstance().format(number);. It is 9 times slower.
11911 String string = Integer.toString(number);
11912 if (number < 1000) {
11913 return string;
11914 }
11915 if (number >= 1000 && number < 10000) {
11916 return string.substring(0, 1) + "," + string.substring(1);
11917 }
11918 if (number < 100000) {
11919 return string.substring(0, 2) + "," + string.substring(2);
11920 }
11921 if (number < 1000000) {
11922 return string.substring(0, 3) + "," + string.substring(3);
11923 }
11924 if (number < 10000000) {
11925 return string.substring(0, 1) + "," + string.substring(1, 4) + "," + string.substring(4, 7);
11926 }
11927 if (number < 100000000) {
11928 return string.substring(0, 2) + "," + string.substring(2, 5) + "," + string.substring(5, 8);
11929 }
11930 if (number < 1000000000) {
11931 return string.substring(0, 3) + "," + string.substring(3, 6) + "," + string.substring(6, 9);
11932 }
11933 if (number < Integer.MAX_VALUE) {
11934 return string.substring(0, 1) + "," + string.substring(1, 4) + "," + string.substring(4, 7) + "," + string.substring(7, 10);
11935 }
11936 return string;
11937 }
11938
11939
11940 /**
11941 * Change ClientConfiguration class settings to live version for players if it's set to that.
11942 */
11943 public static void setClientConfiguration() {
11944 if (!ClientLiveConfiguration.LIVE_GAME) {
11945 return;
11946 }
11947 printToConsole = false;
11948 ClientDebugConfiguration.DEBUG_INTERFACES = false;
11949 ClientDebugConfiguration.DEBUG_MODE = false;
11950 ClientDebugConfiguration.DEBUG_SPRITES = false;
11951 ClientDebugConfiguration.DUMP_SPRITES = false;
11952 ClientDebugConfiguration.FORCE_LOG_IN = false;
11953 ClientDebugConfiguration.FORCE_OPEN_INTERFACE = 0;
11954 ClientDebugConfiguration.NO_CLIP_COMMAND = false;
11955 ClientDebugConfiguration.LOCAL_CACHE = false;
11956 Client.LOCAL_HOST = false;
11957 ClientDebugConfiguration.DOWNLOAD_LATEST_CACHE = true;
11958
11959 // Do not change settings if client is local version client.
11960 if (!Client.ZIP_CLIENT_VERSION) {
11961 ClientDebugConfiguration.LOCAL_CACHE = false;
11962 ClientDebugConfiguration.DOWNLOAD_LATEST_CACHE = true;
11963 }
11964 }
11965
11966 public static void getArguments(boolean print) {
11967 String combinedArguments = "";
11968 String mode = "";
11969 if (Client.arguments != null) {
11970 for (int index = 0; index < Client.arguments.length; index++) {
11971 combinedArguments = combinedArguments + Client.arguments[index];
11972 }
11973 if (combinedArguments.contains("LIVE")) {
11974 printToConsole = true;
11975 }
11976 else {
11977 if (combinedArguments.contains("IGNORE")) {
11978 printToConsole = true;
11979 return;
11980 }
11981 if (combinedArguments.contains("MGT")) {
11982 isMgt = true;
11983 }
11984 if (combinedArguments.contains("HOME_CACHE")) {
11985 ClientDebugConfiguration.LOCAL_CACHE = false;
11986 }
11987 if (combinedArguments.contains("162.252.11.137")) {
11988 Client.LOCAL_HOST = true;
11989 printToConsole = true;
11990 }
11991 if (combinedArguments.contains("DEBUG")) {
11992 ClientLiveConfiguration.LIVE_GAME = false;
11993 printToConsole = true;
11994 }
11995 if (combinedArguments.contains("PRINT")) {
11996 printToConsole = true;
11997 }
11998 WebsiteRead.port = combinedArguments.contains("43595") ? 43595 : 43594;
11999 if (combinedArguments.contains("ECO")) {
12000 Config.ECO = true;
12001 Config.PVP = false;
12002 mode = "Eco";
12003 } else if (combinedArguments.contains("PVP")) {
12004 Config.ECO = false;
12005 Config.PVP = true;
12006 printToConsole = true;
12007 mode = "Pvp";
12008 } else if (combinedArguments.contains("PRE_EOC")) {
12009 Config.ECO = false;
12010 Config.PVP = false;
12011 Config.PRE_EOC = true;
12012 mode = "Pre-eoc";
12013 }
12014 }
12015 }
12016 if (print && !ClientLiveConfiguration.LIVE_GAME) {
12017 Utility.print("Mode: " + mode);
12018 Utility.print("Localhost: " + Client.LOCAL_HOST);
12019 Utility.print("Live client: " + ClientLiveConfiguration.LIVE_GAME);
12020 }
12021 }
12022
12023 public static void changeInterfaceSprite(int interfaceId, int newSpriteId) {
12024 RSInterface hover = RSInterface.interfaceCache[interfaceId];
12025 if (newSpriteId == -1) {
12026 hover.sprite1 = null;
12027 hover.sprite1Number = -1;
12028 }
12029 else {
12030 hover.sprite1 = RSInterface.imageLoaderNew(newSpriteId);
12031 hover.sprite1Number = newSpriteId;
12032 }
12033
12034 }
12035
12036 public static void changeInterfaceModel(int interfaceId, int newModel, int modelZoom, int xRotate, int yRotate, int xOffset, int yOffset) {
12037 RSInterface hover = RSInterface.interfaceCache[interfaceId];
12038 if (newModel >= 0) {
12039 hover.mediaID = newModel;
12040 }
12041 if (xRotate >= 0) {
12042 hover.modelRotationX = xRotate;
12043 }
12044 if (yRotate >= 0) {
12045 hover.modelRotationY = yRotate;
12046 }
12047 if (xOffset >= 0) {
12048 hover.mediaIdOffset1 = xOffset;
12049 }
12050 if (yOffset >= 0) {
12051 hover.mediaIdOffset2 = yOffset;
12052 }
12053 if (modelZoom >= 0) {
12054 hover.modelZoom = modelZoom;
12055 }
12056 }
12057
12058 public static void isClientOutdated() {
12059 if (ClientDebugConfiguration.DEBUG_MODE) {
12060 return;
12061 }
12062 if (ClientLiveConfiguration.CLIENT_VERSION < WebsiteRead.websiteClientLatestVersion) {
12063 Object[] options =
12064 {"Open website", "Continue"};
12065 int input = JOptionPane.showOptionDialog(null, "Your client is OUTDATED, you may experience bugs.\nReload your client to download latest updates.\nIf it does not work, open the website or go to www.Runecessor.com\nand re-download the client.", "" + ClientConstants.getServerName() + "", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, null);
12066
12067 if (input == JOptionPane.OK_OPTION) {
12068 try {
12069 Desktop.getDesktop().browse(new URI("https://www.Runecessor.com/play"));
12070 }
12071 catch (IOException e) {
12072 e.printStackTrace();
12073 }
12074 catch (URISyntaxException e) {
12075 e.printStackTrace();
12076 }
12077 }
12078 }
12079
12080 }
12081
12082 Entity opponent1 = null;
12083
12084 long delayTimer = 0;
12085
12086 private int currentHealth, maxHealth;
12087
12088 public static String getChatAreaInputBoxPlayerInput() {
12089 return chatAreaInputBoxPlayerInput;
12090 }
12091
12092 public static void setChatAreaInputBoxPlayerInput(String promptInput) {
12093 Client.chatAreaInputBoxPlayerInput = promptInput;
12094 }
12095
12096 public int getInteractingWithEntityId() {
12097 return interactingWithEntityId;
12098 }
12099
12100 public void setInteractingWithEntityId(int interactingWithEntityId) {
12101 this.interactingWithEntityId = interactingWithEntityId;
12102 }
12103
12104 public static void closeAllInterfaces() {
12105 if (getInvOverlayInterfaceID() != -1) {
12106 setInvOverlayInterfaceID(-1);
12107 setTabAreaAltered(true);
12108 }
12109 if (backDialogueId != -1) {
12110 backDialogueId = -1;
12111 setUpdateChatAreaPending(true);
12112 }
12113 if (inputDialogState != 0) {
12114 inputDialogState = 0;
12115 setUpdateChatAreaPending(true);
12116 }
12117 inputValue = -1;
12118 setInterfaceDisplayed(-1);
12119 setDialogueOptionsShowing(false);
12120 donatorShopSearching = false;
12121 shopSearching = false;
12122 searching = false;
12123 profileSearching = false;
12124
12125 }
12126
12127 public static boolean sendChat(String s, boolean autoChat) {
12128 // Because if you send 2 or more text in the same game tick, the server will only pick up the latest.
12129 if (System.currentTimeMillis() - KeyBoardAction.timeChatSent < 630) {
12130 return true;
12131 }
12132 if (autoChat) {
12133 Client.instance.sendCommandPacket("::autotype " + s);
12134 }
12135 KeyBoardAction.timeChatSent = System.currentTimeMillis();
12136 int j2 = 0;
12137 if (s.startsWith("yellow:")) {
12138 j2 = 0;
12139 s = s.substring(7);
12140 }
12141 else if (s.startsWith("red:")) {
12142 j2 = 1;
12143 s = s.substring(4);
12144 }
12145 else if (s.startsWith("green:")) {
12146 j2 = 2;
12147 s = s.substring(6);
12148 }
12149 else if (s.startsWith("cyan:")) {
12150 j2 = 3;
12151 s = s.substring(5);
12152 }
12153 else if (s.startsWith("purple:")) {
12154 j2 = 4;
12155 s = s.substring(7);
12156 }
12157 else if (s.startsWith("white:")) {
12158 j2 = 5;
12159 s = s.substring(6);
12160 }
12161 else if (s.startsWith("flash1:")) {
12162 j2 = 6;
12163 s = s.substring(7);
12164 }
12165 else if (s.startsWith("flash2:")) {
12166 j2 = 7;
12167 s = s.substring(7);
12168 }
12169 else if (s.startsWith("flash3:")) {
12170 j2 = 8;
12171 s = s.substring(7);
12172 }
12173 else if (s.startsWith("glow1:")) {
12174 j2 = 9;
12175 s = s.substring(6);
12176 }
12177 else if (s.startsWith("glow2:")) {
12178 j2 = 10;
12179 s = s.substring(6);
12180 }
12181 else if (s.startsWith("glow3:")) {
12182 j2 = 11;
12183 s = s.substring(6);
12184 }
12185 s = s.toLowerCase();
12186 int i3 = 0;
12187 if (s.startsWith("wave:")) {
12188 i3 = 1;
12189 s = s.substring(5);
12190 }
12191 else if (s.startsWith("wave2:")) {
12192 i3 = 2;
12193 s = s.substring(6);
12194 }
12195 else if (s.startsWith("shake:")) {
12196 i3 = 3;
12197 s = s.substring(6);
12198 }
12199 else if (s.startsWith("scroll:")) {
12200 i3 = 4;
12201 s = s.substring(7);
12202 }
12203 else if (s.startsWith("slide:")) {
12204 i3 = 5;
12205 s = s.substring(6);
12206 }
12207 Client.instance.stream.createFrame(4);
12208 Client.instance.stream.writeWordBigEndian(0);
12209 int j3 = Client.instance.stream.currentOffset;
12210 Client.instance.stream.method425(i3);
12211 Client.instance.stream.method425(j2);
12212 Client.instance.aStream_834.currentOffset = 0;
12213 TextInput.method526(s, Client.instance.aStream_834);
12214 Client.instance.stream.method441(0, Client.instance.aStream_834.buffer, Client.instance.aStream_834.currentOffset);
12215 Client.instance.stream.writeBytes(Client.instance.stream.currentOffset - j3);
12216 s = TextInput.processText(s);
12217 Client.myPlayer.textSpoken = s;
12218 Client.myPlayer.spokenColor = j2;
12219 Client.myPlayer.spokenEffect = i3;
12220 Client.myPlayer.textCycle = 150;
12221 // Messages of myself appearing in the chatbox.
12222 int rights = Client.myPlayer.privelage;
12223 Client.instance.pushMessage(Client.myPlayer.textSpoken, ClientConstants.CHAT_TYPE_MY_PLAYER, PlayerRank.getIconText(rights) + PlayerTitle.myMessagesInMyChat(Client.myPlayer), Client.myPlayer.getName());
12224 if (Client.instance.publicChatMode == ClientConstants.PUBLIC_OFF) {
12225 Client.instance.publicChatMode = ClientConstants.PUBLIC_HIDE;
12226 Client.instance.stream.createFrame(95);
12227 Client.instance.stream.writeWordBigEndian(Client.instance.publicChatMode);
12228 Client.instance.stream.writeWordBigEndian(Client.instance.privateChatMode);
12229 Client.instance.stream.writeWordBigEndian(Client.instance.tradeMode);
12230 }
12231 return false;
12232 }
12233
12234 static void sendString(String text, int id) {
12235 if (RSInterface.interfaceCache[id] != null) {
12236 RSInterface.interfaceCache[id].message = text;
12237 RSInterface.interfaceCache[id].scrollPosition = 0;
12238 }
12239 }
12240
12241
12242 public static void generateLoadingBarColour() {
12243 Client.loadingBarColour = Color.decode("#" + ClientConstants.LOADING_BAR_COLOUR);
12244 Client.loadingBarColourHex = Integer.valueOf(String.valueOf(ClientConstants.LOADING_BAR_COLOUR), 16);
12245
12246 }
12247
12248 public int yellColour;
12249
12250 public void handleColourGrab(Color col) {
12251 switch (getInterfaceDisplayed()) {
12252 case 26610: {
12253 RSInterface.interfaceCache[26510].colour = colourSelected;
12254 RSInterface.interfaceCache[26519].textColour = colourSelected;
12255 RSInterface.interfaceCache[26519].message = "<col=" + Integer.toHexString(colourSelected).substring(2) + ">From " + myPlayer.getName() + ": Hello my friend.";
12256 colourViewing = colourSelected;
12257 }
12258 break;
12259 case 26611: {
12260 Settings.PLAYER_TITLE = colourSelected;
12261 RSInterface.interfaceCache[26510].colour = colourSelected;
12262 RSInterface.interfaceCache[26519].message = "<col=" + Integer.toHexString(Settings.PLAYER_TITLE).substring(2) + ">" + myPlayer.playerTitle + " <col=ffffff>" + myPlayer.getName();
12263 colourViewing = colourSelected;
12264 }
12265 break;
12266 case 26612: {
12267 Settings.YELL = colourSelected;
12268 RSInterface.interfaceCache[26510].colour = colourSelected;
12269 RSInterface.interfaceCache[26519].textColour = colourSelected;
12270 RSInterface.interfaceCache[26519].message = "<col=" + Integer.toHexString(Settings.YELL).substring(2) + ">[Owner] " + myPlayer.getName() + "<col=ffffff>: Hey.";
12271 colourViewing = colourSelected;
12272 }
12273 break;
12274 case 26613: {
12275 RSInterface.interfaceCache[26510].colour = colourSelected;
12276 RSInterface.interfaceCache[26519].message = "";
12277 colourViewing = colourSelected;
12278 }
12279 break;
12280 }
12281 }
12282
12283 public void sendData(int type) {
12284 switch (type) {
12285
12286 case 1:
12287 Settings.PRIVATE_MESSAGE = colourViewing;
12288 RSInterface.interfaceCache[26511].colour = colourSelected;
12289 break;
12290 case 2:
12291 Settings.PLAYER_TITLE = colourViewing;
12292 RSInterface.interfaceCache[26512].colour = colourSelected;
12293 stream.createFrame(187);
12294 stream.method431(0);
12295 stream.writeDWord(Settings.PLAYER_TITLE);
12296 break;
12297 case 3:
12298 Settings.YELL = colourViewing;
12299 RSInterface.interfaceCache[26513].colour = colourSelected;
12300 stream.createFrame(187);
12301 stream.method431(1);
12302 stream.writeDWord(Settings.YELL);
12303 break;
12304 case 4:
12305 FogHandler.fogColour = colourViewing;
12306 RSInterface.interfaceCache[26514].colour = colourSelected;
12307 break;
12308
12309 }
12310 }
12311
12312 public static SystemInfo getSystemInfo() {
12313 return info;
12314 }
12315
12316 public JPanel getGamePanel() {
12317 return parentPanel;
12318 }
12319
12320 public boolean isInitializedByStandalone() {
12321 return initializedByStandalone;
12322 }
12323
12324 public static AutomaticClientUpdater getClientUpdater() {
12325 return clientUpdater;
12326 }
12327
12328 private int getFrameFocusedInterface() {
12329 return frameFocusedInterface;
12330 }
12331
12332 public LocalResourceLoader getLocalResourceLoader() {
12333 return localResourceLoader;
12334 }
12335
12336 private void setFrameFocusedInterface(int frameFocusedInterface) {
12337 this.frameFocusedInterface = frameFocusedInterface;
12338 }
12339
12340 public static boolean isIgnorePromptInputReset() {
12341 return ignorePromptInputReset;
12342 }
12343
12344 public static void setIgnorePromptInputReset(boolean ignorePromptInputReset) {
12345 Client.ignorePromptInputReset = ignorePromptInputReset;
12346 }
12347
12348 public static String getChatAreaInputBoxTitle() {
12349 return chatAreaInputBoxTitle;
12350 }
12351
12352 public static void setChatAreaInputBoxTitle(String inputBoxTitle) {
12353 Client.chatAreaInputBoxTitle = inputBoxTitle;
12354 }
12355 public String getLoginMessage3() {
12356 return loginMessage3;
12357 }
12358 private void setLoginMessage3(String loginMessage3) {
12359 this.loginMessage3 = loginMessage3;
12360 }
12361 public void launchURL(String url) {
12362 String osName = System.getProperty("os.name");
12363 try {
12364 if (osName.startsWith("Mac OS")) {
12365 Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
12366 Method openURL = fileMgr.getDeclaredMethod("openURL",
12367 new Class[] { String.class });
12368 openURL.invoke(null, new Object[] { url });
12369 } else if (osName.startsWith("Windows"))
12370 Runtime.getRuntime().exec(
12371 "rundll32 url.dll,FileProtocolHandler " + url);
12372 else { // assume Unix or Linux
12373 String[] browsers = { "firefox", "opera", "konqueror",
12374 "epiphany", "mozilla", "netscape", "safari" };
12375 String browser = null;
12376 for (int count = 0; count < browsers.length && browser == null; count++)
12377 if (Runtime.getRuntime()
12378 .exec(new String[] { "which", browsers[count] })
12379 .waitFor() == 0)
12380 browser = browsers[count];
12381 if (browser == null) {
12382 throw new Exception("Could not find web browser");
12383 } else
12384 Runtime.getRuntime().exec(new String[] { browser, url });
12385 }
12386 } catch (Exception e) {
12387 pushMessage("Failed to open URL.", 0, "", "");
12388 }
12389 }
12390}