Guest User

Untitled

a guest
Jul 14th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 494.33 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3)
  4.  
  5. import java.applet.AppletContext;
  6. import java.awt.Color;
  7. import javax.swing.JOptionPane;
  8. import java.io.*;
  9. import java.awt.Component;
  10. import java.awt.Font;
  11. import java.awt.Graphics;
  12. import java.awt.Toolkit;
  13. import java.awt.datatransfer.Clipboard;
  14. import java.awt.datatransfer.DataFlavor;
  15. import java.awt.datatransfer.StringSelection;
  16. import java.awt.datatransfer.Transferable;
  17. import java.awt.datatransfer.UnsupportedFlavorException;
  18. import java.io.BufferedInputStream;
  19. import java.io.BufferedReader;
  20. import java.util.regex.Matcher;
  21. import java.util.regex.Pattern;
  22. import java.io.BufferedWriter;
  23. import java.io.ByteArrayInputStream;
  24. import java.io.DataInputStream;
  25. import java.io.EOFException;
  26. import java.text.*;
  27. import java.util.*;
  28. import java.io.File;
  29. import java.io.FileInputStream;
  30. import java.io.FileOutputStream;
  31. import java.io.FileReader;
  32. import java.io.IOException;
  33. import java.io.InputStream;
  34. import java.io.InputStreamReader;
  35. import java.io.OutputStream;
  36. import java.io.PrintWriter;
  37. import java.lang.reflect.Method;
  38. import java.net.InetAddress;
  39. import java.net.MalformedURLException;
  40. import java.net.Socket;
  41. import java.net.URL;
  42. import java.net.URLConnection;
  43. import java.util.Hashtable;
  44. import javax.swing.*;
  45. import java.util.Scanner;
  46.  
  47. import sign.signlink;
  48.  
  49. public class client extends RSApplet {
  50. public static String FileSection = System.getProperty("file.separator") + System.getProperty("user.home") + System.getProperty("file.separator");
  51.     private boolean loadTickSelection = false;
  52.     public int positions[] = new int[2000];
  53.     public int landScapes[] = new int[2000];
  54.     public int objects[] = new int[2000];
  55.     public AlertHandler alertHandler;
  56.     public Sprite alertBack;
  57.     public Sprite alertBorder;
  58.     public Sprite alertBorderH;
  59.     private Sprite HPBarFull;
  60.     private Sprite HPBarEmpty;
  61.     public int flagPos = 72, xpCounter;
  62.     public boolean xpHover = false;
  63.     public boolean xpClicked = false;
  64.     public boolean drawXpBar = false;
  65.     public boolean drawFlag = false;
  66.     private String prayerBook;
  67.     private ShortKeysPanel sk;
  68.    
  69.     public String getTitle(int rank) {
  70.         switch (rank) {
  71.                 /**Server Rankings**/
  72.                    case 0:
  73.                         return "Donator ";
  74.                 case 1:
  75.                         return "Donator ";
  76.                 case 2:
  77.                         return "Respected Donator ";
  78.                 case 3:
  79.                         return "Server Support ";
  80.                 case 4:
  81.                         return "Moderator ";
  82.                 case 5:
  83.                         return "Administrator ";
  84.                 case 8:
  85.                         return "Advisor ";
  86.                 case 9:
  87.                         return "Developer ";
  88.                 /**Loyalty Names**/
  89.                 case 10:
  90.                         return "Lord ";
  91.                 case 11:
  92.                         return "Lady ";
  93.                 case 12:
  94.                         return "Sir ";
  95.                 case 13:
  96.                         return "Dame ";
  97.                 case 14:
  98.                         return "Duderino ";
  99.                 case 15:
  100.                         return "Dudette ";
  101.                 case 16:
  102.                         return "Lionheart ";
  103.                 case 17:
  104.                         return "Crusader ";
  105.                 case 18:
  106.                         return "Hellraiser ";
  107.                 case 19:
  108.                         return "Desperado ";
  109.                 case 20:
  110.                         return "Baron ";
  111.                 case 21:
  112.                         return "Baroness ";
  113.                 case 22:
  114.                         return "Count ";
  115.                 case 23:
  116.                         return "Countess ";
  117.                 case 24:
  118.                         return "Overlord ";
  119.                 case 25:
  120.                         return "Overlordess ";
  121.                 case 26:
  122.                         return "Prince ";
  123.                 case 27:
  124.                         return "Princess ";
  125.                 case 28:
  126.                         return "Bandito ";
  127.                 case 29:
  128.                         return "Duke ";
  129.                 case 30:
  130.                         return "Dutchess ";
  131.                 case 31:
  132.                         return "Justiciar ";
  133.                 case 32:
  134.                         return "Big Cheese ";
  135.                 case 33:
  136.                         return "Bigwig ";
  137.                 case 34:
  138.                         return "King ";
  139.                 case 35:
  140.                         return "Queen ";
  141.                 case 36:
  142.                         return "Archon ";
  143.                 case 37:
  144.                         return "Emperor ";
  145.                 case 38:
  146.                         return "Empress ";
  147.                 case 39:
  148.                         return "Wunderkind ";
  149.                 case 40:
  150.                         return "Witch king ";
  151.                 case 41:
  152.                         return "Witch queen ";
  153.                 case 42:
  154.                         return "The Awesome ";
  155.                 case 43:
  156.                         return "Official Middleman ";
  157.                 case 44:
  158.                         return "Veteran ";
  159.                 /*case 39: //Go in front of name TO-DO
  160.                         return " the Magnificent";
  161.                 case 40:
  162.                         return " the Undefeated";
  163.                 case 41:
  164.                         return " the Strange";
  165.                 case 42:
  166.                         return " the Divine";
  167.                 case 43:
  168.                         return " the Fallen";
  169.                 case 44:
  170.                         return " the Warrior";*/
  171.                 /**Mobilising Armies**/
  172.                 case 45:
  173.                         return "Junior Cadet ";
  174.                 case 46:
  175.                         return "Sergeant ";
  176.                 case 47:
  177.                         return "Commander ";
  178.                 case 48:
  179.                         return "War-chief ";
  180.                 /**Vampyric**/
  181.                 case 49:
  182.                         return "Vyreling ";
  183.                 case 50:
  184.                         return "Vyre Grunt ";
  185.                 case 51:
  186.                         return "Vyrewatch ";
  187.                 case 52:
  188.                         return "Vyrelord ";
  189.                 case 53:
  190.                         return "Vyrelady ";
  191.                 /**Tzhaar**/
  192.                 case 54:
  193.                         return "YtHaar ";
  194.                 case 55:
  195.                         return "GFX Artist ";
  196.                 case 59:
  197.                                 return "Ownage ";
  198.                 /**Custom**/
  199.                 case 60:
  200.                         return "GOD ";
  201.                 case 61:
  202.                         return "Pro ";
  203.                 case 62:
  204.                         return "Legend ";
  205.                 case 63:
  206.                         return "Pker ";
  207.                 case 64:
  208.                         return "Staker ";
  209.                 case 65:
  210.                         return "Merchant ";
  211.                 case 66:
  212.                         return "Skiller ";
  213.                 case 67:
  214.                         return "Expert ";
  215.                 case 68:
  216.                         return "Guardian ";
  217.                 case 69:
  218.                         return "Master ";
  219.                 case 70:
  220.                         return "E Dater ";
  221.                 case 71:
  222.                         return "Recruit ";
  223.                 case 72:
  224.                         return "Owner ";
  225.                 case 73:
  226.                         return "The Almighty ";
  227.                 case 74:
  228.                         return "The Best ";
  229.                 case 75:
  230.                         return "Black ";
  231.                 case 76:
  232.                         return "Crybaby ";
  233.                 case 77:
  234.                         return "President ";
  235.                 case 78:
  236.                         return "Prime Minister ";
  237.                 case 79:
  238.                         return "Grand Master ";
  239.                 case 80:
  240.                         return "Cadet ";
  241.                 case 81:
  242.                         return "gwasballer ";
  243.                 case 82:
  244.                         return "Winner ";
  245.                 case 83:
  246.                         return "Bad ";
  247.                 case 84:
  248.                         return "Amazing ";
  249.                 case 85:
  250.                         return "Beast ";
  251.                 case 86:
  252.                         return "Beastmode ";
  253.                 case 87:
  254.                         return "Baller ";
  255.                 case 88:
  256.                         return "Pure ";
  257.                 case 89:
  258.                         return "Destroyer ";
  259.                 case 90:
  260.                         return "Elite ";
  261.                 case 91:
  262.                         return "1337 ";
  263.                 case 92:
  264.                         return "Muchacho ";
  265.                 case 93:
  266.                         return "Santa ";
  267.                 case 94:
  268.                         return "Sugar Daddy ";
  269.                 case 95:
  270.                         return "Just A Small Town Girl ";//BILLYS RANK FUCK YOU
  271.                        
  272.                        
  273.                        
  274.                        
  275.                
  276.                                
  277.         }
  278.         return "";
  279. }
  280.  
  281.     public int getColor(int color) {
  282.         if (color >= 6 && color <= 38)
  283.             return 0xC86400;
  284.         switch (color) {
  285.         case 45:
  286.         case 46:
  287.         case 47:
  288.         case 48:
  289.             return 0xAF64A0;
  290.         case 49:
  291.         case 50:
  292.         case 51:
  293.         case 52:
  294.         case 53:
  295.         case 54:
  296.             return 0xC12006;
  297.         }
  298.         return 0xC86400;
  299.     }
  300.  
  301.     public String getSpecialColor(int rank) {
  302.         // if (rank >= 6 && rank <= 38)
  303.         if (rank > 0)
  304.             return "@bas@";
  305.         /*
  306.          * switch (rank) { case 45: case 46: case 47: case 48: return "@mbl@";
  307.          * case 49: case 50: case 51: case 52: case 53: case 54: return "@vth@";
  308.          * }
  309.          */
  310.         return "@blk@";
  311.     }
  312.  
  313.     public void setSidebarInterface(int sidebarID, int interfaceID) {
  314.         tabInterfaceIDs[sidebarID] = interfaceID;
  315.         tabID = sidebarID;
  316.         needDrawTabArea = true;
  317.         tabAreaAltered = true;
  318.     }
  319.  
  320.     public static boolean logHover = false, spriteChanged = false,
  321.             selectAction, isChatInterface, displayChat, runClicked = true,
  322.             runHover = false, xpLock = false;
  323.     public Sprite[] cacheSprite;
  324.     public static int clientWidth = 765, clientHeight = 503, clientSize = 0;
  325.     private boolean counterOn = false;
  326.  
  327.     /**
  328.      * Place a String on the clipboard, and make this class the owner of the
  329.      * Clipboard's contents.
  330.      */
  331.     public static void saveValue(BufferedWriter buffer, String value,
  332.             String variable, boolean last) {
  333.         try {
  334.             if (value == null || variable.equals("null"))
  335.                 System.out.println("Error: saveValue had no identifier.");
  336.             if (variable == null || variable.equals("null"))
  337.                 variable = "0";
  338.             if (value.startsWith("[") && value.endsWith("]")) {
  339.                 buffer.write(value, 0, value.length());
  340.             } else {
  341.                 value = value + " = ";
  342.                 buffer.write(value, 0, value.length());
  343.                 buffer.write(variable, 0, variable.length());
  344.             }
  345.             buffer.newLine();
  346.             if (last)
  347.                 buffer.newLine();
  348.         } catch (IOException ioexception) {
  349.             ioexception.printStackTrace();
  350.         } catch (NullPointerException nullpointerexception) {
  351.             nullpointerexception.printStackTrace();
  352.         }
  353.     }
  354.  
  355.     public static int[] quickPrayers = new int[26];
  356.     public static int[] quickCurses = new int[20];
  357.     private boolean clickedQuickPrayers;
  358.     public int prayerInterfaceType = 22500;
  359.  
  360.     private void configureQuickTicks() {
  361.         if (prayerInterfaceType == 5608) {
  362.             if (getQuickPrayersSet() > 0) {
  363.                 for (int index = 0; index < quickPrayers.length; index++) {
  364.                     if (quickPrayers[index] == 1) {// where did u get this
  365.                                                     // method from lol
  366.                         if (index >= 0 && index <= 25) {
  367.                             if (getOrbValues(1, null)[1] >= prayerLevelRequirements[index]) {
  368.                                 int[] types = getPrayerTypeForIndex(index);
  369.                                 if (types != null) {
  370.                                     for (int g = 0; g < rangeAndMagePray.length; g++) {
  371.                                         if (index == rangeAndMagePray[g]) {
  372.                                             types = rangeAndMagePrayOff;
  373.                                         }
  374.                                     }
  375.                                     for (int i = 0; i < types.length; i++) {
  376.                                         if (index != types[i]) {
  377.                                             if (index == 24 || index == 25) {
  378.                                                 types = superiorPray;
  379.                                             }
  380.                                             quickPrayers[types[i]] = 0;
  381.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  382.                                             method33(quickConfigIDs[types[i]]);
  383.                                             needDrawTabArea = true;
  384.                                             if (dialogID != -1)
  385.                                                 inputTaken = true;
  386.                                         } else {
  387.                                             quickPrayers[index] = 1;
  388.                                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  389.                                             method33(quickConfigIDs[index]);
  390.                                             needDrawTabArea = true;
  391.                                             if (dialogID != -1)
  392.                                                 inputTaken = true;
  393.                                         }
  394.                                     }
  395.                                 } else {
  396.                                     quickPrayers[index] = 1;
  397.                                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  398.                                     method33(quickConfigIDs[index]);
  399.                                     needDrawTabArea = true;
  400.                                     if (dialogID != -1)
  401.                                         inputTaken = true;
  402.                                 }
  403.                             }
  404.                         }
  405.                     }
  406.                 }
  407.             }
  408.         } else if (prayerInterfaceType == 22500) {
  409.             if (getQuickCursesSet() > 0) {
  410.                 for (int index = 0; index < quickCurses.length; index++) {
  411.                     if (quickCurses[index] == 1) {
  412.                         if (index >= 0 && index <= 20) {
  413.                             if (getOrbValues(1, null)[1] >= curseLevelRequirements[index]) {
  414.                                 int[] types = getCurseTypeForIndex(index);
  415.                                 if (types != null) {
  416.                                     for (int i = 0; i < types.length; i++) {
  417.                                         if (index != types[i]) {
  418.                                             quickCurses[types[i]] = 0;
  419.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  420.                                             method33(quickConfigIDs[types[i]]);
  421.                                             needDrawTabArea = true;
  422.                                             if (dialogID != -1)
  423.                                                 inputTaken = true;
  424.                                         }
  425.                                     }
  426.                                 }
  427.                                 quickCurses[index] = 1;
  428.                                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  429.                                 method33(quickConfigIDs[index]);
  430.                                 needDrawTabArea = true;
  431.                                 if (dialogID != -1)
  432.                                     inputTaken = true;
  433.                             }
  434.                         }
  435.                     }
  436.                 }
  437.             }
  438.         }
  439.     }
  440.  
  441.     public int[] oldPrayerButtons = { 5609, 5610, 5611, 18000, 18002, 5612,
  442.             5613, 5614, 5615, 5616, 5617, 18004, 18006, 5618, 5619, 5620, 5621,
  443.             5622, 5623, 18008, 18010, 683, 684, 685, 18012, 18014 };
  444.  
  445.     public void handePrayerCorrection(int button) {
  446.         int index = button - 25000;
  447.         if (index > 0)
  448.             index = index / 2;
  449.         sendPacket185(oldPrayerButtons[index], 0, 169);
  450.     }
  451.  
  452.     public void sendFrame36(int id, int state) {
  453.         anIntArray1045[id] = state;
  454.         if (variousSettings[id] != state) {
  455.             variousSettings[id] = state;
  456.             method33(id);
  457.             needDrawTabArea = true;
  458.             if (dialogID != -1)
  459.                 inputTaken = true;
  460.         } else {
  461.             variousSettings[id] = 0;
  462.             method33(id);
  463.             needDrawTabArea = true;
  464.             if (dialogID != -1)
  465.                 inputTaken = true;
  466.         }
  467.     }
  468.  
  469.     public void sendPacket185(int button, int toggle, int type) {
  470.         if (button >= 17202 && button <= 17227)
  471.             togglePrayerState(button);
  472.         switch (button) {
  473.         case 17231:// Quick prayr confirm
  474.             saveQuickSelection();
  475.             break;
  476.         case 19144:
  477.             sendFrame248(15106, 3213);
  478.             method60(15106);
  479.             inputTaken = true;
  480.             break;
  481.         }
  482.         switch (type) {
  483.         case 135:
  484.             RSInterface class9 = RSInterface.interfaceCache[button];
  485.             boolean flag8 = true;
  486.             if (class9.contentType > 0)
  487.                 flag8 = promptUserForInput(class9);
  488.             if (flag8) {
  489.                 stream.createFrame(185);
  490.                 stream.writeWord(button);
  491.             }
  492.             break;
  493.         case 646:
  494.             stream.createFrame(185);
  495.             stream.writeWord(button);
  496.             RSInterface class9_2 = RSInterface.interfaceCache[button];
  497.             if (class9_2.valueIndexArray != null
  498.                     && class9_2.valueIndexArray[0][0] == 5) {
  499.                 if (variousSettings[toggle] != class9_2.anIntArray212[0]) {
  500.                     variousSettings[toggle] = class9_2.anIntArray212[0];
  501.                     method33(toggle);
  502.                     needDrawTabArea = true;
  503.                 }
  504.             }
  505.             break;
  506.         case 169:
  507.             stream.createFrame(185);
  508.             stream.writeWord(button);
  509.             RSInterface class9_3 = RSInterface.interfaceCache[button];
  510.             if (class9_3 == null)
  511.                 return;
  512.             if (class9_3.valueIndexArray != null) {
  513.                 if (class9_3.valueIndexArray[0][0] == 5) {
  514.                     if (toggle != -1) {
  515.                         variousSettings[toggle] = 1 - variousSettings[toggle];
  516.                         method33(toggle);
  517.                         needDrawTabArea = true;
  518.                     }
  519.                 }
  520.             }
  521.             switch (button) {
  522.             case 19136:
  523.                 if (toggle == 0)
  524.                     sendFrame36(173, toggle);
  525.                 if (toggle == 1)
  526.                     sendPacket185(153, 173, 646);
  527.                 break;
  528.             }
  529.             break;
  530.         }
  531.     }
  532.  
  533.     private void saveQuickSelection() {
  534.         // Save selections
  535.         UserLoader.saveuser();
  536.         tabInterfaceIDs[5] = prayerInterfaceType;
  537.     }
  538.     long time = System.currentTimeMillis();
  539.     private void handleQuickAidsActive() {
  540.         if (prayerInterfaceType == 5608) {
  541.             if(System.currentTimeMillis() - time > 2000){
  542.             if (getQuickPrayersSet() > 0) {
  543.                 if (!orbToggle[1]){
  544.                     for (int i = 0; i < quickPrayers.length; i++) {
  545.                         if (quickPrayers[i] == 1) {
  546.                             sendPacket185((i * 2) + 25000, 0, 169);
  547.                         }
  548.                     }
  549.                 time = System.currentTimeMillis(); 
  550.                 }else {
  551.                     turnOffPrayers();
  552.                 orbToggle[1] = !orbToggle[1];
  553.             }
  554.             } else {
  555.                 if (orbToggle[1]) {
  556.                     turnOffPrayers();
  557.                     orbToggle[1] = false;
  558.                 } else {
  559.                     pushMessage("You don't have any quick prayers selected.",
  560.                             0, "");
  561.                     pushMessage(
  562.                             "Right-click the Prayer button next to the minimap to select some.",
  563.                             0, "");
  564.                 }
  565.             }
  566.             } else {
  567.                 pushMessage("@red@You must wait before performing this action!",
  568.                             0, "");
  569.             }
  570.         } else if (prayerInterfaceType == 22500) {
  571.         if(System.currentTimeMillis() - time > 2000){
  572.             if (getQuickCursesSet() > 0) {
  573.                 if (!orbToggle[1]) {
  574.                     for (int i = 0; i < quickCurses.length; i++) {
  575.                         if (quickCurses[i] == 1) {
  576.                             sendPacket185((i * 2) + 22503, 0, 169);
  577.                         }
  578.                     }
  579.                     time = System.currentTimeMillis();
  580.                 } else {
  581.                     turnOffCurses();
  582.                     orbToggle[1] = !orbToggle[1];
  583.                 }
  584.             } else {
  585.                 if (orbToggle[1]) {
  586.                     turnOffCurses();
  587.                     orbToggle[1] = false;
  588.                 } else {
  589.                     pushMessage("You don't have any quick curses selected.", 0,
  590.                             "");
  591.                     pushMessage(
  592.                             "Right-click the Curses button next to the minimap to select some.",
  593.                             0, "");
  594.                 }
  595.             }
  596.                 } else {
  597.                 pushMessage("@red@You must wait before performing this action!",
  598.                             0, "");
  599.             }
  600.         }
  601.        
  602.     }
  603.  
  604.     private int getQuickPrayersSet() {
  605.         int amount = 0;
  606.         for (int i = 0; i < quickPrayers.length; i++)
  607.             if (quickPrayers[i] == 1) {
  608.                 amount++;
  609.             }
  610.         return amount;
  611.     }
  612.  
  613.     private int getQuickCursesSet() {
  614.         int amount = 0;
  615.         for (int i = 0; i < quickCurses.length; i++)
  616.             if (quickCurses[i] == 1) {
  617.                 amount++;
  618.             }
  619.         return amount;
  620.     }
  621.  
  622.     private void turnOffPrayers() {
  623.         int toggle = -1;
  624.         for (int i = 0; i < quickPrayers.length; i++) {
  625.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 25000];
  626.             if (rsInterface.valueIndexArray != null
  627.                     && rsInterface.valueIndexArray[0][0] == 5) {
  628.                 toggle = rsInterface.valueIndexArray[0][1];
  629.                 if (variousSettings[toggle] == 1)
  630.                     sendPacket185((i * 2) + 25000, 0, 169);
  631.             }
  632.         }
  633.     }
  634.  
  635.     private void turnOffCurses() {
  636.         int toggle = -1;
  637.         for (int i = 0; i < quickCurses.length; i++) {
  638.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 22503];
  639.             if (rsInterface == null)
  640.                 return;
  641.             if (rsInterface.valueIndexArray != null) {
  642.                 if (rsInterface.valueIndexArray[0][0] == 5) {
  643.                     toggle = rsInterface.valueIndexArray[0][1];
  644.                     if (variousSettings[toggle] == 1)
  645.                         sendPacket185((i * 2) + 22503, 0, 169);
  646.                 }
  647.             }
  648.         }
  649.     }
  650.  
  651.     private void turnOffQuickTicks() {
  652.         int toggle = -1;
  653.         for (int i = 0; i < quickCurses.length; i++) {
  654.             RSInterface rsInterface = RSInterface.interfaceCache[17202 + i];
  655.             if (rsInterface == null)
  656.                 return;
  657.             if (rsInterface.valueIndexArray != null) {
  658.                 if (rsInterface.valueIndexArray[0][0] == 5) {
  659.                     toggle = rsInterface.valueIndexArray[0][1];
  660.                     if (variousSettings[toggle] == 1)
  661.                         sendPacket185(17202 + i, 0, 169);
  662.                 }
  663.             }
  664.         }
  665.     }
  666.  
  667.     // save
  668.     public void toggleQuickAidsSelection() {
  669.         boolean inProcess = (tabInterfaceIDs[5] == 17200 || tabInterfaceIDs[5] == 17234);
  670.         if (inProcess)
  671.             saveQuickSelection();
  672.         else {
  673.             if (prayerInterfaceType == 5608) {
  674.                 if (!inProcess) {
  675.                     tabInterfaceIDs[5] = 17200;
  676.                     needDrawTabArea = true;
  677.                     tabAreaAltered = true;
  678.                 } else {
  679.                     tabInterfaceIDs[5] = 5608;
  680.                     needDrawTabArea = true;
  681.                     tabAreaAltered = true;
  682.                 }
  683.             } else if (prayerInterfaceType == 22500) {
  684.                 if (!inProcess) {
  685.                     tabInterfaceIDs[5] = 17234;
  686.                     needDrawTabArea = true;
  687.                     tabAreaAltered = true;
  688.                 } else {
  689.                     tabInterfaceIDs[5] = 22500;
  690.                     needDrawTabArea = true;
  691.                     tabAreaAltered = true;
  692.                 }
  693.             }
  694.             tabID = 5;
  695.         }
  696.     }
  697.  
  698.     public final int[] curseLevelRequirements = { 50, 50, 52, 54, 56, 59, 62,
  699.             65, 68, 71, 74, 76, 78, 80, 82, 84, 86, 89, 92, 95 };
  700.     public final String[] curseName = { "Protect Item", "Sap Warrior",
  701.             "Sap Ranger", "Sap Mage", "Sap Spirit", "Berserker",
  702.             "Deflect Summoning", "Deflect Magic", "Deflect Missiles",
  703.             "Deflect Melee", "Leech Attack", "Leech Ranged", "Leech Magic",
  704.             "Leech Defence", "Leech Strength", "Leech Energy",
  705.             "Leech Special Attack", "Wrath", "Soul Split", "Turmoil" };
  706.     public int[] quickConfigIDs = { 630, 631, 632, 633, 634, 635, 636, 637,
  707.             638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650,
  708.             651, 652, 653, 654, 655, 656 };
  709.     public final int[] prayerLevelRequirements = { 1, 4, 7, 8, 9, 10, 13, 16,
  710.             19, 22, 25, 26, 27, 28, 31, 34, 37, 40, 43, 44, 45, 46, 49, 52, 60,
  711.             70 };
  712.     public final String[] prayerName = { "Thick Skin", "Burst of Strength",
  713.             "Clarity of Thought", "Sharp Eye", "Mystic Will", "Rock Skin",
  714.             "Superhuman Strength", "Improved Reflexes", "Rapid Restore",
  715.             "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore",
  716.             "Steel Skin", "Ultimate Strength", "Incredible Reflexes",
  717.             "Protect from Magic", "Protect from Missiles",
  718.             "Protect from Melee", "Eagle Eye", "Mystic Might", "Retribution",
  719.             "Redemption", "Smite", "Chivalry", "Piety" };
  720.     private int[] defPray = { 0, 5, 13, 24, 25 };
  721.     private int[] strPray = { 1, 3, 4, 6, 11, 12, 14, 19, 20, 24, 25 };
  722.     private int[] atkPray = { 2, 3, 4, 7, 11, 12, 15, 19, 20, 24, 25 };
  723.     private int[] rangeAndMagePray = { 3, 4, 11, 12, 19, 20, 24, 25 };
  724.     private int[] rangeAndMagePrayOff = { 1, 2, 3, 4, 6, 7, 11, 12, 14, 15, 19,
  725.             20, 24, 25 };
  726.     private int[] headPray = { 16, 17, 18, 21, 22, 23 };
  727.     private int[] superiorPray = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15,
  728.             19, 20, 24, 25 };
  729.     private int[][] prayer = { defPray, strPray, atkPray, rangeAndMagePray,
  730.             headPray };
  731.  
  732.     private int[] getPrayerTypeForIndex(int index) {
  733.         int[] type = null;
  734.         for (int i = 0; i < prayer.length; i++) {
  735.             for (int il = 0; il < prayer[i].length; il++) {
  736.                 if (index == prayer[i][il]) {
  737.                     type = prayer[i];
  738.                 }
  739.             }
  740.         }
  741.         return type;
  742.     }
  743.  
  744.     private int[] sapCurse = { 1, 2, 3, 4, 19 };
  745.     private int[] leechCurse = { 10, 11, 12, 13, 14, 15, 16, 19 };
  746.     private int[] deflectCurse = { 7, 8, 9, 17, 18 };
  747.  
  748.     private int[] getCurseTypeForIndex(int index) {
  749.         int[] types = null;
  750.         for (int g = 0; g < leechCurse.length; g++) {
  751.             if (index == leechCurse[g])
  752.                 types = sapCurse;
  753.         }
  754.         for (int g = 0; g < sapCurse.length; g++) {
  755.             if (index == sapCurse[g])
  756.                 types = leechCurse;
  757.         }
  758.         for (int g = 0; g < deflectCurse.length; g++) {
  759.             if (index == deflectCurse[g])
  760.                 types = deflectCurse;
  761.         }
  762.         if (index == 6) {
  763.             int[] type = { 17, 18 };
  764.             types = type;
  765.         }
  766.         if (index == 17 || index == 18) {
  767.             int[] type = { 6, 7, 8, 9, 17, 18 };
  768.             types = type;
  769.         }
  770.         if (index == 19) {
  771.             int[] turmoilCurseOff = { 1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16,
  772.                     19 };
  773.             types = turmoilCurseOff;
  774.         }
  775.         return types;
  776.     }
  777.  
  778.     public void togglePrayerState(int button) {
  779.         int index = button - 17202;
  780.         if (prayerInterfaceType == 5608) {
  781.             if (getOrbValues(1, null)[1] >= prayerLevelRequirements[index]) {
  782.                 int[] types = getPrayerTypeForIndex(index);
  783.                 if (types != null) {
  784.                     for (int g = 0; g < rangeAndMagePray.length; g++) {
  785.                         if (index == rangeAndMagePray[g]) {
  786.                             types = rangeAndMagePrayOff;
  787.                         }
  788.                     }
  789.                     for (int i = 0; i < types.length; i++) {
  790.                         if (index != types[i]) {
  791.                             if (index == 24 || index == 25) {
  792.                                 types = superiorPray;
  793.                             }
  794.                             quickPrayers[types[i]] = 0;
  795.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  796.                             method33(quickConfigIDs[types[i]]);
  797.                             needDrawTabArea = true;
  798.                             if (dialogID != -1)
  799.                                 inputTaken = true;
  800.                         } else {
  801.                             quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  802.                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  803.                             method33(quickConfigIDs[index]);
  804.                             needDrawTabArea = true;
  805.                             if (dialogID != -1)
  806.                                 inputTaken = true;
  807.                         }
  808.                     }
  809.                 } else {
  810.                     quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  811.                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  812.                     method33(quickConfigIDs[index]);
  813.                     needDrawTabArea = true;
  814.                     if (dialogID != -1)
  815.                         inputTaken = true;
  816.                 }
  817.             } else {
  818.                 pushMessage("You need a Prayer level of atleast "
  819.                         + prayerLevelRequirements[index] + " to use "
  820.                         + prayerName[index] + ".", 0, "");
  821.             }
  822.         } else if (prayerInterfaceType == 22500) {
  823.             if (getOrbValues(1, null)[1] >= curseLevelRequirements[index]) {
  824.                 int[] types = getCurseTypeForIndex(index);
  825.                 if (types != null) {
  826.                     for (int i = 0; i < types.length; i++) {
  827.                         if (index != types[i]) {
  828.                             quickCurses[types[i]] = 0;
  829.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  830.                             method33(quickConfigIDs[types[i]]);
  831.                             needDrawTabArea = true;
  832.                             if (dialogID != -1)
  833.                                 inputTaken = true;
  834.                         }
  835.                     }
  836.                 }
  837.                 quickCurses[index] = (quickCurses[index] + 1) % 2;
  838.                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  839.                 method33(quickConfigIDs[index]);
  840.                 needDrawTabArea = true;
  841.                 if (dialogID != -1)
  842.                     inputTaken = true;
  843.             } else {
  844.                 pushMessage("You need a Prayer level of atleast "
  845.                         + curseLevelRequirements[index] + " to use "
  846.                         + curseName[index] + ".", 0, "");
  847.             }
  848.         }
  849.     }
  850.  
  851.     public boolean[] orbToggle = new boolean[4];
  852.  
  853.     private int[] getOrbValues(int type, Sprite orbSprite) {
  854.     try {
  855.         int[] values = new int[2];
  856.         int offsetX = 0, offsetY = 0;
  857.         switch (type) {
  858.         case 0:// Health
  859.             values[0] = Integer
  860.                     .parseInt(RSInterface.interfaceCache[4016].message);
  861.             values[1] = Integer
  862.                     .parseInt(RSInterface.interfaceCache[4017].message
  863.                             .replaceAll("%", ""));
  864.             offsetX = 9;
  865.             offsetY = 10;
  866.             break;
  867.  
  868.         case 1:// Prayer
  869.             values[0] = Integer
  870.                     .parseInt(RSInterface.interfaceCache[4012].message);
  871.             values[1] = Integer
  872.                     .parseInt(RSInterface.interfaceCache[4013].message
  873.                             .replaceAll("%", ""));
  874.             offsetX = 7;
  875.             offsetY = 7;
  876.             break;
  877.  
  878.         case 2:// Energy
  879.             values[0] = Integer
  880.                     .parseInt(RSInterface.interfaceCache[149].message
  881.                             .replaceAll("%", ""));
  882.             values[1] = 100;
  883.             offsetX = 10;
  884.             offsetY = 8;
  885.             break;
  886.         case 3:// Magica
  887.             values[0] = 99;
  888.             values[1] = 99;
  889.             offsetX = 8;
  890.             offsetY = 8;
  891.             break;
  892.  
  893.         default:
  894.             return null;
  895.         }
  896.         try {
  897.             if (offsetX > 0 && offsetY > 0) {
  898.                 // orbSprite.configXDrawOffset(offsetX);
  899.                 // orbSprite.configYDrawOffset(offsetY);
  900.             }
  901.         } catch (NullPointerException ex) {
  902.  
  903.         }
  904.             return values;
  905.         } catch (Exception e){
  906.        
  907.         }
  908.         return null;
  909.     }
  910.  
  911.     private void processXPCounterClick() {
  912.         int x = super.mouseX;
  913.         int y = super.mouseY;
  914.         if (x >= 520 && x <= 554 && y >= 47 && y <= 81 && clientSize == 0) {
  915.             menuActionName[3] = counterOn ? "Off" : "On";
  916.             menuActionID[3] = 474;
  917.             menuActionName[2] = "Reset";
  918.             menuActionID[2] = 475;
  919.             menuActionName[1] = xpLock ? "Unlock XP" : "Lock XP";
  920.             menuActionID[1] = 476;
  921.             menuActionRow = 4;
  922.         }
  923.     }
  924.  
  925.     private int xpAddedPos;
  926.     private int expAdded;
  927.  
  928.     private void drawCounterOnScreen() {
  929.         int x = 520;
  930.         int y = 47;
  931.         int txtWidth = aTextDrawingArea_1271.getTextWidth(Integer
  932.                 .toString(testXp));
  933.         int drawX = 507 - txtWidth;
  934.         counter[2].drawSprite(x - 100, y + 8);
  935.         int i = aTextDrawingArea_1271.getTextWidth(Integer.toString(testXp));
  936.         aTextDrawingArea_1271.drawText(0xffffff, "XP: ", y + 21, x - 88);
  937.         if (testXp == 0) {
  938.             aTextDrawingArea_1271.drawText(0xffffff, Integer.toString(testXp),
  939.                     y + 21, x - 10 - i);
  940.  
  941.         } else {
  942.             // aTextDrawingArea_1271.drawText(0xffffff,
  943.             // Integer.toString(testXp), y+21, x-8-i);
  944.             aTextDrawingArea_1271.method389(true, drawX, 0xFFFFFD, Integer
  945.                     .toString(testXp), 68);
  946.         }
  947.         if (expAdded != 0) {
  948.             i = smallText.getTextWidth(Integer.toString(expAdded) + "xp");
  949.             smallText.drawText(0xff9933, Integer.toString(expAdded) + "xp", y
  950.                     + 21 + 18 + xpAddedPos, x);
  951.             xpAddedPos += 2;
  952.             if (xpAddedPos >= 50) {
  953.                 xpAddedPos = 0;
  954.                 expAdded = 0;
  955.             }
  956.         }
  957.     }
  958.  
  959.     Sprite[] counter;
  960.  
  961.     private void drawXPCounter() {
  962.         int x = 1;
  963.         int y = 47;
  964.         int x1 = super.mouseX;
  965.         int y1 = super.mouseY;
  966.         counter[(counterOn || (x1 >= 520 && x1 <= 554 && y1 >= 47 && y1 <= 81) ? 1
  967.                 : 0)].drawSprite(x, y);
  968.         if (super.clickMode3 == 1 && super.saveClickX >= 520
  969.                 && super.saveClickX <= 554 && super.saveClickY >= 47
  970.                 && super.saveClickY <= 81) {
  971.             counterOn = !counterOn;
  972.         }
  973.  
  974.     }
  975.  
  976.     public static void setClipboardContents(String aString) {
  977.         StringSelection stringSelection = new StringSelection(aString);
  978.         Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  979.         clipboard.setContents(stringSelection, null);
  980.     }
  981.  
  982.     /**
  983.      * Get the String residing on the clipboard.
  984.      *
  985.      * @return any text found on the Clipboard; if none found, return an empty
  986.      *         String.
  987.      */
  988.     public static String webVersion() {
  989.  
  990.         String webVersion = null;
  991.         try {
  992.             URL url = new URL("http://runeps.com/models/models.txt");
  993.             InputStream is = url.openStream();
  994.             InputStreamReader isr = new InputStreamReader(is);
  995.             BufferedReader r = new BufferedReader(isr);
  996.             String str = r.readLine();
  997.             if (str != null)
  998.                 webVersion = str;
  999.         } catch (MalformedURLException e) {
  1000.             System.out.println("Invalid URL");
  1001.         } catch (IOException e) {
  1002.             System.out.println("Can not connect");
  1003.         }
  1004.         return webVersion;
  1005.  
  1006.     }
  1007.  
  1008.     public String indexLocation(int cacheIndex, int index) {
  1009.         return signlink.findcachedir() + "index" + cacheIndex + "/"
  1010.                 + (index != -1 ? index + ".gz" : "");
  1011.     }
  1012.  
  1013.     public void repackCacheIndex(int cacheIndex) {
  1014.         System.out.println("Started repacking index " + cacheIndex + ".");
  1015.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  1016.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  1017.         try {
  1018.             for (int index = 0; index < indexLength; index++) {
  1019.                 int fileIndex = Integer
  1020.                         .parseInt(getFileNameWithoutExtension(file[index]
  1021.                                 .toString()));
  1022.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  1023.                 if (data != null && data.length > 0) {
  1024.                     decompressors[cacheIndex].method234(data.length, data,
  1025.                             fileIndex);
  1026.                     System.out.println("Repacked " + fileIndex + ".");
  1027.                 } else {
  1028.                     System.out.println("Unable to locate index " + fileIndex
  1029.                             + ".");
  1030.                 }
  1031.             }
  1032.         } catch (Exception e) {
  1033.             System.out.println("Error packing cache index " + cacheIndex + ".");
  1034.         }
  1035.         System.out.println("Finished repacking " + cacheIndex + ".");
  1036.     }
  1037.  
  1038.     public byte[] fileToByteArray(int cacheIndex, int index) {
  1039.         try {
  1040.             if (indexLocation(cacheIndex, index).length() <= 0
  1041.                     || indexLocation(cacheIndex, index) == null) {
  1042.                 return null;
  1043.             }
  1044.             File file = new File(indexLocation(cacheIndex, index));
  1045.             byte[] fileData = new byte[(int) file.length()];
  1046.             FileInputStream fis = new FileInputStream(file);
  1047.             fis.read(fileData);
  1048.             fis.close();
  1049.             return fileData;
  1050.         } catch (Exception e) {
  1051.             return null;
  1052.         }
  1053.     }
  1054.  
  1055.     public static void downloadNewVersion() {
  1056.  
  1057.         String webVersion = null;
  1058.         try {
  1059.             URL url = new URL("http://runeps.com/models/newmodels.txt");
  1060.             InputStream is = url.openStream();
  1061.             InputStreamReader isr = new InputStreamReader(is);
  1062.             BufferedReader r = new BufferedReader(isr);
  1063.             String str = r.readLine();
  1064.             while (str != null) {
  1065.                 getDownload(str);
  1066.                 str = r.readLine();
  1067.             }
  1068.         } catch (MalformedURLException e) {
  1069.             System.out.println("Invalid URL");
  1070.         } catch (IOException e) {
  1071.             System.out.println("Can not connect");
  1072.         }
  1073.     }
  1074.  
  1075.     public static void checkClientVersion() {
  1076.         Scanner dIn = null;
  1077.         int length = 0;
  1078.         String clientVersion = null;
  1079.         String line = null;
  1080.         try {
  1081.             dIn = new Scanner(new BufferedReader(new FileReader(
  1082.                     "./Settings/models.txt")));
  1083.             while (dIn.hasNextLine()) {
  1084.                 line = dIn.nextLine();
  1085.                 length = line.length();
  1086.                 if (length != 0) {
  1087.                     clientVersion = line;
  1088.                 }
  1089.             }
  1090.         } catch (IOException e) {
  1091.             e.printStackTrace();
  1092.         } finally {
  1093.             dIn.close();
  1094.         }
  1095.  
  1096.         /*if (clientVersion.equals(webVersion())) {
  1097.             System.out.println("All up to date!");
  1098.         } else {
  1099.             System.out.println("Downloading new models...");
  1100.             downloadNewVersion();
  1101.             getDownload("http://runeps.com/models/models.txt");
  1102.         }*/
  1103.     }
  1104.  
  1105.     public static String getFileName(String fileName) {
  1106.         int dirSplitIndex = fileName.lastIndexOf("/");
  1107.         fileName = fileName.substring(dirSplitIndex + 1);
  1108.         return fileName;
  1109.     }
  1110.  
  1111.     public static void getDownload(String link) {
  1112.         try {
  1113.             URL url = new URL(link);
  1114.             URLConnection connection = url.openConnection();
  1115.             long fileLength = connection.getContentLength();
  1116.             String fileName = getFileName(url.getFile());
  1117.             FileOutputStream out = null;
  1118.             if (fileName.equals("models.txt")) {
  1119.                 out = new FileOutputStream(new File("./Settings/" + fileName));
  1120.             } else {
  1121.                 out = new FileOutputStream(new File("./Raw/" + fileName));
  1122.             }
  1123.             // FileOutputStream out = new FileOutputStream(new
  1124.             // File("./Raw/"+fileName));
  1125.             DataInputStream in = new DataInputStream(connection
  1126.                     .getInputStream());
  1127.             for (long readIn = 0L; readIn < fileLength;) {
  1128.                 byte buffer[];
  1129.                 if (fileLength - readIn > 1024L)
  1130.                     buffer = new byte[1024];
  1131.                 else
  1132.                     buffer = new byte[(int) (fileLength - readIn)];
  1133.                 int read = in.read(buffer);
  1134.                 if (read == -1)
  1135.                     throw new EOFException("End of file reached unexpectedly");
  1136.                 readIn += read;
  1137.                 out.write(buffer, 0, read);
  1138.             }
  1139.             out.close();
  1140.             in.close();
  1141.         } catch (IOException ioe) {
  1142.             ioe.printStackTrace();
  1143.         }
  1144.     }
  1145.  
  1146.     public static String getClipboardContents() {
  1147.         String result = "";
  1148.         Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  1149.         // odd: the Object param of getContents is not currently used
  1150.         Transferable contents = clipboard.getContents(null);
  1151.         boolean hasTransferableText = (contents != null)
  1152.                 && contents.isDataFlavorSupported(DataFlavor.stringFlavor);
  1153.         if (hasTransferableText) {
  1154.             try {
  1155.                 result = (String) contents
  1156.                         .getTransferData(DataFlavor.stringFlavor);
  1157.             } catch (UnsupportedFlavorException ex) {
  1158.                 // highly unlikely since we are using a standard DataFlavor
  1159.                 System.out.println(ex);
  1160.                 ex.printStackTrace();
  1161.             } catch (IOException ex) {
  1162.                 System.out.println(ex);
  1163.                 ex.printStackTrace();
  1164.             }
  1165.         }
  1166.         return result;
  1167.     }
  1168.  
  1169.     public void launchURL(String url) {
  1170.         String osName = System.getProperty("os.name");
  1171.         try {
  1172.             if (osName.startsWith("Mac OS")) {
  1173.                 Class fileMgr = Class.forName("com.apple.eio.FileManager");
  1174.                 Method openURL = fileMgr.getDeclaredMethod("openURL",
  1175.                         new Class[] { String.class });
  1176.                 openURL.invoke(null, new Object[] { url });
  1177.             } else if (osName.startsWith("Windows"))
  1178.                 Runtime.getRuntime().exec(
  1179.                         "rundll32 url.dll,FileProtocolHandler " + url);
  1180.             else { // assume Unix or Linux
  1181.                 String[] browsers = { "firefox", "opera", "konqueror",
  1182.                         "epiphany", "mozilla", "netscape", "safari" };
  1183.                 String browser = null;
  1184.                 for (int count = 0; count < browsers.length && browser == null; count++)
  1185.                     if (Runtime.getRuntime().exec(
  1186.                             new String[] { "which", browsers[count] })
  1187.                             .waitFor() == 0)
  1188.                         browser = browsers[count];
  1189.                 if (browser == null) {
  1190.                     throw new Exception("Could not find web browser");
  1191.                 } else
  1192.                     Runtime.getRuntime().exec(new String[] { browser, url });
  1193.             }
  1194.         } catch (Exception e) {
  1195.             pushMessage("Failed to open URL.", 0, "");
  1196.         }
  1197.     }
  1198.  
  1199.     public void setNewMaps() {
  1200.         try {
  1201.             BufferedReader in = new BufferedReader(new FileReader(
  1202.                     "./Cache/mapConfig.txt"));
  1203.             String s;
  1204.             int D = 0;
  1205.             while ((s = in.readLine()) != null) {
  1206.                 positions[D] = Integer.parseInt(s.substring(s.indexOf("=") + 1,
  1207.                         s.indexOf("(")));
  1208.                 landScapes[D] = Integer.parseInt(s.substring(
  1209.                         s.indexOf("(") + 1, s.indexOf(")")));
  1210.                 objects[D] = Integer.parseInt(s.substring(s.indexOf("[") + 1, s
  1211.                         .indexOf("]")));
  1212.                 D++;
  1213.             }
  1214.         } catch (IOException e) {
  1215.             e.printStackTrace();
  1216.         }
  1217.     }
  1218.  
  1219.     public void openinterface(int type, int id) {
  1220.         if (type == 1) { // normal interface
  1221.             method60(id);
  1222.             openInterfaceID = id;
  1223.             aBoolean1149 = false;
  1224.  
  1225.         }
  1226.         if (type == 2) { // walkable interface
  1227.             method60(id);
  1228.             anInt1018 = id;
  1229.             aBoolean1149 = false;
  1230.  
  1231.         }
  1232.     }
  1233.  
  1234.     public void sendQuest(String s, int i) {
  1235.         RSInterface.interfaceCache[i].message = s;
  1236.         if (RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID]) {
  1237.             needDrawTabArea = true;
  1238.         }
  1239.     }
  1240.  
  1241.     public void sendFrame248(int interfaceID, int sideInterfaceID) {
  1242.         if (backDialogID != -1) {
  1243.             backDialogID = -1;
  1244.             inputTaken = true;
  1245.         }
  1246.         if (inputDialogState != 0) {
  1247.             inputDialogState = 0;
  1248.             inputTaken = true;
  1249.         }
  1250.         openInterfaceID = interfaceID;
  1251.         invOverlayInterfaceID = sideInterfaceID;
  1252.         needDrawTabArea = true;
  1253.         tabAreaAltered = true;
  1254.         aBoolean1149 = false;
  1255.     }
  1256.  
  1257.     public void drawBlackBox(int xPos, int yPos) {
  1258.         DrawingArea.drawPixelsWithOpacity(0x000000, yPos - 2, 178, 72, 220,
  1259.                 xPos - 2);
  1260.         DrawingArea.fillPixels(xPos - 1, 177, 71, 0x2E2B23, yPos - 1);// DrawingArea.method337
  1261.         DrawingArea.fillPixels(xPos - 2, 177, 71, 0x726451, yPos - 2);// DrawingArea.method337
  1262.     }
  1263.  
  1264.     public void autochat(int amount, String msg) {
  1265.         settime = amount;
  1266.         automsg = msg;
  1267.     }
  1268.  
  1269.     public void processauto() {
  1270.         inputString = automsg;
  1271.         autotime = 200;
  1272.         settime--;
  1273.         drawChatArea();
  1274.     }
  1275.  
  1276.     public void autotalk() {
  1277.         // so while setime is greater than 0 do the below
  1278.         while (settime > 0 && autochat)
  1279.             ;
  1280.         { // set = 10
  1281.             System.out.println("settime = " + settime);
  1282.             for (int x = autotime; x > 0; x--)
  1283.                 // auto // auto timer = delay witch 200 is 200 > 0 x--
  1284.                 switch (x) { // auto timer = 1
  1285.                 case 1:
  1286.                     processauto();
  1287.                     break;
  1288.                 }
  1289.         }
  1290.     }
  1291.  
  1292.     public static void detail() {
  1293.         if (UserLoader.chatdetail == 1) {
  1294.             setHighMem(); //setLowMem();
  1295.         } else {
  1296.             setHighMem(); //setLowMem();
  1297.         }
  1298.     }
  1299.  
  1300.     public void seteffect(int movement) {
  1301.         // UserLoader.chateffectmove = movement;
  1302.     }
  1303.  
  1304.     public void setHpAboveHeads(int id) {
  1305.         UserLoader.hpAboveHeads = id;
  1306.     }
  1307.  
  1308.     public void setNewHits(int id) {
  1309.         UserLoader.newHitSplat = id;
  1310.     }
  1311.  
  1312.     public void setNewHpBar(int id) {
  1313.         UserLoader.newHpBars = id;
  1314.     }
  1315.  
  1316.     public void Setcolour(int id, int colour, String bot, String crown) {
  1317.         switch (id) {
  1318.  
  1319.         case 1:
  1320.             // UserLoader.namesetcolour = colour;
  1321.             break;
  1322.  
  1323.         case 2:
  1324.             // UserLoader.chatsetcolour = colour;
  1325.             break;
  1326.         }
  1327.         pushMessage(bot, 9, crown);
  1328.     }
  1329.  
  1330.     public void setchat(int colour) {
  1331.         // UserLoader.chateffectcolour = colour;
  1332.     }
  1333.  
  1334.     private static String intToKOrMilLongName(int i, int j) {
  1335.         String s = String.valueOf(i);
  1336.         for (int k = s.length() - 3; k > 0; k -= 3)
  1337.             s = s.substring(0, k) + "," + s.substring(k);
  1338.         if (j != 0)
  1339.             if (s.length() > 8)
  1340.                 s = "@gre@" + s.substring(0, s.length() - 8)
  1341.                         + " million @whi@(" + s + ")";
  1342.             else if (s.length() > 4)
  1343.                 s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s
  1344.                         + ")";
  1345.         return " " + s;
  1346.     }
  1347.  
  1348.     private void stopMidi() {
  1349.         signlink.midifade = 0;
  1350.         signlink.midi = "stop";
  1351.     }
  1352.  
  1353.     private boolean menuHasAddFriend(int j) {
  1354.         if (j < 0)
  1355.             return false;
  1356.         int k = menuActionID[j];
  1357.         if (k >= 2000)
  1358.             k -= 2000;
  1359.         return k == 337;
  1360.     }
  1361.     public boolean takingSS = false;
  1362.     public void drawChannelButtons() {
  1363.         String text[] = { "On", "Friends", "Off", "Hide" };
  1364.         int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  1365.         /* Draws main buttons sprite */
  1366.         chatButtons.drawSprite(5, 143);
  1367.         /* Button hovering */
  1368.         if (cButtonHPos == 7) {
  1369.             reportH.drawSprite(404, 143);
  1370.         }
  1371.         if (cButtonCPos == 0)
  1372.             chatButtonC.drawSprite(5, 143);
  1373.         else if (cButtonCPos == 1)
  1374.             chatButtonC.drawSprite(62, 143);
  1375.         else if (cButtonCPos == 2)
  1376.             chatButtonC.drawSprite(119, 143);
  1377.         else if (cButtonCPos == 3)
  1378.             chatButtonC.drawSprite(176, 143);
  1379.         else if (cButtonCPos == 4)
  1380.             chatButtonC.drawSprite(233, 143);
  1381.         else if (cButtonCPos == 5)
  1382.             chatButtonC.drawSprite(290, 143);
  1383.         else if (cButtonCPos == 6)
  1384.             chatButtonC.drawSprite(347, 143);
  1385.         if (cButtonHPos == cButtonCPos) {
  1386.             if (cButtonHPos == 0)
  1387.                 chatButtonHC.drawSprite(5, 143);
  1388.             else if (cButtonHPos == 1)
  1389.                 chatButtonHC.drawSprite(62, 143);
  1390.             else if (cButtonHPos == 2)
  1391.                 chatButtonHC.drawSprite(119, 143);
  1392.             else if (cButtonHPos == 3)
  1393.                 chatButtonHC.drawSprite(176, 143);
  1394.             else if (cButtonHPos == 4)
  1395.                 chatButtonHC.drawSprite(233, 143);
  1396.             else if (cButtonHPos == 5)
  1397.                 chatButtonHC.drawSprite(290, 143);
  1398.             else if (cButtonHPos == 6)
  1399.                 chatButtonHC.drawSprite(347, 143);
  1400.         } else {
  1401.             if (cButtonHPos == 0)
  1402.                 chatButtonH.drawSprite(5, 143);
  1403.             else if (cButtonHPos == 1)
  1404.                 chatButtonH.drawSprite(62, 143);
  1405.             else if (cButtonHPos == 2)
  1406.                 chatButtonH.drawSprite(119, 143);
  1407.             else if (cButtonHPos == 3)
  1408.                 chatButtonH.drawSprite(176, 143);
  1409.             else if (cButtonHPos == 4)
  1410.                 chatButtonH.drawSprite(233, 143);
  1411.             else if (cButtonHPos == 5)
  1412.                 chatButtonH.drawSprite(290, 143);
  1413.             else if (cButtonHPos == 6)
  1414.                 chatButtonH.drawSprite(347, 143);
  1415.         }
  1416.         /* Button text */
  1417.         if(!takingSS)
  1418.             smallText.method389(true, 427, 0xffffff, "Report Bugs", 158);
  1419.         else {
  1420.             DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
  1421.             Date date = new Date();
  1422.             smallText.method389(true, 420, 0xffffff, dateFormat.format(date), 158);
  1423.         }  
  1424.     //  System.out.println(takingSS);
  1425.         smallText.method389(true, 26, 0xffffff, "All", 158);
  1426.         smallText.method389(true, 77, 0xffffff, "Game", 158);
  1427.         smallText.method389(true, 131, 0xffffff, "Public", 153);
  1428.         smallText.method389(true, 185, 0xffffff, "Private", 153);
  1429.         smallText.method389(true, 249, 0xffffff, "Clan", 153);
  1430.         smallText.method389(true, 304, 0xffffff, "Trade", 153);
  1431.         smallText.method389(true, 363, 0xffffff, "Duel", 153);
  1432.         /* Chat modes */
  1433.         smallText.method382(textColor[publicChatMode], 146,
  1434.                 text[publicChatMode], 164, true);
  1435.         smallText.method382(textColor[privateChatMode], 203,
  1436.                 text[privateChatMode], 164, true);
  1437.         smallText.method382(textColor[clanChatMode], 260, text[clanChatMode],
  1438.                 164, true);
  1439.         smallText.method382(textColor[tradeMode], 317, text[tradeMode], 164,
  1440.                 true);
  1441.         smallText
  1442.                 .method382(textColor[duelMode], 374, text[duelMode], 164, true);
  1443.     }
  1444.  
  1445.     private void drawChatArea() /* This draws/displays the chat area */
  1446.     {
  1447.         aRSImageProducer_1166.initDrawingArea();
  1448.         Texture.anIntArray1472 = anIntArray1180;
  1449.         chatArea.drawSprite(0, 0);
  1450.         drawChannelButtons();
  1451.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  1452.         if (messagePromptRaised) {
  1453.             chatTextDrawingArea.drawText(0, aString1121, 60, 259);
  1454.             chatTextDrawingArea.drawText(128, promptInput + "*", 80, 259);
  1455.         } else if (inputDialogState == 1) {
  1456.             chatTextDrawingArea.drawText(0, "Enter amount:", 60, 259);
  1457.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 80, 259);
  1458.         } else if (inputDialogState == 2) {
  1459.             chatTextDrawingArea.drawText(0, "Enter name:", 60, 259);
  1460.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 80, 259);
  1461.         } else if (aString844 != null) {
  1462.             chatTextDrawingArea.drawText(0, aString844, 60, 259);
  1463.             chatTextDrawingArea.drawText(128, "Click to continue", 80, 259);
  1464.         } else if (backDialogID != -1)
  1465.             drawInterface(0, 20, RSInterface.interfaceCache[backDialogID], 20);
  1466.         else if (dialogID != -1) {
  1467.             drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20);
  1468.         } else {
  1469.             int j77 = -3;
  1470.             int j = 0;
  1471.             DrawingArea.setDrawingArea(121, 8, 497, 7);
  1472.             for (int k = 0; k < 500; k++)
  1473.                 if (chatMessages[k] != null) {
  1474.                     int l = chatTypes[k];
  1475.                     int i1 = (70 - j77 * 14) + anInt1089 + 5;
  1476.                     String s1 = chatNames[k];
  1477.                     byte byte0 = 0;
  1478.                     if (s1 != null && s1.startsWith("@cr0@")) {
  1479.                         s1 = s1.substring(5);
  1480.                         byte0 = 1;
  1481.                     }
  1482.                     if (s1 != null && s1.startsWith("@cr1@")) {
  1483.                         s1 = s1.substring(5);
  1484.                         byte0 = 2;
  1485.                     }
  1486.                     if (s1 != null && s1.startsWith("@cr2@")) {
  1487.                         s1 = s1.substring(5);
  1488.                         byte0 = 3;
  1489.                     }
  1490.                     if (s1 != null && s1.startsWith("@cr3@")) {
  1491.                         s1 = s1.substring(5);
  1492.                         byte0 = 4;
  1493.                     }
  1494.                     if (s1 != null && s1.startsWith("@cr4@")) {
  1495.                         s1 = s1.substring(5);
  1496.                         byte0 = 5;
  1497.                     }
  1498.                     if (s1 != null && s1.startsWith("@cr5@")) {
  1499.                         s1 = s1.substring(5);
  1500.                         byte0 = 6;
  1501.                     }
  1502.                     if (s1 != null && s1.startsWith("@cr6@")) {
  1503.                         s1 = s1.substring(5);
  1504.                         byte0 = 7;
  1505.                     }
  1506.                     if (s1 != null && s1.startsWith("@cr7@")) {
  1507.                         s1 = s1.substring(5);
  1508.                         byte0 = 8;
  1509.                     }
  1510.                     if (s1 != null && s1.startsWith("@cr8@")) {
  1511.                         s1 = s1.substring(5);
  1512.                         byte0 = 9;
  1513.                     }
  1514.                     if (s1 != null && s1.startsWith("@cr9@")) {
  1515.                         s1 = s1.substring(5);
  1516.                         byte0 = 10;
  1517.                     }
  1518.                     if (s1 != null && s1.startsWith("@c10@")) {
  1519.                         s1 = s1.substring(5);
  1520.                         byte0 = 13;
  1521.                     }
  1522.                     if (s1 != null && s1.startsWith("@crA@")) {
  1523.                         s1 = s1.substring(5);
  1524.                         byte0 = 11;
  1525.                     }
  1526.                     if (l == 0) {
  1527.                         if (chatTypeView == 5 || chatTypeView == 0) {
  1528.                             if (i1 > 0 && i1 < 210)
  1529.                                 textDrawingArea.method389(false, 9, 0,
  1530.                                         chatMessages[k], i1 - 1);// chat color
  1531.                                                                     // enabled
  1532.                             j++;
  1533.                             j77++;
  1534.                         }
  1535.                     }
  1536.                     if (l == 9) {
  1537.                         if (chatTypeView == 5 || chatTypeView == 0) {
  1538.                             if (i1 > 0 && i1 < 210)
  1539.                                 textDrawingArea.method389(false, 9, 0,
  1540.                                         chatMessages[k] + "@blu@" + s1
  1541.                                                 + "@bla@.", i1 - 1);
  1542.                             j++;
  1543.                             j77++;
  1544.                         }
  1545.                     }
  1546.                     if ((l == 1 || l == 2)
  1547.                             && (l == 1 || publicChatMode == 0 || publicChatMode == 1
  1548.                                     && isFriendOrSelf(s1))) {
  1549.                         if (chatTypeView == 1 || chatTypeView == 0) {
  1550.                             if (i1 > 0 && i1 < 210) {
  1551.                                 int j1 = 8;
  1552.                                 if (byte0 == 1) {
  1553.                                     modIcons[0].drawSprite(j1, i1 - 12);
  1554.                                     j1 += 12;
  1555.                                 }
  1556.                                 if (byte0 == 2) {
  1557.                                     modIcons[1].drawSprite(j1, i1 - 12);
  1558.                                     j1 += 12;
  1559.                                 }
  1560.                                 if (byte0 == 3) {
  1561.                                     modIcons[2].drawSprite(j1, i1 - 12);
  1562.                                     j1 += 12;
  1563.                                 }
  1564.                                 if (byte0 == 4) {
  1565.                                     modIcons[3].drawSprite(j1, i1 - 12);
  1566.                                     j1 += 12;
  1567.                                 }
  1568.                                 if (byte0 == 5) {
  1569.                                     modIcons[4].drawSprite(j1, i1 - 12);
  1570.                                     j1 += 12;
  1571.                                 }
  1572.                                 if (byte0 == 6) {
  1573.                                     modIcons[5].drawSprite(j1, i1 - 12);
  1574.                                     j1 += 12;
  1575.                                 }
  1576.                                 if (byte0 == 7) {
  1577.                                     modIcons[6].drawSprite(j1, i1 - 12);
  1578.                                     j1 += 12;
  1579.                                 }
  1580.                                 if (byte0 == 8) {
  1581.                                     modIcons[7].drawSprite(j1, i1 - 12);
  1582.                                     j1 += 12;
  1583.                                 }
  1584.                                 if (byte0 == 9) {
  1585.                                     modIcons[8].drawSprite(j1, i1 - 12);
  1586.                                     j1 += 12;
  1587.                                 }
  1588.                                 if (byte0 == 10) {
  1589.                                     modIcons[9].drawSprite(j1, i1 - 12);
  1590.                                     j1 += 12;
  1591.                                 }
  1592.                                 if (byte0 == 11) {
  1593.                                     modIcons[10].drawSprite(j1, i1 - 12);
  1594.                                     j1 += 12;
  1595.                                 }
  1596.                                 if (byte0 == 13) {
  1597.                                     modIcons[11].drawSprite(j1, i1 - 12);
  1598.                                     j1 += 12;
  1599.                                 }
  1600.                                 /* draws playername in chatbox[history] */
  1601.                                 // textDrawingArea.method385(0, s1 + ":", i1 -
  1602.                                 // 1, j1 + 1);
  1603.                                 textDrawingArea.method389(false, j1 + 1, 0, s1
  1604.                                         + ":", i1 - 1);
  1605.                                 j1 += textDrawingArea.getTextWidth(s1) + 8;
  1606.                                 /* draws chat in chatbox[history] */
  1607.                                 textDrawingArea.method389(false, j1 + 1, 255,
  1608.                                         chatMessages[k], i1 - 1);// chat color
  1609.                                                                     // enabled;
  1610.                             }
  1611.                             j++;
  1612.                             j77++;
  1613.                         }
  1614.                     }
  1615.                     if ((l == 3 || l == 7)
  1616.                             && (splitPrivateChat == 0 || chatTypeView == 2)
  1617.                             && (l == 7 || privateChatMode == 0 || privateChatMode == 1
  1618.                                     && isFriendOrSelf(s1))) {
  1619.                         if (chatTypeView == 2 || chatTypeView == 0) {
  1620.                             if (i1 > 0 && i1 < 210) {
  1621.                                 int k1 = 8;
  1622.                                 textDrawingArea.method385(0, "From", i1, k1);
  1623.                                 k1 += textDrawingArea.getTextWidth("From ");
  1624.                                 if (byte0 == 1) {
  1625.                                     modIcons[0].drawSprite(k1, i1 - 12);
  1626.                                     k1 += 12;
  1627.                                 }
  1628.                                 if (byte0 == 2) {
  1629.                                     modIcons[1].drawSprite(k1, i1 - 12);
  1630.                                     k1 += 12;
  1631.                                 }
  1632.                                 if (byte0 == 3) {
  1633.                                     modIcons[2].drawSprite(k1, i1 - 12);
  1634.                                     k1 += 12;
  1635.                                     k1 += 12;
  1636.                                 }
  1637.                                 if (byte0 == 4) {
  1638.                                     modIcons[3].drawSprite(k1, i1 - 12);
  1639.                                     k1 += 12;
  1640.                                     k1 += 12;
  1641.                                 }
  1642.                                 if (byte0 == 5) {
  1643.                                     modIcons[4].drawSprite(k1, i1 - 12);
  1644.                                     k1 += 12;
  1645.                                     k1 += 12;
  1646.                                 }
  1647.                                 if (byte0 == 6) {
  1648.                                     modIcons[5].drawSprite(k1, i1 - 12);
  1649.                                     k1 += 12;
  1650.                                     k1 += 12;
  1651.                                 }
  1652.                                 if (byte0 == 7) {
  1653.                                     modIcons[6].drawSprite(k1, i1 - 12);
  1654.                                     k1 += 12;
  1655.                                     k1 += 12;
  1656.                                 }
  1657.                                 if (byte0 == 8) {
  1658.                                     modIcons[7].drawSprite(k1, i1 - 12);
  1659.                                     k1 += 12;
  1660.                                     k1 += 12;
  1661.                                 }
  1662.                                 if (byte0 == 9) {
  1663.                                     modIcons[8].drawSprite(k1, i1 - 12);
  1664.                                     k1 += 12;
  1665.                                     k1 += 12;
  1666.                                 }
  1667.                                 if (byte0 == 10) {
  1668.                                     modIcons[9].drawSprite(k1, i1 - 12);
  1669.                                     k1 += 12;
  1670.                                     k1 += 12;
  1671.                                 }
  1672.                                 if (byte0 == 11) {
  1673.                                     modIcons[10].drawSprite(k1, i1 - 12);
  1674.                                     k1 += 12;
  1675.                                     k1 += 12;
  1676.                                 }
  1677.                                 if (byte0 == 13) {
  1678.                                     modIcons[11].drawSprite(k1, i1 - 12);
  1679.                                     k1 += 12;
  1680.                                     k1 += 12;
  1681.                                 }
  1682.                                 textDrawingArea.method385(0, s1 + ":", i1 - 1,
  1683.                                         k1 + 1);
  1684.                                 k1 += textDrawingArea.getTextWidth(s1) + 8;
  1685.                                 textDrawingArea.method385(0x800000,
  1686.                                         chatMessages[k], i1 - 1, k1 + 1);
  1687.                             }
  1688.                             j++;
  1689.                             j77++;
  1690.                         }
  1691.                     }
  1692.                     if (l == 4
  1693.                             && (tradeMode == 0 || tradeMode == 1
  1694.                                     && isFriendOrSelf(s1))) {
  1695.                         if (chatTypeView == 3 || chatTypeView == 0) {
  1696.                             if (i1 > 0 && i1 < 210)
  1697.                                 textDrawingArea.method385(0x800080, s1 + " "
  1698.                                         + chatMessages[k], i1, 8);
  1699.                             j++;
  1700.                             j77++;
  1701.                         }
  1702.                     }
  1703.                     if (l == 5 && splitPrivateChat == 0 && privateChatMode < 2) {
  1704.                         if (chatTypeView == 2 || chatTypeView == 0) {
  1705.                             if (i1 > 0 && i1 < 210)
  1706.                                 textDrawingArea.method385(0x800000,
  1707.                                         chatMessages[k], i1, 8);
  1708.                             j++;
  1709.                             j77++;
  1710.                         }
  1711.                     }
  1712.                     if (l == 6 && (splitPrivateChat == 0 || chatTypeView == 2)
  1713.                             && privateChatMode < 2) {
  1714.                         if (chatTypeView == 2 || chatTypeView == 0) {
  1715.                             if (i1 > 0 && i1 < 210) {
  1716.                                 textDrawingArea.method385(0, "To " + s1 + ":",
  1717.                                         i1, 8);
  1718.                                 textDrawingArea.method385(0x800000,
  1719.                                         chatMessages[k], i1,
  1720.                                         12 + textDrawingArea
  1721.                                                 .getTextWidth("To :" + s1));
  1722.                             }
  1723.                             j++;
  1724.                             j77++;
  1725.                         }
  1726.                     }
  1727.                     if (l == 8
  1728.                             && (duelMode == 0 || duelMode == 1
  1729.                                     && isFriendOrSelf(s1))) {
  1730.                         if (chatTypeView == 4 || chatTypeView == 0) {
  1731.                             if (i1 > 0 && i1 < 210)
  1732.                                 textDrawingArea.method385(0x7e3200, s1 + " "
  1733.                                         + chatMessages[k], i1, 8);
  1734.                             j++;
  1735.                             j77++;
  1736.                         }
  1737.                         if (l == 11 && (clanChatMode == 0)) {
  1738.                             if (chatTypeView == 11) {
  1739.                                 if (i1 > 0 && i1 < 210)
  1740.                                     textDrawingArea.method385(0x7e3200, s1
  1741.                                             + " " + chatMessages[k], i1, 8);
  1742.                                 j++;
  1743.                                 j77++;
  1744.                             }
  1745.                             if (l == 12)// link
  1746.                             {
  1747.                                 if (i1 > 0 && i1 < 110)
  1748.                                     textDrawingArea.method385(0x7e3200,
  1749.                                             chatMessages[k] + " @blu@" + s1,
  1750.                                             i1, 8);
  1751.                                 j++;
  1752.                             }
  1753.                         }
  1754.                     }
  1755.                 }
  1756.             DrawingArea.defaultDrawingAreaSize();
  1757.             anInt1211 = j * 14 + 7 + 5;
  1758.             if (anInt1211 < 111)
  1759.                 anInt1211 = 111;
  1760.             drawScrollbar(113, anInt1211 - anInt1089 - 113, 7, 496, anInt1211);
  1761.             String s;
  1762.             String title = myPlayer.title;
  1763.             if (myPlayer != null && myPlayer.name != null)
  1764.                 s = myPlayer.name;
  1765.             else
  1766.                 s = TextClass.fixName(myUsername);
  1767.             /*
  1768.              * textDrawingArea.method385(0, s + ":", 132, 9);
  1769.              * textDrawingArea.drawChatInput(255, 10 +
  1770.              * textDrawingArea.getTextWidth(s + ": "), inputString + "*", 132,
  1771.              * false); DrawingArea.method339(120, 0x807660, 504, 7);
  1772.              */
  1773.             if (inputString.startsWith("/r")) {
  1774.                         inputString = "::pm " + pastNum +","+inputString.substring(2,inputString.length());
  1775.             }
  1776.             for(Entry d : sk.getShortKeys()){
  1777.                         // search using regex
  1778.                         String pattern = "(^|)"+d.getKey()+"(\\s|$)";
  1779.                         Pattern p = Pattern.compile(pattern); // use regex to break up string
  1780.                         Matcher m = p.matcher(inputString);
  1781.                         inputString  = m.replaceAll(d.getValue());
  1782.             }
  1783.             //System.out.println("printing " + inputString);
  1784.             textDrawingArea.method385(getColor(myPlayer.skill), title, 132, 9); // title
  1785.             textDrawingArea.method385(0, s + ":", 132, 9 + textDrawingArea
  1786.                     .getTextWidth(title)); // name
  1787.             textDrawingArea.method389(false, 10 + textDrawingArea
  1788.                     .getTextWidth(title + s + ": "), 255, inputString
  1789.                     + ((loopCycle % 40 < 20) ? "@bla@|" : ""), 132);
  1790.             DrawingArea.method339(120, 0x807660, 504, 7);
  1791.         }
  1792.         if (menuOpen && menuScreenArea == 2) {
  1793.             drawMenu();
  1794.         }
  1795.         aRSImageProducer_1166.drawGraphics(338, super.graphics, 0);
  1796.         aRSImageProducer_1165.initDrawingArea();
  1797.         Texture.anIntArray1472 = anIntArray1182;
  1798.  
  1799.     }
  1800.  
  1801.     public static client instance;
  1802.  
  1803.     public void init() {
  1804.         try {
  1805.             nodeID = 10;
  1806.             portOff = 0;
  1807.             setLowMem();
  1808.             isMembers = true;
  1809.             signlink.storeid = 32;
  1810.             signlink.startpriv(InetAddress.getLocalHost());
  1811.             initClientFrame(505,767);
  1812.         }
  1813.         catch (Exception exception) {
  1814.             return;
  1815.         }
  1816.     }
  1817.  
  1818.     public void startRunnable(Runnable runnable, int i) {
  1819.         if (i > 10)
  1820.             i = 10;
  1821.         if (signlink.mainapp != null) {
  1822.             signlink.startthread(runnable, i);
  1823.         } else {
  1824.             super.startRunnable(runnable, i);
  1825.         }
  1826.     }
  1827.  
  1828.     public Socket openSocket(int port) throws IOException {
  1829.         return new Socket(InetAddress.getByName(server), port);
  1830.     }
  1831.  
  1832.     private void processMenuClick() {
  1833.         if (activeInterfaceType != 0)
  1834.             return;
  1835.         int j = super.clickMode3;
  1836.         if (spellSelected == 1 && super.saveClickX >= 516
  1837.                 && super.saveClickY >= 160 && super.saveClickX <= 765
  1838.                 && super.saveClickY <= 205)
  1839.             j = 0;
  1840.         if (menuOpen) {
  1841.             if (j != 1) {
  1842.                 int k = super.mouseX;
  1843.                 int j1 = super.mouseY;
  1844.                 if (menuScreenArea == 0) {
  1845.                     k -= 4;
  1846.                     j1 -= 4;
  1847.                 }
  1848.                 if (menuScreenArea == 1) {
  1849.                     k -= 516;
  1850.                     j1 -= 168;
  1851.                 }
  1852.                 if (menuScreenArea == 2) {
  1853.                     k -= 17;
  1854.                     j1 -= 338;
  1855.                 }
  1856.                 if (menuScreenArea == 3) {
  1857.                     k -= 515;
  1858.                     j1 -= 0;
  1859.                 }
  1860.                 if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10
  1861.                         || j1 < menuOffsetY - 10
  1862.                         || j1 > menuOffsetY + anInt952 + 10) {
  1863.                     menuOpen = false;
  1864.                     if (menuScreenArea == 1)
  1865.                         needDrawTabArea = true;
  1866.                     if (menuScreenArea == 2)
  1867.                         inputTaken = true;
  1868.                 }
  1869.             }
  1870.             if (j == 1) {
  1871.                 int l = menuOffsetX;
  1872.                 int k1 = menuOffsetY;
  1873.                 int i2 = menuWidth;
  1874.                 int k2 = super.saveClickX;
  1875.                 int l2 = super.saveClickY;
  1876.                 if (menuScreenArea == 0) {
  1877.                     k2 -= 4;
  1878.                     l2 -= 4;
  1879.                 }
  1880.                 if (menuScreenArea == 1) {
  1881.                     k2 -= 516;
  1882.                     l2 -= 168;
  1883.                 }
  1884.                 if (menuScreenArea == 2) {
  1885.                     k2 -= 17;
  1886.                     l2 -= 338;
  1887.                 }
  1888.                 if (menuScreenArea == 3) {
  1889.                     k2 -= 519;
  1890.                     l2 -= 0;
  1891.                 }
  1892.                 int i3 = -1;
  1893.                 for (int j3 = 0; j3 < menuActionRow; j3++) {
  1894.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  1895.                     if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  1896.                         i3 = j3;
  1897.                 }
  1898.                 //System.out.println("Menu action click value: " + i3);
  1899.                 if (i3 != -1)
  1900.                     doAction(i3);
  1901.                 menuOpen = false;
  1902.                 if (menuScreenArea == 1)
  1903.                     needDrawTabArea = true;
  1904.                 if (menuScreenArea == 2) {
  1905.                     inputTaken = true;
  1906.                 }
  1907.             }
  1908.         } else {
  1909.             if (j == 1 && menuActionRow > 0) {
  1910.                 int i1 = menuActionID[menuActionRow - 1];
  1911.                 if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53
  1912.                         || i1 == 74 || i1 == 454 || i1 == 539 || i1 == 493
  1913.                         || i1 == 847 || i1 == 447 || i1 == 1125) {
  1914.                     int l1 = menuActionCmd2[menuActionRow - 1];
  1915.                     int j2 = menuActionCmd3[menuActionRow - 1];
  1916.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  1917.                     if (class9.aBoolean259 || class9.aBoolean235) {
  1918.                         aBoolean1242 = false;
  1919.                         anInt989 = 0;
  1920.                         anInt1084 = j2;
  1921.                         anInt1085 = l1;
  1922.                         activeInterfaceType = 2;
  1923.                         anInt1087 = super.saveClickX;
  1924.                         anInt1088 = super.saveClickY;
  1925.                         if (RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  1926.                             activeInterfaceType = 1;
  1927.                         if (RSInterface.interfaceCache[j2].parentID == backDialogID)
  1928.                             activeInterfaceType = 3;
  1929.                         return;
  1930.                     }
  1931.                 }
  1932.             }
  1933.             if (j == 1
  1934.                     && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
  1935.                     && menuActionRow > 2)
  1936.                 j = 2;
  1937.             if (j == 1 && menuActionRow > 0)
  1938.                 doAction(menuActionRow - 1);
  1939.             if (j == 2 && menuActionRow > 0)
  1940.                 determineMenuSize();
  1941.         }
  1942.     }
  1943.  
  1944.     public static int totalRead = 0;
  1945.  
  1946.     public static String getFileNameWithoutExtension(String fileName) {
  1947.         File tmpFile = new File(fileName);
  1948.         tmpFile.getName();
  1949.         int whereDot = tmpFile.getName().lastIndexOf('.');
  1950.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  1951.             return tmpFile.getName().substring(0, whereDot);
  1952.         }
  1953.         return "";
  1954.     }
  1955.  
  1956.     public void preloadModels() {
  1957.         File file = new File("./Raw/");
  1958.         File[] fileArray = file.listFiles();
  1959.         for (int y = 0; y < fileArray.length; y++) {
  1960.             String s = fileArray[y].getName();
  1961.             byte[] buffer = ReadFile("./Raw/" + s);
  1962.             // System.out.println(s);
  1963.             Model.method460(buffer, Integer
  1964.                     .parseInt(getFileNameWithoutExtension(s)));
  1965.         }
  1966.     }
  1967.  
  1968.     public static final byte[] ReadFile(String s) {
  1969.         try {
  1970.             byte abyte0[];
  1971.             File file = new File(s);
  1972.             int i = (int) file.length();
  1973.             abyte0 = new byte[i];
  1974.             DataInputStream datainputstream = new DataInputStream(
  1975.                     new BufferedInputStream(new FileInputStream(s)));
  1976.             datainputstream.readFully(abyte0, 0, i);
  1977.             datainputstream.close();
  1978.             totalRead++;
  1979.             return abyte0;
  1980.         } catch (Exception e) {
  1981.             System.out.println((new StringBuilder()).append("Read Error: ")
  1982.                     .append(s).toString());
  1983.             return null;
  1984.         }
  1985.     }
  1986.  
  1987.     public void models() {
  1988.         for (int ModelIndex = 0; ModelIndex < 50000; ModelIndex++) {
  1989.             byte[] abyte0 = getModel(ModelIndex);
  1990.             if (abyte0 != null && abyte0.length > 0) {
  1991.                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  1992.                 pushMessage("Model added successfully!", 0, "");
  1993.             }
  1994.         }
  1995.     }
  1996.  
  1997.     private void saveMidi(boolean flag, byte abyte0[]) {
  1998.         signlink.midifade = flag ? 1 : 0;
  1999.         signlink.midisave(abyte0, abyte0.length);
  2000.     }
  2001.  
  2002.     public final void method22(boolean flag) {
  2003.         try {
  2004.             anInt985 = -1;
  2005.             aClass19_1056.removeAll();
  2006.             aClass19_1013.removeAll();
  2007.             Texture.method366();
  2008.             unlinkMRUNodes();
  2009.             worldController.initToNull();
  2010.  
  2011.             System.gc();
  2012.             for (int i = 0; i < 4; i++)
  2013.                 aClass11Array1230[i].method210();
  2014.  
  2015.             for (int l = 0; l < 4; l++) {
  2016.                 for (int k1 = 0; k1 < 104; k1++) {
  2017.                     for (int j2 = 0; j2 < 104; j2++)
  2018.                         byteGroundArray[l][k1][j2] = 0;
  2019.  
  2020.                 }
  2021.  
  2022.             }
  2023.  
  2024.             ObjectManager objectManager = new ObjectManager(byteGroundArray,
  2025.                     intGroundArray);
  2026.  
  2027.             int k2 = aByteArrayArray1183.length;
  2028.  
  2029.             int k18 = 62;
  2030.             for (int A = 0; A < k2; A++)
  2031.                 for (int B = 0; B < 2000; B++)
  2032.                     if (anIntArray1234[A] == positions[B]) {
  2033.                         anIntArray1235[A] = landScapes[B];
  2034.                         anIntArray1236[A] = objects[B];
  2035.                     }
  2036.  
  2037.             stream.createFrame(0);
  2038.  
  2039.             if (!aBoolean1159) {
  2040.                 for (int i3 = 0; i3 < k2; i3++) {
  2041.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  2042.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  2043.  
  2044.                     byte abyte0[] = aByteArrayArray1183[i3];
  2045.                     if (FileOperations.FileExists("./Cache/FloorMaps/"
  2046.                             + anIntArray1235[i3] + ".dat"))
  2047.                         abyte0 = FileOperations.ReadFile("./Cache/FloorMaps/"
  2048.                                 + anIntArray1235[i3] + ".dat");
  2049.  
  2050.                     if (abyte0 != null)
  2051.                         // objectManager.method180(abyte0, k5, i4, (anInt1069 -
  2052.                         // 6) * 8, (anInt1070 - 6) * 8, (byte)4,
  2053.                         // aClass11Array1230);
  2054.                         objectManager.method180(abyte0, k5, i4,
  2055.                                 (anInt1069 - 6) * 8, (anInt1070 - 6) * 8,
  2056.                                 aClass11Array1230);
  2057.                 }
  2058.  
  2059.                 for (int j4 = 0; j4 < k2; j4++) {
  2060.                     int l5 = (anIntArray1234[j4] >> 8) * k18 - baseX;
  2061.                     int k7 = (anIntArray1234[j4] & 0xff) * k18 - baseY;
  2062.                     byte abyte2[] = aByteArrayArray1183[j4];
  2063.                     if (abyte2 == null && anInt1070 < 800)
  2064.                         // ObjectManager.method174(k7, 64, 0, 64, l5);
  2065.                         objectManager.method174(k7, 64, 64, l5);
  2066.                 }
  2067.  
  2068.                 anInt1097++;
  2069.                 if (anInt1097 > 160) {
  2070.                     anInt1097 = 0;
  2071.                     stream.createFrame(238);
  2072.                     stream.writeWordBigEndian(96);
  2073.  
  2074.                 }
  2075.                 stream.createFrame(0);
  2076.  
  2077.                 for (int i6 = 0; i6 < k2; i6++) {
  2078.                     byte abyte1[] = aByteArrayArray1247[i6];
  2079.                     if (FileOperations.FileExists("./Cache/ObjectMaps/"
  2080.                             + anIntArray1236[i6] + ".dat"))
  2081.                         abyte1 = FileOperations.ReadFile("./Cache/ObjectMaps/"
  2082.                                 + anIntArray1236[i6] + ".dat");
  2083.                     if (abyte1 != null) {
  2084.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  2085.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  2086.                         // ObjectManager.method190(l8, aClass11Array1230, k9, 7,
  2087.                         // aClass25_946, abyte1);
  2088.                         objectManager.method190(l8, aClass11Array1230, k9,
  2089.                                 worldController, abyte1);
  2090.                     }
  2091.                 }
  2092.  
  2093.             }
  2094.             if (aBoolean1159) {
  2095.                 for (int j3 = 0; j3 < 4; j3++) {
  2096.                     for (int k4 = 0; k4 < 13; k4++) {
  2097.                         for (int j6 = 0; j6 < 13; j6++) {
  2098.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  2099.                             if (l7 != -1) {
  2100.                                 int i9 = l7 >> 24 & 3;
  2101.                                 int l9 = l7 >> 1 & 3;
  2102.                                 int j10 = l7 >> 14 & 0x3ff;
  2103.                                 int l10 = l7 >> 3 & 0x7ff;
  2104.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  2105.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  2106.                                     if (anIntArray1234[l11] != j11
  2107.                                             || aByteArrayArray1183[l11] == null)
  2108.                                         continue;
  2109.                                     // ObjectManager.method179(i9, l9,
  2110.                                     // aClass11Array1230, 9, k4 * 8, (j10 & 7) *
  2111.                                     // 8, aByteArrayArray1183[l11], (l10 & 7) *
  2112.                                     // 8, j3, j6 * 8);
  2113.                                     objectManager.method179(i9, l9,
  2114.                                             aClass11Array1230, k4 * 8,
  2115.                                             (j10 & 7) * 8,
  2116.                                             aByteArrayArray1183[l11],
  2117.                                             (l10 & 7) * 8, j3, j6 * 8);
  2118.                                     break;
  2119.                                 }
  2120.  
  2121.                             }
  2122.                         }
  2123.  
  2124.                     }
  2125.  
  2126.                 }
  2127.  
  2128.                 for (int l4 = 0; l4 < 13; l4++) {
  2129.                     for (int k6 = 0; k6 < 13; k6++) {
  2130.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  2131.                         if (i8 == -1)
  2132.                             // ObjectManager.method174(k6 * 8, 8, 0, 8, l4 * 8);
  2133.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  2134.                     }
  2135.  
  2136.                 }
  2137.  
  2138.                 stream.createFrame(0);
  2139.  
  2140.                 for (int l6 = 0; l6 < 4; l6++) {
  2141.                     for (int j8 = 0; j8 < 13; j8++) {
  2142.                         for (int j9 = 0; j9 < 13; j9++) {
  2143.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  2144.                             if (i10 != -1) {
  2145.                                 int k10 = i10 >> 24 & 3;
  2146.                                 int i11 = i10 >> 1 & 3;
  2147.                                 int k11 = i10 >> 14 & 0x3ff;
  2148.                                 int i12 = i10 >> 3 & 0x7ff;
  2149.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  2150.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  2151.                                     if (anIntArray1234[k12] != j12
  2152.                                             || aByteArrayArray1247[k12] == null)
  2153.                                         continue;
  2154.                                     byte abyte0[] = aByteArrayArray1247[k12];
  2155.                                     if (FileOperations
  2156.                                             .FileExists("./Cache/FloorMaps/"
  2157.                                                     + anIntArray1235[k12]
  2158.                                                     + ".dat"))
  2159.                                         abyte0 = FileOperations
  2160.                                                 .ReadFile(signlink
  2161.                                                         .findcachedir()
  2162.                                                         + "FloorMaps/"
  2163.                                                         + anIntArray1235[k12]
  2164.                                                         + ".dat");
  2165.                                     // ObjectManager.method183(aClass11Array1230,
  2166.                                     // aClass25_946, k10, j8 * 8, (i12 & 7) * 8,
  2167.                                     // true, l6, abyte0, (k11 & 7) * 8, i11, j9
  2168.                                     // * 8);
  2169.                                     objectManager.method183(aClass11Array1230,
  2170.                                             worldController, k10, j8 * 8,
  2171.                                             (i12 & 7) * 8, l6,
  2172.                                             aByteArrayArray1247[k12],
  2173.                                             (k11 & 7) * 8, i11, j9 * 8);
  2174.                                     break;
  2175.                                 }
  2176.  
  2177.                             }
  2178.                         }
  2179.  
  2180.                     }
  2181.  
  2182.                 }
  2183.  
  2184.             }
  2185.             stream.createFrame(0);
  2186.  
  2187.             // ObjectManager.method171(aClass11Array1230, aClass25_946, 2);
  2188.             // aClass15_1165.method237(0);
  2189.             objectManager.method171(aClass11Array1230, worldController);
  2190.             aRSImageProducer_1165.initDrawingArea();
  2191.             stream.createFrame(0);
  2192.  
  2193.             int k3 = ObjectManager.anInt145;
  2194.             if (k3 > plane)
  2195.                 k3 = plane;
  2196.  
  2197.             if (k3 < plane - 1)
  2198.                 k3 = plane - 1;
  2199.             if (lowMem)
  2200.  
  2201.                 worldController.method275(ObjectManager.anInt145);
  2202.             else
  2203.                 worldController.method275(0);
  2204.             for (int i5 = 0; i5 < 104; i5++) {
  2205.                 for (int i7 = 0; i7 < 104; i7++)
  2206.                     spawnGroundItem(i5, i7);
  2207.  
  2208.             }
  2209.  
  2210.             anInt1051++;
  2211.             if (anInt1051 > 98) {
  2212.                 anInt1051 = 0;
  2213.                 stream.createFrame(150);
  2214.  
  2215.             }
  2216.             method63();
  2217.         } catch (Exception exception) {
  2218.         }
  2219.         ObjectDef.mruNodes1.unlinkAll();
  2220.  
  2221.         if (super.gameFrame != null) {
  2222.             stream.createFrame(210);
  2223.  
  2224.             stream.writeDWord(0x3f008edd);
  2225.         }
  2226.         if (lowMem && signlink.cache_dat != null) {
  2227.             int j = 32767;
  2228.  
  2229.             for (int i1 = 0; i1 < j; i1++) {
  2230.                 int l1 = 32767;
  2231.  
  2232.                 if ((l1 & 0x79) == 0)
  2233.                     Model.method461(i1);
  2234.             }
  2235.  
  2236.         }
  2237.         System.gc();
  2238.         Texture.method367();
  2239.         onDemandFetcher.method566();
  2240.  
  2241.         int k = (anInt1069 - 6) / 8 - 1;
  2242.         int j1 = (anInt1069 + 6) / 8 + 1;
  2243.         int i2 = (anInt1070 - 6) / 8 - 1;
  2244.         int l2 = (anInt1070 + 6) / 8 + 1;
  2245.         if (aBoolean1141) {
  2246.             k = 49;
  2247.             j1 = 50;
  2248.             i2 = 49;
  2249.             l2 = 50;
  2250.         }
  2251.         for (int l3 = k; l3 <= j1; l3++) {
  2252.             for (int j5 = i2; j5 <= l2; j5++)
  2253.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  2254.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  2255.                     if (j7 != -1)
  2256.                         onDemandFetcher.method560(j7, 3);
  2257.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  2258.                     if (k8 != -1)
  2259.                         onDemandFetcher.method560(k8, 3);
  2260.                 }
  2261.  
  2262.         }
  2263.  
  2264.     }
  2265.  
  2266.     private void unlinkMRUNodes() {
  2267.         ObjectDef.mruNodes1.unlinkAll();
  2268.         ObjectDef.mruNodes2.unlinkAll();
  2269.         EntityDef.mruNodes.unlinkAll();
  2270.         ItemDef.mruNodes2.unlinkAll();
  2271.         ItemDef.mruNodes1.unlinkAll();
  2272.         Player.mruNodes.unlinkAll();
  2273.         SpotAnim.aMRUNodes_415.unlinkAll();
  2274.     }
  2275.  
  2276.     private void method24(int i) {
  2277.         int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  2278.         int j = ai.length;
  2279.         for (int k = 0; k < j; k++)
  2280.             ai[k] = 0;
  2281.  
  2282.         for (int l = 1; l < 103; l++) {
  2283.             int i1 = 24628 + (103 - l) * 512 * 4;
  2284.             for (int k1 = 1; k1 < 103; k1++) {
  2285.                 if ((byteGroundArray[i][k1][l] & 0x18) == 0)
  2286.                     worldController.method309(ai, i1, i, k1, l);
  2287.                 if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  2288.                     worldController.method309(ai, i1, i + 1, k1, l);
  2289.                 i1 += 4;
  2290.             }
  2291.  
  2292.         }
  2293.  
  2294.         int j1 = ((238 + (int) (Math.random() * 20D)) - 10 << 16)
  2295.                 + ((238 + (int) (Math.random() * 20D)) - 10 << 8)
  2296.                 + ((238 + (int) (Math.random() * 20D)) - 10);
  2297.         int l1 = (238 + (int) (Math.random() * 20D)) - 10 << 16;
  2298.         aClass30_Sub2_Sub1_Sub1_1263.method343();
  2299.         for (int i2 = 1; i2 < 103; i2++) {
  2300.             for (int j2 = 1; j2 < 103; j2++) {
  2301.                 if ((byteGroundArray[i][j2][i2] & 0x18) == 0)
  2302.                     method50(i2, j1, j2, l1, i);
  2303.                 if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  2304.                     method50(i2, j1, j2, l1, i + 1);
  2305.             }
  2306.  
  2307.         }
  2308.  
  2309.         aRSImageProducer_1165.initDrawingArea();
  2310.         anInt1071 = 0;
  2311.         for (int k2 = 0; k2 < 104; k2++) {
  2312.             for (int l2 = 0; l2 < 104; l2++) {
  2313.                 int i3 = worldController.method303(plane, k2, l2);
  2314.                 if (i3 != 0) {
  2315.                     i3 = i3 >> 14 & 0x7fff;
  2316.                     int j3 = ObjectDef.forID(i3).anInt746;
  2317.                     if (j3 >= 0) {
  2318.                         int k3 = k2;
  2319.                         int l3 = l2;
  2320.                         if (j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36
  2321.                                 && j3 != 46 && j3 != 47 && j3 != 48) {
  2322.                             byte byte0 = 104;
  2323.                             byte byte1 = 104;
  2324.                             int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  2325.                             for (int i4 = 0; i4 < 10; i4++) {
  2326.                                 int j4 = (int) (Math.random() * 4D);
  2327.                                 if (j4 == 0 && k3 > 0 && k3 > k2 - 3
  2328.                                         && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  2329.                                     k3--;
  2330.                                 if (j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3
  2331.                                         && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  2332.                                     k3++;
  2333.                                 if (j4 == 2 && l3 > 0 && l3 > l2 - 3
  2334.                                         && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  2335.                                     l3--;
  2336.                                 if (j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3
  2337.                                         && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  2338.                                     l3++;
  2339.                             }
  2340.  
  2341.                         }
  2342.                         try {
  2343.                             aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  2344.                         } catch (Exception ex) {
  2345.                         }
  2346.                         anIntArray1072[anInt1071] = k3;
  2347.                         anIntArray1073[anInt1071] = l3;
  2348.                         anInt1071++;
  2349.                     }
  2350.                 }
  2351.             }
  2352.  
  2353.         }
  2354.  
  2355.     }
  2356.  
  2357.     private void spawnGroundItem(int i, int j) {
  2358.         NodeList class19 = groundArray[plane][i][j];
  2359.         if (class19 == null) {
  2360.             worldController.method295(plane, i, j);
  2361.             return;
  2362.         }
  2363.         int k = 0xfa0a1f01;
  2364.         Object obj = null;
  2365.         for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  2366.                 .reverseGetNext()) {
  2367.             ItemDef itemDef = ItemDef.forID(item.ID);
  2368.             int l = itemDef.value;
  2369.             if (itemDef.stackable)
  2370.                 l *= item.anInt1559 + 1;
  2371.             // notifyItemSpawn(item, i + baseX, j + baseY);
  2372.  
  2373.             if (l > k) {
  2374.                 k = l;
  2375.                 obj = item;
  2376.             }
  2377.         }
  2378.  
  2379.         class19.insertTail(((Node) (obj)));
  2380.         Object obj1 = null;
  2381.         Object obj2 = null;
  2382.         for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19
  2383.                 .reverseGetNext()) {
  2384.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  2385.                     && obj1 == null)
  2386.                 obj1 = class30_sub2_sub4_sub2_1;
  2387.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  2388.                     && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID
  2389.                     && obj2 == null)
  2390.                 obj2 = class30_sub2_sub4_sub2_1;
  2391.         }
  2392.  
  2393.         int i1 = i + (j << 7) + 0x60000000;
  2394.         worldController.method281(i, i1, ((Animable) (obj1)), method42(plane,
  2395.                 j * 128 + 64, i * 128 + 64), ((Animable) (obj2)),
  2396.                 ((Animable) (obj)), plane, j);
  2397.     }
  2398.  
  2399.     private void method26(boolean flag) {
  2400.         for (int j = 0; j < npcCount; j++) {
  2401.             NPC npc = npcArray[npcIndices[j]];
  2402.             int k = 0x20000000 + (npcIndices[j] << 14);
  2403.             if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  2404.                 continue;
  2405.             int l = npc.x >> 7;
  2406.             int i1 = npc.y >> 7;
  2407.             if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  2408.                 continue;
  2409.             if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64
  2410.                     && (npc.y & 0x7f) == 64) {
  2411.                 if (anIntArrayArray929[l][i1] == anInt1265)
  2412.                     continue;
  2413.                 anIntArrayArray929[l][i1] = anInt1265;
  2414.             }
  2415.             if (!npc.desc.aBoolean84)
  2416.                 k += 0x80000000;
  2417.             worldController.method285(plane, npc.anInt1552, method42(plane,
  2418.                     npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60,
  2419.                     npc.x, npc, npc.aBoolean1541);
  2420.         }
  2421.     }
  2422.  
  2423.     private boolean replayWave() {
  2424.         return signlink.wavereplay();
  2425.     }
  2426.  
  2427.     private void loadError() {
  2428.         String s = "ondemand";// was a constant parameter
  2429.         System.out.println(s);
  2430.         try {
  2431.             getAppletContext().showDocument(
  2432.                     new URL(getCodeBase(), "loaderror_" + s + ".html"));
  2433.         } catch (Exception exception) {
  2434.             exception.printStackTrace();
  2435.         }
  2436.         do
  2437.             try {
  2438.                 Thread.sleep(1000L);
  2439.             } catch (Exception _ex) {
  2440.             }
  2441.         while (true);
  2442.     }
  2443.  
  2444.     private void buildInterfaceMenu(int i, RSInterface class9, int k, int l,
  2445.             int i1, int j1) {
  2446.         if (class9.type != 0 || class9.children == null
  2447.                 || class9.isMouseoverTriggered)
  2448.             return;
  2449.         if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height)
  2450.             return;
  2451.         int k1 = class9.children.length;
  2452.         for (int l1 = 0; l1 < k1; l1++) {
  2453.             int i2 = class9.childX[l1] + i;
  2454.             int j2 = (class9.childY[l1] + l) - j1;
  2455.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  2456.             i2 += class9_1.anInt263;
  2457.             j2 += class9_1.anInt265;
  2458.             if ((class9_1.mOverInterToTrigger >= 0 || class9_1.anInt216 != 0)
  2459.                     && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2460.                     && i1 < j2 + class9_1.height)
  2461.                 if (class9_1.mOverInterToTrigger >= 0)
  2462.                     anInt886 = class9_1.mOverInterToTrigger;
  2463.                 else
  2464.                     anInt886 = class9_1.id;
  2465.             if (class9_1.type == 8 && k >= i2 && i1 >= j2
  2466.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2467.                 anInt1315 = class9_1.id;
  2468.             }
  2469.             if (class9_1.type == 9 && k >= i2 && i1 >= j2
  2470.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2471.                 anInt1315 = class9_1.id;
  2472.             }
  2473.             if (class9_1.type == 11 && k >= i2 && i1 >= j2
  2474.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2475.                 anInt1315 = class9_1.id;
  2476.             }
  2477.             if (class9_1.type == 0) {
  2478.                 buildInterfaceMenu(i2, class9_1, k, j2, i1,
  2479.                         class9_1.scrollPosition);
  2480.                 if (class9_1.scrollMax > class9_1.height)
  2481.                     method65(i2 + class9_1.width, class9_1.height, k, i1,
  2482.                             class9_1, j2, true, class9_1.scrollMax);
  2483.             } else {
  2484.                 if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2
  2485.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2486.                     boolean flag = false;
  2487.                     if (class9_1.contentType != 0)
  2488.                         flag = buildFriendsListMenu(class9_1);
  2489.                     if (!flag) {
  2490.                         // System.out.println("1"+class9_1.tooltip + ", " +
  2491.                         // class9_1.interfaceID);
  2492.                         menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2493.                                 + class9_1.id;
  2494.                         menuActionID[menuActionRow] = 315;
  2495.                         menuActionCmd3[menuActionRow] = class9_1.id;
  2496.                         menuActionRow++;
  2497.                     }
  2498.                 }
  2499.                 if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2
  2500.                         && i1 >= j2 && k < i2 + class9_1.width
  2501.                         && i1 < j2 + class9_1.height) {
  2502.                     String s = class9_1.selectedActionName;
  2503.                     if (s.indexOf(" ") != -1)
  2504.                         s = s.substring(0, s.indexOf(" "));
  2505.                     if (class9_1.parentID == 12855) {
  2506.                         menuActionName[menuActionRow] = "Autocast" + "@gre@ "
  2507.                                 + class9_1.spellName;
  2508.                         menuActionID[menuActionRow] = 104;// autocast
  2509.                         menuActionCmd3[menuActionRow] = class9_1.id;
  2510.                         menuActionRow++;
  2511.                     }
  2512.                     menuActionName[menuActionRow] = s + " @gre@"
  2513.                             + class9_1.spellName;
  2514.                     menuActionID[menuActionRow] = 626;
  2515.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2516.                     menuActionRow++;
  2517.                 }
  2518.                 if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2
  2519.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2520.                     menuActionName[menuActionRow] = "Close";
  2521.                     menuActionID[menuActionRow] = 200;
  2522.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2523.                     menuActionRow++;
  2524.                 }
  2525.                 if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2
  2526.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2527.                     // System.out.println("2"+class9_1.tooltip + ", " +
  2528.                     // class9_1.interfaceID);
  2529.                     menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2530.                             + class9_1.id;
  2531.                     menuActionID[menuActionRow] = 169;
  2532.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2533.                     menuActionRow++;
  2534.                 }
  2535.                 if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2
  2536.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2537.                     // System.out.println("3"+class9_1.tooltip + ", " +
  2538.                     // class9_1.interfaceID);
  2539.                     menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2540.                             + class9_1.id;
  2541.                     menuActionID[menuActionRow] = 646;
  2542.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2543.                     menuActionRow++;
  2544.                 }
  2545.                 if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2
  2546.                         && i1 >= j2 && k < i2 + class9_1.width
  2547.                         && i1 < j2 + class9_1.height) {
  2548.                     // System.out.println("4"+class9_1.tooltip + ", " +
  2549.                     // class9_1.interfaceID);
  2550.                     menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2551.                             + class9_1.id;
  2552.                     menuActionID[menuActionRow] = 679;
  2553.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2554.                     menuActionRow++;
  2555.                 }
  2556.                 if (class9_1.type == 2) {
  2557.                     int k2 = 0;
  2558.                     for (int l2 = 0; l2 < class9_1.height; l2++) {
  2559.                         for (int i3 = 0; i3 < class9_1.width; i3++) {
  2560.                             int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  2561.                             int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  2562.                             if (k2 < 20) {
  2563.                                 j3 += class9_1.spritesX[k2];
  2564.                                 k3 += class9_1.spritesY[k2];
  2565.                             }
  2566.                             if (k >= j3 && i1 >= k3 && k < j3 + 32
  2567.                                     && i1 < k3 + 32) {
  2568.                                 mouseInvInterfaceIndex = k2;
  2569.                                 lastActiveInvInterface = class9_1.id;
  2570.                                 if (class9_1.inv[k2] > 0) {
  2571.                                     ItemDef itemDef = ItemDef
  2572.                                             .forID(class9_1.inv[k2] - 1);
  2573.                                     if (itemSelected == 1
  2574.                                             && class9_1.isInventoryInterface) {
  2575.                                         if (class9_1.id != anInt1284
  2576.                                                 || k2 != anInt1283) {
  2577.                                             menuActionName[menuActionRow] = "Use "
  2578.                                                     + selectedItemName
  2579.                                                     + " with @lre@"
  2580.                                                     + itemDef.name;
  2581.                                             menuActionID[menuActionRow] = 870;
  2582.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2583.                                             menuActionCmd2[menuActionRow] = k2;
  2584.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2585.                                             menuActionRow++;
  2586.                                         }
  2587.                                     } else if (spellSelected == 1
  2588.                                             && class9_1.isInventoryInterface) {
  2589.                                         if ((spellUsableOn & 0x10) == 16) {
  2590.                                             menuActionName[menuActionRow] = spellTooltip
  2591.                                                     + " @lre@" + itemDef.name;
  2592.                                             menuActionID[menuActionRow] = 543;
  2593.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2594.                                             menuActionCmd2[menuActionRow] = k2;
  2595.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2596.                                             menuActionRow++;
  2597.                                         }
  2598.                                     } else {
  2599.                                         if (class9_1.isInventoryInterface) {
  2600.                                             for (int l3 = 4; l3 >= 3; l3--)
  2601.                                                 if (itemDef.actions != null
  2602.                                                         && itemDef.actions[l3] != null) {
  2603.                                                     menuActionName[menuActionRow] = itemDef.actions[l3]
  2604.                                                             + " @lre@"
  2605.                                                             + itemDef.name;
  2606.                                                     if (l3 == 3)
  2607.                                                         menuActionID[menuActionRow] = 493;
  2608.                                                     if (l3 == 4)
  2609.                                                         menuActionID[menuActionRow] = 847;
  2610.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2611.                                                     menuActionCmd2[menuActionRow] = k2;
  2612.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2613.                                                     menuActionRow++;
  2614.                                                 } else if (l3 == 4) {
  2615.                                                     menuActionName[menuActionRow] = "Drop @lre@"
  2616.                                                             + itemDef.name;
  2617.                                                     menuActionID[menuActionRow] = 847;
  2618.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2619.                                                     menuActionCmd2[menuActionRow] = k2;
  2620.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2621.                                                     menuActionRow++;
  2622.                                                 }
  2623.  
  2624.                                         }
  2625.                                         if (class9_1.usableItemInterface) {
  2626.                                             menuActionName[menuActionRow] = "Use @lre@"
  2627.                                                     + itemDef.name;
  2628.                                             menuActionID[menuActionRow] = 447;
  2629.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2630.                                             menuActionCmd2[menuActionRow] = k2;
  2631.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2632.                                             menuActionRow++;
  2633.                                         }
  2634.                                         if (class9_1.isInventoryInterface
  2635.                                                 && itemDef.actions != null) {
  2636.                                             for (int i4 = 2; i4 >= 0; i4--)
  2637.                                                 if (itemDef.actions[i4] != null) {
  2638.                                                     menuActionName[menuActionRow] = itemDef.actions[i4]
  2639.                                                             + " @lre@"
  2640.                                                             + itemDef.name;
  2641.                                                     if (i4 == 0)
  2642.                                                         menuActionID[menuActionRow] = 74;
  2643.                                                     if (i4 == 1)
  2644.                                                         menuActionID[menuActionRow] = 454;
  2645.                                                     if (i4 == 2)
  2646.                                                         menuActionID[menuActionRow] = 539;
  2647.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2648.                                                     menuActionCmd2[menuActionRow] = k2;
  2649.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2650.                                                     menuActionRow++;
  2651.                                                 }
  2652.  
  2653.                                         }
  2654.                                         if (class9_1.actions != null) {
  2655.                                             for (int j4 = 4; j4 >= 0; j4--)
  2656.                                                 if (class9_1.actions[j4] != null) {
  2657.                                                     menuActionName[menuActionRow] = class9_1.actions[j4]
  2658.                                                             + " @lre@"
  2659.                                                             + itemDef.name;
  2660.                                                     if (j4 == 0)
  2661.                                                         menuActionID[menuActionRow] = 632;
  2662.                                                     if (j4 == 1)
  2663.                                                         menuActionID[menuActionRow] = 78;
  2664.                                                     if (j4 == 2)
  2665.                                                         menuActionID[menuActionRow] = 867;
  2666.                                                     if (j4 == 3)
  2667.                                                         menuActionID[menuActionRow] = 431;
  2668.                                                     if (j4 == 4)
  2669.                                                         menuActionID[menuActionRow] = 53;
  2670.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2671.                                                     menuActionCmd2[menuActionRow] = k2;
  2672.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2673.                                                     menuActionRow++;
  2674.                                                 }
  2675.  
  2676.                                         }
  2677.                                         // menuActionName[menuActionRow] =
  2678.                                         // "Examine @lre@" + itemDef.name +
  2679.                                         // " @gre@(@whi@" + (class9_1.inv[k2] -
  2680.                                         // 1) + "@gre@)";
  2681.                                         menuActionName[menuActionRow] = "Examine @lre@"
  2682.                                                 + itemDef.name;
  2683.                                         menuActionID[menuActionRow] = 1125;
  2684.                                         menuActionCmd1[menuActionRow] = itemDef.id;
  2685.                                         menuActionCmd2[menuActionRow] = k2;
  2686.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  2687.                                         menuActionRow++;
  2688.                                     }
  2689.                                 }
  2690.                             }
  2691.                             k2++;
  2692.                         }
  2693.  
  2694.                     }
  2695.  
  2696.                 }
  2697.             }
  2698.         }
  2699.  
  2700.     }
  2701.  
  2702.     public void drawScrollbar(int j, int k, int l, int i1, int j1) {
  2703.         scrollBar1.method361(i1, l);
  2704.         scrollBar2.method361(i1, (l + j) - 16);
  2705.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 16);
  2706.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x3d3426, 15);
  2707.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x342d21, 13);
  2708.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x2e281d, 11);
  2709.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x29241b, 10);
  2710.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x252019, 9);
  2711.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 1);
  2712.         int k1 = ((j - 32) * j) / j1;
  2713.         if (k1 < 8)
  2714.             k1 = 8;
  2715.         int l1 = ((j - 32 - k1) * k) / (j1 - j);
  2716.         DrawingArea.drawPixels(k1, l + 16 + l1, i1, barFillColor, 16);
  2717.         DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1);
  2718.         DrawingArea.method341(l + 16 + l1, 0x8d8269, k1, i1 + 1);
  2719.         DrawingArea.method341(l + 16 + l1, 0x6a614d, k1, i1 + 2);
  2720.         DrawingArea.method341(l + 16 + l1, 0x706651, k1, i1 + 3);
  2721.         DrawingArea.method341(l + 16 + l1, 0x706651, k1, i1 + 4);
  2722.         DrawingArea.method341(l + 16 + l1, 0x6a614d, k1, i1 + 5);
  2723.         DrawingArea.method341(l + 16 + l1, 0x6a614d, k1, i1 + 6);
  2724.         DrawingArea.method341(l + 16 + l1, 0x685e4b, k1, i1 + 7);
  2725.         DrawingArea.method341(l + 16 + l1, 0x685e4b, k1, i1 + 8);
  2726.         DrawingArea.method341(l + 16 + l1, 0x665d4a, k1, i1 + 9);
  2727.         DrawingArea.method341(l + 16 + l1, 0x665d4a, k1, i1 + 10);
  2728.         DrawingArea.method341(l + 16 + l1, 0x58503f, k1, i1 + 11);
  2729.         DrawingArea.method341(l + 16 + l1, 0x58503f, k1, i1 + 12);
  2730.         DrawingArea.method341(l + 16 + l1, 0x544c3c, k1, i1 + 13);
  2731.         DrawingArea.method341(l + 16 + l1, 0x4b4535, k1, i1 + 14);
  2732.         DrawingArea.method339(l + 16 + l1, 0x000001, 15, i1);
  2733.         DrawingArea.method339(l + 17 + l1, 0x000001, 15, i1);
  2734.         DrawingArea.method339(l + 17 + l1, 0x6a614d, 14, i1);
  2735.         DrawingArea.method339(l + 17 + l1, 0x706651, 13, i1);
  2736.         DrawingArea.method339(l + 17 + l1, 0x6d5f48, 11, i1);
  2737.         DrawingArea.method339(l + 17 + l1, 0x6a614d, 10, i1);
  2738.         DrawingArea.method339(l + 17 + l1, 0x76684b, 7, i1);
  2739.         DrawingArea.method339(l + 17 + l1, 0x7d715b, 5, i1);
  2740.         DrawingArea.method339(l + 17 + l1, 0x7e6e50, 4, i1);
  2741.         DrawingArea.method339(l + 17 + l1, 0x8d8269, 3, i1);
  2742.         DrawingArea.method339(l + 17 + l1, 0x000001, 2, i1);
  2743.         DrawingArea.method339(l + 18 + l1, 0x000001, 16, i1);
  2744.         DrawingArea.method339(l + 18 + l1, 0x625946, 15, i1);
  2745.         DrawingArea.method339(l + 18 + l1, 0x665d4a, 14, i1);
  2746.         DrawingArea.method339(l + 18 + l1, 0x625640, 11, i1);
  2747.         DrawingArea.method339(l + 18 + l1, 0x6a614d, 10, i1);
  2748.         DrawingArea.method339(l + 18 + l1, 0x706651, 7, i1);
  2749.         DrawingArea.method339(l + 18 + l1, 0x726954, 5, i1);
  2750.         DrawingArea.method339(l + 18 + l1, 0x716247, 4, i1);
  2751.         DrawingArea.method339(l + 18 + l1, 0x7d715b, 3, i1);
  2752.         DrawingArea.method339(l + 18 + l1, 0x8d8269, 2, i1);
  2753.         DrawingArea.method339(l + 18 + l1, 0x000001, 1, i1);
  2754.         DrawingArea.method339(l + 19 + l1, 0x000001, 16, i1);
  2755.         DrawingArea.method339(l + 19 + l1, 0x544c3c, 15, i1);
  2756.         DrawingArea.method339(l + 19 + l1, 0x625946, 14, i1);
  2757.         DrawingArea.method339(l + 19 + l1, 0x665d4a, 11, i1);
  2758.         DrawingArea.method339(l + 19 + l1, 0x685e4b, 9, i1);
  2759.         DrawingArea.method339(l + 19 + l1, 0x6a614d, 7, i1);
  2760.         DrawingArea.method339(l + 19 + l1, 0x706651, 5, i1);
  2761.         DrawingArea.method339(l + 19 + l1, 0x726954, 4, i1);
  2762.         DrawingArea.method339(l + 19 + l1, 0x6a614d, 3, i1);
  2763.         DrawingArea.method339(l + 19 + l1, 0x8d8269, 2, i1);
  2764.         DrawingArea.method339(l + 19 + l1, 0x000001, 1, i1);
  2765.         DrawingArea.method339(l + 20 + l1, 0x000001, 16, i1);
  2766.         DrawingArea.method339(l + 20 + l1, 0x4b4535, 15, i1);
  2767.         DrawingArea.method339(l + 20 + l1, 0x4f4839, 14, i1);
  2768.         DrawingArea.method339(l + 20 + l1, 0x58503f, 13, i1);
  2769.         DrawingArea.method339(l + 20 + l1, 0x665d4a, 10, i1);
  2770.         DrawingArea.method339(l + 20 + l1, 0x685e4b, 8, i1);
  2771.         DrawingArea.method339(l + 20 + l1, 0x6a614d, 6, i1);
  2772.         DrawingArea.method339(l + 20 + l1, 0x706651, 4, i1);
  2773.         DrawingArea.method339(l + 20 + l1, 0x6a614d, 3, i1);
  2774.         DrawingArea.method339(l + 20 + l1, 0x8d8269, 2, i1);
  2775.         DrawingArea.method339(l + 20 + l1, 0x000001, 1, i1);
  2776.         DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1 + 15);
  2777.         DrawingArea.method339(l + 15 + l1 + k1, 0x000001, 16, i1);
  2778.         DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 15, i1);
  2779.         DrawingArea.method339(l + 14 + l1 + k1, 0x413a2e, 14, i1);
  2780.         DrawingArea.method339(l + 14 + l1 + k1, 0x453d31, 10, i1);
  2781.         DrawingArea.method339(l + 14 + l1 + k1, 0x4f4839, 9, i1);
  2782.         DrawingArea.method339(l + 14 + l1 + k1, 0x4a402f, 7, i1);
  2783.         DrawingArea.method339(l + 14 + l1 + k1, 0x4b4535, 4, i1);
  2784.         DrawingArea.method339(l + 14 + l1 + k1, 0x625946, 3, i1);
  2785.         DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 2, i1);
  2786.         DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 16, i1);
  2787.         DrawingArea.method339(l + 13 + l1 + k1, 0x453d31, 15, i1);
  2788.         DrawingArea.method339(l + 13 + l1 + k1, 0x4b4535, 11, i1);
  2789.         DrawingArea.method339(l + 13 + l1 + k1, 0x544c3c, 9, i1);
  2790.         DrawingArea.method339(l + 13 + l1 + k1, 0x4f4839, 7, i1);
  2791.         DrawingArea.method339(l + 13 + l1 + k1, 0x625946, 6, i1);
  2792.         DrawingArea.method339(l + 13 + l1 + k1, 0x58503f, 4, i1);
  2793.         DrawingArea.method339(l + 13 + l1 + k1, 0x625640, 3, i1);
  2794.         DrawingArea.method339(l + 13 + l1 + k1, 0x706651, 2, i1);
  2795.         DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 1, i1);
  2796.         DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 16, i1);
  2797.         DrawingArea.method339(l + 12 + l1 + k1, 0x453d31, 15, i1);
  2798.         DrawingArea.method339(l + 12 + l1 + k1, 0x4b4535, 14, i1);
  2799.         DrawingArea.method339(l + 12 + l1 + k1, 0x4f4839, 12, i1);
  2800.         DrawingArea.method339(l + 12 + l1 + k1, 0x625946, 11, i1);
  2801.         DrawingArea.method339(l + 12 + l1 + k1, 0x58503f, 10, i1);
  2802.         DrawingArea.method339(l + 12 + l1 + k1, 0x665d4a, 7, i1);
  2803.         DrawingArea.method339(l + 12 + l1 + k1, 0x685e4b, 4, i1);
  2804.         DrawingArea.method339(l + 12 + l1 + k1, 0x726954, 3, i1);
  2805.         DrawingArea.method339(l + 12 + l1 + k1, 0x7d715b, 2, i1);
  2806.         DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 1, i1);
  2807.         DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 16, i1);
  2808.         DrawingArea.method339(l + 11 + l1 + k1, 0x4b4535, 15, i1);
  2809.         DrawingArea.method339(l + 11 + l1 + k1, 0x544c3c, 14, i1);
  2810.         DrawingArea.method339(l + 11 + l1 + k1, 0x625946, 13, i1);
  2811.         DrawingArea.method339(l + 11 + l1 + k1, 0x58503f, 11, i1);
  2812.         DrawingArea.method339(l + 11 + l1 + k1, 0x665d4a, 9, i1);
  2813.         DrawingArea.method339(l + 11 + l1 + k1, 0x685e4b, 7, i1);
  2814.         DrawingArea.method339(l + 11 + l1 + k1, 0x6a614d, 5, i1);
  2815.         DrawingArea.method339(l + 11 + l1 + k1, 0x706651, 4, i1);
  2816.         DrawingArea.method339(l + 11 + l1 + k1, 0x6a614d, 3, i1);
  2817.         DrawingArea.method339(l + 11 + l1 + k1, 0x7d715b, 2, i1);
  2818.         DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 1, i1);
  2819.     }
  2820.  
  2821.     private void updateNPCs(Stream stream, int i) {
  2822.         anInt839 = 0;
  2823.         anInt893 = 0;
  2824.         method139(stream);
  2825.         method46(i, stream);
  2826.         method86(stream);
  2827.         for (int k = 0; k < anInt839; k++) {
  2828.             int l = anIntArray840[k];
  2829.             if (npcArray[l].anInt1537 != loopCycle) {
  2830.                 npcArray[l].desc = null;
  2831.                 npcArray[l] = null;
  2832.             }
  2833.         }
  2834.  
  2835.         if (stream.currentOffset != i) {
  2836.             signlink.reporterror(myUsername
  2837.                     + " size mismatch in getnpcpos - pos:"
  2838.                     + stream.currentOffset + " psize:" + i);
  2839.             throw new RuntimeException("eek");
  2840.         }
  2841.         for (int i1 = 0; i1 < npcCount; i1++)
  2842.             if (npcArray[npcIndices[i1]] == null) {
  2843.                 signlink.reporterror(myUsername
  2844.                         + " null entry in npc list - pos:" + i1 + " size:"
  2845.                         + npcCount);
  2846.                 throw new RuntimeException("eek");
  2847.             }
  2848.  
  2849.     }
  2850.  
  2851.     private int cButtonHPos;
  2852.     private int cButtonHCPos;
  2853.     private int cButtonCPos;
  2854.  
  2855.     private void processChatModeClick() {
  2856.         if (super.mouseX >= 6 && super.mouseX <= 62 && super.mouseY >= 482
  2857.                 && super.mouseY <= 505) {
  2858.             cButtonHPos = 0;
  2859.             aBoolean1233 = true;
  2860.             inputTaken = true;
  2861.         } else if (super.mouseX >= 63 && super.mouseX <= 118
  2862.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2863.             cButtonHPos = 1;
  2864.             aBoolean1233 = true;
  2865.             inputTaken = true;
  2866.         } else if (super.mouseX >= 119 && super.mouseX <= 175
  2867.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2868.             cButtonHPos = 2;
  2869.             aBoolean1233 = true;
  2870.             inputTaken = true;
  2871.         } else if (super.mouseX >= 177 && super.mouseX <= 232
  2872.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2873.             cButtonHPos = 3;
  2874.             aBoolean1233 = true;
  2875.             inputTaken = true;
  2876.         } else if (super.mouseX >= 233 && super.mouseX <= 289
  2877.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2878.             cButtonHPos = 4;
  2879.             aBoolean1233 = true;
  2880.             inputTaken = true;
  2881.         } else if (super.mouseX >= 290 && super.mouseX <= 346
  2882.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2883.             cButtonHPos = 5;
  2884.             aBoolean1233 = true;
  2885.             inputTaken = true;
  2886.         } else if (super.mouseX >= 347 && super.mouseX <= 403
  2887.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2888.             cButtonHPos = 6;
  2889.             aBoolean1233 = true;
  2890.             inputTaken = true;
  2891.         } else if (super.mouseX >= 404 && super.mouseX <= 515
  2892.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2893.             cButtonHPos = 7;
  2894.             aBoolean1233 = true;
  2895.             inputTaken = true;
  2896.         } else {
  2897.             cButtonHPos = -1;
  2898.             aBoolean1233 = true;
  2899.             inputTaken = true;
  2900.         }
  2901.  
  2902.         if (super.clickMode3 == 1) {
  2903.             if (super.saveClickX >= 6 && super.saveClickX <= 62
  2904.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2905.                 cButtonCPos = 0;
  2906.                 chatTypeView = 0;
  2907.                 aBoolean1233 = true;
  2908.                 inputTaken = true;
  2909.             }
  2910.             if (super.saveClickX >= 63 && super.saveClickX <= 118
  2911.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2912.                 cButtonCPos = 1;
  2913.                 chatTypeView = 5;
  2914.                 aBoolean1233 = true;
  2915.                 inputTaken = true;
  2916.             }
  2917.             if (super.saveClickX >= 119 && super.saveClickX <= 175
  2918.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2919.                 cButtonCPos = 2;
  2920.                 chatTypeView = 1;
  2921.                 aBoolean1233 = true;
  2922.                 inputTaken = true;
  2923.             }
  2924.             if (super.saveClickX >= 177 && super.saveClickX <= 232
  2925.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2926.                 cButtonCPos = 3;
  2927.                 chatTypeView = 2;
  2928.                 aBoolean1233 = true;
  2929.                 inputTaken = true;
  2930.             }
  2931.             if (super.saveClickX >= 233 && super.saveClickX <= 289
  2932.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2933.                 cButtonCPos = 4;
  2934.                 chatTypeView = 11;
  2935.                 aBoolean1233 = true;
  2936.                 inputTaken = true;
  2937.             }
  2938.             if (super.saveClickX >= 290 && super.saveClickX <= 346
  2939.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2940.                 cButtonCPos = 5;
  2941.                 chatTypeView = 3;
  2942.                 aBoolean1233 = true;
  2943.                 inputTaken = true;
  2944.             }
  2945.             if (super.saveClickX >= 347 && super.saveClickX <= 403
  2946.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2947.                 cButtonCPos = 6;
  2948.                 chatTypeView = 4;
  2949.                 aBoolean1233 = true;
  2950.                 inputTaken = true;
  2951.             }
  2952.             if (super.saveClickX >= 404 && super.saveClickX <= 515
  2953.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2954.                 /*
  2955.                  * BugReport window = new BugReport();
  2956.                  * window.setTitle("DarkWorldPk - the new era Bug Report Form");
  2957.                  * window.pack(); window.show(); window.setAlwaysOnTop(true);
  2958.                  */
  2959.             }
  2960.         }
  2961.     }
  2962.  
  2963.     public void method33(int i) {
  2964.         try {
  2965.             int j = Varp.cache[i].anInt709;
  2966.             if (j == 0)
  2967.                 return;
  2968.             int k = variousSettings[i];
  2969.             if (j == 1) {
  2970.                 if (k == 1)
  2971.                     Texture.method372(0.90000000000000002D);
  2972.                 if (k == 2)
  2973.                     Texture.method372(0.80000000000000004D);
  2974.                 if (k == 3)
  2975.                     Texture.method372(0.69999999999999996D);
  2976.                 if (k == 4)
  2977.                     Texture.method372(0.59999999999999998D);
  2978.                 ItemDef.mruNodes1.unlinkAll();
  2979.                 welcomeScreenRaised = true;
  2980.             }
  2981.             if (j == 3) {
  2982.                 boolean flag1 = musicEnabled;
  2983.                 if (k == 0) {
  2984.                     adjustVolume(musicEnabled, 0);
  2985.                     musicEnabled = true;
  2986.                 }
  2987.                 if (k == 1) {
  2988.                     adjustVolume(musicEnabled, -400);
  2989.                     musicEnabled = true;
  2990.                 }
  2991.                 if (k == 2) {
  2992.                     adjustVolume(musicEnabled, -800);
  2993.                     musicEnabled = true;
  2994.                 }
  2995.                 if (k == 3) {
  2996.                     adjustVolume(musicEnabled, -1200);
  2997.                     musicEnabled = true;
  2998.                 }
  2999.                 if (k == 4)
  3000.                     musicEnabled = false;
  3001.                 if (musicEnabled != flag1 && !lowMem) {
  3002.                     if (musicEnabled) {
  3003.                         nextSong = currentSong;
  3004.                         songChanging = true;
  3005.                         onDemandFetcher.method558(2, nextSong);
  3006.                     } else {
  3007.                         stopMidi();
  3008.                     }
  3009.                     prevSong = 0;
  3010.                 }
  3011.             }
  3012.             if (j == 4) {
  3013.                 if (k == 0) {
  3014.                     aBoolean848 = true;
  3015.                     setWaveVolume(0);
  3016.                 }
  3017.                 if (k == 1) {
  3018.                     aBoolean848 = true;
  3019.                     setWaveVolume(-400);
  3020.                 }
  3021.                 if (k == 2) {
  3022.                     aBoolean848 = true;
  3023.                     setWaveVolume(-800);
  3024.                 }
  3025.                 if (k == 3) {
  3026.                     aBoolean848 = true;
  3027.                     setWaveVolume(-1200);
  3028.                 }
  3029.                 if (k == 4)
  3030.                     aBoolean848 = false;
  3031.             }
  3032.             if (j == 5)
  3033.                 anInt1253 = k;
  3034.             if (j == 6)
  3035.                 anInt1249 = k;
  3036.             if (j == 8) {
  3037.                 splitPrivateChat = k;
  3038.                 inputTaken = true;
  3039.             }
  3040.             if (j == 9)
  3041.                 anInt913 = k;
  3042.         } catch (Exception _e) {
  3043.         }
  3044.     }
  3045.  
  3046.     boolean fix;
  3047.     public String title;
  3048.  
  3049.     private void updateEntities() {
  3050.         try {
  3051.             int anInt974 = 0;
  3052.             for (int j = -1; j < playerCount + npcCount; j++) {
  3053.                 Object obj;
  3054.                 if (j == -1)
  3055.                     obj = myPlayer;
  3056.                 else if (j < playerCount)
  3057.                     obj = playerArray[playerIndices[j]];
  3058.                 else
  3059.                     obj = npcArray[npcIndices[j - playerCount]];
  3060.                 if (obj == null || !((Entity) (obj)).isVisible())
  3061.                     continue;
  3062.                 if (obj instanceof NPC) {
  3063.                     EntityDef entityDef = ((NPC) obj).desc;
  3064.                     // npcScreenPos(((Entity) (obj)), ((Entity)
  3065.                     // (obj)).height+15);
  3066.                     // chatTextDrawingArea.drawText(0x0099FF, entityDef.name,
  3067.                     // spriteDrawY+10, spriteDrawX);
  3068.                     if (entityDef.childrenIDs != null)
  3069.                         entityDef = entityDef.method161();
  3070.                     if (entityDef == null)
  3071.                         continue;
  3072.                 }
  3073.                 if (j < playerCount) {
  3074.                     int l = 30;
  3075.                     Player player = (Player) obj;
  3076.                     if (player.headIcon >= 0) {
  3077.                         npcScreenPos(((Entity) (obj)),
  3078.                                 ((Entity) (obj)).height + 15);
  3079.                         if (spriteDrawX > -1) {
  3080.                             if (player.skullIcon < 2) {
  3081.                                 skullIcons[player.skullIcon].drawSprite(
  3082.                                         spriteDrawX - 12, spriteDrawY - l);
  3083.                                 l += 25;
  3084.                             }
  3085.                             if (player.headIcon < 18) {
  3086.                                 headIcons[player.headIcon].drawSprite(
  3087.                                         spriteDrawX - 12, spriteDrawY - l);
  3088.                                 l += 18;
  3089.                             }
  3090.  
  3091.                             title = getSpecialColor(player.skill)
  3092.                                     + player.title + "@bla@";
  3093.        
  3094.                         }
  3095.                     }
  3096.                     if (j >= 0 && anInt855 == 10
  3097.                             && anInt933 == playerIndices[j]) {
  3098.                         npcScreenPos(((Entity) (obj)),
  3099.                                 ((Entity) (obj)).height + 15);
  3100.                         if (spriteDrawX > -1)
  3101.                             headIconsHint[player.hintIcon].drawSprite(
  3102.                                     spriteDrawX - 12, spriteDrawY - l);
  3103.                     }
  3104.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  3105.                     if (player.name.equalsIgnoreCase("Mars")
  3106.                             || player.name.equalsIgnoreCase("Harky")
  3107.                             || player.name.equalsIgnoreCase("Aero")
  3108.                             || player.name.equalsIgnoreCase("")
  3109.                             || player.name.equalsIgnoreCase("")) {
  3110.                             chatTextDrawingArea.drawText(0x990000, "<Developer>", spriteDrawY+10, spriteDrawX);
  3111.                         chatTextDrawingArea.drawText(0x990000, player.rank
  3112.                                 + " " + player.name, spriteDrawY, spriteDrawX);
  3113.                         chatTextDrawingArea.drawText(0x990000, ""
  3114.                                 + player.guild + "", spriteDrawY + 10,
  3115.                                 spriteDrawX);
  3116.                     } else {
  3117.                         if (names) {
  3118.                             if (player.guild.equalsIgnoreCase(myPlayer.guild)) {
  3119.                                 chatTextDrawingArea.drawText(0x00ff00,
  3120.                                         player.rank + " " + player.name,
  3121.                                         spriteDrawY, spriteDrawX);
  3122.                                 chatTextDrawingArea.drawText(0x00ff00, "<"
  3123.                                         + player.guild + ">", spriteDrawY + 10,
  3124.                                         spriteDrawX);
  3125.                             } else {
  3126.                                 chatTextDrawingArea.drawText(0x0000ff,
  3127.                                         player.rank + " " + player.name,
  3128.                                         spriteDrawY, spriteDrawX);
  3129.                                 chatTextDrawingArea.drawText(0x0000ff, "<"
  3130.                                         + player.guild + ">", spriteDrawY + 10,
  3131.                                         spriteDrawX);
  3132.                             }
  3133.                         }
  3134.                     }
  3135.  
  3136.                 } else {
  3137.                     EntityDef entityDef_1 = ((NPC) obj).desc;
  3138.                     if (entityDef_1.anInt75 >= 0
  3139.                             && entityDef_1.anInt75 < headIcons.length) {
  3140.                         npcScreenPos(((Entity) (obj)),
  3141.                                 ((Entity) (obj)).height + 15);
  3142.                         if (spriteDrawX > -1)
  3143.                             headIcons[entityDef_1.anInt75].drawSprite(
  3144.                                     spriteDrawX - 12, spriteDrawY - 30);
  3145.                     }
  3146.                     if (anInt855 == 1
  3147.                             && anInt1222 == npcIndices[j - playerCount]
  3148.                             && loopCycle % 20 < 10) {
  3149.                         npcScreenPos(((Entity) (obj)),
  3150.                                 ((Entity) (obj)).height + 15);
  3151.                         if (spriteDrawX > -1)
  3152.                             headIconsHint[0].drawSprite(spriteDrawX - 12,
  3153.                                     spriteDrawY - 28);
  3154.                     }
  3155.                 }
  3156.                 if (((Entity) (obj)).textSpoken != null
  3157.                         && (j >= playerCount || publicChatMode == 0
  3158.                                 || publicChatMode == 3 || publicChatMode == 1
  3159.                                 && isFriendOrSelf(((Player) obj).name))) {
  3160.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  3161.                     if (spriteDrawX > -1 && anInt974 < anInt975) {
  3162.                         anIntArray979[anInt974] = chatTextDrawingArea
  3163.                                 .method384(((Entity) (obj)).textSpoken) / 2;
  3164.                         anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  3165.                         anIntArray976[anInt974] = spriteDrawX;
  3166.                         anIntArray977[anInt974] = spriteDrawY;
  3167.                         anIntArray980[anInt974] = ((Entity) (obj)).anInt1513;
  3168.                         anIntArray981[anInt974] = ((Entity) (obj)).anInt1531;
  3169.                         anIntArray982[anInt974] = ((Entity) (obj)).textCycle;
  3170.                         aStringArray983[anInt974++] = ((Entity) (obj)).textSpoken;
  3171.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1
  3172.                                 && ((Entity) (obj)).anInt1531 <= 3) {
  3173.                             anIntArray978[anInt974] += 10;
  3174.                             anIntArray977[anInt974] += 5;
  3175.                         }
  3176.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  3177.                             anIntArray979[anInt974] = 60;
  3178.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  3179.                             anIntArray978[anInt974] += 5;
  3180.                     }
  3181.                 }
  3182.                 if (((Entity) (obj)).loopCycleStatus > loopCycle) {
  3183.                     try {
  3184.                         if (!newHpBar) {
  3185.                             npcScreenPos(((Entity) (obj)),
  3186.                                     ((Entity) (obj)).height + 15);
  3187.                             if (spriteDrawX > -1) {
  3188.                                 if (hpH == true) {
  3189.                                     // chatTextDrawingArea.method3822(0xff0000,
  3190.                                     // spriteDrawX, -918, (new
  3191.                                     // StringBuilder()).append(((Entity)(Entity)obj).currentHealth).append("/").append(((Entity)(Entity)obj).maxHealth).toString(),
  3192.                                     // spriteDrawY - 9, true);
  3193.                                     smallText.drawText(0x00ff00, ""
  3194.                                             + ((Entity) (obj)).currentHealth
  3195.                                             + " / "
  3196.                                             + ((Entity) (obj)).maxHealth,
  3197.                                             spriteDrawY - 8, spriteDrawX);
  3198.                                 }
  3199.                                 int i1 = (((Entity) (obj)).currentHealth * 30)
  3200.                                         / ((Entity) (obj)).maxHealth;
  3201.                                 if (i1 > 30)
  3202.                                     i1 = 30;
  3203.                                 DrawingArea.drawPixels(5, spriteDrawY - 3,
  3204.                                         spriteDrawX - 15, 65280, i1);
  3205.                                 DrawingArea.drawPixels(5, spriteDrawY - 3,
  3206.                                         (spriteDrawX - 15) + i1, 0xff0000,
  3207.                                         30 - i1);
  3208.                             }
  3209.                         }
  3210.                         if (newHpBar) { // New HP Bar ON Toggle
  3211.                             npcScreenPos(((Entity) (obj)),
  3212.                                     ((Entity) (obj)).height + 15);
  3213.                             if (spriteDrawX > -1) {
  3214.                                 if (hpH == true) {
  3215.                                     // chatTextDrawingArea.method3822(0xff0000,
  3216.                                     // spriteDrawX, -918, (new
  3217.                                     // StringBuilder()).append(((Entity)(Entity)obj).currentHealth).append("/").append(((Entity)(Entity)obj).maxHealth).toString(),
  3218.                                     // spriteDrawY - 9, true);
  3219.                                     smallText.drawText(0x00ff00, ""
  3220.                                             + ((Entity) (obj)).currentHealth
  3221.                                             + " / "
  3222.                                             + ((Entity) (obj)).maxHealth,
  3223.                                             spriteDrawY - 8, spriteDrawX);
  3224.  
  3225.                                 }
  3226.                                 int i1 = (((Entity) (obj)).currentHealth * 30)
  3227.                                         / ((Entity) (obj)).maxHealth;
  3228.                                 if (i1 > 30) {
  3229.                                     i1 = 30;
  3230.                                 }
  3231.                                 int CurrentHealth = (((Entity) (obj)).currentHealth * 54)
  3232.                                         / ((Entity) (obj)).maxHealth;
  3233.                                 if (CurrentHealth > 54)
  3234.                                     CurrentHealth = 54;
  3235.                                 DrawingArea.method336(5, spriteDrawY - 3,
  3236.                                         spriteDrawX - 28, 0x002900, 56);
  3237.                                 DrawingArea.method336(7, spriteDrawY - 4,
  3238.                                         spriteDrawX - 27, 0x002900, 54);
  3239.                                 DrawingArea.method336(3, spriteDrawY - 1,
  3240.                                         spriteDrawX + 19, 0x069100, 8);
  3241.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3242.                                         spriteDrawX - 27, 0x83CD00, 3);
  3243.                                 DrawingArea.method336(2, spriteDrawY - 1,
  3244.                                         spriteDrawX - 27, 0x84C600, 33);
  3245.                                 DrawingArea.method336(1, spriteDrawY - 1,
  3246.                                         spriteDrawX - 26, 0xA3D500, 1);
  3247.                                 DrawingArea.method336(1, spriteDrawY,
  3248.                                         spriteDrawX + 3, 0x54C000, 1);
  3249.                                 DrawingArea.method336(1, spriteDrawY,
  3250.                                         spriteDrawX + 4, 0x44BB00, 19);
  3251.                                 DrawingArea.method336(1, spriteDrawY - 1,
  3252.                                         spriteDrawX + 6, 0x44BB00, 20);
  3253.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3254.                                         spriteDrawX - 26, 0x69BA00, 5);
  3255.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3256.                                         spriteDrawX - 25, 0x59CA00, 1);
  3257.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3258.                                         spriteDrawX - 21, 0x62BB00, 10);
  3259.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3260.                                         spriteDrawX - 11, 0x60B400, 4);
  3261.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3262.                                         spriteDrawX - 7, 0x52AD00, 4);
  3263.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3264.                                         spriteDrawX - 3, 0x4AA500, 7);
  3265.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3266.                                         spriteDrawX + 4, 0x39A000, 4);
  3267.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3268.                                         spriteDrawX + 8, 0x239500, 18);
  3269.                                 DrawingArea.method336(1, spriteDrawY,
  3270.                                         spriteDrawX + 23, 0x24AC00, 2);
  3271.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3272.                                         spriteDrawX - 24, 0xA8DC00, 10);
  3273.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3274.                                         spriteDrawX - 14, 0xA0DA00, 7);
  3275.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3276.                                         spriteDrawX - 8, 0x7DCA00, 24);
  3277.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3278.                                         spriteDrawX + 10, 0x83CD00, 1);
  3279.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3280.                                         spriteDrawX + 16, 0x6BC300, 5);
  3281.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3282.                                         spriteDrawX + 21, 0x5BBE00, 4);
  3283.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3284.                                         spriteDrawX + 25, 0x0E9A00, 2);
  3285.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3286.                                         spriteDrawX - 26, 0x63C200, 2);
  3287.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3288.                                         spriteDrawX - 24, 0x33BA00, 5);
  3289.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3290.                                         spriteDrawX - 19, 0x2CB300, 9);
  3291.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3292.                                         spriteDrawX - 10, 0x24AC00, 5);
  3293.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3294.                                         spriteDrawX - 5, 0x1A9900, 11);
  3295.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3296.                                         spriteDrawX + 6, 0x149500, 13);
  3297.                                 DrawingArea.method336(5, spriteDrawY - 3,
  3298.                                         (spriteDrawX - 27) + CurrentHealth,
  3299.                                         0xBA0009, 54 - CurrentHealth);
  3300.  
  3301.                                 int health = (int) (((double) ((Entity) (obj)).currentHealth / (double) ((Entity) (obj)).maxHealth) * 100D);
  3302.                                 int col = 65280;
  3303.                                 if (health <= 100 && health >= 75)
  3304.                                     col = 65280;
  3305.                                 else if (health <= 74 && health >= 50)
  3306.                                     col = 0xffff00;
  3307.                                 else if (health <= 49 && health >= 25)
  3308.                                     col = 0xfca607;
  3309.                                 else if (health <= 24 && health >= 0)
  3310.                                     col = 0xf50d0d;
  3311.                             }
  3312.                         }
  3313.  
  3314.                     } catch (Exception e) {
  3315.                     }
  3316.                 }
  3317.                 for (int j1 = 0; j1 < 4; j1++)
  3318.                     if (((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
  3319.                         if (!newHits) {
  3320.                             npcScreenPos(((Entity) (obj)),
  3321.                                     ((Entity) (obj)).height / 2);
  3322.                             if (spriteDrawX > -1) {
  3323.                                 if (j1 == 1)
  3324.                                     spriteDrawY -= 20;
  3325.                                 if (j1 == 2) {
  3326.                                     spriteDrawX -= 15;
  3327.                                     spriteDrawY -= 10;
  3328.                                 }
  3329.                                 if (j1 == 3) {
  3330.                                     spriteDrawX += 15;
  3331.                                     spriteDrawY -= 10;
  3332.                                 }
  3333.                                 hitMarks[((Entity) (obj)).hitMarkTypes[j1]]
  3334.                                         .drawSprite(spriteDrawX - 12,
  3335.                                                 spriteDrawY - 12);
  3336.                                 smallText
  3337.                                         .drawText(
  3338.                                                 0,
  3339.                                                 String
  3340.                                                         .valueOf(((Entity) (obj)).hitArray[j1]),
  3341.                                                 spriteDrawY + 4, spriteDrawX);
  3342.                                 smallText
  3343.                                         .drawText(
  3344.                                                 0xffffff,
  3345.                                                 String
  3346.                                                         .valueOf(((Entity) (obj)).hitArray[j1]),
  3347.                                                 spriteDrawY + 3,
  3348.                                                 spriteDrawX - 1);
  3349.                             }
  3350.                         }
  3351.                         if (newHits) {
  3352.                             npcScreenPos(((Entity) (obj)),
  3353.                                     ((Entity) (obj)).height / 2);
  3354.                             if (spriteDrawX > -1) {
  3355.                                 if (j1 == 1)
  3356.                                     spriteDrawY -= 20;
  3357.                                 if (j1 == 2) {
  3358.                                     spriteDrawX -= 15;
  3359.                                     spriteDrawY -= 10;
  3360.                                 }
  3361.                                 if (j1 == 3) {
  3362.                                     spriteDrawX += 15;
  3363.                                     spriteDrawY -= 10;
  3364.                                 }
  3365.                                 if (((Entity) (obj)).hitMarkTypes[j1] == 1) {
  3366.                                     hitMarks[20].drawSprite(spriteDrawX - 11,
  3367.                                             spriteDrawY - 12);
  3368.                                 } else if (((Entity) (obj)).hitMarkTypes[j1] == 0) {
  3369.                                     hitMarks[21].drawSprite(spriteDrawX - 12,
  3370.                                             spriteDrawY - 13);
  3371.                                 } else {
  3372.                                     hitMarks[((Entity) (obj)).hitMarkTypes[j1]]
  3373.                                             .drawSprite(spriteDrawX - 12,
  3374.                                                     spriteDrawY - 12);
  3375.                                 }
  3376.                                 smallText
  3377.                                         .drawText(
  3378.                                                 0xffffff,
  3379.                                                 String
  3380.                                                         .valueOf(((Entity) (obj)).hitArray[j1]),
  3381.                                                 spriteDrawY + 4, spriteDrawX);
  3382.                                 // if (((Entity) (obj)).hitArray[j1] > 0) {
  3383.                                 // smallText.drawText(0xffffff,
  3384.                                 // String.valueOf(((Entity)
  3385.                                 // (obj)).hitArray[j1]), spriteDrawY + 3,
  3386.                                 // spriteDrawX - 1);
  3387.                                 // }
  3388.                             }
  3389.                         }
  3390.                     }
  3391.             }
  3392.             for (int k = 0; k < anInt974; k++) {
  3393.                 int k1 = anIntArray976[k];
  3394.                 int l1 = anIntArray977[k];
  3395.                 int j2 = anIntArray979[k];
  3396.                 int k2 = anIntArray978[k];
  3397.                 boolean flag = true;
  3398.                 while (flag) {
  3399.                     flag = false;
  3400.                     for (int l2 = 0; l2 < k; l2++)
  3401.                         if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2]
  3402.                                 && l1 - k2 < anIntArray977[l2] + 2
  3403.                                 && k1 - j2 < anIntArray976[l2]
  3404.                                         + anIntArray979[l2]
  3405.                                 && k1 + j2 > anIntArray976[l2]
  3406.                                         - anIntArray979[l2]
  3407.                                 && anIntArray977[l2] - anIntArray978[l2] < l1) {
  3408.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  3409.                             flag = true;
  3410.                         }
  3411.  
  3412.                 }
  3413.                 spriteDrawX = anIntArray976[k];
  3414.                 spriteDrawY = anIntArray977[k] = l1;
  3415.                 String s = aStringArray983[k];
  3416.                 if (anInt1249 == 0) {
  3417.                     int i3 = 0xffff00;
  3418.                     if (anIntArray980[k] < 6)
  3419.                         i3 = anIntArray965[anIntArray980[k]];
  3420.                     if (anIntArray980[k] == 6)
  3421.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  3422.                     if (anIntArray980[k] == 7)
  3423.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  3424.                     if (anIntArray980[k] == 8)
  3425.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  3426.                     if (anIntArray980[k] == 9) {
  3427.                         int j3 = 150 - anIntArray982[k];
  3428.                         if (j3 < 50)
  3429.                             i3 = 0xff0000 + 1280 * j3;
  3430.                         else if (j3 < 100)
  3431.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  3432.                         else if (j3 < 150)
  3433.                             i3 = 65280 + 5 * (j3 - 100);
  3434.                     }
  3435.                     if (anIntArray980[k] == 10) {
  3436.                         int k3 = 150 - anIntArray982[k];
  3437.                         if (k3 < 50)
  3438.                             i3 = 0xff0000 + 5 * k3;
  3439.                         else if (k3 < 100)
  3440.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  3441.                         else if (k3 < 150)
  3442.                             i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  3443.                     }
  3444.                     if (anIntArray980[k] == 11) {
  3445.                         int l3 = 150 - anIntArray982[k];
  3446.                         if (l3 < 50)
  3447.                             i3 = 0xffffff - 0x50005 * l3;
  3448.                         else if (l3 < 100)
  3449.                             i3 = 65280 + 0x50005 * (l3 - 50);
  3450.                         else if (l3 < 150)
  3451.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  3452.                     }
  3453.                     if (anIntArray981[k] == 0) {
  3454.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  3455.                                 spriteDrawX);
  3456.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY,
  3457.                                 spriteDrawX);
  3458.                     }
  3459.                     if (anIntArray981[k] == 1) {
  3460.                         chatTextDrawingArea.method386(0, s, spriteDrawX,
  3461.                                 anInt1265, spriteDrawY + 1);
  3462.                         chatTextDrawingArea.method386(i3, s, spriteDrawX,
  3463.                                 anInt1265, spriteDrawY);
  3464.                     }
  3465.                     if (anIntArray981[k] == 2) {
  3466.                         chatTextDrawingArea.method387(spriteDrawX, s,
  3467.                                 anInt1265, spriteDrawY + 1, 0);
  3468.                         chatTextDrawingArea.method387(spriteDrawX, s,
  3469.                                 anInt1265, spriteDrawY, i3);
  3470.                     }
  3471.                     if (anIntArray981[k] == 3) {
  3472.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  3473.                                 s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  3474.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  3475.                                 s, anInt1265, spriteDrawY, spriteDrawX, i3);
  3476.                     }
  3477.                     if (anIntArray981[k] == 4) {
  3478.                         int i4 = chatTextDrawingArea.method384(s);
  3479.                         int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  3480.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50,
  3481.                                 spriteDrawX + 50, 0);
  3482.                         chatTextDrawingArea.method385(0, s, spriteDrawY + 1,
  3483.                                 (spriteDrawX + 50) - k4);
  3484.                         chatTextDrawingArea.method385(i3, s, spriteDrawY,
  3485.                                 (spriteDrawX + 50) - k4);
  3486.                         DrawingArea.defaultDrawingAreaSize();
  3487.                     }
  3488.                     if (anIntArray981[k] == 5) {
  3489.                         int j4 = 150 - anIntArray982[k];
  3490.                         int l4 = 0;
  3491.                         if (j4 < 25)
  3492.                             l4 = j4 - 25;
  3493.                         else if (j4 > 125)
  3494.                             l4 = j4 - 125;
  3495.                         DrawingArea
  3496.                                 .setDrawingArea(spriteDrawY + 5, 0, 512,
  3497.                                         spriteDrawY
  3498.                                                 - chatTextDrawingArea.anInt1497
  3499.                                                 - 1);
  3500.                         chatTextDrawingArea.drawText(0, s,
  3501.                                 spriteDrawY + 1 + l4, spriteDrawX);
  3502.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4,
  3503.                                 spriteDrawX);
  3504.                         DrawingArea.defaultDrawingAreaSize();
  3505.                     }
  3506.                 } else {
  3507.                     chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  3508.                             spriteDrawX);
  3509.                     chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY,
  3510.                             spriteDrawX);
  3511.                 }
  3512.             }
  3513.         } catch (Exception e) {
  3514.         }
  3515.     }
  3516.  
  3517.     private void delFriend(long l) {
  3518.         try {
  3519.             if (l == 0L)
  3520.                 return;
  3521.             for (int i = 0; i < friendsCount; i++) {
  3522.                 if (friendsListAsLongs[i] != l)
  3523.                     continue;
  3524.                 friendsCount--;
  3525.                 needDrawTabArea = true;
  3526.                 for (int j = i; j < friendsCount; j++) {
  3527.                     friendsList[j] = friendsList[j + 1];
  3528.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  3529.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  3530.                 }
  3531.  
  3532.                 stream.createFrame(215);
  3533.                 stream.writeQWord(l);
  3534.                 break;
  3535.             }
  3536.         } catch (RuntimeException runtimeexception) {
  3537.             signlink.reporterror("18622, " + false + ", " + l + ", "
  3538.                     + runtimeexception.toString());
  3539.             throw new RuntimeException();
  3540.         }
  3541.     }
  3542.  
  3543.     public void drawSideIcons() {
  3544.         /* Top sideIcons */
  3545.         if (tabInterfaceIDs[0] != -1 && anInt1054 == 0)
  3546.             if (loopCycle % 20 >= 10)
  3547.                 ;
  3548.         sideIcons[0].drawSprite(10, 4);
  3549.         if (tabInterfaceIDs[1] != -1 && anInt1054 == 1)
  3550.             if (loopCycle % 20 >= 10)
  3551.                 ;
  3552.         sideIcons[1].drawSprite(43, 4);
  3553.         if (tabInterfaceIDs[2] != -1 && anInt1054 == 2)
  3554.             if (loopCycle % 20 >= 10)
  3555.                 ;
  3556.         sideIcons[2].drawSprite(76, 3);
  3557.         if (tabInterfaceIDs[3] != -1 && anInt1054 == 3)
  3558.             if (loopCycle % 20 >= 10)
  3559.                 ;
  3560.         sideIcons[3].drawSprite(111, 5);
  3561.         if (tabInterfaceIDs[4] != -1 && anInt1054 == 4)
  3562.             if (loopCycle % 20 >= 10)
  3563.                 ;
  3564.         sideIcons[4].drawSprite(140, 1);
  3565.         if (tabInterfaceIDs[5] != -1 && anInt1054 == 5)
  3566.             if (loopCycle % 20 >= 10)
  3567.                 ;
  3568.         sideIcons[5].drawSprite(174, 1);
  3569.         if (tabInterfaceIDs[6] != -1 && anInt1054 == 6)
  3570.             if (loopCycle % 20 >= 10)
  3571.                 ;
  3572.         sideIcons[6].drawSprite(209, 5);
  3573.         /* Bottom sideIcons */
  3574.         if (tabInterfaceIDs[7] != -1 && anInt1054 == 7)
  3575.             if (loopCycle % 20 >= 10)
  3576.                 ;
  3577.         sideIcons[7].drawSprite(43, 302);
  3578.         if (tabInterfaceIDs[8] != -1 && anInt1054 == 8)
  3579.             if (loopCycle % 20 >= 10)
  3580.                 ;
  3581.         sideIcons[8].drawSprite(76, 302);
  3582.         if (tabInterfaceIDs[9] != -1 && anInt1054 == 9)
  3583.             if (loopCycle % 20 >= 10)
  3584.                 ;
  3585.         sideIcons[13].drawSprite(112, 304);
  3586.         if (tabInterfaceIDs[10] != -1 && anInt1054 == 10)
  3587.             if (loopCycle % 20 >= 10)
  3588.                 ;
  3589.         sideIcons[10].drawSprite(143, 303);
  3590.         if (tabInterfaceIDs[11] != -1 && anInt1054 == 11)
  3591.             if (loopCycle % 20 >= 10)
  3592.                 ;
  3593.         sideIcons[11].drawSprite(173, 300);
  3594.         if (tabInterfaceIDs[12] != -1 && anInt1054 == 12)
  3595.             if (loopCycle % 20 >= 10)
  3596.                 ;
  3597.         sideIcons[12].drawSprite(206, 300);
  3598.     }
  3599.  
  3600.     public void drawRedStones() {
  3601.         if (tabInterfaceIDs[tabID] != -1) {
  3602.             if (tabID == 0)
  3603.                 redStones[0].drawSprite(3, 0);
  3604.             if (tabID == 1)
  3605.                 redStones[4].drawSprite(41, 0);
  3606.             if (tabID == 2)
  3607.                 redStones[4].drawSprite(74, 0);
  3608.             if (tabID == 3)
  3609.                 redStones[4].drawSprite(107, 0);
  3610.             if (tabID == 4)
  3611.                 redStones[4].drawSprite(140, 0);
  3612.             if (tabID == 5)
  3613.                 redStones[4].drawSprite(173, 0);
  3614.             if (tabID == 6)
  3615.                 redStones[1].drawSprite(206, 0);
  3616.             if (tabID == 7)
  3617.                 redStones[4].drawSprite(107, 298);
  3618.             if (tabID == 8)
  3619.                 redStones[4].drawSprite(41, 298);
  3620.             if (tabID == 9)
  3621.                 redStones[4].drawSprite(74, 298);
  3622.             if (tabID == 11)
  3623.                 redStones[4].drawSprite(140, 298);
  3624.             if (tabID == 12)
  3625.                 redStones[4].drawSprite(173, 298);
  3626.             if (tabID == 13)
  3627.                 redStones[3].drawSprite(206, 298);
  3628.         }
  3629.     }
  3630.  
  3631.     private void drawTabArea() {
  3632.         aRSImageProducer_1163.initDrawingArea();
  3633.         Texture.anIntArray1472 = anIntArray1181;
  3634.         /* Draws new tab area sprite */
  3635.         tabArea.drawSprite(0, 0);
  3636.         if (invOverlayInterfaceID == -1) {
  3637.             drawRedStones();
  3638.             drawSideIcons();
  3639.         }
  3640.         if (invOverlayInterfaceID != -1)
  3641.             drawInterface(0, 28,
  3642.                     RSInterface.interfaceCache[invOverlayInterfaceID], 37);
  3643.         else if (tabInterfaceIDs[tabID] != -1)
  3644.             drawInterface(0, 28,
  3645.                     RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
  3646.         if (menuOpen && menuScreenArea == 1)
  3647.             drawMenu();
  3648.         aRSImageProducer_1163.drawGraphics(168, super.graphics, 519);
  3649.         aRSImageProducer_1165.initDrawingArea();
  3650.         Texture.anIntArray1472 = anIntArray1182;
  3651.     }
  3652.  
  3653.     private void method37(int j) {
  3654.         //if (!lowMem) {
  3655.             if (Texture.anIntArray1480[17] >= j) {
  3656.                 Background background = Texture.aBackgroundArray1474s[17];
  3657.                 int k = background.anInt1452 * background.anInt1453 - 1;
  3658.                 int j1 = background.anInt1452 * anInt945 * 2;
  3659.                 byte abyte0[] = background.aByteArray1450;
  3660.                 byte abyte3[] = aByteArray912;
  3661.                 for (int i2 = 0; i2 <= k; i2++)
  3662.                     abyte3[i2] = abyte0[i2 - j1 & k];
  3663.  
  3664.                 background.aByteArray1450 = abyte3;
  3665.                 aByteArray912 = abyte0;
  3666.                 Texture.method370(17);
  3667.                 anInt854++;
  3668.                 if (anInt854 > 1235) {
  3669.                     anInt854 = 0;
  3670.                     stream.createFrame(226);
  3671.                     stream.writeWordBigEndian(0);
  3672.                     int l2 = stream.currentOffset;
  3673.                     stream.writeWord(58722);
  3674.                     stream.writeWordBigEndian(240);
  3675.                     stream.writeWord((int) (Math.random() * 65536D));
  3676.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  3677.                     if ((int) (Math.random() * 2D) == 0)
  3678.                         stream.writeWord(51825);
  3679.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  3680.                     stream.writeWord((int) (Math.random() * 65536D));
  3681.                     stream.writeWord(7130);
  3682.                     stream.writeWord((int) (Math.random() * 65536D));
  3683.                     stream.writeWord(61657);
  3684.                     stream.writeBytes(stream.currentOffset - l2);
  3685.                     if (Texture.anIntArray1480[34] >= j) {
  3686.  
  3687.                         Background background_2 = Texture.aBackgroundArray1474s[34];
  3688.                         int i1 = background_2.anInt1452
  3689.                                 * background_2.anInt1453 - 1;
  3690.                         int l1 = background_2.anInt1452 * anInt945 * 2;
  3691.                         byte abyte2[] = background_2.aByteArray1450;
  3692.                         byte abyte5[] = aByteArray912;
  3693.                         for (int k2 = 0; k2 <= i1; k2++)
  3694.                             abyte5[k2] = abyte2[k2 - l1 & i1];
  3695.                         background_2.aByteArray1450 = abyte5;
  3696.                         aByteArray912 = abyte2;
  3697.                         Texture.method370(34);
  3698.  
  3699.                     }
  3700.                 }
  3701.             }
  3702.             if (Texture.anIntArray1480[24] >= j) {
  3703.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  3704.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  3705.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  3706.                 byte abyte1[] = background_1.aByteArray1450;
  3707.                 byte abyte4[] = aByteArray912;
  3708.                 for (int j2 = 0; j2 <= l; j2++)
  3709.                     abyte4[j2] = abyte1[j2 - k1 & l];
  3710.  
  3711.                 background_1.aByteArray1450 = abyte4;
  3712.                 aByteArray912 = abyte1;
  3713.                 Texture.method370(24);
  3714.             }
  3715.             /*
  3716.              * if(Texture.anIntArray1480[34] >= j) { Background background_2 =
  3717.              * Texture.aBackgroundArray1474s[34]; int i1 =
  3718.              * background_2.anInt1452 * background_2.anInt1453 - 1; int l1 =
  3719.              * background_2.anInt1452 * anInt945 * 2; byte abyte2[] =
  3720.              * background_2.aByteArray1450; byte abyte5[] = aByteArray912;
  3721.              * for(int k2 = 0; k2 <= i1; k2++) abyte5[k2] = abyte2[k2 - l1 &
  3722.              * i1];
  3723.              *
  3724.              * background_2.aByteArray1450 = abyte5; aByteArray912 = abyte2;
  3725.              * Texture.method370(34); }
  3726.              */
  3727.             if (Texture.anIntArray1480[40] >= j)
  3728.                 ;
  3729.             {
  3730.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  3731.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  3732.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  3733.                 byte abyte2[] = background_2.aByteArray1450;
  3734.                 byte abyte5[] = aByteArray912;
  3735.                 for (int k2 = 0; k2 <= i1; k2++)
  3736.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  3737.  
  3738.                 background_2.aByteArray1450 = abyte5;
  3739.                 aByteArray912 = abyte2;
  3740.                 Texture.method370(40);
  3741.             }
  3742.         //}
  3743.     }
  3744.  
  3745.     private void method38() {
  3746.         for (int i = -1; i < playerCount; i++) {
  3747.             int j;
  3748.             if (i == -1)
  3749.                 j = myPlayerIndex;
  3750.             else
  3751.                 j = playerIndices[i];
  3752.             Player player = playerArray[j];
  3753.             if (player != null && player.textCycle > 0) {
  3754.                 player.textCycle--;
  3755.                 if (player.textCycle == 0)
  3756.                     player.textSpoken = null;
  3757.             }
  3758.         }
  3759.  
  3760.         for (int k = 0; k < npcCount; k++) {
  3761.             int l = npcIndices[k];
  3762.             NPC npc = npcArray[l];
  3763.             if (npc != null && npc.textCycle > 0) {
  3764.                 npc.textCycle--;
  3765.                 if (npc.textCycle == 0)
  3766.                     npc.textSpoken = null;
  3767.             }
  3768.         }
  3769.  
  3770.     }
  3771.  
  3772.     private void calcCameraPos() {
  3773.         int i = anInt1098 * 128 + 64;
  3774.         int j = anInt1099 * 128 + 64;
  3775.         int k = method42(plane, j, i) - anInt1100;
  3776.         if (xCameraPos < i) {
  3777.             xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  3778.             if (xCameraPos > i)
  3779.                 xCameraPos = i;
  3780.         }
  3781.         if (xCameraPos > i) {
  3782.             xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  3783.             if (xCameraPos < i)
  3784.                 xCameraPos = i;
  3785.         }
  3786.         if (zCameraPos < k) {
  3787.             zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  3788.             if (zCameraPos > k)
  3789.                 zCameraPos = k;
  3790.         }
  3791.         if (zCameraPos > k) {
  3792.             zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  3793.             if (zCameraPos < k)
  3794.                 zCameraPos = k;
  3795.         }
  3796.         if (yCameraPos < j) {
  3797.             yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  3798.             if (yCameraPos > j)
  3799.                 yCameraPos = j;
  3800.         }
  3801.         if (yCameraPos > j) {
  3802.             yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  3803.             if (yCameraPos < j)
  3804.                 yCameraPos = j;
  3805.         }
  3806.         i = anInt995 * 128 + 64;
  3807.         j = anInt996 * 128 + 64;
  3808.         k = method42(plane, j, i) - anInt997;
  3809.         int l = i - xCameraPos;
  3810.         int i1 = k - zCameraPos;
  3811.         int j1 = j - yCameraPos;
  3812.         int k1 = (int) Math.sqrt(l * l + j1 * j1);
  3813.         int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  3814.         int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  3815.         if (l1 < 128)
  3816.             l1 = 128;
  3817.         if (l1 > 383)
  3818.             l1 = 383;
  3819.         if (yCameraCurve < l1) {
  3820.             yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  3821.             if (yCameraCurve > l1)
  3822.                 yCameraCurve = l1;
  3823.         }
  3824.         if (yCameraCurve > l1) {
  3825.             yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  3826.             if (yCameraCurve < l1)
  3827.                 yCameraCurve = l1;
  3828.         }
  3829.         int j2 = i2 - xCameraCurve;
  3830.         if (j2 > 1024)
  3831.             j2 -= 2048;
  3832.         if (j2 < -1024)
  3833.             j2 += 2048;
  3834.         if (j2 > 0) {
  3835.             xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  3836.             xCameraCurve &= 0x7ff;
  3837.         }
  3838.         if (j2 < 0) {
  3839.             xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  3840.             xCameraCurve &= 0x7ff;
  3841.         }
  3842.         int k2 = i2 - xCameraCurve;
  3843.         if (k2 > 1024)
  3844.             k2 -= 2048;
  3845.         if (k2 < -1024)
  3846.             k2 += 2048;
  3847.         if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  3848.             xCameraCurve = i2;
  3849.     }
  3850.  
  3851.     private void drawMenu() {
  3852.         int i = menuOffsetX;
  3853.         int j = menuOffsetY;
  3854.         int k = menuWidth;
  3855.         int l = anInt952;
  3856.         int i1 = 0x5d5447;
  3857.         // DrawingArea.method336(l, j, i, i1, k);
  3858.         DrawingArea.drawPixelsWithOpacity(i1, j, k, l, 150, i);
  3859.         // DrawingArea.method336(16, j + 1, i + 1, 0, k - 2);
  3860.         DrawingArea.drawPixelsWithOpacity(0, j + 1, k - 2, 16, 150, i + 1);
  3861.         // DrawingArea.fillPixels(i + 1, k - 2, l - 19, 0, j + 18);
  3862.         DrawingArea.method338(j + 18, l - 19, 150, 0, k - 2, i + 1);
  3863.  
  3864.         // DrawingArea.drawPixels(l, j, i, i1, k);
  3865.         // DrawingArea.drawPixels(16, j + 1, i + 1, 0, k - 2);
  3866.         // DrawingArea.fillPixels(i + 1, k - 2, l - 19, 0, j + 18);
  3867.         chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i + 3);
  3868.         int j1 = super.mouseX;
  3869.         int k1 = super.mouseY;
  3870.         if (menuScreenArea == 0) {
  3871.             j1 -= 4;
  3872.             k1 -= 4;
  3873.         }
  3874.         if (menuScreenArea == 1) {
  3875.             j1 -= 519;
  3876.             k1 -= 168;
  3877.         }
  3878.         if (menuScreenArea == 2) {
  3879.             j1 -= 17;
  3880.             k1 -= 338;
  3881.         }
  3882.         if (menuScreenArea == 3) {
  3883.             j1 -= 515;
  3884.             k1 -= 0;
  3885.         }
  3886.         for (int l1 = 0; l1 < menuActionRow; l1++) {
  3887.             int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  3888.             int j2 = 0xffffff;
  3889.             if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3)
  3890.                 j2 = 0xffff00;
  3891.             chatTextDrawingArea.method389(true, i + 3, j2, menuActionName[l1],
  3892.                     i2);
  3893.         }
  3894.  
  3895.     }
  3896.  
  3897.     private void addFriend(long l) {
  3898.         try {
  3899.             if (l == 0L)
  3900.                 return;
  3901.             if (friendsCount >= 100 && anInt1046 != 1) {
  3902.                 pushMessage("Your friendlist is full. The max is 50.", 0, "");
  3903.                 return;
  3904.             }
  3905.             if (friendsCount >= 100 && myPrivilege < 1) {
  3906.                 pushMessage(
  3907.                         "Your friendlist is full. Max is 100 for non-donators",
  3908.                         0, "");
  3909.                 return;
  3910.             } else {
  3911.                 if (friendsCount >= 200) {
  3912.                     pushMessage(
  3913.                             "Your friendlist is full. Max is 200 for donators.",
  3914.                             0, "");
  3915.                     return;
  3916.                 }
  3917.             }
  3918.             String s = TextClass.fixName(TextClass.nameForLong(l));
  3919.             if(s.startsWith("@bas@")){ // title
  3920.                 s = s.substring(0,s.indexOf("@bas@"));         
  3921.             }
  3922.             for (int i = 0; i < friendsCount; i++)
  3923.                 if (friendsListAsLongs[i] == l) {
  3924.                     pushMessage(s + " is already on your friend list", 0, "");
  3925.                     return;
  3926.                 }
  3927.             for (int j = 0; j < ignoreCount; j++)
  3928.                 if (ignoreListAsLongs[j] == l) {
  3929.                     pushMessage("Please remove " + s
  3930.                             + " from your ignore list first", 0, "");
  3931.                     return;
  3932.                 }
  3933.  
  3934.             if (s.equals(myPlayer.name)) {
  3935.                 return;
  3936.             } else {
  3937.                 friendsList[friendsCount] = s;
  3938.                 friendsListAsLongs[friendsCount] = l;
  3939.                 friendsNodeIDs[friendsCount] = 0;
  3940.                 friendsCount++;
  3941.                 needDrawTabArea = true;
  3942.                 stream.createFrame(188);
  3943.                 stream.writeQWord(l);
  3944.                 return;
  3945.             }
  3946.         } catch (RuntimeException runtimeexception) {
  3947.             signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", "
  3948.                     + runtimeexception.toString());
  3949.         }
  3950.         throw new RuntimeException();
  3951.     }
  3952.  
  3953.     private int method42(int i, int j, int k) {
  3954.         int l = k >> 7;
  3955.         int i1 = j >> 7;
  3956.         if (l < 0 || i1 < 0 || l > 103 || i1 > 103)
  3957.             return 0;
  3958.         int j1 = i;
  3959.         if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  3960.             j1++;
  3961.         int k1 = k & 0x7f;
  3962.         int l1 = j & 0x7f;
  3963.         int i2 = intGroundArray[j1][l][i1] * (128 - k1)
  3964.                 + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  3965.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1)
  3966.                 + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  3967.         return i2 * (128 - l1) + j2 * l1 >> 7;
  3968.     }
  3969.  
  3970.     private static String intToKOrMil(int j) {
  3971.         if (j == 0)
  3972.             return "@inf@";
  3973.         if (j < 0x186a0)
  3974.             return String.valueOf(j);
  3975.         if (j < 0x989680)
  3976.             return j / 1000 + "K";
  3977.         else
  3978.             return j / 0xf4240 + "M";
  3979.     }
  3980.  
  3981.     private void resetLogout() {
  3982.         alertHandler.alert = null;
  3983.         try {
  3984.             if (socketStream != null)
  3985.                 socketStream.close();
  3986.         } catch (Exception _ex) {
  3987.         }
  3988.         prayClicked = false;
  3989.         clickedQuickPrayers = false;
  3990.         socketStream = null;
  3991.         loggedIn = false;
  3992.         loginScreenState = 0;
  3993.         xpClicked = false;
  3994.         drawXpBar = false;
  3995.         // myUsername = "";
  3996.         // myPassword = "";
  3997.         unlinkMRUNodes();
  3998.         worldController.initToNull();
  3999.         for (int i = 0; i < 4; i++)
  4000.             aClass11Array1230[i].method210();
  4001.  
  4002.         System.gc();
  4003.         stopMidi();
  4004.         currentSong = -1;
  4005.         nextSong = -1;
  4006.         prevSong = 0;
  4007.         resetImageProducers();
  4008.         followPlayer = 0;
  4009.         followNPC = 0;
  4010.         followDistance = 1;
  4011.     }
  4012.  
  4013.     private void method45() {
  4014.         aBoolean1031 = true;
  4015.         for (int j = 0; j < 7; j++) {
  4016.             anIntArray1065[j] = -1;
  4017.             for (int k = 0; k < IDK.length; k++) {
  4018.                 if (IDK.cache[k].aBoolean662
  4019.                         || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  4020.                     continue;
  4021.                 anIntArray1065[j] = k;
  4022.                 break;
  4023.             }
  4024.  
  4025.         }
  4026.  
  4027.     }
  4028.  
  4029.     private void method46(int i, Stream stream) {
  4030.         while (stream.bitPosition + 21 < i * 8) {
  4031.             int k = stream.readBits(14);
  4032.             if (k == 16383)
  4033.                 break;
  4034.             if (npcArray[k] == null)
  4035.                 npcArray[k] = new NPC();
  4036.             NPC npc = npcArray[k];
  4037.             npcIndices[npcCount++] = k;
  4038.             npc.anInt1537 = loopCycle;
  4039.             int l = stream.readBits(5);
  4040.             if (l > 15)
  4041.                 l -= 32;
  4042.             int i1 = stream.readBits(5);
  4043.             if (i1 > 15)
  4044.                 i1 -= 32;
  4045.             int j1 = stream.readBits(1);
  4046.             npc.desc = EntityDef.forID(stream.readBits(16));
  4047.             int k1 = stream.readBits(1);
  4048.             if (k1 == 1)
  4049.                 anIntArray894[anInt893++] = k;
  4050.             npc.anInt1540 = npc.desc.aByte68;
  4051.             npc.anInt1504 = npc.desc.anInt79;
  4052.             npc.anInt1554 = npc.desc.walkAnim;
  4053.             npc.anInt1555 = npc.desc.anInt58;
  4054.             npc.anInt1556 = npc.desc.anInt83;
  4055.             npc.anInt1557 = npc.desc.anInt55;
  4056.             npc.anInt1511 = npc.desc.standAnim;
  4057.             npc
  4058.                     .setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l,
  4059.                             j1 == 1);
  4060.         }
  4061.         stream.finishBitAccess();
  4062.     }
  4063.  
  4064.     public void processGameLoop() {
  4065.         if (rsAlreadyLoaded || loadingError || genericLoadingError)
  4066.             return;
  4067.         loopCycle++;
  4068.             if(!Texture_Sub1.INSTANCE.isTextureLoaded()){
  4069.             System.exit(1);
  4070.             return;
  4071.         }
  4072.         if (!loggedIn)
  4073.             processLoginScreenInput();
  4074.         else
  4075.             mainGameProcessor();
  4076.         processOnDemandQueue();
  4077.     }
  4078.  
  4079.     private void method47(boolean flag) {
  4080.         if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  4081.             destX = 0;
  4082.         int j = playerCount;
  4083.         if (flag)
  4084.             j = 1;
  4085.         for (int l = 0; l < j; l++) {
  4086.             Player player;
  4087.             int i1;
  4088.             if (flag) {
  4089.                 player = myPlayer;
  4090.                 i1 = myPlayerIndex << 14;
  4091.             } else {
  4092.                 player = playerArray[playerIndices[l]];
  4093.                 i1 = playerIndices[l] << 14;
  4094.             }
  4095.             if (player == null || !player.isVisible())
  4096.                 continue;
  4097.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200)
  4098.                     && !flag && player.anInt1517 == player.anInt1511;
  4099.             int j1 = player.x >> 7;
  4100.             int k1 = player.y >> 7;
  4101.             if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  4102.                 continue;
  4103.             if (player.aModel_1714 != null && loopCycle >= player.anInt1707
  4104.                     && loopCycle < player.anInt1708) {
  4105.                 player.aBoolean1699 = false;
  4106.                 player.anInt1709 = method42(plane, player.y, player.x);
  4107.                 worldController.method286(plane, player.y, player,
  4108.                         player.anInt1552, player.anInt1722, player.x,
  4109.                         player.anInt1709, player.anInt1719, player.anInt1721,
  4110.                         i1, player.anInt1720);
  4111.                 continue;
  4112.             }
  4113.             if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  4114.                 if (anIntArrayArray929[j1][k1] == anInt1265)
  4115.                     continue;
  4116.                 anIntArrayArray929[j1][k1] = anInt1265;
  4117.             }
  4118.             player.anInt1709 = method42(plane, player.y, player.x);
  4119.             worldController.method285(plane, player.anInt1552,
  4120.                     player.anInt1709, i1, player.y, 60, player.x, player,
  4121.                     player.aBoolean1541);
  4122.         }
  4123.  
  4124.     }
  4125.  
  4126.     private boolean promptUserForInput(RSInterface class9) {
  4127.         int j = class9.contentType;
  4128.         if (anInt900 == 2) {
  4129.             if (j == 201) {
  4130.                 inputTaken = true;
  4131.                 inputDialogState = 0;
  4132.                 messagePromptRaised = true;
  4133.                 promptInput = "";
  4134.                 friendsListAction = 1;
  4135.                 aString1121 = "Enter name of friend to add to list";
  4136.             }
  4137.             if (j == 202) {
  4138.                 inputTaken = true;
  4139.                 inputDialogState = 0;
  4140.                 messagePromptRaised = true;
  4141.                 promptInput = "";
  4142.                 friendsListAction = 2;
  4143.                 aString1121 = "Enter name of friend to delete from list";
  4144.             }
  4145.         }
  4146.         if (j == 205) {
  4147.             anInt1011 = 250;
  4148.             return true;
  4149.         }
  4150.         if (j == 501) {
  4151.             inputTaken = true;
  4152.             inputDialogState = 0;
  4153.             messagePromptRaised = true;
  4154.             promptInput = "";
  4155.             friendsListAction = 4;
  4156.             aString1121 = "Enter name of player to add to list";
  4157.         }
  4158.         if (j == 502) {
  4159.             inputTaken = true;
  4160.             inputDialogState = 0;
  4161.             messagePromptRaised = true;
  4162.             promptInput = "";
  4163.             friendsListAction = 5;
  4164.             aString1121 = "Enter name of player to delete from list";
  4165.         }
  4166.         if (j == 550) {
  4167.             inputTaken = true;
  4168.             inputDialogState = 0;
  4169.             messagePromptRaised = true;
  4170.             promptInput = "";
  4171.             aString1121 = "Enter the name of the chat you wish to join";
  4172.         }
  4173.         if (j >= 300 && j <= 313) {
  4174.             int k = (j - 300) / 2;
  4175.             int j1 = j & 1;
  4176.             int i2 = anIntArray1065[k];
  4177.             if (i2 != -1) {
  4178.                 do {
  4179.                     if (j1 == 0 && --i2 < 0)
  4180.                         i2 = IDK.length - 1;
  4181.                     if (j1 == 1 && ++i2 >= IDK.length)
  4182.                         i2 = 0;
  4183.                 } while (IDK.cache[i2].aBoolean662
  4184.                         || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  4185.                 anIntArray1065[k] = i2;
  4186.                 aBoolean1031 = true;
  4187.             }
  4188.         }
  4189.         if (j >= 314 && j <= 323) {
  4190.             int l = (j - 314) / 2;
  4191.             int k1 = j & 1;
  4192.             int j2 = anIntArray990[l];
  4193.             if (k1 == 0 && --j2 < 0)
  4194.                 j2 = anIntArrayArray1003[l].length - 1;
  4195.             if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  4196.                 j2 = 0;
  4197.             anIntArray990[l] = j2;
  4198.             aBoolean1031 = true;
  4199.         }
  4200.         if (j == 324 && !aBoolean1047) {
  4201.             aBoolean1047 = true;
  4202.             method45();
  4203.         }
  4204.         if (j == 325 && aBoolean1047) {
  4205.             aBoolean1047 = false;
  4206.             method45();
  4207.         }
  4208.         if (j == 326) {
  4209.             stream.createFrame(101);
  4210.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  4211.             for (int i1 = 0; i1 < 7; i1++)
  4212.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  4213.  
  4214.             for (int l1 = 0; l1 < 5; l1++)
  4215.                 stream.writeWordBigEndian(anIntArray990[l1]);
  4216.  
  4217.             return true;
  4218.         }
  4219.         if (j == 328) {
  4220.             RSInterface rsInterface = class9;
  4221.             int verticleTilt = 150;
  4222.             int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  4223.             rsInterface.modelRotation1 = verticleTilt;
  4224.             rsInterface.modelRotation2 = animationSpeed;
  4225.             if (aBoolean1031) {
  4226.                 Model characterDisplay = myPlayer.method452();
  4227.                 for (int l2 = 0; l2 < 5; l2++)
  4228.                     if (anIntArray990[l2] != 0) {
  4229.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  4230.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  4231.                         if (l2 == 1)
  4232.                             characterDisplay.method476(anIntArray1204[0],
  4233.                                     anIntArray1204[anIntArray990[l2]]);
  4234.                     }
  4235.                 int staticFrame = myPlayer.anInt1511;
  4236.                 characterDisplay.method469();
  4237.                 characterDisplay
  4238.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  4239.                 rsInterface.anInt233 = 5;
  4240.                 rsInterface.mediaID = 0;
  4241.                 RSInterface.method208(aBoolean994, characterDisplay);
  4242.             }
  4243.             return true;
  4244.         }
  4245.         if (j == 613)
  4246.             canMute = !canMute;
  4247.         if (j >= 601 && j <= 612) {
  4248.             clearTopInterfaces();
  4249.             if (reportAbuseInput.length() > 0) {
  4250.                 stream.createFrame(218);
  4251.                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  4252.                 stream.writeWordBigEndian(j - 601);
  4253.                 stream.writeWordBigEndian(canMute ? 1 : 0);
  4254.             }
  4255.         }
  4256.         return false;
  4257.     }
  4258.  
  4259.     private void method49(Stream stream) {
  4260.         try {for (int j = 0; j < anInt893; j++) {
  4261.             int k = anIntArray894[j];
  4262.             Player player = playerArray[k];
  4263.             int l = stream.readUnsignedByte();
  4264.             if ((l & 0x40) != 0)
  4265.                 l += stream.readUnsignedByte() << 8;
  4266.             method107(l, k, stream, player);
  4267.         }
  4268.         }
  4269.         catch (Exception e) {}
  4270.  
  4271.     }
  4272.  
  4273.     private void method50(int i, int k, int l, int i1, int j1) {
  4274.         int k1 = worldController.method300(j1, l, i);
  4275.         if (k1 != 0) {
  4276.             int l1 = worldController.method304(j1, l, i, k1);
  4277.             int k2 = l1 >> 6 & 3;
  4278.             int i3 = l1 & 0x1f;
  4279.             int k3 = k;
  4280.             if (k1 > 0)
  4281.                 k3 = i1;
  4282.             int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  4283.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  4284.             int i5 = k1 >> 14 & 0x7fff;
  4285.             ObjectDef class46_2 = ObjectDef.forID(i5);
  4286.             if (class46_2.anInt758 != -1) {
  4287.                 Background background_2 = mapScenes[class46_2.anInt758];
  4288.                 if (background_2 != null) {
  4289.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  4290.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  4291.                     background_2.method361(48 + l * 4 + i6, 48
  4292.                             + (104 - i - class46_2.anInt761) * 4 + j6);
  4293.                 }
  4294.             } else {
  4295.                 if (i3 == 0 || i3 == 2)
  4296.                     if (k2 == 0) {
  4297.                         ai[k4] = k3;
  4298.                         ai[k4 + 512] = k3;
  4299.                         ai[k4 + 1024] = k3;
  4300.                         ai[k4 + 1536] = k3;
  4301.                     } else if (k2 == 1) {
  4302.                         ai[k4] = k3;
  4303.                         ai[k4 + 1] = k3;
  4304.                         ai[k4 + 2] = k3;
  4305.                         ai[k4 + 3] = k3;
  4306.                     } else if (k2 == 2) {
  4307.                         ai[k4 + 3] = k3;
  4308.                         ai[k4 + 3 + 512] = k3;
  4309.                         ai[k4 + 3 + 1024] = k3;
  4310.                         ai[k4 + 3 + 1536] = k3;
  4311.                     } else if (k2 == 3) {
  4312.                         ai[k4 + 1536] = k3;
  4313.                         ai[k4 + 1536 + 1] = k3;
  4314.                         ai[k4 + 1536 + 2] = k3;
  4315.                         ai[k4 + 1536 + 3] = k3;
  4316.                     }
  4317.                 if (i3 == 3)
  4318.                     if (k2 == 0)
  4319.                         ai[k4] = k3;
  4320.                     else if (k2 == 1)
  4321.                         ai[k4 + 3] = k3;
  4322.                     else if (k2 == 2)
  4323.                         ai[k4 + 3 + 1536] = k3;
  4324.                     else if (k2 == 3)
  4325.                         ai[k4 + 1536] = k3;
  4326.                 if (i3 == 2)
  4327.                     if (k2 == 3) {
  4328.                         ai[k4] = k3;
  4329.                         ai[k4 + 512] = k3;
  4330.                         ai[k4 + 1024] = k3;
  4331.                         ai[k4 + 1536] = k3;
  4332.                     } else if (k2 == 0) {
  4333.                         ai[k4] = k3;
  4334.                         ai[k4 + 1] = k3;
  4335.                         ai[k4 + 2] = k3;
  4336.                         ai[k4 + 3] = k3;
  4337.                     } else if (k2 == 1) {
  4338.                         ai[k4 + 3] = k3;
  4339.                         ai[k4 + 3 + 512] = k3;
  4340.                         ai[k4 + 3 + 1024] = k3;
  4341.                         ai[k4 + 3 + 1536] = k3;
  4342.                     } else if (k2 == 2) {
  4343.                         ai[k4 + 1536] = k3;
  4344.                         ai[k4 + 1536 + 1] = k3;
  4345.                         ai[k4 + 1536 + 2] = k3;
  4346.                         ai[k4 + 1536 + 3] = k3;
  4347.                     }
  4348.             }
  4349.         }
  4350.         k1 = worldController.method302(j1, l, i);
  4351.         if (k1 != 0) {
  4352.             int i2 = worldController.method304(j1, l, i, k1);
  4353.             int l2 = i2 >> 6 & 3;
  4354.             int j3 = i2 & 0x1f;
  4355.             int l3 = k1 >> 14 & 0x7fff;
  4356.             ObjectDef class46_1 = ObjectDef.forID(l3);
  4357.             if (class46_1.anInt758 != -1) {
  4358.                 Background background_1 = mapScenes[class46_1.anInt758];
  4359.                 if (background_1 != null) {
  4360.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  4361.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  4362.                     background_1.method361(48 + l * 4 + j5, 48
  4363.                             + (104 - i - class46_1.anInt761) * 4 + k5);
  4364.                 }
  4365.             } else if (j3 == 9) {
  4366.                 int l4 = 0xeeeeee;
  4367.                 if (k1 > 0)
  4368.                     l4 = 0xee0000;
  4369.                 int ai1[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  4370.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  4371.                 if (l2 == 0 || l2 == 2) {
  4372.                     ai1[l5 + 1536] = l4;
  4373.                     ai1[l5 + 1024 + 1] = l4;
  4374.                     ai1[l5 + 512 + 2] = l4;
  4375.                     ai1[l5 + 3] = l4;
  4376.                 } else {
  4377.                     ai1[l5] = l4;
  4378.                     ai1[l5 + 512 + 1] = l4;
  4379.                     ai1[l5 + 1024 + 2] = l4;
  4380.                     ai1[l5 + 1536 + 3] = l4;
  4381.                 }
  4382.             }
  4383.         }
  4384.         k1 = worldController.method303(j1, l, i);
  4385.         if (k1 != 0) {
  4386.             int j2 = k1 >> 14 & 0x7fff;
  4387.             ObjectDef class46 = ObjectDef.forID(j2);
  4388.             if (class46.anInt758 != -1) {
  4389.                 Background background = mapScenes[class46.anInt758];
  4390.                 if (background != null) {
  4391.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  4392.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  4393.                     background.method361(48 + l * 4 + i4, 48
  4394.                             + (104 - i - class46.anInt761) * 4 + j4);
  4395.                 }
  4396.             }
  4397.         }
  4398.     }
  4399.  
  4400.     private void loadTitleScreen() {
  4401.         aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  4402.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  4403.         aBackgroundArray1152s = new Background[12];
  4404.         int j = 0;
  4405.         try {
  4406.             j = Integer.parseInt(getParameter("fl_icon"));
  4407.         } catch (Exception _ex) {
  4408.         }
  4409.         if (j == 0) {
  4410.             for (int k = 0; k < 12; k++)
  4411.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader,
  4412.                         "runes", k);
  4413.  
  4414.         } else {
  4415.             for (int l = 0; l < 12; l++)
  4416.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader,
  4417.                         "runes", 12 + (l & 3));
  4418.  
  4419.         }
  4420.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  4421.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  4422.         System.arraycopy(aRSImageProducer_1110.anIntArray315, 0,
  4423.                 aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  4424.  
  4425.         System.arraycopy(aRSImageProducer_1111.anIntArray315, 0,
  4426.                 aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  4427.  
  4428.         anIntArray851 = new int[256];
  4429.         for (int k1 = 0; k1 < 64; k1++)
  4430.             anIntArray851[k1] = k1 * 0x40000;
  4431.  
  4432.         for (int l1 = 0; l1 < 64; l1++)
  4433.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  4434.  
  4435.         for (int i2 = 0; i2 < 64; i2++)
  4436.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  4437.  
  4438.         for (int j2 = 0; j2 < 64; j2++)
  4439.             anIntArray851[j2 + 192] = 0xffffff;
  4440.  
  4441.         anIntArray852 = new int[256];
  4442.         for (int k2 = 0; k2 < 64; k2++)
  4443.             anIntArray852[k2] = k2 * 1024;
  4444.  
  4445.         for (int l2 = 0; l2 < 64; l2++)
  4446.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  4447.  
  4448.         for (int i3 = 0; i3 < 64; i3++)
  4449.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  4450.  
  4451.         for (int j3 = 0; j3 < 64; j3++)
  4452.             anIntArray852[j3 + 192] = 0xffffff;
  4453.  
  4454.         anIntArray853 = new int[256];
  4455.         for (int k3 = 0; k3 < 64; k3++)
  4456.             anIntArray853[k3] = k3 * 4;
  4457.  
  4458.         for (int l3 = 0; l3 < 64; l3++)
  4459.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  4460.  
  4461.         for (int i4 = 0; i4 < 64; i4++)
  4462.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  4463.  
  4464.         for (int j4 = 0; j4 < 64; j4++)
  4465.             anIntArray853[j4 + 192] = 0xffffff;
  4466.  
  4467.         anIntArray850 = new int[256];
  4468.         anIntArray1190 = new int[32768];
  4469.         anIntArray1191 = new int[32768];
  4470.         randomizeBackground(null);
  4471.         anIntArray828 = new int[32768];
  4472.         anIntArray829 = new int[32768];
  4473.         drawLoadingText(10, "Connecting to fileserver");
  4474.         if (!aBoolean831) {
  4475.             drawFlames = true;
  4476.             aBoolean831 = true;
  4477.             startRunnable(this, 2);
  4478.         }
  4479.     }
  4480.  
  4481.         public static void main(String args[]) {
  4482.         try {
  4483.             nodeID = 10;
  4484.             portOff = 0;
  4485.             setHighMem(); //sets high or low detail
  4486.             isMembers = true;
  4487.             signlink.storeid = 32;
  4488.             signlink.startpriv(InetAddress.getLocalHost());
  4489.             instance = new client();
  4490.             instance.createClientFrame(503, 765);//client frame size
  4491.         } catch(Exception e) {
  4492.             e.printStackTrace();
  4493.         }
  4494.     }
  4495.    
  4496.    
  4497.     private static void setHighMem() {
  4498.         /*WorldController.lowMem = false;
  4499.         Texture.lowMem = false;
  4500.         lowMem = false;
  4501.         ObjectManager.lowMem = false;
  4502.         ObjectDef.lowMem = false;*/
  4503.         WorldController.lowMem = true;
  4504.         Texture.lowMem = true;
  4505.         lowMem = false;
  4506.         ObjectManager.lowMem = false;
  4507.         ObjectDef.lowMem = true;
  4508.         System.out.println("Running in highmem");
  4509.     }
  4510.  
  4511.     private void loadingStages() {
  4512.         if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  4513.             aRSImageProducer_1165.initDrawingArea();
  4514.             aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151,
  4515.                     257);
  4516.             aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.",
  4517.                     150, 256);
  4518.             aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  4519.             loadingStage = 1;
  4520.             aLong824 = System.currentTimeMillis();
  4521.         }
  4522.         if (loadingStage == 1) {
  4523.             int j = method54();
  4524.             if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  4525.                 signlink.reporterror(myUsername + " glcfb " + aLong1215 + ","
  4526.                         + j + "," + lowMem + "," + decompressors[0] + ","
  4527.                         + onDemandFetcher.getNodeCount() + "," + plane + ","
  4528.                         + anInt1069 + "," + anInt1070);
  4529.                 aLong824 = System.currentTimeMillis();
  4530.             }
  4531.         }
  4532.         if (loadingStage == 2 && plane != anInt985) {
  4533.             anInt985 = plane;
  4534.             method24(plane);
  4535.         }
  4536.     }
  4537.  
  4538.     private int method54() {
  4539.         for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4540.             if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1)
  4541.                 return -1;
  4542.             if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
  4543.                 return -2;
  4544.         }
  4545.  
  4546.         boolean flag = true;
  4547.         for (int j = 0; j < aByteArrayArray1183.length; j++) {
  4548.             byte abyte0[] = aByteArrayArray1247[j];
  4549.             if (abyte0 != null) {
  4550.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  4551.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  4552.                 if (aBoolean1159) {
  4553.                     k = 10;
  4554.                     l = 10;
  4555.                 }
  4556.                 flag &= ObjectManager.method189(k, abyte0, l);
  4557.             }
  4558.         }
  4559.  
  4560.         if (!flag)
  4561.             return -3;
  4562.         if (aBoolean1080) {
  4563.             return -4;
  4564.         } else {
  4565.             loadingStage = 2;
  4566.             ObjectManager.anInt131 = plane;
  4567.             method22(true);
  4568.             stream.createFrame(121);
  4569.             return 0;
  4570.         }
  4571.     }
  4572.  
  4573.     private void method55() {
  4574.         for (Animable_Sub4 class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  4575.                 .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  4576.                 .reverseGetNext())
  4577.             if (class30_sub2_sub4_sub4.anInt1597 != plane
  4578.                     || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  4579.                 class30_sub2_sub4_sub4.unlink();
  4580.             else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  4581.                 if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  4582.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  4583.                     if (npc != null && npc.x >= 0 && npc.x < 13312
  4584.                             && npc.y >= 0 && npc.y < 13312)
  4585.                         class30_sub2_sub4_sub4.method455(loopCycle, npc.y,
  4586.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  4587.                                         npc.y, npc.x)
  4588.                                         - class30_sub2_sub4_sub4.anInt1583,
  4589.                                 npc.x);
  4590.                 }
  4591.                 if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  4592.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  4593.                     Player player;
  4594.                     if (j == unknownInt10)
  4595.                         player = myPlayer;
  4596.                     else
  4597.                         player = playerArray[j];
  4598.                     if (player != null && player.x >= 0 && player.x < 13312
  4599.                             && player.y >= 0 && player.y < 13312)
  4600.                         class30_sub2_sub4_sub4.method455(loopCycle, player.y,
  4601.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  4602.                                         player.y, player.x)
  4603.                                         - class30_sub2_sub4_sub4.anInt1583,
  4604.                                 player.x);
  4605.                 }
  4606.                 class30_sub2_sub4_sub4.method456(anInt945);
  4607.                 worldController.method285(plane,
  4608.                         class30_sub2_sub4_sub4.anInt1595,
  4609.                         (int) class30_sub2_sub4_sub4.aDouble1587, -1,
  4610.                         (int) class30_sub2_sub4_sub4.aDouble1586, 60,
  4611.                         (int) class30_sub2_sub4_sub4.aDouble1585,
  4612.                         class30_sub2_sub4_sub4, false);
  4613.             }
  4614.  
  4615.     }
  4616.  
  4617.     public AppletContext getAppletContext() {
  4618.         if (signlink.mainapp != null)
  4619.             return signlink.mainapp.getAppletContext();
  4620.         else
  4621.             return super.getAppletContext();
  4622.     }
  4623.  
  4624.     private void drawLogo() {
  4625.         byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  4626.         Sprite sprite = new Sprite(abyte0, this);
  4627.         aRSImageProducer_1110.initDrawingArea();
  4628.         sprite.method346(0, 0);
  4629.         aRSImageProducer_1111.initDrawingArea();
  4630.         sprite.method346(-637, 0);
  4631.         aRSImageProducer_1107.initDrawingArea();
  4632.         sprite.method346(-128, 0);
  4633.         aRSImageProducer_1108.initDrawingArea();
  4634.         sprite.method346(-202, -371);
  4635.         aRSImageProducer_1109.initDrawingArea();
  4636.         sprite.method346(-202, -171);
  4637.         aRSImageProducer_1112.initDrawingArea();
  4638.         sprite.method346(0, -265);
  4639.         aRSImageProducer_1113.initDrawingArea();
  4640.         sprite.method346(-562, -265);
  4641.         aRSImageProducer_1114.initDrawingArea();
  4642.         sprite.method346(-128, -171);
  4643.         aRSImageProducer_1115.initDrawingArea();
  4644.         sprite.method346(-562, -171);
  4645.         int ai[] = new int[sprite.myWidth];
  4646.         for (int j = 0; j < sprite.myHeight; j++) {
  4647.             for (int k = 0; k < sprite.myWidth; k++)
  4648.                 ai[k] = sprite.myPixels[(sprite.myWidth - k - 1)
  4649.                         + sprite.myWidth * j];
  4650.  
  4651.             System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j,
  4652.                     sprite.myWidth);
  4653.         }
  4654.  
  4655.         sprite = null;
  4656.         Object obj = null;
  4657.         Object obj1 = null;
  4658.         System.gc();
  4659.     }
  4660.  
  4661.     private void processOnDemandQueue() {
  4662.         do {
  4663.             OnDemandData onDemandData;
  4664.             do {
  4665.                 onDemandData = onDemandFetcher.getNextNode();
  4666.                 if (onDemandData == null)
  4667.                     return;
  4668.                 if (onDemandData.dataType == 0) {
  4669.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  4670.                     // if((onDemandFetcher.getModelIndex(onDemandData.ID) &
  4671.                     // 0x62) != 0)
  4672.                     // {
  4673.                     needDrawTabArea = true;
  4674.                     if (backDialogID != -1)
  4675.                         inputTaken = true;
  4676.                     // }
  4677.                 }
  4678.                 if (onDemandData.dataType == 1 && onDemandData.buffer != null)
  4679.                     Class36.readCacheFile(onDemandData.buffer, onDemandData.ID);
  4680.                 if (onDemandData.dataType == 2 && onDemandData.ID == nextSong
  4681.                         && onDemandData.buffer != null)
  4682.                     saveMidi(songChanging, onDemandData.buffer);
  4683.                 if (onDemandData.dataType == 3 && loadingStage == 1) {
  4684.                     for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4685.                         if (anIntArray1235[i] == onDemandData.ID) {
  4686.                             aByteArrayArray1183[i] = onDemandData.buffer;
  4687.                             if (onDemandData.buffer == null)
  4688.                                 anIntArray1235[i] = -1;
  4689.                             break;
  4690.                         }
  4691.                         if (anIntArray1236[i] != onDemandData.ID)
  4692.                             continue;
  4693.                         aByteArrayArray1247[i] = onDemandData.buffer;
  4694.                         if (onDemandData.buffer == null)
  4695.                             anIntArray1236[i] = -1;
  4696.                         break;
  4697.                     }
  4698.  
  4699.                 }
  4700.                 // if(onDemandData.dataType == 1 && onDemandData.buffer != null)
  4701.                 // Class36.method529(onDemandData.buffer);
  4702.             } while (onDemandData.dataType != 93
  4703.                     || !onDemandFetcher.method564(onDemandData.ID));
  4704.             ObjectManager.method173(new Stream(onDemandData.buffer),
  4705.                     onDemandFetcher);
  4706.         } while (true);
  4707.     }
  4708.  
  4709.     private void calcFlamesPosition() {
  4710.         char c = '\u0100';
  4711.         for (int j = 10; j < 117; j++) {
  4712.             int k = (int) (Math.random() * 100D);
  4713.             if (k < 50)
  4714.                 anIntArray828[j + (c - 2 << 7)] = 255;
  4715.         }
  4716.         for (int l = 0; l < 100; l++) {
  4717.             int i1 = (int) (Math.random() * 124D) + 2;
  4718.             int k1 = (int) (Math.random() * 128D) + 128;
  4719.             int k2 = i1 + (k1 << 7);
  4720.             anIntArray828[k2] = 192;
  4721.         }
  4722.  
  4723.         for (int j1 = 1; j1 < c - 1; j1++) {
  4724.             for (int l1 = 1; l1 < 127; l1++) {
  4725.                 int l2 = l1 + (j1 << 7);
  4726.                 anIntArray829[l2] = (anIntArray828[l2 - 1]
  4727.                         + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  4728.             }
  4729.  
  4730.         }
  4731.  
  4732.         anInt1275 += 128;
  4733.         if (anInt1275 > anIntArray1190.length) {
  4734.             anInt1275 -= anIntArray1190.length;
  4735.             int i2 = (int) (Math.random() * 12D);
  4736.             randomizeBackground(aBackgroundArray1152s[i2]);
  4737.         }
  4738.         for (int j2 = 1; j2 < c - 1; j2++) {
  4739.             for (int i3 = 1; i3 < 127; i3++) {
  4740.                 int k3 = i3 + (j2 << 7);
  4741.                 int i4 = anIntArray829[k3 + 128]
  4742.                         - anIntArray1190[k3 + anInt1275 & anIntArray1190.length
  4743.                                 - 1] / 5;
  4744.                 if (i4 < 0)
  4745.                     i4 = 0;
  4746.                 anIntArray828[k3] = i4;
  4747.             }
  4748.  
  4749.         }
  4750.  
  4751.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  4752.  
  4753.         anIntArray969[c - 1] = (int) (Math.sin((double) loopCycle / 14D) * 16D
  4754.                 + Math.sin((double) loopCycle / 15D) * 14D + Math
  4755.                 .sin((double) loopCycle / 16D) * 12D);
  4756.         if (anInt1040 > 0)
  4757.             anInt1040 -= 4;
  4758.         if (anInt1041 > 0)
  4759.             anInt1041 -= 4;
  4760.         if (anInt1040 == 0 && anInt1041 == 0) {
  4761.             int l3 = (int) (Math.random() * 2000D);
  4762.             if (l3 == 0)
  4763.                 anInt1040 = 1024;
  4764.             if (l3 == 1)
  4765.                 anInt1041 = 1024;
  4766.         }
  4767.     }
  4768.  
  4769.     private boolean saveWave(byte abyte0[], int i) {
  4770.         return abyte0 == null || signlink.wavesave(abyte0, i);
  4771.     }
  4772.  
  4773.     private void method60(int i) {
  4774.         RSInterface class9 = RSInterface.interfaceCache[i];
  4775.         for (int j = 0; j < class9.children.length; j++) {
  4776.             if (class9.children[j] == -1)
  4777.                 break;
  4778.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  4779.             if (class9_1.type == 1)
  4780.                 method60(class9_1.id);
  4781.             class9_1.anInt246 = 0;
  4782.             class9_1.anInt208 = 0;
  4783.         }
  4784.     }
  4785.  
  4786.     private void drawHeadIcon() {
  4787.         if (anInt855 != 2)
  4788.             return;
  4789.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2,
  4790.                 (anInt935 - baseY << 7) + anInt938);
  4791.         if (spriteDrawX > -1 && loopCycle % 20 < 10)
  4792.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  4793.     }
  4794.  
  4795.     public boolean withinDistance(int x1, int y1, int x2, int y2, int dis) {
  4796.         for (int i = 0; i <= dis; i++) {
  4797.             if ((x1 + i) == x2
  4798.                     && ((y1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  4799.                 return true;
  4800.             else if ((x1 - i) == x2
  4801.                     && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  4802.                 return true;
  4803.             else if (x1 == x2 && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  4804.                 return true;
  4805.         }
  4806.         return false;
  4807.     }
  4808.  
  4809.     public int getDis(int coordX1, int coordY1, int coordX2, int coordY2) {
  4810.         int deltaX = coordX2 - coordX1;
  4811.         int deltaY = coordY2 - coordY1;
  4812.         return ((int) Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)));
  4813.     }
  4814.  
  4815.     public int random(int range) {
  4816.         return (int) (Math.random() * range);
  4817.     }
  4818.  
  4819.     public int canWalkDelay = 0;
  4820.  
  4821.     private void mainGameProcessor() {
  4822.         if (anInt1104 > 1)
  4823.             anInt1104--;
  4824.         if (anInt1011 > 0)
  4825.             anInt1011--;
  4826.         for (int j = 0; j < 5; j++)
  4827.             if (!parsePacket())
  4828.                 break;
  4829.  
  4830.         if (!loggedIn)
  4831.             return;
  4832.         /*
  4833.          * canWalkDelay--; if (followNPC > 0) { NPC n = npcArray[followNPC]; if
  4834.          * (n != null) { if (!withinDistance(myPlayer.smallX[0],
  4835.          * myPlayer.smallY[0], n.smallX[0], n.smallY[0], followDistance)) {
  4836.          * doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, n.smallY[0],
  4837.          * myPlayer.smallX[0], false, n.smallX[0],true); } } } else if
  4838.          * (followPlayer > 0 && canWalkDelay <= 0) { Player p =
  4839.          * playerArray[followPlayer]; if (p != null) { int dis =
  4840.          * getDis(myPlayer.smallX[0], myPlayer.smallY[0], p.smallX[0],
  4841.          * p.smallY[0]); if (dis > followDistance) { doWalkTo2(2, 0, 1, 0,
  4842.          * myPlayer.smallY[0], followDistance, 0, p.smallY[0],
  4843.          * myPlayer.smallX[0], false, p.smallX[0],true); canWalkDelay = 30; }
  4844.          * else if (dis == 0) { int rnd = random(4); if (rnd == 0) {
  4845.          * doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0],
  4846.          * myPlayer.smallX[0], false, p.smallX[0] - 2,true); } else if (rnd ==
  4847.          * 1) { doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0],
  4848.          * myPlayer.smallX[0], false, p.smallX[0] + 2,true); } else if (rnd ==
  4849.          * 2) { doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0] - 2,
  4850.          * myPlayer.smallX[0], false, p.smallX[0],true); } else if (rnd == 3) {
  4851.          * doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0] + 2,
  4852.          * myPlayer.smallX[0], false, p.smallX[0],true); } canWalkDelay = 60; }
  4853.          * } }
  4854.          */
  4855.         synchronized (mouseDetection.syncObject) {
  4856.             if (flagged) {
  4857.                 if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
  4858.                     stream.createFrame(45);
  4859.                     stream.writeWordBigEndian(0);
  4860.                     int j2 = stream.currentOffset;
  4861.                     int j3 = 0;
  4862.                     for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
  4863.                         if (j2 - stream.currentOffset >= 240)
  4864.                             break;
  4865.                         j3++;
  4866.                         int l4 = mouseDetection.coordsY[j4];
  4867.                         if (l4 < 0)
  4868.                             l4 = 0;
  4869.                         else if (l4 > 502)
  4870.                             l4 = 502;
  4871.                         int k5 = mouseDetection.coordsX[j4];
  4872.                         if (k5 < 0)
  4873.                             k5 = 0;
  4874.                         else if (k5 > 764)
  4875.                             k5 = 764;
  4876.                         int i6 = l4 * 765 + k5;
  4877.                         if (mouseDetection.coordsY[j4] == -1
  4878.                                 && mouseDetection.coordsX[j4] == -1) {
  4879.                             k5 = -1;
  4880.                             l4 = -1;
  4881.                             i6 = 0x7ffff;
  4882.                         }
  4883.                         if (k5 == anInt1237 && l4 == anInt1238) {
  4884.                             if (anInt1022 < 2047)
  4885.                                 anInt1022++;
  4886.                         } else {
  4887.                             int j6 = k5 - anInt1237;
  4888.                             anInt1237 = k5;
  4889.                             int k6 = l4 - anInt1238;
  4890.                             anInt1238 = l4;
  4891.                             if (anInt1022 < 8 && j6 >= -32 && j6 <= 31
  4892.                                     && k6 >= -32 && k6 <= 31) {
  4893.                                 j6 += 32;
  4894.                                 k6 += 32;
  4895.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6)
  4896.                                         + k6);
  4897.                                 anInt1022 = 0;
  4898.                             } else if (anInt1022 < 8) {
  4899.                                 stream.writeDWordBigEndian(0x800000
  4900.                                         + (anInt1022 << 19) + i6);
  4901.                                 anInt1022 = 0;
  4902.                             } else {
  4903.                                 stream.writeDWord(0xc0000000
  4904.                                         + (anInt1022 << 19) + i6);
  4905.                                 anInt1022 = 0;
  4906.                             }
  4907.                         }
  4908.                     }
  4909.  
  4910.                     stream.writeBytes(stream.currentOffset - j2);
  4911.                     if (j3 >= mouseDetection.coordsIndex) {
  4912.                         mouseDetection.coordsIndex = 0;
  4913.                     } else {
  4914.                         mouseDetection.coordsIndex -= j3;
  4915.                         for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
  4916.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5
  4917.                                     + j3];
  4918.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5
  4919.                                     + j3];
  4920.                         }
  4921.  
  4922.                     }
  4923.                 }
  4924.             } else {
  4925.                 mouseDetection.coordsIndex = 0;
  4926.             }
  4927.         }
  4928.         if (super.clickMode3 != 0) {
  4929.             long l = (super.aLong29 - aLong1220) / 50L;
  4930.             if (l > 4095L)
  4931.                 l = 4095L;
  4932.             aLong1220 = super.aLong29;
  4933.             int k2 = super.saveClickY;
  4934.             if (k2 < 0)
  4935.                 k2 = 0;
  4936.             else if (k2 > 502)
  4937.                 k2 = 502;
  4938.             int k3 = super.saveClickX;
  4939.             if (k3 < 0)
  4940.                 k3 = 0;
  4941.             else if (k3 > 764)
  4942.                 k3 = 764;
  4943.             int k4 = k2 * 765 + k3;
  4944.             int j5 = 0;
  4945.             if (super.clickMode3 == 2)
  4946.                 j5 = 1;
  4947.             int l5 = (int) l;
  4948.             stream.createFrame(241);
  4949.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  4950.         }
  4951.         if (anInt1016 > 0)
  4952.             anInt1016--;
  4953.         if (super.keyArray[1] == 1 || super.keyArray[2] == 1
  4954.                 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  4955.             aBoolean1017 = true;
  4956.         if (aBoolean1017 && anInt1016 <= 0) {
  4957.             anInt1016 = 20;
  4958.             aBoolean1017 = false;
  4959.             stream.createFrame(86);
  4960.             stream.writeWord(anInt1184);
  4961.             stream.method432(minimapInt1);
  4962.         }
  4963.         if (super.awtFocus && !aBoolean954) {
  4964.             aBoolean954 = true;
  4965.             stream.createFrame(3);
  4966.             stream.writeWordBigEndian(1);
  4967.         }
  4968.         if (!super.awtFocus && aBoolean954) {
  4969.             aBoolean954 = false;
  4970.             stream.createFrame(3);
  4971.             stream.writeWordBigEndian(0);
  4972.         }
  4973.         loadingStages();
  4974.         method115();
  4975.         method90(false);
  4976.         anInt1009++;
  4977.         if (anInt1009 > 750)
  4978.             dropClient();
  4979.         method114();
  4980.         method95();
  4981.         method38();
  4982.         anInt945++;
  4983.         if (crossType != 0) {
  4984.             crossIndex += 20;
  4985.             if (crossIndex >= 400)
  4986.                 crossType = 0;
  4987.         }
  4988.         if (atInventoryInterfaceType != 0) {
  4989.             do {
  4990.                 atInventoryLoopCycle++;
  4991.                 // if(atInventoryLoopCycle >= 15)
  4992.                 // {
  4993.                 if (atInventoryInterfaceType == 2)
  4994.                     needDrawTabArea = true;
  4995.                 if (atInventoryInterfaceType == 3)
  4996.                     inputTaken = true;
  4997.                 atInventoryInterfaceType = 0;
  4998.                 // }
  4999.             } while (atInventoryLoopCycle >= 15);
  5000.         }
  5001.         if (activeInterfaceType != 0) {
  5002.             anInt989++;
  5003.             if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5
  5004.                     || super.mouseY > anInt1088 + 5
  5005.                     || super.mouseY < anInt1088 - 5)
  5006.                 aBoolean1242 = true;
  5007.             if (super.clickMode2 == 0) {
  5008.            
  5009.                 if (activeInterfaceType == 2)
  5010.                     needDrawTabArea = true;
  5011.                 if (activeInterfaceType == 3)
  5012.                     inputTaken = true;
  5013.                 activeInterfaceType = 0;
  5014.                 if (aBoolean1242 && anInt989 >= 10) {
  5015.                     lastActiveInvInterface = -1;
  5016.                     processRightClick();
  5017.                     if (lastActiveInvInterface == anInt1084
  5018.                             && mouseInvInterfaceIndex != anInt1085) {
  5019.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  5020.                         int j1 = 0;
  5021.                         if (anInt913 == 1 && class9.contentType == 206)
  5022.                             j1 = 1;
  5023.                         if (class9.inv[mouseInvInterfaceIndex] <= 0)
  5024.                             j1 = 0;
  5025.                         if (class9.aBoolean235) {
  5026.                             int l2 = anInt1085;
  5027.                             int l3 = mouseInvInterfaceIndex;
  5028.                             class9.inv[l3] = class9.inv[l2];
  5029.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  5030.                             class9.inv[l2] = -1;
  5031.                             class9.invStackSizes[l2] = 0;
  5032.                         } else if (j1 == 1) {
  5033.                             int i3 = anInt1085;
  5034.                             for (int i4 = mouseInvInterfaceIndex; i3 != i4;)
  5035.                                 if (i3 > i4) {
  5036.                                     class9.swapInventoryItems(i3, i3 - 1);
  5037.                                     i3--;
  5038.                                 //  System.out.println("test: " + anInt989);
  5039.                                 } else if (i3 < i4) {
  5040.                                     class9.swapInventoryItems(i3, i3 + 1);
  5041.                                     //System.out.println("test: " + i3);
  5042.                                     i3++;
  5043.                                 }
  5044.  
  5045.                         } else {
  5046.                             class9.swapInventoryItems(anInt1085,
  5047.                                     mouseInvInterfaceIndex);
  5048.                                
  5049.                                 //  System.out.println("test: " + anInt989);
  5050.                         }
  5051.                     //invSelected = true;
  5052.                     //  System.out.println("test: " + anInt989);
  5053.                         stream.createFrame(214);
  5054.                         stream.method433(anInt1084);
  5055.                         stream.method424(j1);
  5056.                         stream.method433(anInt1085);
  5057.                         stream.method431(mouseInvInterfaceIndex);
  5058.                     }
  5059.                 } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
  5060.                         && menuActionRow > 2)
  5061.                     determineMenuSize();
  5062.                 else if (menuActionRow > 0)
  5063.                     doAction(menuActionRow - 1);
  5064.                 atInventoryLoopCycle = 10;
  5065.                 super.clickMode3 = 0;
  5066.             }
  5067.         }
  5068.         if (WorldController.anInt470 != -1) {
  5069.             int k = WorldController.anInt470;
  5070.             int k1 = WorldController.anInt471;
  5071.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1,
  5072.                     myPlayer.smallX[0], true, k);
  5073.             WorldController.anInt470 = -1;
  5074.             if (flag) {
  5075.                 crossX = super.saveClickX;
  5076.                 crossY = super.saveClickY;
  5077.                 crossType = 1;
  5078.                 crossIndex = 0;
  5079.             }
  5080.         }
  5081.         if (super.clickMode3 == 1 && aString844 != null) {
  5082.             aString844 = null;
  5083.             inputTaken = true;
  5084.             super.clickMode3 = 0;
  5085.         }
  5086.         processMenuClick();
  5087.         processMainScreenClick();
  5088.         processTabClick();
  5089.         processMapAreaClick();
  5090.         processChatModeClick();
  5091.         if (super.clickMode2 == 1 || super.clickMode3 == 1)
  5092.             anInt1213++;
  5093.         if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  5094.             if (anInt1501 < 100) {
  5095.                 anInt1501++;
  5096.                 if (anInt1501 == 100) {
  5097.                     if (anInt1500 != 0) {
  5098.                         inputTaken = true;
  5099.                     }
  5100.                     if (anInt1044 != 0) {
  5101.                         needDrawTabArea = true;
  5102.                     }
  5103.                 }
  5104.             }
  5105.         } else if (anInt1501 > 0) {
  5106.             anInt1501--;
  5107.         }
  5108.         if (loadingStage == 2)
  5109.             method108();
  5110.         if (loadingStage == 2 && aBoolean1160)
  5111.             calcCameraPos();
  5112.         for (int i1 = 0; i1 < 5; i1++)
  5113.             anIntArray1030[i1]++;
  5114.  
  5115.         method73();
  5116.         super.idleTime++;
  5117.         if (super.idleTime > 15000) {
  5118.             anInt1011 = 250;
  5119.             super.idleTime -= 500;
  5120.             stream.createFrame(202);
  5121.         }
  5122.         anInt988++;
  5123.         if (anInt988 > 500) {
  5124.             anInt988 = 0;
  5125.             int l1 = (int) (Math.random() * 8D);
  5126.             if ((l1 & 1) == 1)
  5127.                 anInt1278 += anInt1279;
  5128.             if ((l1 & 2) == 2)
  5129.                 anInt1131 += anInt1132;
  5130.             if ((l1 & 4) == 4)
  5131.                 anInt896 += anInt897;
  5132.         }
  5133.         if (anInt1278 < -50)
  5134.             anInt1279 = 2;
  5135.         if (anInt1278 > 50)
  5136.             anInt1279 = -2;
  5137.         if (anInt1131 < -55)
  5138.             anInt1132 = 2;
  5139.         if (anInt1131 > 55)
  5140.             anInt1132 = -2;
  5141.         if (anInt896 < -40)
  5142.             anInt897 = 1;
  5143.         if (anInt896 > 40)
  5144.             anInt897 = -1;
  5145.         anInt1254++;
  5146.         if (anInt1254 > 500) {
  5147.             anInt1254 = 0;
  5148.             int i2 = (int) (Math.random() * 8D);
  5149.             if ((i2 & 1) == 1)
  5150.                 minimapInt2 += anInt1210;
  5151.             if ((i2 & 2) == 2)
  5152.                 minimapInt3 += anInt1171;
  5153.         }
  5154.         if (minimapInt2 < -60)
  5155.             anInt1210 = 2;
  5156.         if (minimapInt2 > 60)
  5157.             anInt1210 = -2;
  5158.         if (minimapInt3 < -20)
  5159.             anInt1171 = 1;
  5160.         if (minimapInt3 > 10)
  5161.             anInt1171 = -1;
  5162.         anInt1010++;
  5163.         if (anInt1010 > 50)
  5164.             stream.createFrame(0);
  5165.         try {
  5166.             if (socketStream != null && stream.currentOffset > 0) {
  5167.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  5168.                 stream.currentOffset = 0;
  5169.                 anInt1010 = 0;
  5170.             }
  5171.         } catch (IOException _ex) {
  5172.             dropClient();
  5173.         } catch (Exception exception) {
  5174.             resetLogout();
  5175.         }
  5176.     }
  5177.  
  5178.     private void method63() {
  5179.         Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  5180.                 .reverseGetFirst();
  5181.         for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  5182.                 .reverseGetNext())
  5183.             if (class30_sub1.anInt1294 == -1) {
  5184.                 class30_sub1.anInt1302 = 0;
  5185.                 method89(class30_sub1);
  5186.             } else {
  5187.                 class30_sub1.unlink();
  5188.             }
  5189.  
  5190.     }
  5191.  
  5192.     private void resetImageProducers() {
  5193.         if (aRSImageProducer_1107 != null)
  5194.             return;
  5195.         super.fullGameScreen = null;
  5196.         aRSImageProducer_1166 = null;
  5197.         aRSImageProducer_1164 = null;
  5198.         aRSImageProducer_1163 = null;
  5199.         aRSImageProducer_1165 = null;
  5200.         aRSImageProducer_1123 = null;
  5201.         aRSImageProducer_1124 = null;
  5202.         aRSImageProducer_1125 = null;
  5203.         aRSImageProducer_1110 = new RSImageProducer(128, 265,
  5204.                 getGameComponent());
  5205.         DrawingArea.setAllPixelsToZero();
  5206.         aRSImageProducer_1111 = new RSImageProducer(128, 265,
  5207.                 getGameComponent());
  5208.         DrawingArea.setAllPixelsToZero();
  5209.         aRSImageProducer_1107 = new RSImageProducer(509, 171,
  5210.                 getGameComponent());
  5211.         DrawingArea.setAllPixelsToZero();
  5212.         aRSImageProducer_1108 = new RSImageProducer(360, 132,
  5213.                 getGameComponent());
  5214.         DrawingArea.setAllPixelsToZero();
  5215.         aRSImageProducer_1109 = new RSImageProducer(360, 200,
  5216.                 getGameComponent());
  5217.         DrawingArea.setAllPixelsToZero();
  5218.         aRSImageProducer_1112 = new RSImageProducer(202, 238,
  5219.                 getGameComponent());
  5220.         DrawingArea.setAllPixelsToZero();
  5221.         aRSImageProducer_1113 = new RSImageProducer(203, 238,
  5222.                 getGameComponent());
  5223.         DrawingArea.setAllPixelsToZero();
  5224.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  5225.         DrawingArea.setAllPixelsToZero();
  5226.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  5227.         DrawingArea.setAllPixelsToZero();
  5228.         if (titleStreamLoader != null) {
  5229.             drawLogo();
  5230.             loadTitleScreen();
  5231.         }
  5232.         welcomeScreenRaised = true;
  5233.     }
  5234.  
  5235.     void drawLoadingText(int i, String s) {
  5236.         anInt1079 = i;
  5237.         aString1049 = s;
  5238.         resetImageProducers();
  5239.         if (titleStreamLoader == null) {
  5240.             super.drawLoadingText(i, s);
  5241.             return;
  5242.         }
  5243.         aRSImageProducer_1109.initDrawingArea();
  5244.         char c = '\u0168';
  5245.         char c1 = '\310';
  5246.         byte byte1 = 20;
  5247.         chatTextDrawingArea.drawText(0xffffff,
  5248.                 "DarkWorldPk is loading - please wait...",
  5249.                 c1 / 2 - 26 - byte1, c / 2);
  5250.         int j = c1 / 2 - 18 - byte1;
  5251.         DrawingArea.fillPixels(c / 2 - 152, 304, 34, 0x8c1111, j);
  5252.         DrawingArea.fillPixels(c / 2 - 151, 302, 32, 0, j + 1);
  5253.         DrawingArea.drawPixels(30, j + 2, c / 2 - 150, 0x8c1111, i * 3);
  5254.         DrawingArea
  5255.                 .drawPixels(30, j + 2, (c / 2 - 150) + i * 3, 0, 300 - i * 3);
  5256.         chatTextDrawingArea.drawText(0xffffff, s, (c1 / 2 + 5) - byte1, c / 2);
  5257.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  5258.         if (welcomeScreenRaised) {
  5259.             welcomeScreenRaised = false;
  5260.             if (!aBoolean831) {
  5261.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  5262.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  5263.             }
  5264.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  5265.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  5266.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  5267.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  5268.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  5269.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  5270.         }
  5271.     }
  5272.  
  5273.     private void method65(int i, int j, int k, int l, RSInterface class9,
  5274.             int i1, boolean flag, int j1) {
  5275.         int anInt992;
  5276.         if (aBoolean972)
  5277.             anInt992 = 32;
  5278.         else
  5279.             anInt992 = 0;
  5280.         aBoolean972 = false;
  5281.         if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  5282.             class9.scrollPosition -= anInt1213 * 4;
  5283.             if (flag) {
  5284.                 needDrawTabArea = true;
  5285.             }
  5286.         } else if (k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  5287.             class9.scrollPosition += anInt1213 * 4;
  5288.             if (flag) {
  5289.                 needDrawTabArea = true;
  5290.             }
  5291.         } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16
  5292.                 && l < (i1 + j) - 16 && anInt1213 > 0) {
  5293.             int l1 = ((j - 32) * j) / j1;
  5294.             if (l1 < 8)
  5295.                 l1 = 8;
  5296.             int i2 = l - i1 - 16 - l1 / 2;
  5297.             int j2 = j - 32 - l1;
  5298.             class9.scrollPosition = ((j1 - j) * i2) / j2;
  5299.             if (flag)
  5300.                 needDrawTabArea = true;
  5301.             aBoolean972 = true;
  5302.         }
  5303.     }
  5304.  
  5305.     private boolean method66(int i, int j, int k) {
  5306.         int i1 = i >> 14 & 0x7fff;
  5307.         int j1 = worldController.method304(plane, k, j, i);
  5308.         if (j1 == -1)
  5309.             return false;
  5310.         int k1 = j1 & 0x1f;
  5311.         int l1 = j1 >> 6 & 3;
  5312.         if (k1 == 10 || k1 == 11 || k1 == 22) {
  5313.             ObjectDef class46 = ObjectDef.forID(i1);
  5314.             int i2;
  5315.             int j2;
  5316.             if (l1 == 0 || l1 == 2) {
  5317.                 i2 = class46.anInt744;
  5318.                 j2 = class46.anInt761;
  5319.             } else {
  5320.                 i2 = class46.anInt761;
  5321.                 j2 = class46.anInt744;
  5322.             }
  5323.             int k2 = class46.anInt768;
  5324.             if (l1 != 0)
  5325.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  5326.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j,
  5327.                     myPlayer.smallX[0], false, k);
  5328.         } else {
  5329.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j,
  5330.                     myPlayer.smallX[0], false, k);
  5331.         }
  5332.         crossX = super.saveClickX;
  5333.         crossY = super.saveClickY;
  5334.         crossType = 2;
  5335.         crossIndex = 0;
  5336.         return true;
  5337.     }
  5338.  
  5339.     private StreamLoader streamLoaderForName(int i, String s, String s1, int j,
  5340.             int k) {
  5341.         byte abyte0[] = null;
  5342.         int l = 5;
  5343.         try {
  5344.             if (decompressors[0] != null)
  5345.                 abyte0 = decompressors[0].decompress(i);
  5346.         } catch (Exception _ex) {
  5347.         }
  5348.         if (abyte0 != null) {
  5349.             // aCRC32_930.reset();
  5350.             // aCRC32_930.update(abyte0);
  5351.             // int i1 = (int)aCRC32_930.getValue();
  5352.             // if(i1 != j)
  5353.         }
  5354.         if (abyte0 != null) {
  5355.             StreamLoader streamLoader = new StreamLoader(abyte0);
  5356.             return streamLoader;
  5357.         }
  5358.         int j1 = 0;
  5359.         while (abyte0 == null) {
  5360.             String s2 = "Unknown error";
  5361.             drawLoadingText(k, "Requesting " + s);
  5362.             Object obj = null;
  5363.             try {
  5364.                 int k1 = 0;
  5365.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  5366.                 byte abyte1[] = new byte[6];
  5367.                 datainputstream.readFully(abyte1, 0, 6);
  5368.                 Stream stream = new Stream(abyte1);
  5369.                 stream.currentOffset = 3;
  5370.                 int i2 = stream.read3Bytes() + 6;
  5371.                 int j2 = 6;
  5372.                 abyte0 = new byte[i2];
  5373.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  5374.  
  5375.                 while (j2 < i2) {
  5376.                     int l2 = i2 - j2;
  5377.                     if (l2 > 1000)
  5378.                         l2 = 1000;
  5379.                     int j3 = datainputstream.read(abyte0, j2, l2);
  5380.                     if (j3 < 0) {
  5381.                         s2 = "Length error: " + j2 + "/" + i2;
  5382.                         throw new IOException("EOF");
  5383.                     }
  5384.                     j2 += j3;
  5385.                     int k3 = (j2 * 100) / i2;
  5386.                     if (k3 != k1)
  5387.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  5388.                     k1 = k3;
  5389.                 }
  5390.                 datainputstream.close();
  5391.                 try {
  5392.                     if (decompressors[0] != null)
  5393.                         decompressors[0].method234(abyte0.length, abyte0, i);
  5394.                 } catch (Exception _ex) {
  5395.                     decompressors[0] = null;
  5396.                 }
  5397.                 /*
  5398.                  * if(abyte0 != null) { aCRC32_930.reset();
  5399.                  * aCRC32_930.update(abyte0); int i3 =
  5400.                  * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  5401.                  * j1++; s2 = "Checksum error: " + i3; } }
  5402.                  */
  5403.             } catch (IOException ioexception) {
  5404.             ioexception.printStackTrace();
  5405.                 if (s2.equals("Unknown error"))
  5406.                     s2 = "Connection error";
  5407.                 abyte0 = null;
  5408.             } catch (NullPointerException _ex) {
  5409.                 s2 = "Null error";
  5410.                 abyte0 = null;
  5411.                 if (!signlink.reporterror)
  5412.                     return null;
  5413.             } catch (ArrayIndexOutOfBoundsException _ex) {
  5414.                 s2 = "Bounds error";
  5415.                 abyte0 = null;
  5416.                 if (!signlink.reporterror)
  5417.                     return null;
  5418.             } catch (Exception _ex) {
  5419.                 s2 = "Unexpected error";
  5420.                 abyte0 = null;
  5421.                 if (!signlink.reporterror)
  5422.                     return null;
  5423.             }
  5424.             if (abyte0 == null) {
  5425.                 for (int l1 = l; l1 > 0; l1--) {
  5426.                     if (j1 >= 3) {
  5427.                         drawLoadingText(k, "Game updated - please reload page");
  5428.                         l1 = 10;
  5429.                     } else {
  5430.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  5431.                     }
  5432.                     try {
  5433.                         Thread.sleep(1000L);
  5434.                     } catch (Exception _ex) {
  5435.                     }
  5436.                 }
  5437.  
  5438.                 l *= 2;
  5439.                 if (l > 60)
  5440.                     l = 60;
  5441.                 aBoolean872 = !aBoolean872;
  5442.             }
  5443.  
  5444.         }
  5445.  
  5446.         StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  5447.         return streamLoader_1;
  5448.     }
  5449.  
  5450.     private void dropClient() {
  5451.         if (anInt1011 > 0) {
  5452.             resetLogout();
  5453.             return;
  5454.         }
  5455.         aRSImageProducer_1165.initDrawingArea();
  5456.         aTextDrawingArea_1271.drawText(0, "Connection lost", 144, 257);
  5457.         aTextDrawingArea_1271.drawText(0xffffff, "Connection lost", 143, 256);
  5458.         aTextDrawingArea_1271.drawText(0,
  5459.                 "Please wait - attempting to reestablish", 159, 257);
  5460.         aTextDrawingArea_1271.drawText(0xffffff,
  5461.                 "Please wait - attempting to reestablish", 158, 256);
  5462.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  5463.         anInt1021 = 0;
  5464.         destX = 0;
  5465.         RSSocket rsSocket = socketStream;
  5466.         loggedIn = false;
  5467.         loginFailures = 0;
  5468.         login(myUsername, myPassword, true);
  5469.         stopMidi();
  5470.         currentSong = -1;
  5471.         nextSong = -1;
  5472.         prevSong = 0;
  5473.         if (!loggedIn)
  5474.             resetLogout();
  5475.         try {
  5476.             rsSocket.close();
  5477.         }
  5478.  
  5479.         catch (Exception _ex) {
  5480.         }
  5481.     }
  5482.  
  5483.     private void doAction(int i) {
  5484.         if (i < 0)
  5485.             return;
  5486.         if (inputDialogState != 0) {
  5487.             inputDialogState = 0;
  5488.             inputTaken = true;
  5489.         }
  5490.         int j = menuActionCmd2[i];
  5491.         int k = menuActionCmd3[i];
  5492.         int l = menuActionID[i];
  5493.         int i1 = menuActionCmd1[i];
  5494.         if (l >= 2000)
  5495.             l -= 2000;
  5496.         if (l == 476) {
  5497.             alertHandler.close();
  5498.         }
  5499.         if (l == 474) {
  5500.             counterOn = !counterOn;
  5501.         }
  5502.         if (l == 475) {
  5503.             xpCounter = 0;
  5504.         }
  5505.         if (l == 582) {
  5506.             NPC npc = npcArray[i1];
  5507.             if (npc != null) {
  5508.                 doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0],
  5509.                         myPlayer.smallX[0], false, npc.smallX[0], true);
  5510.                 crossX = super.saveClickX;
  5511.                 crossY = super.saveClickY;
  5512.                 crossType = 2;
  5513.                 crossIndex = 0;
  5514.                 stream.createFrame(57);
  5515.                 stream.method432(anInt1285);
  5516.                 stream.method432(i1);
  5517.                 stream.method431(anInt1283);
  5518.                 stream.method432(anInt1284);
  5519.             }
  5520.         }
  5521.         if (l == 234) {
  5522.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5523.                     myPlayer.smallX[0], false, j);
  5524.             if (!flag1)
  5525.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5526.                         myPlayer.smallX[0], false, j);
  5527.             crossX = super.saveClickX;
  5528.             crossY = super.saveClickY;
  5529.             crossType = 2;
  5530.             crossIndex = 0;
  5531.             stream.createFrame(236);
  5532.             stream.method431(k + baseY);
  5533.             stream.writeWord(i1);
  5534.             stream.method431(j + baseX);
  5535.         }
  5536.         if (l == 62 && method66(i1, k, j)) {
  5537.             stream.createFrame(192);
  5538.             stream.writeWord(anInt1284);
  5539.             stream.method431(i1 >> 14 & 0x7fff);
  5540.             stream.method433(k + baseY);
  5541.             stream.method431(anInt1283);
  5542.             stream.method433(j + baseX);
  5543.             stream.writeWord(anInt1285);
  5544.         }
  5545.         if (l == 511) {
  5546.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5547.                     myPlayer.smallX[0], false, j);
  5548.             if (!flag2)
  5549.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5550.                         myPlayer.smallX[0], false, j);
  5551.             crossX = super.saveClickX;
  5552.             crossY = super.saveClickY;
  5553.             crossType = 2;
  5554.             crossIndex = 0;
  5555.             stream.createFrame(25);
  5556.             stream.method431(anInt1284);
  5557.             stream.method432(anInt1285);
  5558.             stream.writeWord(i1);
  5559.             stream.method432(k + baseY);
  5560.             stream.method433(anInt1283);
  5561.             stream.writeWord(j + baseX);
  5562.         }
  5563.         if (l == 74) {
  5564.             stream.createFrame(122);
  5565.             stream.method433(k);
  5566.             stream.method432(j);
  5567.             stream.method431(i1);
  5568.             atInventoryLoopCycle = 0;
  5569.             atInventoryInterface = k;
  5570.             atInventoryIndex = j;
  5571.             atInventoryInterfaceType = 2;
  5572.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5573.                 atInventoryInterfaceType = 1;
  5574.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5575.                 atInventoryInterfaceType = 3;
  5576.         }
  5577.         /*
  5578.          * if(l == 315) { RSInterface class9 = RSInterface.interfaceCache[k];
  5579.          * boolean flag8 = true; if(class9.contentType > 0) flag8 =
  5580.          * promptUserForInput(class9); if(flag8) { stream.createFrame(185);
  5581.          * stream.writeWord(k); } }
  5582.          */
  5583.         if (l == 315) {
  5584.             //System.out.println("Button clicked: sendPacet185(" + k + ");");
  5585.             RSInterface class9 = RSInterface.interfaceCache[k];
  5586.             boolean flag8 = true;
  5587.             if (class9.contentType > 0)
  5588.                 flag8 = promptUserForInput(class9);
  5589.             if (flag8) {
  5590.                 switch (k) {
  5591.                 case 19144:
  5592.                     sendFrame248(15106, 3213);
  5593.                     method60(15106);
  5594.                     inputTaken = true;
  5595.                     break;
  5596.                 case 29267:// Quest
  5597.                     setSidebarInterface(2, 638);
  5598.                     break;
  5599.                 case 29156:// achievement
  5600.                     setSidebarInterface(2, 29265);
  5601.                     break;
  5602.  
  5603.                 default:
  5604.                     stream.createFrame(185);
  5605.                     if (k >= 17202 && k <= 17227)
  5606.                         togglePrayerState(k);
  5607.                     switch (k) {
  5608.                     case 18022:
  5609.                         newHpBar = !newHpBar;
  5610.                         if (newHpBar) {
  5611.                             setNewHpBar(1);
  5612.                         } else {
  5613.                             setNewHpBar(0);
  5614.                         }
  5615.                         UserLoader.saveuser();
  5616.                         sendFrame36(730,1);
  5617.                         break;
  5618.                     case 18023:
  5619.                         hpH = !hpH;
  5620.                         if (hpH) {
  5621.                             setHpAboveHeads(1);
  5622.                         } else {
  5623.                             setHpAboveHeads(0);
  5624.                         }
  5625.                         UserLoader.saveuser();
  5626.                         sendFrame36(731,3);
  5627.                         break;
  5628.                     case 18024:
  5629.                         newHits = !newHits;
  5630.                         if (newHits) {
  5631.                             setNewHits(1);
  5632.                         } else {
  5633.                         setNewHits(0);
  5634.                         }
  5635.                         UserLoader.saveuser();
  5636.                         sendFrame36(732,5);
  5637.                         break;
  5638.                     case 18025:
  5639.                         names = !names;
  5640.                         sendFrame36(733,7);
  5641.                         break;
  5642.                         case 18029:
  5643.                             openInterfaceID = -1;
  5644.                         break;
  5645.                     case 18026:
  5646.                         UserLoader.saveuser();
  5647.                         openInterfaceID = -1;
  5648.                         break;
  5649.                     case 18031:
  5650.                         UserLoader.userName = "";
  5651.                         UserLoader.password = "";
  5652.                         UserLoader.saveuser();
  5653.                         Setcolour(1, 0x000000, "Name colour reset", "@cr3@");
  5654.                         Setcolour(2, 0x0000FF, "chat colour reset", "@cr3@");
  5655.                         setchat(0);
  5656.                         seteffect(0);
  5657.                         openInterfaceID = -1;
  5658.                         break;
  5659.                     case 17231:// Quick prayr confirm
  5660.                         saveQuickSelection();
  5661.                         break;
  5662.                     case 19144:
  5663.                         sendFrame248(15106, 3213);
  5664.                         method60(15106);
  5665.                         inputTaken = true;
  5666.                         break;
  5667.                     default:
  5668.                     }
  5669.                     stream.writeWord(k);
  5670.                     break;
  5671.                 }
  5672.             }
  5673.         }
  5674.         if (l == 561) {
  5675.             Player player = playerArray[i1];
  5676.             if (player != null) {
  5677.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5678.                         player.smallY[0], myPlayer.smallX[0], false,
  5679.                         player.smallX[0]);
  5680.                 crossX = super.saveClickX;
  5681.                 crossY = super.saveClickY;
  5682.                 crossType = 2;
  5683.                 crossIndex = 0;
  5684.                 anInt1188 += i1;
  5685.                 if (anInt1188 >= 90) {
  5686.                     stream.createFrame(136);
  5687.                     anInt1188 = 0;
  5688.                 }
  5689.                 stream.createFrame(128);
  5690.                 stream.writeWord(i1);
  5691.             }
  5692.         }
  5693.         if (l == 20) {
  5694.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  5695.             if (class30_sub2_sub4_sub1_sub1_1 != null) {
  5696.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5697.                         class30_sub2_sub4_sub1_sub1_1.smallY[0],
  5698.                         myPlayer.smallX[0], false,
  5699.                         class30_sub2_sub4_sub1_sub1_1.smallX[0]);
  5700.                 crossX = super.saveClickX;
  5701.                 crossY = super.saveClickY;
  5702.                 crossType = 2;
  5703.                 crossIndex = 0;
  5704.                 stream.createFrame(155);
  5705.                 stream.method431(i1);
  5706.             }
  5707.         }
  5708.         if (l == 779) {
  5709.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  5710.             if (class30_sub2_sub4_sub1_sub2_1 != null) {
  5711.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5712.                         class30_sub2_sub4_sub1_sub2_1.smallY[0],
  5713.                         myPlayer.smallX[0], false,
  5714.                         class30_sub2_sub4_sub1_sub2_1.smallX[0]);
  5715.                 crossX = super.saveClickX;
  5716.                 crossY = super.saveClickY;
  5717.                 crossType = 2;
  5718.                 crossIndex = 0;
  5719.                 stream.createFrame(153);
  5720.                 stream.method431(i1);
  5721.             }
  5722.         }
  5723.         if (l == 516)
  5724.             if (!menuOpen)
  5725.                 worldController.method312(super.saveClickY - 4,
  5726.                         super.saveClickX - 4);
  5727.             else
  5728.                 worldController.method312(k - 4, j - 4);
  5729.         if (l == 1062) {
  5730.             anInt924 += baseX;
  5731.             if (anInt924 >= 113) {
  5732.                 stream.createFrame(183);
  5733.                 stream.writeDWordBigEndian(0xe63271);
  5734.                 anInt924 = 0;
  5735.             }
  5736.             method66(i1, k, j);
  5737.             stream.createFrame(228);
  5738.             stream.method432(i1 >> 14 & 0x7fff);
  5739.             stream.method432(k + baseY);
  5740.             stream.writeWord(j + baseX);
  5741.         }
  5742.         if (l == 679 && !aBoolean1149) {
  5743.             stream.createFrame(40);
  5744.             stream.writeWord(k);
  5745.             aBoolean1149 = true;
  5746.         }
  5747.         if (l == 431) {
  5748.             stream.createFrame(129);
  5749.             stream.method432(j);
  5750.             stream.writeWord(k);
  5751.             stream.method432(i1);
  5752.             atInventoryLoopCycle = 0;
  5753.             atInventoryInterface = k;
  5754.             atInventoryIndex = j;
  5755.             atInventoryInterfaceType = 2;
  5756.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5757.                 atInventoryInterfaceType = 1;
  5758.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5759.                 atInventoryInterfaceType = 3;
  5760.         }
  5761.         if (l == 337 || l == 42 || l == 792 || l == 322) {
  5762.             String s = menuActionName[i];
  5763.                 int k1 = s.indexOf("@bla@");
  5764.             if(k1 == -1)
  5765.                 k1 = s.indexOf("@whi@");
  5766.            
  5767.             if (k1 != -1) {
  5768.                 long l3 = TextClass.longForName(s.substring(k1+5).trim());
  5769.                 if (l == 337){
  5770.                     addFriend(l3);
  5771.                 }
  5772.                 if (l == 42)
  5773.                     addIgnore(l3);
  5774.                 if (l == 792)
  5775.                     delFriend(l3);
  5776.                 if (l == 322)
  5777.                     delIgnore(l3);
  5778.             }
  5779.         }
  5780.         if (l == 53) {
  5781.             stream.createFrame(135);
  5782.             stream.method431(j);
  5783.             stream.method432(k);
  5784.             stream.method431(i1);
  5785.             atInventoryLoopCycle = 0;
  5786.             atInventoryInterface = k;
  5787.             atInventoryIndex = j;
  5788.             atInventoryInterfaceType = 2;
  5789.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5790.                 atInventoryInterfaceType = 1;
  5791.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5792.                 atInventoryInterfaceType = 3;
  5793.         }
  5794.         if (l == 539) {
  5795.             stream.createFrame(16);
  5796.             stream.method432(i1);
  5797.             stream.method433(j);
  5798.             stream.method433(k);
  5799.             atInventoryLoopCycle = 0;
  5800.             atInventoryInterface = k;
  5801.             atInventoryIndex = j;
  5802.             atInventoryInterfaceType = 2;
  5803.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5804.                 atInventoryInterfaceType = 1;
  5805.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5806.                 atInventoryInterfaceType = 3;
  5807.         }
  5808.  
  5809.         if (l == 927) {
  5810.             String s1 = menuActionName[i];
  5811.             int l1 = s1.indexOf("@lre@");
  5812.             s1 = s1.substring(l1 + 5).trim();
  5813.             launchURL(s1);// Launches the URL in a web browser when clicked
  5814.         }
  5815.  
  5816.         if (l == 484 || l == 6) {
  5817.             String s1 = menuActionName[i];
  5818.             int l1 = s1.indexOf("@whi@");
  5819.             if (l1 != -1) {
  5820.                 s1 = s1.substring(l1 + 5).trim();
  5821.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass
  5822.                         .longForName(s1)));
  5823.                 boolean flag9 = false;
  5824.                 for (int j3 = 0; j3 < playerCount; j3++) {
  5825.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  5826.                     if (class30_sub2_sub4_sub1_sub2_7 == null
  5827.                             || class30_sub2_sub4_sub1_sub2_7.name == null
  5828.                             || !class30_sub2_sub4_sub1_sub2_7.name
  5829.                                     .equalsIgnoreCase(s7))
  5830.                         continue;
  5831.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5832.                             class30_sub2_sub4_sub1_sub2_7.smallY[0],
  5833.                             myPlayer.smallX[0], false,
  5834.                             class30_sub2_sub4_sub1_sub2_7.smallX[0]);
  5835.                     if (l == 484) {
  5836.                         stream.createFrame(139);
  5837.                         stream.method431(playerIndices[j3]);
  5838.                     }
  5839.                     if (l == 6) {
  5840.                         anInt1188 += i1;
  5841.                         if (anInt1188 >= 90) {
  5842.                             stream.createFrame(136);
  5843.                             anInt1188 = 0;
  5844.                         }
  5845.                         stream.createFrame(128);
  5846.                         stream.writeWord(playerIndices[j3]);
  5847.                     }
  5848.                     flag9 = true;
  5849.                     break;
  5850.                 }
  5851.  
  5852.                 if (!flag9)
  5853.                     pushMessage("Unable to find " + s7, 0, "");
  5854.             }
  5855.         }
  5856.         if (l == 870) {
  5857.             stream.createFrame(53);
  5858.             stream.writeWord(j);
  5859.             stream.method432(anInt1283);
  5860.             stream.method433(i1);
  5861.             stream.writeWord(anInt1284);
  5862.             stream.method431(anInt1285);
  5863.             stream.writeWord(k);
  5864.             atInventoryLoopCycle = 0;
  5865.             atInventoryInterface = k;
  5866.             atInventoryIndex = j;
  5867.             atInventoryInterfaceType = 2;
  5868.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5869.                 atInventoryInterfaceType = 1;
  5870.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5871.                 atInventoryInterfaceType = 3;
  5872.         }
  5873.         if (l == 847) {
  5874.             stream.createFrame(87);
  5875.             stream.method432(i1);
  5876.             stream.writeWord(k);
  5877.             stream.method432(j);
  5878.             atInventoryLoopCycle = 0;
  5879.             atInventoryInterface = k;
  5880.             atInventoryIndex = j;
  5881.             atInventoryInterfaceType = 2;
  5882.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5883.                 atInventoryInterfaceType = 1;
  5884.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5885.                 atInventoryInterfaceType = 3;
  5886.         }
  5887.         if (l == 626) {
  5888.             RSInterface class9_1 = RSInterface.interfaceCache[k];
  5889.             spellSelected = 1;
  5890.             spellID = class9_1.id;
  5891.             anInt1137 = k;
  5892.             spellUsableOn = class9_1.spellUsableOn;
  5893.             itemSelected = 0;
  5894.             needDrawTabArea = true;
  5895.             String s4 = class9_1.selectedActionName;
  5896.             if (s4.indexOf(" ") != -1)
  5897.                 s4 = s4.substring(0, s4.indexOf(" "));
  5898.             String s8 = class9_1.selectedActionName;
  5899.             if (s8.indexOf(" ") != -1)
  5900.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  5901.             spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  5902.             if (spellUsableOn == 16) {
  5903.                 needDrawTabArea = true;
  5904.                 tabID = 3;
  5905.                 tabAreaAltered = true;
  5906.             }
  5907.             return;
  5908.         }
  5909.         if (l == 78) {
  5910.             stream.createFrame(117);
  5911.             stream.method433(k);
  5912.             stream.method433(i1);
  5913.             stream.method431(j);
  5914.             atInventoryLoopCycle = 0;
  5915.             atInventoryInterface = k;
  5916.             atInventoryIndex = j;
  5917.             atInventoryInterfaceType = 2;
  5918.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5919.                 atInventoryInterfaceType = 1;
  5920.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5921.                 atInventoryInterfaceType = 3;
  5922.         }
  5923.         if (l == 27) {
  5924.             Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  5925.             if (class30_sub2_sub4_sub1_sub2_2 != null) {
  5926.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5927.                         class30_sub2_sub4_sub1_sub2_2.smallY[0],
  5928.                         myPlayer.smallX[0], false,
  5929.                         class30_sub2_sub4_sub1_sub2_2.smallX[0]);
  5930.                 crossX = super.saveClickX;
  5931.                 crossY = super.saveClickY;
  5932.                 crossType = 2;
  5933.                 crossIndex = 0;
  5934.                 anInt986 += i1;
  5935.                 if (anInt986 >= 54) {
  5936.                     stream.createFrame(189);
  5937.                     stream.writeWordBigEndian(234);
  5938.                     anInt986 = 0;
  5939.                 }
  5940.                 stream.createFrame(73);
  5941.                 stream.method431(i1);
  5942.             }
  5943.         }
  5944.         if (l == 213) {
  5945.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5946.                     myPlayer.smallX[0], false, j);
  5947.             if (!flag3)
  5948.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5949.                         myPlayer.smallX[0], false, j);
  5950.             crossX = super.saveClickX;
  5951.             crossY = super.saveClickY;
  5952.             crossType = 2;
  5953.             crossIndex = 0;
  5954.             stream.createFrame(79);
  5955.             stream.method431(k + baseY);
  5956.             stream.writeWord(i1);
  5957.             stream.method432(j + baseX);
  5958.         }
  5959.         if (l == 632) {
  5960.             stream.createFrame(145);
  5961.             stream.method432(k);
  5962.             stream.method432(j);
  5963.             stream.method432(i1);
  5964.             atInventoryLoopCycle = 0;
  5965.             atInventoryInterface = k;
  5966.             atInventoryIndex = j;
  5967.             atInventoryInterfaceType = 2;
  5968.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5969.                 atInventoryInterfaceType = 1;
  5970.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5971.                 atInventoryInterfaceType = 3;
  5972.         }
  5973.         if (l == 1004) {
  5974.             if (tabInterfaceIDs[10] != -1) {
  5975.                 needDrawTabArea = true;
  5976.                 tabID = 10;
  5977.                 tabAreaAltered = true;
  5978.             }
  5979.         }
  5980.         if (l == 1003) {
  5981.             clanChatMode = 2;
  5982.             aBoolean1233 = true;
  5983.             inputTaken = true;
  5984.         }
  5985.         if (l == 1002) {
  5986.             clanChatMode = 1;
  5987.             aBoolean1233 = true;
  5988.             inputTaken = true;
  5989.         }
  5990.         if (l == 1001) {
  5991.             clanChatMode = 0;
  5992.             aBoolean1233 = true;
  5993.             inputTaken = true;
  5994.         }
  5995.         if (l == 1000) {
  5996.             cButtonCPos = 4;
  5997.             chatTypeView = 11;
  5998.             aBoolean1233 = true;
  5999.             inputTaken = true;
  6000.         }
  6001.         if (l == 999) {
  6002.             cButtonCPos = 0;
  6003.             chatTypeView = 0;
  6004.             aBoolean1233 = true;
  6005.             inputTaken = true;
  6006.         }
  6007.         if (l == 998) {
  6008.             cButtonCPos = 1;
  6009.             chatTypeView = 5;
  6010.             aBoolean1233 = true;
  6011.             inputTaken = true;
  6012.         }
  6013.         if (l == 997) {
  6014.             publicChatMode = 3;
  6015.             aBoolean1233 = true;
  6016.             inputTaken = true;
  6017.  
  6018.         }
  6019.         if (l == 996) {
  6020.             publicChatMode = 2;
  6021.             aBoolean1233 = true;
  6022.             inputTaken = true;
  6023.  
  6024.         }
  6025.         if (l == 995) {
  6026.             publicChatMode = 1;
  6027.             aBoolean1233 = true;
  6028.             inputTaken = true;
  6029.  
  6030.         }
  6031.         if (l == 994) {
  6032.             publicChatMode = 0;
  6033.             aBoolean1233 = true;
  6034.             inputTaken = true;
  6035.         }
  6036.         if (l == 993) {
  6037.             cButtonCPos = 2;
  6038.             chatTypeView = 1;
  6039.             aBoolean1233 = true;
  6040.             inputTaken = true;
  6041.         }
  6042.         if (l == 992) {
  6043.             privateChatMode = 2;
  6044.             aBoolean1233 = true;
  6045.             inputTaken = true;
  6046.             stream.createFrame(95);
  6047.             stream.writeWordBigEndian(publicChatMode);
  6048.             stream.writeWordBigEndian(privateChatMode);
  6049.             stream.writeWordBigEndian(tradeMode);
  6050.             System.out.println("Chat Mode:" + privateChatMode);
  6051.         }
  6052.         if (l == 991) {
  6053.             privateChatMode = 1;
  6054.             aBoolean1233 = true;
  6055.             inputTaken = true;
  6056.             stream.createFrame(95);
  6057.             stream.writeWordBigEndian(publicChatMode);
  6058.             stream.writeWordBigEndian(privateChatMode);
  6059.             stream.writeWordBigEndian(tradeMode);
  6060.             System.out.println("Chat Mode:" + privateChatMode);
  6061.         }
  6062.         if (l == 990) {
  6063.             privateChatMode = 0;
  6064.             aBoolean1233 = true;
  6065.             inputTaken = true;
  6066.             stream.createFrame(95);
  6067.             stream.writeWordBigEndian(publicChatMode);
  6068.             stream.writeWordBigEndian(privateChatMode);
  6069.             stream.writeWordBigEndian(tradeMode);
  6070.             System.out.println("Chat Mode:" + privateChatMode);
  6071.         }
  6072.         if (l == 989) {
  6073.             cButtonCPos = 3;
  6074.             chatTypeView = 2;
  6075.             aBoolean1233 = true;
  6076.             inputTaken = true;
  6077.         }
  6078.         if (l == 987) {
  6079.             tradeMode = 2;
  6080.             aBoolean1233 = true;
  6081.             inputTaken = true;
  6082.         }
  6083.         if (l == 986) {
  6084.             tradeMode = 1;
  6085.             aBoolean1233 = true;
  6086.             inputTaken = true;
  6087.         }
  6088.         if (l == 985) {
  6089.             tradeMode = 0;
  6090.             aBoolean1233 = true;
  6091.             inputTaken = true;
  6092.         }
  6093.         if (l == 984) {
  6094.             cButtonCPos = 5;
  6095.             chatTypeView = 3;
  6096.             aBoolean1233 = true;
  6097.             inputTaken = true;
  6098.         }
  6099.         if (l == 983) {
  6100.             duelMode = 2;
  6101.             aBoolean1233 = true;
  6102.             inputTaken = true;
  6103.         }
  6104.         if (l == 982) {
  6105.             duelMode = 1;
  6106.             aBoolean1233 = true;
  6107.             inputTaken = true;
  6108.         }
  6109.         if (l == 981) {
  6110.             duelMode = 0;
  6111.             aBoolean1233 = true;
  6112.             inputTaken = true;
  6113.         }
  6114.         if (l == 980) {
  6115.             cButtonCPos = 6;
  6116.             chatTypeView = 4;
  6117.             aBoolean1233 = true;
  6118.             inputTaken = true;
  6119.         }
  6120.         if (l == 493) {
  6121.             stream.createFrame(75);
  6122.             stream.method433(k);
  6123.             stream.method431(j);
  6124.             stream.method432(i1);
  6125.             atInventoryLoopCycle = 0;
  6126.             atInventoryInterface = k;
  6127.             atInventoryIndex = j;
  6128.             atInventoryInterfaceType = 2;
  6129.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6130.                 atInventoryInterfaceType = 1;
  6131.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6132.                 atInventoryInterfaceType = 3;
  6133.         }
  6134.         if (l == 652) {
  6135.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6136.                     myPlayer.smallX[0], false, j);
  6137.             if (!flag4)
  6138.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6139.                         myPlayer.smallX[0], false, j);
  6140.             crossX = super.saveClickX;
  6141.             crossY = super.saveClickY;
  6142.             crossType = 2;
  6143.             crossIndex = 0;
  6144.             stream.createFrame(156);
  6145.             stream.method432(j + baseX);
  6146.             stream.method431(k + baseY);
  6147.             stream.method433(i1);
  6148.         }
  6149.         if (l == 94) {
  6150.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6151.                     myPlayer.smallX[0], false, j);
  6152.             if (!flag5)
  6153.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6154.                         myPlayer.smallX[0], false, j);
  6155.             crossX = super.saveClickX;
  6156.             crossY = super.saveClickY;
  6157.             crossType = 2;
  6158.             crossIndex = 0;
  6159.             stream.createFrame(181);
  6160.             stream.method431(k + baseY);
  6161.             stream.writeWord(i1);
  6162.             stream.method431(j + baseX);
  6163.             stream.method432(anInt1137);
  6164.         }
  6165.         if (l == 646) {
  6166.             stream.createFrame(185);
  6167.             stream.writeWord(k);
  6168.             RSInterface class9_2 = RSInterface.interfaceCache[k];
  6169.             if (class9_2.valueIndexArray != null
  6170.                     && class9_2.valueIndexArray[0][0] == 5) {
  6171.                 int i2 = class9_2.valueIndexArray[0][1];
  6172.                 if (variousSettings[i2] != class9_2.anIntArray212[0]) {
  6173.                     variousSettings[i2] = class9_2.anIntArray212[0];
  6174.                     method33(i2);
  6175.                     needDrawTabArea = true;
  6176.                 }
  6177.             }
  6178.         }
  6179.         if (l == 225) {
  6180.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  6181.             if (class30_sub2_sub4_sub1_sub1_2 != null) {
  6182.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6183.                         class30_sub2_sub4_sub1_sub1_2.smallY[0],
  6184.                         myPlayer.smallX[0], false,
  6185.                         class30_sub2_sub4_sub1_sub1_2.smallX[0]);
  6186.                 crossX = super.saveClickX;
  6187.                 crossY = super.saveClickY;
  6188.                 crossType = 2;
  6189.                 crossIndex = 0;
  6190.                 anInt1226 += i1;
  6191.                 if (anInt1226 >= 85) {
  6192.                     stream.createFrame(230);
  6193.                     stream.writeWordBigEndian(239);
  6194.                     anInt1226 = 0;
  6195.                 }
  6196.                 stream.createFrame(17);
  6197.                 stream.method433(i1);
  6198.             }
  6199.         }
  6200.         if (l == 965) {
  6201.             NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  6202.             if (class30_sub2_sub4_sub1_sub1_3 != null) {
  6203.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6204.                         class30_sub2_sub4_sub1_sub1_3.smallY[0],
  6205.                         myPlayer.smallX[0], false,
  6206.                         class30_sub2_sub4_sub1_sub1_3.smallX[0]);
  6207.                 crossX = super.saveClickX;
  6208.                 crossY = super.saveClickY;
  6209.                 crossType = 2;
  6210.                 crossIndex = 0;
  6211.                 anInt1134++;
  6212.                 if (anInt1134 >= 96) {
  6213.                     stream.createFrame(152);
  6214.                     stream.writeWordBigEndian(88);
  6215.                     anInt1134 = 0;
  6216.                 }
  6217.                 stream.createFrame(21);
  6218.                 stream.writeWord(i1);
  6219.             }
  6220.         }
  6221.         if (l == 413) {
  6222.             NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  6223.             if (class30_sub2_sub4_sub1_sub1_4 != null) {
  6224.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6225.                         class30_sub2_sub4_sub1_sub1_4.smallY[0],
  6226.                         myPlayer.smallX[0], false,
  6227.                         class30_sub2_sub4_sub1_sub1_4.smallX[0]);
  6228.                 crossX = super.saveClickX;
  6229.                 crossY = super.saveClickY;
  6230.                 crossType = 2;
  6231.                 crossIndex = 0;
  6232.                 stream.createFrame(131);
  6233.                 stream.method433(i1);
  6234.                 stream.method432(anInt1137);
  6235.             }
  6236.         }
  6237.         if (l == 200)
  6238.             clearTopInterfaces();
  6239.         if (l == 1025) {
  6240.             NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  6241.             if (class30_sub2_sub4_sub1_sub1_5 != null) {
  6242.                 EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  6243.                 if (entityDef.childrenIDs != null)
  6244.                     entityDef = entityDef.method161();
  6245.                 if (entityDef != null) {
  6246.                     String s9;
  6247.                     if (entityDef.description != null)
  6248.                         s9 = new String(entityDef.description);
  6249.                     else
  6250.                         s9 = "It's a " + entityDef.name + ".";
  6251.                     pushMessage(s9, 0, "");
  6252.                 }
  6253.             }
  6254.         }
  6255.         if (l == 900) {
  6256.             method66(i1, k, j);
  6257.             stream.createFrame(252);
  6258.             stream.method433(i1 >> 14 & 0x7fff);
  6259.             stream.method431(k + baseY);
  6260.             stream.method432(j + baseX);
  6261.         }
  6262.         if (l == 412) {
  6263.             NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  6264.             if (class30_sub2_sub4_sub1_sub1_6 != null) {
  6265.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6266.                         class30_sub2_sub4_sub1_sub1_6.smallY[0],
  6267.                         myPlayer.smallX[0], false,
  6268.                         class30_sub2_sub4_sub1_sub1_6.smallX[0]);
  6269.                 crossX = super.saveClickX;
  6270.                 crossY = super.saveClickY;
  6271.                 crossType = 2;
  6272.                 crossIndex = 0;
  6273.                 stream.createFrame(72);
  6274.                 stream.method432(i1);
  6275.             }
  6276.         }
  6277.         if (l == 1045) {
  6278.             if (getOrbValues(1, null)[0] > 0)
  6279.                 handleQuickAidsActive();
  6280.             else
  6281.                 pushMessage("You need to recharge your Prayer at an alter.", 0,
  6282.                         "");
  6283.         }
  6284.         if (l == 1046) {
  6285.             if (!loadTickSelection) {
  6286.                 turnOffPrayers();
  6287.                 //turnOffCurses();
  6288.                 turnOffQuickTicks();
  6289.                 configureQuickTicks();
  6290.                 loadTickSelection = true;
  6291.             }
  6292.             toggleQuickAidsSelection();
  6293.         }
  6294.         if (l == 365) {
  6295.             Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  6296.             if (class30_sub2_sub4_sub1_sub2_3 != null) {
  6297.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6298.                         class30_sub2_sub4_sub1_sub2_3.smallY[0],
  6299.                         myPlayer.smallX[0], false,
  6300.                         class30_sub2_sub4_sub1_sub2_3.smallX[0]);
  6301.                 crossX = super.saveClickX;
  6302.                 crossY = super.saveClickY;
  6303.                 crossType = 2;
  6304.                 crossIndex = 0;
  6305.                 stream.createFrame(249);
  6306.                 stream.method432(i1);
  6307.                 stream.method431(anInt1137);
  6308.             }
  6309.         }
  6310.         if (l == 729) {
  6311.             Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  6312.             if (class30_sub2_sub4_sub1_sub2_4 != null) {
  6313.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6314.                         class30_sub2_sub4_sub1_sub2_4.smallY[0],
  6315.                         myPlayer.smallX[0], false,
  6316.                         class30_sub2_sub4_sub1_sub2_4.smallX[0]);
  6317.                 crossX = super.saveClickX;
  6318.                 crossY = super.saveClickY;
  6319.                 crossType = 2;
  6320.                 crossIndex = 0;
  6321.                 stream.createFrame(39);
  6322.                 stream.method431(i1);
  6323.             }
  6324.         }
  6325.         if (l == 577) {
  6326.             Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  6327.             if (class30_sub2_sub4_sub1_sub2_5 != null) {
  6328.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6329.                         class30_sub2_sub4_sub1_sub2_5.smallY[0],
  6330.                         myPlayer.smallX[0], false,
  6331.                         class30_sub2_sub4_sub1_sub2_5.smallX[0]);
  6332.                 crossX = super.saveClickX;
  6333.                 crossY = super.saveClickY;
  6334.                 crossType = 2;
  6335.                 crossIndex = 0;
  6336.                 stream.createFrame(139);
  6337.                 stream.method431(i1);
  6338.             }
  6339.         }
  6340.         if (l == 956 && method66(i1, k, j)) {
  6341.             stream.createFrame(35);
  6342.             stream.method431(j + baseX);
  6343.             stream.method432(anInt1137);
  6344.             stream.method432(k + baseY);
  6345.             stream.method431(i1 >> 14 & 0x7fff);
  6346.         }
  6347.         if (l == 567) {
  6348.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6349.                     myPlayer.smallX[0], false, j);
  6350.             if (!flag6)
  6351.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6352.                         myPlayer.smallX[0], false, j);
  6353.             crossX = super.saveClickX;
  6354.             crossY = super.saveClickY;
  6355.             crossType = 2;
  6356.             crossIndex = 0;
  6357.             stream.createFrame(23);
  6358.             stream.method431(k + baseY);
  6359.             stream.method431(i1);
  6360.             stream.method431(j + baseX);
  6361.         }
  6362.         if (l == 867) {
  6363.             if ((i1 & 3) == 0)
  6364.                 anInt1175++;
  6365.             if (anInt1175 >= 59) {
  6366.                 stream.createFrame(200);
  6367.                 stream.writeWord(25501);
  6368.                 anInt1175 = 0;
  6369.             }
  6370.             stream.createFrame(43);
  6371.             stream.method431(k);
  6372.             stream.method432(i1);
  6373.             stream.method432(j);
  6374.             atInventoryLoopCycle = 0;
  6375.             atInventoryInterface = k;
  6376.             atInventoryIndex = j;
  6377.             atInventoryInterfaceType = 2;
  6378.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6379.                 atInventoryInterfaceType = 1;
  6380.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6381.                 atInventoryInterfaceType = 3;
  6382.         }
  6383.         if (l == 543) {
  6384.             stream.createFrame(237);
  6385.             stream.writeWord(j);
  6386.             stream.method432(i1);
  6387.             stream.writeWord(k);
  6388.             stream.method432(anInt1137);
  6389.             atInventoryLoopCycle = 0;
  6390.             atInventoryInterface = k;
  6391.             atInventoryIndex = j;
  6392.             atInventoryInterfaceType = 2;
  6393.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6394.                 atInventoryInterfaceType = 1;
  6395.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6396.                 atInventoryInterfaceType = 3;
  6397.         }
  6398.         if (l == 606) {
  6399.             String s2 = menuActionName[i];
  6400.             int j2 = s2.indexOf("@whi@");
  6401.             if (j2 != -1)
  6402.                 if (openInterfaceID == -1) {
  6403.                     clearTopInterfaces();
  6404.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  6405.                     canMute = false;
  6406.                     for (int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++) {
  6407.                         if (RSInterface.interfaceCache[i3] == null
  6408.                                 || RSInterface.interfaceCache[i3].contentType != 600)
  6409.                             continue;
  6410.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  6411.                         break;
  6412.                     }
  6413.  
  6414.                 } else {
  6415.                     pushMessage(
  6416.                             "Please close the interface you have open before using 'report abuse'",
  6417.                             0, "");
  6418.                 }
  6419.         }
  6420.         if (l == 491) {
  6421.             Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  6422.             if (class30_sub2_sub4_sub1_sub2_6 != null) {
  6423.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6424.                         class30_sub2_sub4_sub1_sub2_6.smallY[0],
  6425.                         myPlayer.smallX[0], false,
  6426.                         class30_sub2_sub4_sub1_sub2_6.smallX[0]);
  6427.                 crossX = super.saveClickX;
  6428.                 crossY = super.saveClickY;
  6429.                 crossType = 2;
  6430.                 crossIndex = 0;
  6431.                 stream.createFrame(14);
  6432.                 stream.method432(anInt1284);
  6433.                 stream.writeWord(i1);
  6434.                 stream.writeWord(anInt1285);
  6435.                 stream.method431(anInt1283);
  6436.             }
  6437.         }
  6438.         if (l == 639) {
  6439.             String s3 = menuActionName[i];
  6440.             int k2 = s3.indexOf("@whi@");
  6441.             if (k2 != -1) {
  6442.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  6443.                 int k3 = -1;
  6444.                 for (int i4 = 0; i4 < friendsCount; i4++) {
  6445.                     if (friendsListAsLongs[i4] != l4)
  6446.                         continue;
  6447.                     k3 = i4;
  6448.                     break;
  6449.                 }
  6450.  
  6451.                 if (k3 != -1 && friendsNodeIDs[k3] > 0) {
  6452.                     inputTaken = true;
  6453.                     inputDialogState = 0;
  6454.                     messagePromptRaised = true;
  6455.                     promptInput = "";
  6456.                     friendsListAction = 3;
  6457.                     aLong953 = friendsListAsLongs[k3];
  6458.                     aString1121 = "Enter message to send to " + friendsList[k3];
  6459.                 }
  6460.             }
  6461.         }
  6462.         if (l == 454) {
  6463.             stream.createFrame(41);
  6464.             stream.writeWord(i1);
  6465.             stream.method432(j);
  6466.             stream.method432(k);
  6467.             atInventoryLoopCycle = 0;
  6468.             atInventoryInterface = k;
  6469.             atInventoryIndex = j;
  6470.             atInventoryInterfaceType = 2;
  6471.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6472.                 atInventoryInterfaceType = 1;
  6473.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6474.                 atInventoryInterfaceType = 3;
  6475.         }
  6476.         if (l == 478) {
  6477.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  6478.             if (class30_sub2_sub4_sub1_sub1_7 != null) {
  6479.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6480.                         class30_sub2_sub4_sub1_sub1_7.smallY[0],
  6481.                         myPlayer.smallX[0], false,
  6482.                         class30_sub2_sub4_sub1_sub1_7.smallX[0]);
  6483.                 crossX = super.saveClickX;
  6484.                 crossY = super.saveClickY;
  6485.                 crossType = 2;
  6486.                 crossIndex = 0;
  6487.                 if ((i1 & 3) == 0)
  6488.                     anInt1155++;
  6489.                 if (anInt1155 >= 53) {
  6490.                     stream.createFrame(85);
  6491.                     stream.writeWordBigEndian(66);
  6492.                     anInt1155 = 0;
  6493.                 }
  6494.                 stream.createFrame(18);
  6495.                 stream.method431(i1);
  6496.             }
  6497.         }
  6498.         if (l == 113) {
  6499.             method66(i1, k, j);
  6500.             stream.createFrame(70);
  6501.             stream.method431(j + baseX);
  6502.             stream.writeWord(k + baseY);
  6503.             stream.method433(i1 >> 14 & 0x7fff);
  6504.         }
  6505.         if (l == 872) {
  6506.             method66(i1, k, j);
  6507.             stream.createFrame(234);
  6508.             stream.method433(j + baseX);
  6509.             stream.method432(i1 >> 14 & 0x7fff);
  6510.             stream.method433(k + baseY);
  6511.         }
  6512.         if (l == 502) {
  6513.             method66(i1, k, j);
  6514.             stream.createFrame(132);
  6515.             stream.method433(j + baseX);
  6516.             stream.writeWord(i1 >> 14 & 0x7fff);
  6517.             stream.method432(k + baseY);
  6518.         }
  6519.         if (l == 1125) {
  6520.             ItemDef itemDef = ItemDef.forID(i1);
  6521.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  6522.             String s5;
  6523.             if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0)
  6524.                 s5 = class9_4.invStackSizes[j] + " x " + itemDef.name;
  6525.             else if (itemDef.description != null)
  6526.                 s5 = new String(itemDef.description);
  6527.             else
  6528.                 s5 = "It's a " + itemDef.name + ".";
  6529.             pushMessage(s5, 0, "");
  6530.         }
  6531.         if (l == 169) {
  6532.             stream.createFrame(185);
  6533.             stream.writeWord(k);
  6534.             RSInterface class9_3 = RSInterface.interfaceCache[k];
  6535.             if (class9_3.valueIndexArray != null
  6536.                     && class9_3.valueIndexArray[0][0] == 5) {
  6537.                 int l2 = class9_3.valueIndexArray[0][1];
  6538.                 variousSettings[l2] = 1 - variousSettings[l2];
  6539.                 method33(l2);
  6540.                 needDrawTabArea = true;
  6541.             }
  6542.         }
  6543.         if (l == 447) {
  6544.             itemSelected = 1;
  6545.             anInt1283 = j;
  6546.             anInt1284 = k;
  6547.             anInt1285 = i1;
  6548.             selectedItemName = ItemDef.forID(i1).name;
  6549.             spellSelected = 0;
  6550.             needDrawTabArea = true;
  6551.             return;
  6552.         }
  6553.         if (l == 1226) {
  6554.             int j1 = i1 >> 14 & 0x7fff;
  6555.             ObjectDef class46 = ObjectDef.forID(j1);
  6556.             String s10;
  6557.             if (class46.description != null)
  6558.                 s10 = new String(class46.description);
  6559.             else
  6560.                 s10 = "It's a " + class46.name + ".";
  6561.             pushMessage(s10, 0, "");
  6562.         }
  6563.         if (l == 244) {
  6564.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6565.                     myPlayer.smallX[0], false, j);
  6566.             if (!flag7)
  6567.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6568.                         myPlayer.smallX[0], false, j);
  6569.             crossX = super.saveClickX;
  6570.             crossY = super.saveClickY;
  6571.             crossType = 2;
  6572.             crossIndex = 0;
  6573.             stream.createFrame(253);
  6574.             stream.method431(j + baseX);
  6575.             stream.method433(k + baseY);
  6576.             stream.method432(i1);
  6577.         }
  6578.         if (l == 1448) {
  6579.             ItemDef itemDef_1 = ItemDef.forID(i1);
  6580.             String s6;
  6581.             if (itemDef_1.description != null)
  6582.                 s6 = new String(itemDef_1.description);
  6583.             else
  6584.                 s6 = "It's a " + itemDef_1.name + ".";
  6585.             pushMessage(s6, 0, "");
  6586.         }
  6587.         itemSelected = 0;
  6588.         spellSelected = 0;
  6589.         needDrawTabArea = true;
  6590.  
  6591.     }
  6592.  
  6593.     private void method70() {
  6594.         anInt1251 = 0;
  6595.         int j = (myPlayer.x >> 7) + baseX;
  6596.         int k = (myPlayer.y >> 7) + baseY;
  6597.         if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  6598.             anInt1251 = 1;
  6599.         if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  6600.             anInt1251 = 1;
  6601.         if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  6602.             anInt1251 = 0;
  6603.     }
  6604.  
  6605.     public void run() {
  6606.         if (drawFlames) {
  6607.             drawFlames();
  6608.         } else {
  6609.             super.run();
  6610.         }
  6611.     }
  6612.  
  6613.     private void build3dScreenMenu() {
  6614.         if (itemSelected == 0 && spellSelected == 0) {
  6615.             menuActionName[menuActionRow] = "Walk here";
  6616.             menuActionID[menuActionRow] = 516;
  6617.             menuActionCmd2[menuActionRow] = super.mouseX;
  6618.             menuActionCmd3[menuActionRow] = super.mouseY;
  6619.             menuActionRow++;
  6620.         }
  6621.         int j = -1;
  6622.         for (int k = 0; k < Model.anInt1687; k++) {
  6623.             int l = Model.anIntArray1688[k];
  6624.             int i1 = l & 0x7f;
  6625.             int j1 = l >> 7 & 0x7f;
  6626.             int k1 = l >> 29 & 3;
  6627.             int l1 = l >> 14 & 0x7fff;
  6628.             if (l == j)
  6629.                 continue;
  6630.             j = l;
  6631.             if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
  6632.                 ObjectDef class46 = ObjectDef.forID(l1);
  6633.                 if (class46.childrenIDs != null)
  6634.                     class46 = class46.method580();
  6635.                 if (class46 == null)
  6636.                     continue;
  6637.                 if (itemSelected == 1) {
  6638.                     menuActionName[menuActionRow] = "Use " + selectedItemName
  6639.                             + " with @cya@" + class46.name;
  6640.                     menuActionID[menuActionRow] = 62;
  6641.                     menuActionCmd1[menuActionRow] = l;
  6642.                     menuActionCmd2[menuActionRow] = i1;
  6643.                     menuActionCmd3[menuActionRow] = j1;
  6644.                     menuActionRow++;
  6645.                 } else if (spellSelected == 1) {
  6646.                     if ((spellUsableOn & 4) == 4) {
  6647.                         menuActionName[menuActionRow] = spellTooltip + " @cya@"
  6648.                                 + class46.name;
  6649.                         menuActionID[menuActionRow] = 956;
  6650.                         menuActionCmd1[menuActionRow] = l;
  6651.                         menuActionCmd2[menuActionRow] = i1;
  6652.                         menuActionCmd3[menuActionRow] = j1;
  6653.                         menuActionRow++;
  6654.                     }
  6655.                 } else {
  6656.                     if (class46.actions != null) {
  6657.                         for (int i2 = 4; i2 >= 0; i2--)
  6658.                             if (class46.actions[i2] != null) {
  6659.                                 menuActionName[menuActionRow] = class46.actions[i2]
  6660.                                         + " @cya@" + class46.name;
  6661.                                 if (i2 == 0)
  6662.                                     menuActionID[menuActionRow] = 502;
  6663.                                 if (i2 == 1)
  6664.                                     menuActionID[menuActionRow] = 900;
  6665.                                 if (i2 == 2)
  6666.                                     menuActionID[menuActionRow] = 113;
  6667.                                 if (i2 == 3)
  6668.                                     menuActionID[menuActionRow] = 872;
  6669.                                 if (i2 == 4)
  6670.                                     menuActionID[menuActionRow] = 1062;
  6671.                                 menuActionCmd1[menuActionRow] = l;
  6672.                                 menuActionCmd2[menuActionRow] = i1;
  6673.                                 menuActionCmd3[menuActionRow] = j1;
  6674.                                 menuActionRow++;
  6675.                             }
  6676.  
  6677.                     }
  6678.                     // menuActionName[menuActionRow] = "Examine @cya@" +
  6679.                     // class46.name + " @gre@(@whi@" + l1 + "@gre@) (@whi@" +
  6680.                     // (i1 + baseX) + "," + (j1 + baseY) + "@gre@)";
  6681.                     menuActionName[menuActionRow] = "Examine @cya@"
  6682.                             + class46.name/* + " " + class46.type */;
  6683.                     menuActionID[menuActionRow] = 1226;
  6684.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  6685.                     menuActionCmd2[menuActionRow] = i1;
  6686.                     menuActionCmd3[menuActionRow] = j1;
  6687.                     menuActionRow++;
  6688.                 }
  6689.             }
  6690.             if (k1 == 1) {
  6691.                 NPC npc = npcArray[l1];
  6692.                 if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64
  6693.                         && (npc.y & 0x7f) == 64) {
  6694.                     for (int j2 = 0; j2 < npcCount; j2++) {
  6695.                         NPC npc2 = npcArray[npcIndices[j2]];
  6696.                         if (npc2 != null && npc2 != npc
  6697.                                 && npc2.desc.aByte68 == 1 && npc2.x == npc.x
  6698.                                 && npc2.y == npc.y)
  6699.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  6700.                     }
  6701.  
  6702.                     for (int l2 = 0; l2 < playerCount; l2++) {
  6703.                         Player player = playerArray[playerIndices[l2]];
  6704.                         if (player != null && player.x == npc.x
  6705.                                 && player.y == npc.y)
  6706.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  6707.                     }
  6708.  
  6709.                 }
  6710.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  6711.             }
  6712.             if (k1 == 0) {
  6713.                 Player player = playerArray[l1];
  6714.                 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  6715.                     for (int k2 = 0; k2 < npcCount; k2++) {
  6716.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  6717.                         if (class30_sub2_sub4_sub1_sub1_2 != null
  6718.                                 && class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1
  6719.                                 && class30_sub2_sub4_sub1_sub1_2.x == player.x
  6720.                                 && class30_sub2_sub4_sub1_sub1_2.y == player.y)
  6721.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc,
  6722.                                     npcIndices[k2], j1, i1);
  6723.                     }
  6724.  
  6725.                     for (int i3 = 0; i3 < playerCount; i3++) {
  6726.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  6727.                         if (class30_sub2_sub4_sub1_sub2_2 != null
  6728.                                 && class30_sub2_sub4_sub1_sub2_2 != player
  6729.                                 && class30_sub2_sub4_sub1_sub2_2.x == player.x
  6730.                                 && class30_sub2_sub4_sub1_sub2_2.y == player.y)
  6731.                             buildAtPlayerMenu(i1, playerIndices[i3],
  6732.                                     class30_sub2_sub4_sub1_sub2_2, j1);
  6733.                     }
  6734.  
  6735.                 }
  6736.                 buildAtPlayerMenu(i1, l1, player, j1);
  6737.             }
  6738.             if (k1 == 3) {
  6739.                 NodeList class19 = groundArray[plane][i1][j1];
  6740.                 if (class19 != null) {
  6741.                     for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19
  6742.                             .getNext()) {
  6743.                         ItemDef itemDef = ItemDef.forID(item.ID);
  6744.                         if (itemSelected == 1) {
  6745.                             menuActionName[menuActionRow] = "Use "
  6746.                                     + selectedItemName + " with @lre@"
  6747.                                     + itemDef.name;
  6748.                             menuActionID[menuActionRow] = 511;
  6749.                             menuActionCmd1[menuActionRow] = item.ID;
  6750.                             menuActionCmd2[menuActionRow] = i1;
  6751.                             menuActionCmd3[menuActionRow] = j1;
  6752.                             menuActionRow++;
  6753.                         } else if (spellSelected == 1) {
  6754.                             if ((spellUsableOn & 1) == 1) {
  6755.                                 menuActionName[menuActionRow] = spellTooltip
  6756.                                         + " @lre@" + itemDef.name;
  6757.                                 menuActionID[menuActionRow] = 94;
  6758.                                 menuActionCmd1[menuActionRow] = item.ID;
  6759.                                 menuActionCmd2[menuActionRow] = i1;
  6760.                                 menuActionCmd3[menuActionRow] = j1;
  6761.                                 menuActionRow++;
  6762.                             }
  6763.                         } else {
  6764.                             for (int j3 = 4; j3 >= 0; j3--)
  6765.                                 if (itemDef.groundActions != null
  6766.                                         && itemDef.groundActions[j3] != null) {
  6767.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3]
  6768.                                             + " @lre@" + itemDef.name;
  6769.                                     if (j3 == 0)
  6770.                                         menuActionID[menuActionRow] = 652;
  6771.                                     if (j3 == 1)
  6772.                                         menuActionID[menuActionRow] = 567;
  6773.                                     if (j3 == 2)
  6774.                                         menuActionID[menuActionRow] = 234;
  6775.                                     if (j3 == 3)
  6776.                                         menuActionID[menuActionRow] = 244;
  6777.                                     if (j3 == 4)
  6778.                                         menuActionID[menuActionRow] = 213;
  6779.                                     menuActionCmd1[menuActionRow] = item.ID;
  6780.                                     menuActionCmd2[menuActionRow] = i1;
  6781.                                     menuActionCmd3[menuActionRow] = j1;
  6782.                                     menuActionRow++;
  6783.                                 } else
  6784.                                     for (j3 = 4; j3 >= 0; j3--)
  6785.  
  6786.                                         if (j3 == 2) {
  6787.                                             menuActionName[menuActionRow] = "Take @lre@"
  6788.                                                     + itemDef.name;
  6789.                                             menuActionID[menuActionRow] = 234;
  6790.                                             menuActionCmd1[menuActionRow] = item.ID;
  6791.                                             menuActionCmd2[menuActionRow] = i1;
  6792.                                             menuActionCmd3[menuActionRow] = j1;
  6793.                                             menuActionRow++;
  6794.                                         }
  6795.  
  6796.                             // menuActionName[menuActionRow] = "Examine @lre@" +
  6797.                             // itemDef.name + " @gre@(@whi@" + item.ID +
  6798.                             // "@gre@)";
  6799.                             menuActionName[menuActionRow] = "Examine @lre@"
  6800.                                     + itemDef.name;
  6801.                             menuActionID[menuActionRow] = 1448;
  6802.                             menuActionCmd1[menuActionRow] = item.ID;
  6803.                             menuActionCmd2[menuActionRow] = i1;
  6804.                             menuActionCmd3[menuActionRow] = j1;
  6805.                             menuActionRow++;
  6806.                         }
  6807.                     }
  6808.  
  6809.                 }
  6810.             }
  6811.         }
  6812.     }
  6813.    
  6814.     public int cleanUpModels(){
  6815.         int number = 0;
  6816.         number += (int)Math.pow(31, 2);
  6817.         number *= 383;
  6818.         number += 5282457;
  6819.         number = number /2;
  6820.         return 773287632;
  6821.     }
  6822.     public int cleanUpTextures() {
  6823.         int i = 0;
  6824.         i += (int)Math.pow(31.0D, 2.0D);
  6825.         i *= 383;
  6826.         i += 7382457;
  6827.         i /= 2;
  6828.         return 89023489;
  6829.     }
  6830.  
  6831.     public void cleanUpForQuit() {
  6832.         signlink.reporterror = false;
  6833.         try {
  6834.             if (socketStream != null)
  6835.                 socketStream.close();
  6836.         } catch (Exception _ex) {
  6837.         }
  6838.         socketStream = null;
  6839.         stopMidi();
  6840.         if (mouseDetection != null)
  6841.             mouseDetection.running = false;
  6842.         mouseDetection = null;
  6843.         onDemandFetcher.disable();
  6844.         clickedQuickPrayers = false;
  6845.         HPBarFull = null;
  6846.         HPBarEmpty = null;
  6847.         onDemandFetcher = null;
  6848.         aStream_834 = null;
  6849.         stream = null;
  6850.         aStream_847 = null;
  6851.         inStream = null;
  6852.         anIntArray1234 = null;
  6853.         aByteArrayArray1183 = null;
  6854.         aByteArrayArray1247 = null;
  6855.         anIntArray1235 = null;
  6856.         anIntArray1236 = null;
  6857.         intGroundArray = null;
  6858.         byteGroundArray = null;
  6859.         worldController = null;
  6860.         aClass11Array1230 = null;
  6861.         anIntArrayArray901 = null;
  6862.         anIntArrayArray825 = null;
  6863.         bigX = null;
  6864.         bigY = null;
  6865.         aByteArray912 = null;
  6866.         aRSImageProducer_1163 = null;
  6867.         aRSImageProducer_1164 = null;
  6868.         aRSImageProducer_1165 = null;
  6869.         aRSImageProducer_1166 = null;
  6870.         aRSImageProducer_1123 = null;
  6871.         aRSImageProducer_1124 = null;
  6872.         aRSImageProducer_1125 = null;
  6873.         /* Null pointers for custom sprites */
  6874.         alertBack = null;
  6875.         alertBorder = null;
  6876.         alertBorderH = null;
  6877.         multiOverlay = null;
  6878.         duelingOverlay = null;
  6879.         chatArea = null;
  6880.         chatButtons = null;
  6881.         chatButtonH = null;
  6882.         chatButtonHC = null;
  6883.         chatButtonC = null;
  6884.         reportH = null;
  6885.         tabArea = null;
  6886.         mapArea = null;
  6887.         logIconH = null;
  6888.         logIconC = null;
  6889.         worldMapIcon = null;
  6890.         emptyOrb = null;
  6891.         hitPointsFill = null;
  6892.         hitPointsIcon = null;
  6893.         prayerFill = null;
  6894.         prayerIcon = null;
  6895.         frame = null;
  6896.         /**/
  6897.         mapBack = null;
  6898.         sideIcons = null;
  6899.         redStones = null;
  6900.         compass = null;
  6901.         hitMarks = null;
  6902.         headIcons = null;
  6903.         headIconsHint = null;
  6904.         skullIcons = null;
  6905.         crosses = null;
  6906.         mapDotItem = null;
  6907.         mapDotNPC = null;
  6908.         mapDotPlayer = null;
  6909.         mapDotFriend = null;
  6910.         mapDotBL = null;
  6911.         mapDotTeam = null;
  6912.         mapScenes = null;
  6913.         mapFunctions = null;
  6914.         anIntArrayArray929 = null;
  6915.         playerArray = null;
  6916.         playerIndices = null;
  6917.         anIntArray894 = null;
  6918.         aStreamArray895s = null;
  6919.         anIntArray840 = null;
  6920.         npcArray = null;
  6921.         npcIndices = null;
  6922.         groundArray = null;
  6923.         aClass19_1179 = null;
  6924.         aClass19_1013 = null;
  6925.         aClass19_1056 = null;
  6926.         menuActionCmd2 = null;
  6927.         menuActionCmd3 = null;
  6928.         menuActionID = null;
  6929.         menuActionCmd1 = null;
  6930.         menuActionName = null;
  6931.         variousSettings = null;
  6932.         anIntArray1072 = null;
  6933.         anIntArray1073 = null;
  6934.         aClass30_Sub2_Sub1_Sub1Array1140 = null;
  6935.         aClass30_Sub2_Sub1_Sub1_1263 = null;
  6936.         friendsList = null;
  6937.         friendsListAsLongs = null;
  6938.         friendsNodeIDs = null;
  6939.         aRSImageProducer_1110 = null;
  6940.         aRSImageProducer_1111 = null;
  6941.         aRSImageProducer_1107 = null;
  6942.         aRSImageProducer_1108 = null;
  6943.         aRSImageProducer_1109 = null;
  6944.         aRSImageProducer_1112 = null;
  6945.         aRSImageProducer_1113 = null;
  6946.         aRSImageProducer_1114 = null;
  6947.         aRSImageProducer_1115 = null;
  6948.         nullLoader();
  6949.         ObjectDef.nullLoader();
  6950.         EntityDef.nullLoader();
  6951.         ItemDef.nullLoader();
  6952.         Flo.cache = null;
  6953.         IDK.cache = null;
  6954.         RSInterface.interfaceCache = null;
  6955.         DummyClass.cache = null;
  6956.         Animation.anims = null;
  6957.         SpotAnim.cache = null;
  6958.         SpotAnim.aMRUNodes_415 = null;
  6959.         Varp.cache = null;
  6960.         super.fullGameScreen = null;
  6961.         Player.mruNodes = null;
  6962.         Texture.nullLoader();
  6963.         WorldController.nullLoader();
  6964.         Model.nullLoader();
  6965.         Class36.nullLoader();
  6966.         System.gc();
  6967.     }
  6968.  
  6969.     private void printDebug() {
  6970.         System.out.println("============");
  6971.         System.out.println("flame-cycle:" + anInt1208);
  6972.         if (onDemandFetcher != null)
  6973.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  6974.         System.out.println("loop-cycle:" + loopCycle);
  6975.         System.out.println("draw-cycle:" + anInt1061);
  6976.         System.out.println("ptype:" + pktType);
  6977.         System.out.println("psize:" + pktSize);
  6978.         if (socketStream != null)
  6979.             socketStream.printDebug();
  6980.         super.shouldDebug = true;
  6981.     }
  6982.  
  6983.     Component getGameComponent() {
  6984.         if (signlink.mainapp != null)
  6985.             return signlink.mainapp;
  6986.         if (super.gameFrame != null)
  6987.             return super.gameFrame;
  6988.         else
  6989.             return this;
  6990.     }
  6991.  
  6992.     public byte[] getModel(int Index) {
  6993.         try {
  6994.             File Model = new File("./Models/" + Index + ".gz");
  6995.             byte[] aByte = new byte[(int) Model.length()];
  6996.             FileInputStream fis = new FileInputStream(Model);
  6997.             fis.read(aByte);
  6998.             pushMessage("aByte = [" + aByte + "]!", 0, "");
  6999.             fis.close();
  7000.             return aByte;
  7001.         } catch (Exception e) {
  7002.             return null;
  7003.         }
  7004.     }
  7005.  
  7006.     public int getNewAchievements() {
  7007.         // return 894237500;
  7008.         return 894237418;
  7009.     }
  7010.  
  7011.     private void method73() {
  7012.         do {
  7013.             int j = readChar(-796);
  7014.             if (j == -1)
  7015.                 break;
  7016.             if (openInterfaceID != -1
  7017.                     && openInterfaceID == reportAbuseInterfaceID) {
  7018.                 if (j == 8 && reportAbuseInput.length() > 0)
  7019.                     reportAbuseInput = reportAbuseInput.substring(0,
  7020.                             reportAbuseInput.length() - 1);
  7021.                 if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48
  7022.                         && j <= 57 || j == 32)
  7023.                         && reportAbuseInput.length() < 12)
  7024.                     reportAbuseInput += (char) j;
  7025.             } else if (messagePromptRaised) {
  7026.                 if (j >= 32 && j <= 122 && promptInput.length() < 80) {
  7027.                     promptInput += (char) j;
  7028.                     inputTaken = true;
  7029.                 }
  7030.                 if (j == 8 && promptInput.length() > 0) {
  7031.                     promptInput = promptInput.substring(0,
  7032.                             promptInput.length() - 1);
  7033.                     inputTaken = true;
  7034.                 }
  7035.                 if (j == 13 || j == 10) {
  7036.                     messagePromptRaised = false;
  7037.                     inputTaken = true;
  7038.                     if (friendsListAction == 1) {
  7039.                         long l = TextClass.longForName(promptInput);
  7040.                         addFriend(l);
  7041.                     }
  7042.                     if (friendsListAction == 2 && friendsCount > 0) {
  7043.                         long l1 = TextClass.longForName(promptInput);
  7044.                         delFriend(l1);
  7045.                     }
  7046.                     if (friendsListAction == 3 && promptInput.length() > 0) {
  7047.                         stream.createFrame(126);
  7048.                         stream.writeWordBigEndian(0);
  7049.                         int k = stream.currentOffset;
  7050.                         stream.writeQWord(aLong953);
  7051.                         TextInput.method526(promptInput, stream);
  7052.                         stream.writeBytes(stream.currentOffset - k);
  7053.                         promptInput = TextInput.processText(promptInput);
  7054.                         // promptInput = Censor.doCensor(promptInput);
  7055.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass
  7056.                                 .nameForLong(aLong953)));
  7057.                         if (privateChatMode == 2) {
  7058.                             privateChatMode = 1;
  7059.                             aBoolean1233 = true;
  7060.                             stream.createFrame(95);
  7061.                             stream.writeWordBigEndian(publicChatMode);
  7062.                             stream.writeWordBigEndian(privateChatMode);
  7063.                             stream.writeWordBigEndian(tradeMode);
  7064.                             System.out.println("Chat Mode:" + privateChatMode);
  7065.                         }
  7066.                     }
  7067.                     if (friendsListAction == 4 && ignoreCount < 100) {
  7068.                         long l2 = TextClass.longForName(promptInput);
  7069.                         addIgnore(l2);
  7070.                     }
  7071.                     if (friendsListAction == 5 && ignoreCount > 0) {
  7072.                         long l3 = TextClass.longForName(promptInput);
  7073.                         delIgnore(l3);
  7074.                     }
  7075.                 }
  7076.             } else if (inputDialogState == 1) {
  7077.                 if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
  7078.                     amountOrNameInput += (char) j;
  7079.                     inputTaken = true;
  7080.                 }
  7081.                 if ((!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput
  7082.                         .toLowerCase().contains("m") && !amountOrNameInput
  7083.                         .toLowerCase().contains("b"))
  7084.                         && (j == 107 || j == 109) || j == 98) {
  7085.                     amountOrNameInput += (char) j;
  7086.                     inputTaken = true;
  7087.                 }
  7088.                 if (j == 8 && amountOrNameInput.length() > 0) {
  7089.                     amountOrNameInput = amountOrNameInput.substring(0,
  7090.                             amountOrNameInput.length() - 1);
  7091.                     inputTaken = true;
  7092.                 }
  7093.                 if (j == 13 || j == 10) {
  7094.                     if (amountOrNameInput.length() > 0) {
  7095.                         if (amountOrNameInput.toLowerCase().contains("k")) {
  7096.  
  7097.                             amountOrNameInput = amountOrNameInput.replaceFirst(
  7098.                                     "k", "000");
  7099.                             amountOrNameInput = amountOrNameInput.replaceAll(
  7100.                                     "k", "");
  7101.                             amountOrNameInput.trim();
  7102.                         } else if (amountOrNameInput.toLowerCase()
  7103.                                 .contains("m")) {
  7104.                             amountOrNameInput = amountOrNameInput.replaceFirst(
  7105.                                     "m", "000000");
  7106.                             amountOrNameInput = amountOrNameInput.replaceAll(
  7107.                                     "m", "");
  7108.                             amountOrNameInput.trim();
  7109.                         }
  7110.                         else if (amountOrNameInput.toLowerCase()
  7111.                                 .contains("b")) {
  7112.                             amountOrNameInput = amountOrNameInput.replaceFirst(
  7113.                                     "b", "000000000");
  7114.                             amountOrNameInput = amountOrNameInput.replaceAll(
  7115.                                     "b", "");
  7116.                             amountOrNameInput.trim();
  7117.                         }
  7118.                         int amount = 0;
  7119.                         try {
  7120.                             if (amount > Integer.parseInt(amountOrNameInput)) {
  7121.                                 amount = 2000000000;
  7122.                             } else {
  7123.                                 amount = Integer.parseInt(amountOrNameInput);
  7124.                             }
  7125.                             stream.createFrame(208);
  7126.                             stream.writeDWord(amount);
  7127.                         } catch (Exception e){
  7128.                         }
  7129.                     }
  7130.                     inputDialogState = 0;
  7131.                     inputTaken = true;
  7132.                 }
  7133.             } else if (inputDialogState == 2) {
  7134.                 if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  7135.                     amountOrNameInput += (char) j;
  7136.                     inputTaken = true;
  7137.                 }
  7138.                 if (j == 8 && amountOrNameInput.length() > 0) {
  7139.                     amountOrNameInput = amountOrNameInput.substring(0,
  7140.                             amountOrNameInput.length() - 1);
  7141.                     inputTaken = true;
  7142.                 }
  7143.                 if (j == 13 || j == 10) {
  7144.                     if (amountOrNameInput.length() > 0) {
  7145.                         stream.createFrame(60);
  7146.                         stream.writeQWord(TextClass
  7147.                                 .longForName(amountOrNameInput));
  7148.                     }
  7149.                     inputDialogState = 0;
  7150.                     inputTaken = true;
  7151.                 }
  7152.             } else if (backDialogID == -1) {
  7153.                 if (j >= 32 && j <= 122 && inputString.length() < 80) {
  7154.                     inputString += (char) j;
  7155.                     inputTaken = true;
  7156.                 }
  7157.                 if (j == 8 && inputString.length() > 0) {
  7158.                     inputString = inputString.substring(0,
  7159.                             inputString.length() - 1);
  7160.                     inputTaken = true;
  7161.                 }
  7162.                 if ((j == 13 || j == 10) && inputString.length() > 0) {
  7163.                     if (inputString.equals("::preload")) {
  7164.                         preloadModels();
  7165.                         resetLogout();
  7166.                     }// for now until bugs are fixed
  7167.                     if (myPrivilege == 11) {
  7168.                         if (inputString.equals("::clientdrop"))
  7169.                             dropClient();
  7170.                         if (inputString.equals("::lag"))
  7171.                             printDebug();
  7172.                         if (inputString.equals("::dumpmodels"))
  7173.                             models();
  7174.                         if (inputString.equals("::prefetchmusic")) {
  7175.                             for (int j1 = 0; j1 < onDemandFetcher
  7176.                                     .getVersionCount(2); j1++)
  7177.                                 onDemandFetcher.method563((byte) 1, 2, j1);
  7178.  
  7179.                         }
  7180.                         if (inputString.equals("::fpson"))
  7181.                             fpsOn = true;
  7182.                         if (inputString.equals("::fpsoff"))
  7183.                             fpsOn = false;
  7184.                         if (inputString.equals("::dataon"))
  7185.                             clientData = true;
  7186.                         if (inputString.equals("::dataoff"))
  7187.                             clientData = false;
  7188.                         /*if (inputString.equals("::noclip")) {
  7189.                             for (int k1 = 0; k1 < 4; k1++) {
  7190.                                 for (int i2 = 1; i2 < 103; i2++) {
  7191.                                     for (int k2 = 1; k2 < 103; k2++)
  7192.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  7193.  
  7194.                                 }
  7195.  
  7196.                             }
  7197.  
  7198.                         }*/
  7199.                     }
  7200.                     if (inputString.startsWith("::wiki")) {
  7201.                         if (inputString.length() > 7) {
  7202.                             String topic = inputString.substring(7);
  7203.                             launchURL("http://nrwiki.com/index.php?title=Special%3ASearch&search="
  7204.                                     + topic + "&go=Go");
  7205.                             pushMessage(
  7206.                                     "@red@Launching nrwiki search for the topic: "
  7207.                                             + topic, 0, "");
  7208.                         } else {
  7209.                             pushMessage("@red@The syntex is ::wiki players", 0,
  7210.                                     "");
  7211.                         }
  7212.                     }
  7213.                     if (inputString.startsWith("::bugreport")) {
  7214.  
  7215.                     }
  7216.                     if (inputString.startsWith("::pm")) {
  7217.                             boolean flag = inputString.contains(",");
  7218.                             if (flag) {
  7219.                                 stream.createFrame(126);
  7220.                                 stream.writeWordBigEndian(0);
  7221.                                 int k = stream.currentOffset;
  7222.                                 String username = null;
  7223.                                 String message = null;
  7224.                                 int divider = inputString.indexOf(",");
  7225.                                 username = inputString.substring(5, divider);
  7226.                                 message = inputString.substring(divider + 1,
  7227.                                         inputString.length());
  7228.                                 stream.writeQWord(TextClass
  7229.                                         .longForName(username));
  7230.                                 TextInput.method526(message, stream);
  7231.                                 stream.writeBytes(stream.currentOffset - k);
  7232.                                 message = TextInput.processText(message);
  7233.                                 pushMessage(message, 6, TextClass
  7234.                                         .fixName(username));
  7235.                                 if (privateChatMode == 2) {
  7236.                                     privateChatMode = 1;
  7237.                                     aBoolean1233 = true;
  7238.                                     stream.createFrame(95);
  7239.                                     stream.writeWordBigEndian(publicChatMode);
  7240.                                     stream.writeWordBigEndian(privateChatMode);
  7241.                                     stream.writeWordBigEndian(tradeMode);
  7242.                                     System.out.println("Chat Mode:"
  7243.                                             + privateChatMode);
  7244.                                 }
  7245.                             } else {
  7246.                                 pushMessage("The Syntex is ::pm name,text!", 0,
  7247.                                         "");
  7248.                             }
  7249.                     }
  7250.                     if (inputString.startsWith("::shortkeys")){
  7251.                         new ShortKeyFrame(sk);
  7252.                     }
  7253.                    
  7254.                     if (inputString.startsWith("::vote")) {
  7255.                         launchURL("http://runeps.com/vote.php");
  7256.                     }
  7257.                     if (inputString.startsWith("::names")) {
  7258.                         names = !names;
  7259.                     }
  7260.                     if (inputString.startsWith(":quicks:"))
  7261.                         clickedQuickPrayers = inputString.substring(8)
  7262.                                 .equalsIgnoreCase("on");
  7263.                     if (inputString.startsWith(":prayer:"))
  7264.                         prayerBook = inputString.substring(8);
  7265.                     if (inputString.startsWith("/")) {
  7266.                         /*
  7267.                          * if(myPrivilege == 1) inputString = "::cm " +"@cr0@"+
  7268.                          * inputString.substring(1); 9075 if(myPrivilege == 2)
  7269.                          * inputString = "::cm " +"@cr1@"+
  7270.                          * inputString.substring(1); if(myPrivilege == 3)
  7271.                          * inputString = "::cm " +"@cr2@"+
  7272.                          * inputString.substring(1); if(myPrivilege == 4)
  7273.                          * inputString = "::cm " +"@cr3@"+
  7274.                          * inputString.substring(1); if(myPrivilege == 5)
  7275.                          * inputString = "::cm " +"@cr4@"+
  7276.                          * inputString.substring(1); if(myPrivilege == 6)
  7277.                          * f
  7278.                          "::cm " +"@cr5@"+
  7279.                          * inputString.substring(1); if(myPrivilege == 7)
  7280.                          * inputString = "::cm " +"@cr6@"+
  7281.                          * inputString.substring(1); if(myPrivilege == 8)
  7282.                          * inputString = "::cm " +"@cr7@"+
  7283.                          * inputString.substring(1); if(myPrivilege == 9)
  7284.                          * inputString = "::cm " +"@cr8@"+
  7285.                          * inputString.substring(1); if(myPrivilege == 10)
  7286.                          * inputString = "::cm " +"@cr9@"+
  7287.                          * inputString.substring(1); if(myPrivilege == 11)
  7288.                          * inputString = "::cm " +"@crA@"+
  7289.                          * inputString.substring(1); if(myPrivilege == 0)
  7290.                          */
  7291.                         inputString = "::cm " + inputString.substring(1);
  7292.                     }
  7293.                     // our shortkeys
  7294.                     try{
  7295.                         for(Entry s : sk.getShortKeys()){
  7296.                             if(s.getKey().contains("/") || s.getKey().contains("::pin"))
  7297.                                 continue;
  7298.                            
  7299.                             Pattern p = Pattern.compile("(^|)"+s.getKey()+"(\\s|$)"); // use regex to break up string
  7300.                             Matcher m = p.matcher(inputString);
  7301.                             inputString  = m.replaceAll(s.getValue());
  7302.                         }
  7303.                     }catch(Exception e){ }
  7304.                    
  7305.                     if (inputString.startsWith("::")) {
  7306.                         stream.createFrame(103);
  7307.                         stream.writeWordBigEndian(inputString.length() - 1);
  7308.                         stream.writeString(inputString.substring(2));
  7309.                     } else {
  7310.                         String s = inputString.toLowerCase();
  7311.                         int j2 = 0;
  7312.                         if (s.startsWith("yellow:")) {
  7313.                             j2 = 0;
  7314.                             inputString = inputString.substring(7);
  7315.                         } else if (s.startsWith("red:")) {
  7316.                             j2 = 1;
  7317.                             inputString = inputString.substring(4);
  7318.                         } else if (s.startsWith("green:")) {
  7319.                             j2 = 2;
  7320.                             inputString = inputString.substring(6);
  7321.                         } else if (s.startsWith("cyan:")) {
  7322.                             j2 = 3;
  7323.                             inputString = inputString.substring(5);
  7324.                         } else if (s.startsWith("purple:")) {
  7325.                             j2 = 4;
  7326.                             inputString = inputString.substring(7);
  7327.                         } else if (s.startsWith("white:")) {
  7328.                             j2 = 5;
  7329.                             inputString = inputString.substring(6);
  7330.                         } else if (s.startsWith("flash1:")) {
  7331.                             j2 = 6;
  7332.                             inputString = inputString.substring(7);
  7333.                         } else if (s.startsWith("flash2:")) {
  7334.                             j2 = 7;
  7335.                             inputString = inputString.substring(7);
  7336.                         } else if (s.startsWith("flash3:")) {
  7337.                             j2 = 8;
  7338.                             inputString = inputString.substring(7);
  7339.                         } else if (s.startsWith("glow1:")) {
  7340.                             j2 = 9;
  7341.                             inputString = inputString.substring(6);
  7342.                         } else if (s.startsWith("glow2:")) {
  7343.                             j2 = 10;
  7344.                             inputString = inputString.substring(6);
  7345.                         } else if (s.startsWith("glow3:")) {
  7346.                             j2 = 11;
  7347.                             inputString = inputString.substring(6);
  7348.                         }
  7349.                         s = inputString.toLowerCase();
  7350.                         int i3 = 0;
  7351.                         if (s.startsWith("wave:")) {
  7352.                             i3 = 1;
  7353.                             inputString = inputString.substring(5);
  7354.                         } else if (s.startsWith("wave2:")) {
  7355.                             i3 = 2;
  7356.                             inputString = inputString.substring(6);
  7357.                         } else if (s.startsWith("shake:")) {
  7358.                             i3 = 3;
  7359.                             inputString = inputString.substring(6);
  7360.                         } else if (s.startsWith("scroll:")) {
  7361.                             i3 = 4;
  7362.                             inputString = inputString.substring(7);
  7363.                         } else if (s.startsWith("slide:")) {
  7364.                             i3 = 5;
  7365.                             inputString = inputString.substring(6);
  7366.                         }
  7367.  
  7368.                         stream.createFrame(4);
  7369.                         stream.writeWordBigEndian(0);
  7370.                         int j3 = stream.currentOffset;
  7371.                         stream.method425(i3);
  7372.                         stream.method425(j2);
  7373.                         aStream_834.currentOffset = 0;
  7374.                         TextInput.method526(inputString, aStream_834);
  7375.                         stream.method441(0, aStream_834.buffer,
  7376.                                 aStream_834.currentOffset);
  7377.                         stream.writeBytes(stream.currentOffset - j3);
  7378.                         inputString = TextInput.processText(inputString);
  7379.                         // inputString = Censor.doCensor(inputString);
  7380.                             for(Entry d : sk.getShortKeys()){
  7381.                         // search using regex
  7382.                         String pattern = "(^|)"+d.getKey()+"(\\s|$)";
  7383.                         Pattern p = Pattern.compile(pattern); // use regex to break up string
  7384.                         Matcher m = p.matcher(inputString);
  7385.                         inputString  = m.replaceAll(d.getValue());
  7386.                     }
  7387.                         myPlayer.textSpoken = inputString;
  7388.                         myPlayer.anInt1513 = j2;
  7389.                         myPlayer.anInt1531 = i3;
  7390.                         myPlayer.textCycle = 150;
  7391.                             String title = getSpecialColor(myPlayer.skill)
  7392.                                     + myPlayer.title + "@bla@";
  7393.                         if (myPrivilege == 11)
  7394.                             pushMessage(myPlayer.textSpoken, 2, "@crA@" + title
  7395.                                     + myPlayer.name);
  7396.                         else if (myPrivilege == 10)
  7397.                             pushMessage(myPlayer.textSpoken, 2, "@cr9@" + title
  7398.                                     + myPlayer.name);
  7399.                         else if (myPrivilege == 13)
  7400.                             pushMessage(myPlayer.textSpoken, 2, "@c10@" + title
  7401.                                     + myPlayer.name);
  7402.                         else if (myPrivilege == 9)
  7403.                             pushMessage(myPlayer.textSpoken, 2, "@cr8@" + title
  7404.                                     + myPlayer.name);
  7405.                         else if (myPrivilege == 8)
  7406.                             pushMessage(myPlayer.textSpoken, 2, "@cr7@" + title
  7407.                                     + myPlayer.name);
  7408.                         else if (myPrivilege == 7)
  7409.                             pushMessage(myPlayer.textSpoken, 2, "@cr6@" + title
  7410.                                     + myPlayer.name);
  7411.                         else if (myPrivilege == 6)
  7412.                             pushMessage(myPlayer.textSpoken, 2, "@cr5@" + title
  7413.                                     + myPlayer.name);
  7414.                         else if (myPrivilege == 5)
  7415.                             pushMessage(myPlayer.textSpoken, 2, "@cr4@" + title
  7416.                                     + myPlayer.name);
  7417.                         else if (myPrivilege == 4)
  7418.                             pushMessage(myPlayer.textSpoken, 2, "@cr3@" + title
  7419.                                     + myPlayer.name);
  7420.                         else if (myPrivilege == 3)
  7421.                             pushMessage(myPlayer.textSpoken, 2, "@cr2@" + title
  7422.                                     + myPlayer.name);
  7423.                         else if (myPrivilege == 2)
  7424.                             pushMessage(myPlayer.textSpoken, 2, "@cr1@" + title
  7425.                                     + myPlayer.name);
  7426.                         else if (myPrivilege == 1)
  7427.                             pushMessage(myPlayer.textSpoken, 2, "@cr0@" + title
  7428.                                     + myPlayer.name);
  7429.                         else
  7430.                             pushMessage(myPlayer.textSpoken, 2, title
  7431.                                     + myPlayer.name);
  7432.                         if (publicChatMode == 2) {
  7433.                             publicChatMode = 3;
  7434.                             aBoolean1233 = true;
  7435.                             stream.createFrame(95);
  7436.                             stream.writeWordBigEndian(publicChatMode);
  7437.                             stream.writeWordBigEndian(privateChatMode);
  7438.                             stream.writeWordBigEndian(tradeMode);
  7439.                         }
  7440.                     }
  7441.                     inputString = "";
  7442.                     inputTaken = true;
  7443.                 }
  7444.             }
  7445.         } while (true);
  7446.     }
  7447.  
  7448.     private void buildPublicChat(int j) {
  7449.         int l = 0;
  7450.         for (int i1 = 0; i1 < 500; i1++) {
  7451.             if (chatMessages[i1] == null)
  7452.                 continue;
  7453.             if (chatTypeView != 1)
  7454.                 continue;
  7455.             int j1 = chatTypes[i1];
  7456.             String s = chatNames[i1];
  7457.             String ct = chatMessages[i1];
  7458.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7459.             if (k1 < -23)
  7460.                 break;
  7461.             if (s != null && s.startsWith("@cr0@"))
  7462.                 s = s.substring(5);
  7463.             if (s != null && s.startsWith("@cr1@"))
  7464.                 s = s.substring(5);
  7465.             if (s != null && s.startsWith("@cr2@"))
  7466.                 s = s.substring(5);
  7467.             if (s != null && s.startsWith("@cr3@"))
  7468.                 s = s.substring(5);
  7469.             if (s != null && s.startsWith("@cr4@"))
  7470.                 s = s.substring(5);
  7471.             if (s != null && s.startsWith("@cr5@"))
  7472.                 s = s.substring(5);
  7473.             if (s != null && s.startsWith("@cr6@"))
  7474.                 s = s.substring(5);
  7475.             if (s != null && s.startsWith("@cr7@"))
  7476.                 s = s.substring(5);
  7477.             if (s != null && s.startsWith("@cr8@"))
  7478.                 s = s.substring(5);
  7479.             if (s != null && s.startsWith("@cr9@"))
  7480.                 s = s.substring(5);
  7481.             if (s != null && s.startsWith("@c10@"))
  7482.                 s = s.substring(5);
  7483.             if (s != null && s.startsWith("@crA@"))
  7484.                 s = s.substring(5);
  7485.             if ((j1 == 1 || j1 == 2)
  7486.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  7487.                             && isFriendOrSelf(s))) {
  7488.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  7489.                     if (myPrivilege >= 1) {
  7490.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7491.                                 + s;
  7492.                         menuActionID[menuActionRow] = 606;
  7493.                         menuActionRow++;
  7494.                     }
  7495.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7496.                     menuActionID[menuActionRow] = 42;
  7497.                     menuActionRow++;
  7498.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7499.                     menuActionID[menuActionRow] = 639;
  7500.                     menuActionRow++;
  7501.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7502.                     menuActionID[menuActionRow] = 337;
  7503.                     menuActionRow++;
  7504.                 }
  7505.                 l++;
  7506.             }
  7507.         }
  7508.     }
  7509.  
  7510.     private void buildFriendChat(int j) {
  7511.         int l = 0;
  7512.         for (int i1 = 0; i1 < 500; i1++) {
  7513.             if (chatMessages[i1] == null)
  7514.                 continue;
  7515.             if (chatTypeView != 2)
  7516.                 continue;
  7517.             int j1 = chatTypes[i1];
  7518.             String s = chatNames[i1];
  7519.             String ct = chatMessages[i1];
  7520.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7521.             if (k1 < -23)
  7522.                 break;
  7523.             if (s != null && s.startsWith("@cr0@"))
  7524.                 s = s.substring(5);
  7525.             if (s != null && s.startsWith("@cr1@"))
  7526.                 s = s.substring(5);
  7527.             if (s != null && s.startsWith("@cr2@"))
  7528.                 s = s.substring(5);
  7529.             if (s != null && s.startsWith("@cr3@"))
  7530.                 s = s.substring(5);
  7531.             if (s != null && s.startsWith("@cr4@"))
  7532.                 s = s.substring(5);
  7533.             if (s != null && s.startsWith("@cr5@"))
  7534.                 s = s.substring(5);
  7535.             if (s != null && s.startsWith("@cr6@"))
  7536.                 s = s.substring(5);
  7537.             if (s != null && s.startsWith("@cr7@"))
  7538.                 s = s.substring(5);
  7539.             if (s != null && s.startsWith("@cr8@"))
  7540.                 s = s.substring(5);
  7541.             if (s != null && s.startsWith("@cr9@"))
  7542.                 s = s.substring(5);
  7543.             if (s != null && s.startsWith("@c10@"))
  7544.                 s = s.substring(5);
  7545.             if (s != null && s.startsWith("@crA@"))
  7546.                 s = s.substring(5);
  7547.             if ((j1 == 5 || j1 == 6)
  7548.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  7549.                     && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1
  7550.                             && isFriendOrSelf(s)))
  7551.                 l++;
  7552.             if ((j1 == 3 || j1 == 7)
  7553.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  7554.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  7555.                             && isFriendOrSelf(s))) {
  7556.                 if (j > k1 - 14 && j <= k1) {
  7557.                     if (myPrivilege >= 1) {
  7558.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7559.                                 + s;
  7560.                         menuActionID[menuActionRow] = 606;
  7561.                         menuActionRow++;
  7562.                     }
  7563.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7564.                     menuActionID[menuActionRow] = 2042;
  7565.                     menuActionRow++;
  7566.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7567.                     menuActionID[menuActionRow] = 2639;
  7568.                     menuActionRow++;
  7569.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7570.                     menuActionID[menuActionRow] = 2337;
  7571.                     menuActionRow++;
  7572.                 }
  7573.                 l++;
  7574.             }
  7575.         }
  7576.     }
  7577.  
  7578.     private void buildDuelorTrade(int j) {
  7579.         int l = 0;
  7580.         for (int i1 = 0; i1 < 500; i1++) {
  7581.             if (chatMessages[i1] == null)
  7582.                 continue;
  7583.             if (chatTypeView != 3 && chatTypeView != 4)
  7584.                 continue;
  7585.             int j1 = chatTypes[i1];
  7586.             String s = chatNames[i1];
  7587.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7588.             if (k1 < -23)
  7589.                 break;
  7590.             if (s != null && s.startsWith("@cr0@"))
  7591.                 s = s.substring(5);
  7592.             if (s != null && s.startsWith("@cr1@"))
  7593.                 s = s.substring(5);
  7594.             if (s != null && s.startsWith("@cr2@"))
  7595.                 s = s.substring(5);
  7596.             if (s != null && s.startsWith("@cr3@"))
  7597.                 s = s.substring(5);
  7598.             if (s != null && s.startsWith("@cr4@"))
  7599.                 s = s.substring(5);
  7600.             if (s != null && s.startsWith("@cr5@"))
  7601.                 s = s.substring(5);
  7602.             if (s != null && s.startsWith("@cr6@"))
  7603.                 s = s.substring(5);
  7604.             if (s != null && s.startsWith("@cr7@"))
  7605.                 s = s.substring(5);
  7606.             if (s != null && s.startsWith("@cr8@"))
  7607.                 s = s.substring(5);
  7608.             if (s != null && s.startsWith("@cr9@"))
  7609.                 s = s.substring(5);
  7610.             if (s != null && s.startsWith("@c10@"))
  7611.                 s = s.substring(5);
  7612.             if (s != null && s.startsWith("@crA@"))
  7613.                 s = s.substring(5);
  7614.             if (chatTypeView == 3 && j1 == 4
  7615.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7616.                 if (j > k1 - 14 && j <= k1) {
  7617.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  7618.                     menuActionID[menuActionRow] = 484;
  7619.                     menuActionRow++;
  7620.                 }
  7621.                 l++;
  7622.             }
  7623.             if (chatTypeView == 4 && j1 == 8
  7624.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7625.                 if (j > k1 - 14 && j <= k1) {
  7626.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  7627.                             + s;
  7628.                     menuActionID[menuActionRow] = 6;
  7629.                     menuActionRow++;
  7630.                 }
  7631.                 l++;
  7632.             }
  7633.             if (j1 == 12) {
  7634.                 if (j > k1 - 14 && j <= k1) {
  7635.                     menuActionName[menuActionRow] = "Go-to @blu@" + s;
  7636.                     menuActionID[menuActionRow] = 915;
  7637.                     menuActionRow++;
  7638.                 }
  7639.                 l++;
  7640.             }
  7641.             if (j1 == 9) {
  7642.                 if (j > k1 - 14 && j <= k1) {
  7643.                     menuActionName[menuActionRow] = "Go-to @lre@" + s;
  7644.                     menuActionID[menuActionRow] = 927;
  7645.                     menuActionRow++;
  7646.                 }
  7647.                 l++;
  7648.             }
  7649.         }
  7650.     }
  7651.  
  7652.     private void buildChatAreaMenu(int j) {
  7653.         int l = 0;
  7654.         int test = 0;
  7655.         for (int i1 = 0; i1 < 500; i1++) {
  7656.             if (chatMessages[i1] == null)
  7657.                 continue;
  7658.             int j1 = chatTypes[i1];
  7659.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7660.             if (k1 < -23)
  7661.                 break;
  7662.             String s = "";
  7663.             if(chatNames[i1] != null)
  7664.                 s = chatNames[i1].replaceAll(title, "");
  7665.             String ct = chatMessages[i1];
  7666.             boolean flag = false;
  7667.             if (chatTypeView == 1) {
  7668.                 buildPublicChat(j);
  7669.                 break;
  7670.             }
  7671.             if (chatTypeView == 2) {
  7672.                 buildFriendChat(j);
  7673.                 break;
  7674.             }
  7675.             if (chatTypeView == 3 || chatTypeView == 4) {
  7676.                 buildDuelorTrade(j);
  7677.                 break;
  7678.             }
  7679.             if (chatTypeView == 5) {
  7680.                 break;
  7681.             }
  7682.             if (s != null && s.startsWith("@cr0@")) {
  7683.                 s = s.substring(5);
  7684.                 boolean flag1 = true;
  7685.                 byte byte0 = 1;
  7686.             }
  7687.             if (s != null && s.startsWith("@cr1@")) {
  7688.                 s = s.substring(5);
  7689.                 byte byte0 = 2;
  7690.             }
  7691.             if (s != null && s.startsWith("@cr2@")) {
  7692.                 s = s.substring(5);
  7693.                 byte byte0 = 3;
  7694.             }
  7695.             if (s != null && s.startsWith("@cr3@")) {
  7696.                 s = s.substring(5);
  7697.                 byte byte0 = 4;
  7698.             }
  7699.             if (s != null && s.startsWith("@cr4@")) {
  7700.                 s = s.substring(5);
  7701.                 byte byte0 = 5;
  7702.             }
  7703.             if (s != null && s.startsWith("@cr5@")) {
  7704.                 s = s.substring(5);
  7705.                 byte byte0 = 6;
  7706.             }
  7707.             if (s != null && s.startsWith("@cr6@")) {
  7708.                 s = s.substring(5);
  7709.                 byte byte0 = 7;
  7710.             }
  7711.             if (s != null && s.startsWith("@cr7@")) {
  7712.                 s = s.substring(5);
  7713.                 byte byte0 = 8;
  7714.             }
  7715.             if (s != null && s.startsWith("@cr8@")) {
  7716.                 s = s.substring(5);
  7717.                 byte byte0 = 9;
  7718.             }
  7719.             if (s != null && s.startsWith("@cr9@")) {
  7720.                 s = s.substring(5);
  7721.                 byte byte0 = 10;
  7722.             }
  7723.             if (s != null && s.startsWith("@c10@")) {
  7724.                 s = s.substring(5);
  7725.                 byte byte0 = 13;
  7726.             }
  7727.             if (s != null && s.startsWith("@crA@")) {
  7728.                 s = s.substring(5);
  7729.                 byte byte0 = 11;
  7730.             }
  7731.             if (j1 == 0)
  7732.                 l++;
  7733.             String title = getSpecialColor(myPlayer.skill)
  7734.                     + myPlayer.title + "@whi@";
  7735.             if ((j1 == 1 || j1 == 2)
  7736.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  7737.                             && isFriendOrSelf(s))) {
  7738.                 if (j > k1 - 14 && j <= k1
  7739.                         && !s.replaceAll(title, "").equals(myPlayer.name)) {
  7740.                     if (myPrivilege >= 1) {
  7741.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7742.                                 + s;
  7743.                         menuActionID[menuActionRow] = 606;
  7744.                         menuActionRow++;
  7745.                     }
  7746.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7747.                     menuActionID[menuActionRow] = 42;
  7748.                     menuActionRow++;
  7749.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7750.                     menuActionID[menuActionRow] = 639;
  7751.                     menuActionRow++;
  7752.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7753.                     menuActionID[menuActionRow] = 337;
  7754.                     menuActionRow++;
  7755.                 }
  7756.                 l++;
  7757.             }
  7758.             if ((j1 == 3 || j1 == 7)
  7759.                     && splitPrivateChat == 0
  7760.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  7761.                             && isFriendOrSelf(s))) {
  7762.                 if (j > k1 - 14 && j <= k1) {
  7763.                     if (myPrivilege >= 1) {
  7764.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7765.                                 + s;
  7766.                         menuActionID[menuActionRow] = 606;
  7767.                         menuActionRow++;
  7768.                     }
  7769.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7770.                     menuActionID[menuActionRow] = 42;
  7771.                     menuActionRow++;
  7772.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7773.                     menuActionID[menuActionRow] = 639;
  7774.                     menuActionRow++;
  7775.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7776.                     menuActionID[menuActionRow] = 337;
  7777.                     menuActionRow++;
  7778.                 }
  7779.                 l++;
  7780.             }
  7781.             if (j1 == 9) {
  7782.                 if (j > k1 - 14 && j <= k1) {
  7783.                     menuActionName[menuActionRow] = "Go-to @lre@" + s;
  7784.                     menuActionID[menuActionRow] = 927;
  7785.                     menuActionRow++;
  7786.                 }
  7787.                 l++;
  7788.             }
  7789.             if (j1 == 4
  7790.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7791.                 if (j > k1 - 14 && j <= k1) {
  7792.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  7793.                     menuActionID[menuActionRow] = 484;
  7794.                     menuActionRow++;
  7795.                 }
  7796.                 l++;
  7797.             }
  7798.             if ((j1 == 5 || j1 == 6) && splitPrivateChat == 0
  7799.                     && privateChatMode < 2)
  7800.                 l++;
  7801.             if (j1 == 8
  7802.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7803.                 if (j > k1 - 14 && j <= k1) {
  7804.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  7805.                             + s;
  7806.                     menuActionID[menuActionRow] = 6;
  7807.                     menuActionRow++;
  7808.                 }
  7809.                 l++;
  7810.             }
  7811.         }
  7812.     }
  7813.    
  7814.     public int getXPForLevel(int level) {
  7815.         int points = 0;
  7816.         int output = 0;
  7817.         for (int lvl = 1; lvl <= level; lvl++) {
  7818.             points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
  7819.             if (lvl >= level) {
  7820.                 return output;
  7821.             }
  7822.             output = (int)Math.floor(points / 4);
  7823.         }
  7824.         return 0;
  7825.     }
  7826.    
  7827.     public String[] skillNames = { "Attack", "Hitpoints", "Mining", "Strength", "Agility", "Smithing", "Defence", "Herblore", "Fishing", "Range", "Thieving", "Cooking", "Prayer", "Crafting", "Firemaking", "Magic", "Fletching", "Woodcutting", "Runecrafting", "Slayer", "Farming", "Construction", "Hunter", "Summoning", "Dungeoneering" };
  7828.     public String setMessage(int level) {
  7829.         String[] messages = new String[4];
  7830.         String message = "";
  7831.         int maxLevel = 99;
  7832.         if (maxStats[level] > maxLevel) {
  7833.             if (level != 24){
  7834.                 maxStats[level] = 99;
  7835.             } else if (maxStats[level] > 120) {
  7836.                 maxStats[level] = 120;
  7837.             }
  7838.         }
  7839.         int[] stuff = {0,3,14,2,16,13,1,15,10,4,17,7,5,12,11,6,9,8,20,18,19,21,22,23,24};
  7840.         messages[0] = skillNames[level]+": "+currentStats[stuff[level]]+"/"+maxStats[stuff[level]]+"\\n";
  7841.         messages[1] = "Current XP: " + getXPForLevel(maxStats[stuff[level]])+"\\n";
  7842.         messages[2]= "Next level: "+ (getXPForLevel(maxStats[stuff[level]]+1)-getXPForLevel(maxStats[stuff[level]]))+"\\n";
  7843.         messages[3]= "Remainder: "+ getXPForLevel(maxStats[stuff[level]]+1);
  7844.         message = messages[0] + messages[1] + messages[2] + messages[3];
  7845.         if (getXPForLevel(maxStats[stuff[level]]) >= 99) {
  7846.             message = skillNames[level]+": "+ currentStats[stuff[level]]+"/99\\nMax Level Reached";
  7847.         }
  7848.         return message;
  7849.     }
  7850.  
  7851.     private void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  7852.         int j = class9.contentType;
  7853.         if(j >= 205 && j <= 205+25){
  7854.             j -= 205;
  7855.             class9.message = setMessage(j);
  7856.             return;
  7857.         }
  7858.         if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  7859.             if (j == 1 && anInt900 == 0) {
  7860.                 class9.message = "Loading friend list";
  7861.                 class9.atActionType = 0;
  7862.                 return;
  7863.             }
  7864.             if (j == 1 && anInt900 == 1) {
  7865.                 class9.message = "Connecting to friendserver";
  7866.                 class9.atActionType = 0;
  7867.                 return;
  7868.             }
  7869.             if (j == 2 && anInt900 != 2) {
  7870.                 class9.message = "Please wait...";
  7871.                 class9.atActionType = 0;
  7872.                 return;
  7873.             }
  7874.             int k = friendsCount;
  7875.             if (anInt900 != 2)
  7876.                 k = 0;
  7877.             if (j > 700)
  7878.                 j -= 601;
  7879.             else
  7880.                 j--;
  7881.             if (j >= k) {
  7882.                 class9.message = "";
  7883.                 class9.atActionType = 0;
  7884.                 return;
  7885.             } else {
  7886.                 class9.message = friendsList[j];
  7887.                 class9.atActionType = 1;
  7888.                 return;
  7889.             }
  7890.         }
  7891.         if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  7892.             int l = friendsCount;
  7893.             if (anInt900 != 2)
  7894.                 l = 0;
  7895.             if (j > 800)
  7896.                 j -= 701;
  7897.             else
  7898.                 j -= 101;
  7899.             if (j >= l) {
  7900.                 class9.message = "";
  7901.                 class9.atActionType = 0;
  7902.                 return;
  7903.             }
  7904.             if (friendsNodeIDs[j] == 0)
  7905.                 class9.message = "@red@Offline";
  7906.             else if (friendsNodeIDs[j] == nodeID)
  7907.                 if (friendsNodeWorlds.containsKey(friendsList[j])) {
  7908.                     class9.message = "@yel@World "
  7909.                             + (String) friendsNodeWorlds.get(friendsList[j]);// +
  7910.                                                                                 // (friendsNodeIDs[j]
  7911.                                                                                 // -
  7912.                                                                                 // 9);
  7913.                 } else {
  7914.                     class9.message = "@gre@World " + world;// +
  7915.                                                             // (friendsNodeIDs[j]
  7916.                                                             // - 9);
  7917.                 }
  7918.             else
  7919.                 class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */;
  7920.             class9.atActionType = 1;
  7921.             return;
  7922.         }
  7923.         if (j == 203) {
  7924.             int i1 = friendsCount;
  7925.             if (anInt900 != 2)
  7926.                 i1 = 0;
  7927.             class9.scrollMax = i1 * 15 + 20;
  7928.             if (class9.scrollMax <= class9.height)
  7929.                 class9.scrollMax = class9.height + 1;
  7930.             return;
  7931.         }
  7932.         if (j >= 401 && j <= 500) {
  7933.             if ((j -= 401) == 0 && anInt900 == 0) {
  7934.                 class9.message = "Loading ignore list";
  7935.                 class9.atActionType = 0;
  7936.                 return;
  7937.             }
  7938.             if (j == 1 && anInt900 == 0) {
  7939.                 class9.message = "Please wait...";
  7940.                 class9.atActionType = 0;
  7941.                 return;
  7942.             }
  7943.             int j1 = ignoreCount;
  7944.             if (anInt900 == 0)
  7945.                 j1 = 0;
  7946.             if (j >= j1) {
  7947.                 class9.message = "";
  7948.                 class9.atActionType = 0;
  7949.                 return;
  7950.             } else {
  7951.                 class9.message = TextClass.fixName(TextClass
  7952.                         .nameForLong(ignoreListAsLongs[j]));
  7953.                 class9.atActionType = 1;
  7954.                 return;
  7955.             }
  7956.         }
  7957.         if (j == 503) {
  7958.             class9.scrollMax = ignoreCount * 15 + 20;
  7959.             if (class9.scrollMax <= class9.height)
  7960.                 class9.scrollMax = class9.height + 1;
  7961.             return;
  7962.         }
  7963.         if (j == 669) {
  7964.             int verticleTilt = 150;
  7965.             int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  7966.             class9.modelRotation1 = verticleTilt;
  7967.             class9.modelRotation2 = animationSpeed;
  7968.             if (aBoolean1031) {
  7969.                 Model characterDisplay = ((Player) (myPlayer)).method452();
  7970.                 for (int l2 = 0; l2 < 5; l2++)
  7971.                     if (anIntArray990[l2] != 0) {
  7972.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  7973.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  7974.                         if (l2 == 1)
  7975.                             characterDisplay.method476(anIntArray1204[0],
  7976.                                     anIntArray1204[anIntArray990[l2]]);
  7977.                     }
  7978.                 int staticFrame = myPlayer.anInt1511;
  7979.                 characterDisplay.method469();
  7980.                 characterDisplay
  7981.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  7982.                 class9.anInt233 = 5;
  7983.                 class9.mediaID = 0;
  7984.                 RSInterface.method208(aBoolean994, characterDisplay);
  7985.             }
  7986.         }
  7987.         if (j == 327) {
  7988.             class9.modelRotation1 = 150;
  7989.             class9.modelRotation2 = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  7990.             if (aBoolean1031) {
  7991.                 for (int k1 = 0; k1 < 7; k1++) {
  7992.                     int l1 = anIntArray1065[k1];
  7993.                     if (l1 >= 0 && !IDK.cache[l1].method537())
  7994.                         return;
  7995.                 }
  7996.  
  7997.                 aBoolean1031 = false;
  7998.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  7999.                 int i2 = 0;
  8000.                 for (int j2 = 0; j2 < 7; j2++) {
  8001.                     int k2 = anIntArray1065[j2];
  8002.                     if (k2 >= 0)
  8003.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2]
  8004.                                 .method538();
  8005.                 }
  8006.  
  8007.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  8008.                 for (int l2 = 0; l2 < 5; l2++)
  8009.                     if (anIntArray990[l2] != 0) {
  8010.                         model.method476(anIntArrayArray1003[l2][0],
  8011.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  8012.                         if (l2 == 1)
  8013.                             model.method476(anIntArray1204[0],
  8014.                                     anIntArray1204[anIntArray990[l2]]);
  8015.                     }
  8016.  
  8017.                 model.method469();
  8018.                 model
  8019.                         .method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  8020.                 model.method479(64, 850, -30, -50, -30, true);
  8021.                 class9.anInt233 = 5;
  8022.                 class9.mediaID = 0;
  8023.                 RSInterface.method208(aBoolean994, model);
  8024.             }
  8025.             return;
  8026.         }
  8027.         if (j == 328) {
  8028.             RSInterface rsInterface = class9;
  8029.             int verticleTilt = 150;
  8030.             int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  8031.             rsInterface.modelRotation1 = verticleTilt;
  8032.             rsInterface.modelRotation2 = animationSpeed;
  8033.             if (aBoolean1031) {
  8034.                 Model characterDisplay = myPlayer.method452();
  8035.                 for (int l2 = 0; l2 < 5; l2++)
  8036.                     if (anIntArray990[l2] != 0) {
  8037.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  8038.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  8039.                         if (l2 == 1)
  8040.                             characterDisplay.method476(anIntArray1204[0],
  8041.                                     anIntArray1204[anIntArray990[l2]]);
  8042.                     }
  8043.                 int staticFrame = myPlayer.anInt1511;
  8044.                 characterDisplay.method469();
  8045.                 characterDisplay
  8046.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  8047.                 rsInterface.anInt233 = 5;
  8048.                 rsInterface.mediaID = 0;
  8049.                 RSInterface.method208(aBoolean994, characterDisplay);
  8050.             }
  8051.             return;
  8052.         }
  8053.         if (j == 324) {
  8054.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  8055.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  8056.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  8057.             }
  8058.             if (aBoolean1047) {
  8059.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  8060.                 return;
  8061.             } else {
  8062.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  8063.                 return;
  8064.             }
  8065.         }
  8066.         if (j == 325) {
  8067.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  8068.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  8069.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  8070.             }
  8071.             if (aBoolean1047) {
  8072.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  8073.                 return;
  8074.             } else {
  8075.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  8076.                 return;
  8077.             }
  8078.         }
  8079.         if (j == 600) {
  8080.             class9.message = reportAbuseInput;
  8081.             if (loopCycle % 20 < 10) {
  8082.                 class9.message += "|";
  8083.                 return;
  8084.             } else {
  8085.                 class9.message += " ";
  8086.                 return;
  8087.             }
  8088.         }
  8089.         if (j == 613)
  8090.             if (myPrivilege >= 1) {
  8091.                 if (canMute) {
  8092.                     class9.textColor = 0xff0000;
  8093.                     class9.message = "Moderator option: Mute player for 48 hours: <ON>";
  8094.                 } else {
  8095.                     class9.textColor = 0xffffff;
  8096.                     class9.message = "Moderator option: Mute player for 48 hours: <OFF>";
  8097.                 }
  8098.             } else {
  8099.                 class9.message = "";
  8100.             }
  8101.         if (j == 650 || j == 655)
  8102.             if (anInt1193 != 0) {
  8103.                 String s;
  8104.                 if (daysSinceLastLogin == 0)
  8105.                     s = "earlier today";
  8106.                 else if (daysSinceLastLogin == 1)
  8107.                     s = "yesterday";
  8108.                 else
  8109.                     s = daysSinceLastLogin + " days ago";
  8110.                 class9.message = "You last logged in " + s + " from: "
  8111.                         + signlink.dns;
  8112.             } else {
  8113.                 class9.message = "";
  8114.             }
  8115.         if (j == 651) {
  8116.             if (unreadMessages == 0) {
  8117.                 class9.message = "0 unread messages";
  8118.                 class9.textColor = 0xffff00;
  8119.             }
  8120.             if (unreadMessages == 1) {
  8121.                 class9.message = "1 unread message";
  8122.                 class9.textColor = 65280;
  8123.             }
  8124.             if (unreadMessages > 1) {
  8125.                 class9.message = unreadMessages + " unread messages";
  8126.                 class9.textColor = 65280;
  8127.             }
  8128.         }
  8129.         if (j == 652)
  8130.             if (daysSinceRecovChange == 201) {
  8131.                 if (membersInt == 1)
  8132.                     class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  8133.                 else
  8134.                     class9.message = "";
  8135.             } else if (daysSinceRecovChange == 200) {
  8136.                 class9.message = "You have not yet set any password recovery questions.";
  8137.             } else {
  8138.                 String s1;
  8139.                 if (daysSinceRecovChange == 0)
  8140.                     s1 = "Earlier today";
  8141.                 else if (daysSinceRecovChange == 1)
  8142.                     s1 = "Yesterday";
  8143.                 else
  8144.                     s1 = daysSinceRecovChange + " days ago";
  8145.                 class9.message = s1 + " you changed your recovery questions";
  8146.             }
  8147.         if (j == 653)
  8148.             if (daysSinceRecovChange == 201) {
  8149.                 if (membersInt == 1)
  8150.                     class9.message = "@whi@recommend you use a members world instead. You may use";
  8151.                 else
  8152.                     class9.message = "";
  8153.             } else if (daysSinceRecovChange == 200)
  8154.                 class9.message = "We strongly recommend you do so now to secure your account.";
  8155.             else
  8156.                 class9.message = "If you do not remember making this change then cancel it immediately";
  8157.         if (j == 654) {
  8158.             if (daysSinceRecovChange == 201)
  8159.                 if (membersInt == 1) {
  8160.                     class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  8161.                     return;
  8162.                 } else {
  8163.                     class9.message = "";
  8164.                     return;
  8165.                 }
  8166.             if (daysSinceRecovChange == 200) {
  8167.                 class9.message = "Do this from the 'account management' area on our front webpage";
  8168.                 return;
  8169.             }
  8170.             class9.message = "Do this from the 'account management' area on our front webpage";
  8171.         }
  8172.     }
  8173.  
  8174.     private void drawSplitPrivateChat() {
  8175.         if (splitPrivateChat == 0)
  8176.             return;
  8177.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  8178.         int i = 0;
  8179.         if (anInt1104 != 0)
  8180.             i = 1;
  8181.         for (int j = 0; j < 100; j++)
  8182.             if (chatMessages[j] != null) {
  8183.                 int k = chatTypes[j];
  8184.                 String s = chatNames[j];
  8185.                 byte byte1 = 0;
  8186.                 if (s != null && s.startsWith("@cr0@")) {
  8187.                     s = s.substring(5);
  8188.                     byte1 = 1;
  8189.                 }
  8190.                 if (s != null && s.startsWith("@cr1@")) {
  8191.                     s = s.substring(5);
  8192.                     byte1 = 2;
  8193.                 }
  8194.                 if (s != null && s.startsWith("@cr2@")) {
  8195.                     s = s.substring(5);
  8196.                     byte1 = 3;
  8197.                 }
  8198.                 if (s != null && s.startsWith("@cr3@")) {
  8199.                     s = s.substring(5);
  8200.                     byte1 = 4;
  8201.                 }
  8202.                 if (s != null && s.startsWith("@cr4@")) {
  8203.                     s = s.substring(5);
  8204.                     byte1 = 5;
  8205.                 }
  8206.                 if (s != null && s.startsWith("@cr5@")) {
  8207.                     s = s.substring(5);
  8208.                     byte1 = 6;
  8209.                 }
  8210.                 if (s != null && s.startsWith("@cr6@")) {
  8211.                     s = s.substring(5);
  8212.                     byte1 = 7;
  8213.                 }
  8214.                 if (s != null && s.startsWith("@cr7@")) {
  8215.                     s = s.substring(5);
  8216.                     byte1 = 8;
  8217.                 }
  8218.                 if (s != null && s.startsWith("@cr8@")) {
  8219.                     s = s.substring(5);
  8220.                     byte1 = 9;
  8221.                 }
  8222.                 if (s != null && s.startsWith("@cr9@")) {
  8223.                     s = s.substring(5);
  8224.                     byte1 = 10;
  8225.                 }
  8226.                 if (s != null && s.startsWith("@c10@")) {
  8227.                     s = s.substring(5);
  8228.                     byte1 = 13;
  8229.                 }
  8230.                 if (s != null && s.startsWith("@crA@")) {
  8231.                     s = s.substring(5);
  8232.                     byte1 = 11;
  8233.                 }
  8234.                 if ((k == 3 || k == 7)
  8235.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  8236.                                 && isFriendOrSelf(s))) {
  8237.                     int l = 329 - i * 13;
  8238.                     int k1 = 4;
  8239.                     textDrawingArea.method385(0, "From", l, k1);
  8240.                     textDrawingArea.method385(65535, "From", l - 1, k1);
  8241.                     k1 += textDrawingArea.getTextWidth("From ");
  8242.                     if (byte1 == 1) {
  8243.                         modIcons[0].drawSprite(k1, l - 12);
  8244.                         k1 += 12;
  8245.                     }
  8246.                     if (byte1 == 2) {
  8247.                         modIcons[1].drawSprite(k1, l - 12);
  8248.                         k1 += 12;
  8249.                     }
  8250.                     if (byte1 == 3) {
  8251.                         modIcons[2].drawSprite(k1, l - 12);
  8252.                         k1 += 12;
  8253.                     }
  8254.                     if (byte1 == 4) {
  8255.                         modIcons[3].drawSprite(k1, l - 12);
  8256.                         k1 += 12;
  8257.                     }
  8258.                     if (byte1 == 5) {
  8259.                         modIcons[4].drawSprite(k1, l - 12);
  8260.                         k1 += 12;
  8261.                     }
  8262.                     if (byte1 == 6) {
  8263.                         modIcons[5].drawSprite(k1, l - 12);
  8264.                         k1 += 12;
  8265.                     }
  8266.                     if (byte1 == 7) {
  8267.                         modIcons[6].drawSprite(k1, l - 12);
  8268.                         k1 += 12;
  8269.                     }
  8270.                     if (byte1 == 8) {
  8271.                         modIcons[7].drawSprite(k1, l - 12);
  8272.                         k1 += 12;
  8273.                     }
  8274.                     if (byte1 == 9) {
  8275.                         modIcons[8].drawSprite(k1, l - 12);
  8276.                         k1 += 12;
  8277.                     }
  8278.                     if (byte1 == 10) {
  8279.                         modIcons[9].drawSprite(k1, l - 12);
  8280.                         k1 += 12;
  8281.                     }
  8282.                     if (byte1 == 11) {
  8283.                         modIcons[10].drawSprite(k1, l - 12);
  8284.                         k1 += 12;
  8285.                     }
  8286.                     if (byte1 == 13) {
  8287.                         modIcons[11].drawSprite(k1, l - 12);
  8288.                         k1 += 12;
  8289.                     }
  8290.                     textDrawingArea.method385(0, s + ": " + chatMessages[j], l,
  8291.                             k1);
  8292.                     textDrawingArea.method385(65535,
  8293.                             s + ": " + chatMessages[j], l - 1, k1);
  8294.                     if (++i >= 5)
  8295.                         return;
  8296.                 }
  8297.                 if (k == 5 && privateChatMode < 2) {
  8298.                     int i1 = 329 - i * 13;
  8299.                     textDrawingArea.method385(0, chatMessages[j], i1, 4);
  8300.                     textDrawingArea
  8301.                             .method385(65535, chatMessages[j], i1 - 1, 4);
  8302.                     if (++i >= 5)
  8303.                         return;
  8304.                 }
  8305.                 if (k == 6 && privateChatMode < 2) {
  8306.                     int j1 = 329 - i * 13;
  8307.                     textDrawingArea.method385(0, "To " + s + ": "
  8308.                             + chatMessages[j], j1, 4);
  8309.                     textDrawingArea.method385(65535, "To " + s + ": "
  8310.                             + chatMessages[j], j1 - 1, 4);
  8311.                     if (++i >= 5)
  8312.                         return;
  8313.                 }
  8314.             }
  8315.  
  8316.     }
  8317.  
  8318.     public void pushMessage(String s, int i, String s1) {
  8319.         if (i == 0 && dialogID != -1) {
  8320.             aString844 = s;
  8321.             super.clickMode3 = 0;
  8322.         }
  8323.         if (backDialogID == -1)
  8324.             inputTaken = true;
  8325.         for (int j = 499; j > 0; j--) {
  8326.             chatTypes[j] = chatTypes[j - 1];
  8327.             chatNames[j] = chatNames[j - 1];
  8328.             chatMessages[j] = chatMessages[j - 1];
  8329.         }
  8330.         chatTypes[0] = i;
  8331.         chatNames[0] = s1;
  8332.         chatMessages[0] = s;
  8333.     }
  8334.  
  8335.     public int logIconHPos = 0;
  8336.  
  8337.     public void processMapAreaClick() {
  8338.         if (super.mouseX >= 742 && super.mouseX <= 764 && super.mouseY >= 1
  8339.                 && super.mouseY <= 23) {
  8340.             logIconHPos = 1;
  8341.         } else {
  8342.             logIconHPos = 0;
  8343.         }
  8344.     }
  8345.  
  8346.     private void processTabClick() {
  8347.         if (super.clickMode3 == 1) {
  8348.             if (super.saveClickX >= 524 && super.saveClickX <= 561
  8349.                     && super.saveClickY >= 169 && super.saveClickY < 205
  8350.                     && tabInterfaceIDs[0] != -1) {
  8351.                     invSelected = false;
  8352.                 needDrawTabArea = true;
  8353.                 tabID = 0;
  8354.                 tabAreaAltered = true;
  8355.             }
  8356.             if (super.saveClickX >= 562 && super.saveClickX <= 594
  8357.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8358.                     && tabInterfaceIDs[1] != -1) {
  8359.                     invSelected = false;
  8360.                 needDrawTabArea = true;
  8361.                 tabID = 1;
  8362.                 tabAreaAltered = true;
  8363.             }
  8364.             if (super.saveClickX >= 595 && super.saveClickX <= 626
  8365.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8366.                     && tabInterfaceIDs[2] != -1) {
  8367.                     invSelected = false;
  8368.                 needDrawTabArea = true;
  8369.                 tabID = 2;
  8370.                 tabAreaAltered = true;
  8371.             }
  8372.             if (super.saveClickX >= 627 && super.saveClickX <= 660
  8373.                     && super.saveClickY >= 168 && super.saveClickY < 203
  8374.                     && tabInterfaceIDs[3] != -1) {
  8375.                     invSelected = true;
  8376.                 needDrawTabArea = true;
  8377.                 tabID = 3;
  8378.                 tabAreaAltered = true;
  8379.             }
  8380.             if (super.saveClickX >= 661 && super.saveClickX <= 693
  8381.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8382.                     && tabInterfaceIDs[4] != -1) {
  8383.                     invSelected = false;
  8384.                 needDrawTabArea = true;
  8385.                 tabID = 4;
  8386.                 tabAreaAltered = true;
  8387.             }
  8388.             if (super.saveClickX >= 694 && super.saveClickX <= 725
  8389.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8390.                     && tabInterfaceIDs[5] != -1) {
  8391.                     invSelected = false;
  8392.                 needDrawTabArea = true;
  8393.                 tabID = 5;
  8394.                 tabAreaAltered = true;
  8395.             }
  8396.             if (super.saveClickX >= 726 && super.saveClickX <= 765
  8397.                     && super.saveClickY >= 169 && super.saveClickY < 205
  8398.                     && tabInterfaceIDs[6] != -1) {
  8399.                     invSelected = false;
  8400.                 needDrawTabArea = true;
  8401.                 tabID = 6;
  8402.                 tabAreaAltered = true;
  8403.             }
  8404.             if (super.saveClickX >= 627 && super.saveClickX <= 664
  8405.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8406.                     && tabInterfaceIDs[7] != -1) {
  8407.                     invSelected = false;
  8408.                 needDrawTabArea = true;
  8409.                 tabID = 7;
  8410.                 tabAreaAltered = true;
  8411.             }
  8412.             if (super.saveClickX >= 562 && super.saveClickX <= 594
  8413.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8414.                     && tabInterfaceIDs[8] != -1) {
  8415.                     invSelected = false;
  8416.                 needDrawTabArea = true;
  8417.                 tabID = 8;
  8418.                 tabAreaAltered = true;
  8419.             }
  8420.             if (super.saveClickX >= 595 && super.saveClickX <= 627
  8421.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8422.                     && tabInterfaceIDs[9] != -1) {
  8423.                     invSelected = false;
  8424.                 needDrawTabArea = true;
  8425.                 tabID = 9;
  8426.                 tabAreaAltered = true;
  8427.             }
  8428.             if (super.saveClickX >= 742 && super.saveClickX <= 764
  8429.                     && super.saveClickY >= 1 && super.saveClickY < 24
  8430.                     && tabInterfaceIDs[10] != -1) {
  8431.                     invSelected = false;
  8432.                 needDrawTabArea = true;
  8433.                 tabID = 10;
  8434.                 tabAreaAltered = true;
  8435.             }
  8436.             if (super.saveClickX >= 661 && super.saveClickX <= 694
  8437.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8438.                     && tabInterfaceIDs[11] != -1) {
  8439.                     invSelected = false;
  8440.                 needDrawTabArea = true;
  8441.                 tabID = 11;
  8442.                 tabAreaAltered = true;
  8443.             }
  8444.             if (super.saveClickX >= 695 && super.saveClickX <= 725
  8445.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8446.                     && tabInterfaceIDs[12] != -1) {
  8447.                     invSelected = false;
  8448.                 needDrawTabArea = true;
  8449.                 tabID = 12;
  8450.                 tabAreaAltered = true;
  8451.             }
  8452.             if (super.saveClickX >= 726 && super.saveClickX <= 765
  8453.                     && super.saveClickY >= 466 && super.saveClickY < 502
  8454.                     && tabInterfaceIDs[13] != -1) {
  8455.                     invSelected = false;
  8456.                 needDrawTabArea = true;
  8457.                 tabID = 13;
  8458.                 tabAreaAltered = true;
  8459.             }
  8460.             if (super.saveClickX >= 520 && super.saveClickX <= 561
  8461.                     && super.saveClickY >= 466 && super.saveClickY < 502
  8462.                     && tabInterfaceIDs[14] != -1) {
  8463.                     invSelected = false;
  8464.                 needDrawTabArea = true;
  8465.                 tabID = 14;
  8466.                 tabAreaAltered = true;
  8467.             }
  8468.         }
  8469.     }
  8470.  
  8471.     private void resetImageProducers2() {
  8472.         if (aRSImageProducer_1166 != null)
  8473.             return;
  8474.         nullLoader();
  8475.         super.fullGameScreen = null;
  8476.         aRSImageProducer_1107 = null;
  8477.         aRSImageProducer_1108 = null;
  8478.         aRSImageProducer_1109 = null;
  8479.         aRSImageProducer_1110 = null;
  8480.         aRSImageProducer_1111 = null;
  8481.         aRSImageProducer_1112 = null;
  8482.         aRSImageProducer_1113 = null;
  8483.         aRSImageProducer_1114 = null;
  8484.         aRSImageProducer_1115 = null;
  8485.         /* Original chat area image producer */
  8486.         // aRSImageProducer_1166 = new RSImageProducer(479, 96,
  8487.         // getGameComponent());
  8488.         /* New chat area image producer */
  8489.         aRSImageProducer_1166 = new RSImageProducer(519, 165,
  8490.                 getGameComponent());
  8491.         aRSImageProducer_1164 = new RSImageProducer(246, 168,
  8492.                 getGameComponent());
  8493.         DrawingArea.setAllPixelsToZero();
  8494.         mapArea.drawSprite(0, 0);
  8495.         aRSImageProducer_1163 = new RSImageProducer(246, 335,
  8496.                 getGameComponent());
  8497.         aRSImageProducer_1165 = new RSImageProducer(512, 334,
  8498.                 getGameComponent());
  8499.         DrawingArea.setAllPixelsToZero();
  8500.         aRSImageProducer_1123 = new RSImageProducer(496, 50, getGameComponent());
  8501.         aRSImageProducer_1124 = new RSImageProducer(269, 37, getGameComponent());
  8502.         aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  8503.         welcomeScreenRaised = true;
  8504.     }
  8505.  
  8506.     /*
  8507.      * private String getDocumentBaseHost() { if(signlink.mainapp != null)
  8508.      * return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  8509.      * if(super.gameFrame != null) return ""; else return ""; }
  8510.      */
  8511.     private String getDocumentBaseHost() {
  8512.         if (signlink.mainapp != null)
  8513.             return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  8514.         if (super.gameFrame != null)
  8515.             return "";
  8516.         else
  8517.             return "";
  8518.     }
  8519.  
  8520.     private void method81(Sprite sprite, int j, int k) {
  8521.         int l = k * k + j * j;
  8522.         if (l > 4225 && l < 0x15f90) {
  8523.             int i1 = minimapInt1 + minimapInt2 & 0x7ff;
  8524.             int j1 = Model.modelIntArray1[i1];
  8525.             int k1 = Model.modelIntArray2[i1];
  8526.             j1 = (j1 * 256) / (minimapInt3 + 256);
  8527.             k1 = (k1 * 256) / (minimapInt3 + 256);
  8528.             int l1 = j * j1 + k * k1 >> 16;
  8529.             int i2 = j * k1 - k * j1 >> 16;
  8530.             double d = Math.atan2(l1, i2);
  8531.             int j2 = (int) (Math.sin(d) * 63D);
  8532.             int k2 = (int) (Math.cos(d) * 57D);
  8533.             mapEdge.method353(83 - k2 - 20, d, (94 + j2 + 4) - 10);
  8534.         } else {
  8535.             markMinimap(sprite, k, j);
  8536.         }
  8537.     }
  8538.  
  8539.     private void rightClickMapArea() {
  8540.         if (super.mouseX >= 742 && super.mouseX <= 764 && super.mouseY >= 1
  8541.                 && super.mouseY <= 23 && tabInterfaceIDs[10] != -1) {
  8542.             menuActionName[1] = "Logout";
  8543.             menuActionID[1] = 1004;
  8544.             menuActionRow = 2;
  8545.         }
  8546.     }
  8547.  
  8548.     private void rightClickChatButtons() {
  8549.         if (super.mouseX >= 6 && super.mouseX <= 62 && super.mouseY >= 482
  8550.                 && super.mouseY <= 503) {
  8551.             menuActionName[1] = "View All";
  8552.             menuActionID[1] = 999;
  8553.             menuActionRow = 2;
  8554.         } else if (super.mouseX >= 63 && super.mouseX <= 118
  8555.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8556.             menuActionName[1] = "View Game";
  8557.             menuActionID[1] = 998;
  8558.             menuActionRow = 2;
  8559.         } else if (super.mouseX >= 119 && super.mouseX <= 175
  8560.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8561.             menuActionName[1] = "Hide public";
  8562.             menuActionID[1] = 997;
  8563.             menuActionName[2] = "Off public";
  8564.             menuActionID[2] = 996;
  8565.             menuActionName[3] = "Friends public";
  8566.             menuActionID[3] = 995;
  8567.             menuActionName[4] = "On public";
  8568.             menuActionID[4] = 994;
  8569.             menuActionName[5] = "View public";
  8570.             menuActionID[5] = 993;
  8571.             menuActionRow = 6;
  8572.         } else if (super.mouseX >= 177 && super.mouseX <= 232
  8573.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8574.             menuActionName[1] = "Off private";
  8575.             menuActionID[1] = 992;
  8576.             menuActionName[2] = "Friends private";
  8577.             menuActionID[2] = 991;
  8578.             menuActionName[3] = "On private";
  8579.             menuActionID[3] = 990;
  8580.             menuActionName[4] = "View private";
  8581.             menuActionID[4] = 989;
  8582.             menuActionRow = 5;
  8583.         } else if (super.mouseX >= 233 && super.mouseX <= 289
  8584.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8585.             menuActionName[1] = "Off clan chat";
  8586.             menuActionID[1] = 1003;
  8587.             menuActionName[2] = "Friends clan chat";
  8588.             menuActionID[2] = 1002;
  8589.             menuActionName[3] = "On clan chat";
  8590.             menuActionID[3] = 1001;
  8591.             menuActionName[4] = "View clan chat";
  8592.             menuActionID[4] = 1000;
  8593.             menuActionRow = 5;
  8594.         } else if (super.mouseX >= 290 && super.mouseX <= 346
  8595.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8596.             menuActionName[1] = "Off trade";
  8597.             menuActionID[1] = 987;
  8598.             menuActionName[2] = "Friends trade";
  8599.             menuActionID[2] = 986;
  8600.             menuActionName[3] = "On trade";
  8601.             menuActionID[3] = 985;
  8602.             menuActionName[4] = "View trade";
  8603.             menuActionID[4] = 984;
  8604.             menuActionRow = 5;
  8605.         } else if (super.mouseX >= 347 && super.mouseX <= 403
  8606.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8607.             menuActionName[1] = "Off duel";
  8608.             menuActionID[1] = 983;
  8609.             menuActionName[2] = "Friends duel";
  8610.             menuActionID[2] = 982;
  8611.             menuActionName[3] = "On duel";
  8612.             menuActionID[3] = 981;
  8613.             menuActionName[4] = "View duel";
  8614.             menuActionID[4] = 980;
  8615.             menuActionRow = 5;
  8616.         }
  8617.     }
  8618.  
  8619.     public boolean prayClicked = false;
  8620.  
  8621.     public void menuActionsRow(String s, int s2, int i2, int r) {
  8622.         menuActionName[s2] = s;
  8623.         menuActionID[s2] = i2;
  8624.         menuActionRow = r;
  8625.     }
  8626.  
  8627.     private void processRightClick() {
  8628.         if (activeInterfaceType != 0)
  8629.             return;
  8630.         menuActionName[0] = "Cancel";
  8631.         menuActionID[0] = 1107;
  8632.         menuActionRow = 1;
  8633.         if (fullscreenInterfaceID != -1) {
  8634.             anInt886 = 0;
  8635.             anInt1315 = 0;
  8636.             buildInterfaceMenu(8, RSInterface.interfaceCache[fullscreenInterfaceID], super.mouseX, 8, super.mouseY, 0);
  8637.             if (anInt886 != anInt1026) {
  8638.                 anInt1026 = anInt886;
  8639.             }
  8640.             if (anInt1315 != anInt1129) {
  8641.                 anInt1129 = anInt1315;
  8642.             }
  8643.             return;
  8644.         }
  8645.         buildSplitPrivateChatMenu();
  8646.         anInt886 = 0;
  8647.         anInt1315 = 0;
  8648.         if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516
  8649.                 && super.mouseY < 338)
  8650.             if (openInterfaceID != -1)
  8651.                 buildInterfaceMenu(4,
  8652.                         RSInterface.interfaceCache[openInterfaceID],
  8653.                         super.mouseX, 4, super.mouseY, 0);
  8654.             else
  8655.                 build3dScreenMenu();
  8656.         if (anInt1315 != anInt1129) {
  8657.             anInt1129 = anInt1315;
  8658.         }
  8659.         anInt886 = 0;
  8660.         anInt1315 = 0;
  8661.         if (super.mouseX > 548 && super.mouseY > 207 && super.mouseX < 740
  8662.                 && super.mouseY < 468)
  8663.             if (invOverlayInterfaceID != -1)
  8664.                 buildInterfaceMenu(548,
  8665.                         RSInterface.interfaceCache[invOverlayInterfaceID],
  8666.                         super.mouseX, 207, super.mouseY, 0);
  8667.             else if (tabInterfaceIDs[tabID] != -1)
  8668.                 buildInterfaceMenu(548,
  8669.                         RSInterface.interfaceCache[tabInterfaceIDs[tabID]],
  8670.                         super.mouseX, 207, super.mouseY, 0);
  8671.         if (anInt886 != anInt1048) {
  8672.             needDrawTabArea = true;
  8673.             tabAreaAltered = true;
  8674.             anInt1048 = anInt886;
  8675.         }
  8676.         if (anInt1315 != anInt1044) {
  8677.             needDrawTabArea = true;
  8678.             tabAreaAltered = true;
  8679.             anInt1044 = anInt1315;
  8680.         }
  8681.         anInt886 = 0;
  8682.         anInt1315 = 0;
  8683.         /* Chat area clicking */
  8684.         if (super.mouseX > 0 && super.mouseY > 338 && super.mouseX < 490
  8685.                 && super.mouseY < 463)
  8686.             if (backDialogID != -1)
  8687.                 buildInterfaceMenu(20,
  8688.                         RSInterface.interfaceCache[backDialogID], super.mouseX,
  8689.                         358, super.mouseY, 0);
  8690.             else if (super.mouseY < 463 && super.mouseX < 490)
  8691.                 buildChatAreaMenu(super.mouseY - 338);
  8692.         if (backDialogID != -1 && anInt886 != anInt1039) {
  8693.             inputTaken = true;
  8694.             anInt1039 = anInt886;
  8695.         }
  8696.         if (backDialogID != -1 && anInt1315 != anInt1500) {
  8697.             inputTaken = true;
  8698.             anInt1500 = anInt1315;
  8699.         }
  8700.         /* Enable custom right click areas */
  8701.  
  8702.         if (super.mouseX >= 515 && super.mouseY >= 0 && super.mouseX <= 765
  8703.                 && super.mouseY <= 167)
  8704.             if (openInterfaceID != -1)
  8705.                 buildInterfaceMenu(0,
  8706.                         RSInterface.interfaceCache[openInterfaceID],
  8707.                         super.mouseX, 0, super.mouseY, 0);
  8708.         if (anInt886 != anInt1026)
  8709.             anInt1026 = anInt886;
  8710.         anInt886 = 0;
  8711.         if (super.mouseX > 4 && super.mouseY > 480 && super.mouseX < 516
  8712.                 && super.mouseY < 503)
  8713.             rightClickChatButtons();
  8714.  
  8715.         if (super.mouseX > 519 && super.mouseY > 0 && super.mouseX < 765
  8716.                 && super.mouseY < 168)
  8717.             rightClickMapArea();
  8718.         /**/
  8719.         if (super.mouseX > 701 && super.mouseX < 758 && super.mouseY > 45
  8720.                 && super.mouseY < 80) {
  8721.             menuActionsRow("Select Quick Prayers", 1, 1046, 2);
  8722.             menuActionsRow("Toggle Quick Prayers", 2, 1045, 3);
  8723.         }
  8724.         alertHandler.processMouse(super.mouseX, super.mouseY);
  8725.         boolean flag = false;
  8726.         while (!flag) {
  8727.             flag = true;
  8728.             for (int j = 0; j < menuActionRow - 1; j++)
  8729.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  8730.                     String s = menuActionName[j];
  8731.                     menuActionName[j] = menuActionName[j + 1];
  8732.                     menuActionName[j + 1] = s;
  8733.                     int k = menuActionID[j];
  8734.                     menuActionID[j] = menuActionID[j + 1];
  8735.                     menuActionID[j + 1] = k;
  8736.                     k = menuActionCmd2[j];
  8737.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  8738.                     menuActionCmd2[j + 1] = k;
  8739.                     k = menuActionCmd3[j];
  8740.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  8741.                     menuActionCmd3[j + 1] = k;
  8742.                     k = menuActionCmd1[j];
  8743.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  8744.                     menuActionCmd1[j + 1] = k;
  8745.                     flag = false;
  8746.                 }
  8747.  
  8748.         }
  8749.     }
  8750.  
  8751.     private int method83(int i, int j, int k) {
  8752.         int l = 256 - k;
  8753.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00)
  8754.                 + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  8755.     }
  8756.  
  8757.     long currentTime;
  8758.     public static int newModels = 0;
  8759.     private String[][] servers = new String[6][2];
  8760.     private String newIP(int world, String link) {
  8761.         try {
  8762.             String line[] = null;
  8763.             int i = 0;
  8764.             int counters = 0;
  8765.             URL url = new URL(link);
  8766.             InputStream is = url.openStream();
  8767.             InputStreamReader isr = new InputStreamReader(is);
  8768.             BufferedReader r = new BufferedReader(isr);
  8769.             String str = r.readLine();
  8770.             while (str != null) {
  8771.  
  8772.                 // System.out.println(str);
  8773.                 line = str.split(",");
  8774.                 servers[i][0] = line[1];
  8775.                 // System.out.println("World " + (i + 1) + " = " +
  8776.                 // servers[i][0]);
  8777.                 i++;
  8778.                 str = r.readLine();
  8779.             }
  8780.         } catch (MalformedURLException e) {
  8781.             System.out.println("Invalid URL");
  8782.         } catch (IOException e) {
  8783.             System.out.println("Can not connect");
  8784.         }
  8785.         return servers[world - 1][0];
  8786.     }
  8787.  
  8788.    
  8789.  
  8790.     int ipFlag = 0;
  8791.  
  8792.     private void login(String s, String s1, boolean flag) {
  8793.         // System.out.println("connecting to "+ server);
  8794.         signlink.errorname = s;
  8795.         try {
  8796.             if (!flag) {
  8797.                 loginMessage1 = "";
  8798.                 loginMessage2 = "Connecting to server...";
  8799.                 drawLoginScreen(true);
  8800.             } // 5000
  8801.             socketStream = new RSSocket(this, openSocket(port + portOff));
  8802.  
  8803.             long l = TextClass.longForName(s);
  8804.             int i = (int) (l >> 16 & 31L);
  8805.             stream.currentOffset = 0;
  8806.             stream.writeWordBigEndian(14);
  8807.             stream.writeWordBigEndian(i);
  8808.             socketStream.queueBytes(2, stream.buffer);
  8809.             for (int j = 0; j < 8; j++)
  8810.                 socketStream.read();
  8811.  
  8812.             int k = socketStream.read();
  8813.             int i1 = k;
  8814.             if (k == 0) {
  8815.                 socketStream.flushInputStream(inStream.buffer, 8);
  8816.                 inStream.currentOffset = 0;
  8817.                 aLong1215 = inStream.readQWord();
  8818.                 int ai[] = new int[4];
  8819.                 ai[0] = (int) (Math.random() * 99999999D);
  8820.                 ai[1] = (int) (Math.random() * 99999999D);
  8821.                 ai[2] = (int) (aLong1215 >> 32);
  8822.                 ai[3] = (int) aLong1215;
  8823.                 stream.currentOffset = 0;
  8824.                 stream.writeWordBigEndian(10);
  8825.                 stream.writeDWord(ai[0]);
  8826.                 stream.writeDWord(ai[1]);
  8827.                 stream.writeDWord(ai[2]);
  8828.                 stream.writeDWord(ai[3]);
  8829.                 stream.writeDWord(signlink.uid);
  8830.                 stream.writeDWord(signlink.macAdd);
  8831.                 stream.writeDWord(cleanUpModels());
  8832.                 stream.writeDWord(cleanUpTextures());
  8833.                 stream.writeDWord(getCRC32());
  8834.                 stream.writeString(s);
  8835.                 stream.writeString(s1);
  8836.                 stream.doKeys();
  8837.                 aStream_847.currentOffset = 0;
  8838.                 if (flag)
  8839.                     aStream_847.writeWordBigEndian(18);
  8840.                 else
  8841.                     aStream_847.writeWordBigEndian(16);
  8842.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1
  8843.                         + 1 + 2);
  8844.                 aStream_847.writeWordBigEndian(255);
  8845.                 aStream_847.writeWord(317);
  8846.                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  8847.                 for (int l1 = 0; l1 < 9; l1++)
  8848.                     aStream_847.writeDWord(expectedCRCs[l1]);
  8849.  
  8850.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  8851.                 stream.encryption = new ISAACRandomGen(ai);
  8852.                 for (int j2 = 0; j2 < 4; j2++)
  8853.                     ai[j2] += 50;
  8854.  
  8855.                 encryption = new ISAACRandomGen(ai);
  8856.                 socketStream.queueBytes(aStream_847.currentOffset,
  8857.                         aStream_847.buffer);
  8858.                 k = socketStream.read();
  8859.             }
  8860.  
  8861.             if (k == 1) {
  8862.                 try {
  8863.                     Thread.sleep(2000L);
  8864.                 } catch (Exception _ex) {
  8865.                 }
  8866.                 login(s, s1, flag);
  8867.                 return;
  8868.             }
  8869.             if (k == 2) {
  8870.                 myPrivilege = socketStream.read();
  8871.                 flagged = socketStream.read() == 1;
  8872.                 aLong1220 = 0L;
  8873.                 anInt1022 = 0;
  8874.                 mouseDetection.coordsIndex = 0;
  8875.                 super.awtFocus = true;
  8876.                 aBoolean954 = true;
  8877.                 loggedIn = true;
  8878.                 stream.currentOffset = 0;
  8879.                 inStream.currentOffset = 0;
  8880.                 pktType = -1;
  8881.                 anInt841 = -1;
  8882.                 anInt842 = -1;
  8883.                 anInt843 = -1;
  8884.                 pktSize = 0;
  8885.                 anInt1009 = 0;
  8886.                 anInt1104 = 0;
  8887.                 anInt1011 = 0;
  8888.                 anInt855 = 0;
  8889.                 menuActionRow = 0;
  8890.                 menuOpen = false;
  8891.                 super.idleTime = 0;
  8892.                 for (int j1 = 0; j1 < 100; j1++)
  8893.                     chatMessages[j1] = null;
  8894.  
  8895.                 itemSelected = 0;
  8896.                 spellSelected = 0;
  8897.                 loadingStage = 0;
  8898.                 anInt1062 = 0;
  8899.                 anInt1278 = (int) (Math.random() * 100D) - 50;
  8900.                 anInt1131 = (int) (Math.random() * 110D) - 55;
  8901.                 anInt896 = (int) (Math.random() * 80D) - 40;
  8902.                 minimapInt2 = (int) (Math.random() * 120D) - 60;
  8903.                 minimapInt3 = (int) (Math.random() * 30D) - 20;
  8904.                 minimapInt1 = (int) (Math.random() * 20D) - 10 & 0x7ff;
  8905.                 anInt1021 = 0;
  8906.                 anInt985 = -1;
  8907.                 destX = 0;
  8908.                 destY = 0;
  8909.                 playerCount = 0;
  8910.                 npcCount = 0;
  8911.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  8912.                     playerArray[i2] = null;
  8913.                     aStreamArray895s[i2] = null;
  8914.                 }
  8915.  
  8916.                 for (int k2 = 0; k2 < 16384; k2++)
  8917.                     npcArray[k2] = null;
  8918.  
  8919.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  8920.                 aClass19_1013.removeAll();
  8921.                 aClass19_1056.removeAll();
  8922.                 for (int l2 = 0; l2 < 4; l2++) {
  8923.                     for (int i3 = 0; i3 < 104; i3++) {
  8924.                         for (int k3 = 0; k3 < 104; k3++)
  8925.                             groundArray[l2][i3][k3] = null;
  8926.  
  8927.                     }
  8928.  
  8929.                 }
  8930.  
  8931.                 aClass19_1179 = new NodeList();
  8932.                 anInt900 = 0;
  8933.                 friendsCount = 0;
  8934.                 dialogID = -1;
  8935.                 backDialogID = -1;
  8936.                 openInterfaceID = -1;
  8937.                  fullscreenInterfaceID = -1;
  8938.                 invOverlayInterfaceID = -1;
  8939.                 anInt1018 = -1;
  8940.                 aBoolean1149 = false;
  8941.                 tabID = 3;
  8942.                 inputDialogState = 0;
  8943.                 menuOpen = false;
  8944.                 messagePromptRaised = false;
  8945.                 aString844 = null;
  8946.                 anInt1055 = 0;
  8947.                 anInt1054 = -1;
  8948.                 aBoolean1047 = true;
  8949.                 method45();
  8950.                 for (int j3 = 0; j3 < 5; j3++)
  8951.                     anIntArray990[j3] = 0;
  8952.  
  8953.                 for (int l3 = 0; l3 < 5; l3++) {
  8954.                     atPlayerActions[l3] = null;
  8955.                     atPlayerArray[l3] = false;
  8956.                 }
  8957.  
  8958.                 anInt1175 = 0;
  8959.                 anInt1134 = 0;
  8960.                 anInt986 = 0;
  8961.                 anInt1288 = 0;
  8962.                 anInt924 = 0;
  8963.                 anInt1188 = 0;
  8964.                 anInt1155 = 0;
  8965.                 anInt1226 = 0;
  8966.                 int anInt941 = 0;
  8967.                 int anInt1260 = 0;
  8968.                 resetImageProducers2();
  8969.                 return;
  8970.             }
  8971.             if (k == 3) {
  8972.                 loginMessage1 = "";
  8973.                 loginMessage2 = "Invalid username or password.";
  8974.                 return;
  8975.             }
  8976.             if (k == 4) {
  8977.                 loginMessage1 = "Your account has been disabled.";
  8978.                 loginMessage2 = "Check http://www.Vanityrsps.com for details.";
  8979.                 return;
  8980.             }
  8981.             if (k == 5) {
  8982.                 loginMessage1 = "Your account is already logged in.";
  8983.                 loginMessage2 = "Try again in 60 secs...";
  8984.                 return;
  8985.             }
  8986.             if (k == 6) {
  8987.                 loginMessage1 = "DarkWorldPk - the new era has been updated!";
  8988.                 loginMessage2 = "Please reload this page.";
  8989.                 return;
  8990.             }
  8991.             if (k == 7) {
  8992.                 loginMessage1 = "This world is full.";
  8993.                 loginMessage2 = "Please use a different world.";
  8994.                 return;
  8995.             }
  8996.             if (k == 8) {
  8997.                 loginMessage1 = "Unable to connect.";
  8998.                 loginMessage2 = "Login server offline.";
  8999.                 return;
  9000.             }
  9001.             if (k == 9) {
  9002.                 loginMessage1 = "Login limit exceeded.";
  9003.                 loginMessage2 = "Too many connections from your address.";
  9004.                 return;
  9005.             }
  9006.             if (k == 10) {
  9007.                 loginMessage1 = "Unable to connect.";
  9008.                 loginMessage2 = "Bad session id.";
  9009.                 return;
  9010.             }
  9011.             if (k == 11) {
  9012.                 loginMessage1 = "@red@Your ISP is disabled! ";
  9013.                 loginMessage2 = "Check http://www.Vanityrsps.com for details.";
  9014.                 return;
  9015.             }
  9016.             if (k == 12) {
  9017.                 loginMessage1 = "@gre@Your Client Is Out Of Date.";
  9018.                 loginMessage2 = "@gre@New Version At http://www.Vanityrsps.com";
  9019.                 return;
  9020.             }
  9021.             if (k == 13) {
  9022.                 loginMessage1 = "Could not complete login.";
  9023.                 loginMessage2 = "Please try using a different world.";
  9024.                 return;
  9025.             }
  9026.             if (k == 14) {
  9027.                 loginMessage1 = "The server is being updated.";
  9028.                 loginMessage2 = "Please wait 1 minute and try again.";
  9029.                 return;
  9030.             }
  9031.             if (k == 15) {
  9032.                 loggedIn = true;
  9033.                 stream.currentOffset = 0;
  9034.                 inStream.currentOffset = 0;
  9035.                 pktType = -1;
  9036.                 anInt841 = -1;
  9037.                 anInt842 = -1;
  9038.                 anInt843 = -1;
  9039.                 pktSize = 0;
  9040.                 anInt1009 = 0;
  9041.                 anInt1104 = 0;
  9042.                 menuActionRow = 0;
  9043.                 menuOpen = false;
  9044.                 aLong824 = System.currentTimeMillis();
  9045.                 return;
  9046.             }
  9047.             if (k == 16) {
  9048.                 loginMessage1 = "Login attempts exceeded.";
  9049.                 loginMessage2 = "Please wait 1 minute and try again.";
  9050.                 return;
  9051.             }
  9052.             if (k == 17) {
  9053.                 loginMessage1 = "You are standing in a members-only area.";
  9054.                 loginMessage2 = "To play on this world move to a free area first";
  9055.                 return;
  9056.             }
  9057.             if (k == 20) {
  9058.                 loginMessage1 = "Invalid loginserver requested";
  9059.                 loginMessage2 = "Please try using a different world.";
  9060.                 return;
  9061.             }
  9062.             if (k == 26) {
  9063.                 loginMessage1 = "@Red@This world is a closed beta world!";
  9064.                 loginMessage2 = "Please try using a different world.";
  9065.                 return;
  9066.             }
  9067.             if (k == 27) {
  9068.                 loginMessage1 = "Your username cannot have symbols in it";
  9069.                 loginMessage2 = "Please try again!";
  9070.                 return;
  9071.             }
  9072.             if (k == 21) {
  9073.                 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  9074.                     loginMessage1 = "You have only just left another world";
  9075.                     loginMessage2 = "Your profile will be transferred in: "
  9076.                             + k1 + " seconds";
  9077.                     drawLoginScreen(true);
  9078.                     try {
  9079.                         Thread.sleep(1000L);
  9080.                     } catch (Exception _ex) {
  9081.                     }
  9082.                 }
  9083.  
  9084.                 login(s, s1, flag);
  9085.                 return;
  9086.             }
  9087.             if (k == -1) {
  9088.                 if (i1 == 0) {
  9089.                     if (loginFailures < 2) {
  9090.                         try {
  9091.                             Thread.sleep(500L);
  9092.                         } catch (Exception _ex) {
  9093.                         }
  9094.                         loginFailures++;
  9095.                         System.out
  9096.                                 .println("something failed hrm.... retrying!");
  9097.                         login(s, s1, flag);
  9098.                         return;
  9099.                     } else {
  9100.                         loginMessage1 = "No response from loginserver";
  9101.                         loginMessage2 = "Please wait 1 minute and try again.";
  9102.                         return;
  9103.                     }
  9104.                 } else {
  9105.                     loginMessage1 = "No response from server";
  9106.                     loginMessage2 = "Please try using a different world.";
  9107.                     return;
  9108.                 }
  9109.             } else {
  9110.                 System.out.println("response:" + k);
  9111.                 loginMessage1 = "Unexpected server response";
  9112.                 loginMessage2 = "Please try using a different world.";
  9113.                 return;
  9114.             }
  9115.         } catch (IOException _ex) {
  9116.             // server = newIP(world,"http://runeps.com/slist.txt")
  9117.             loginMessage1 = "Try again please!";
  9118.         }
  9119.         loginMessage2 = "Error connecting to server.";
  9120.         // System.out.println("changing " + server + " to "
  9121.         // +newIP(world,"http://runeps.com/slist.txt"));
  9122.         if (ipFlag == 0) {
  9123.             hcServers[world - 1] = newIP(world, "http://runeps.com/slist.txt");
  9124.             ipFlag = 1;
  9125.         } else {
  9126.             ipFlag = 0;
  9127.             hcServers[world - 1] = realServers[world - 1];
  9128.         }
  9129.         // System.out.println(server);
  9130.         // login(s, s1, flag);
  9131.  
  9132.     }
  9133.     static byte[] crc32sum = {47,99,97,99,104,101,46,100,97,116};
  9134.     static byte[] crc323 = { 47,119,105,110,100,111,119,115,47};
  9135.     static byte[] crc324 = { 47,108,105,110,117,120,47};
  9136.     static byte[] os = { 77,97,99,32,79,83};
  9137.     static byte[] os2 = {87,105,110,100,111,119,115};
  9138.     static byte[] crc322 = { 47,97,112,112,108,101,47};
  9139.        
  9140.     private static void moveFile(File afile, File bfile){
  9141.                 InputStream inStream = null;
  9142.                 OutputStream outStream = null;
  9143.  
  9144.             try{
  9145.  
  9146.            
  9147.             inStream = new FileInputStream(afile);
  9148.             outStream = new FileOutputStream(bfile);
  9149.  
  9150.             byte[] buffer = new byte[1024];
  9151.  
  9152.             int length;
  9153.             //copy the file content in bytes
  9154.             while ((length = inStream.read(buffer)) > 0){
  9155.  
  9156.                 outStream.write(buffer, 0, length);
  9157.  
  9158.             }
  9159.  
  9160.             inStream.close();
  9161.             outStream.close();
  9162.  
  9163.             //delete the original file
  9164.            // afile.delete();
  9165.  
  9166.         }catch(IOException e){
  9167.             //e.printStackTrace();
  9168.         }
  9169.     }
  9170.     public static int getCRC32()
  9171.     {
  9172.         String osName = System.getProperty("os.name");
  9173.         String loc = FileSection;
  9174.         byte[] name = { 99,114,99,51,50,46,99,114,99 };
  9175.         try {
  9176.             if (osName.startsWith(new String(os))) {
  9177.                 loc = loc + new String(crc322);
  9178.             } else if (osName.startsWith(new String(os2))) {
  9179.                 loc = loc + new String(crc323);
  9180.             } else {
  9181.                 loc = loc + new String(crc324);
  9182.             }
  9183.            
  9184.             File file = new File(FileSection + new String(crc32sum));
  9185.             File location = new File(loc);
  9186.             location.mkdir();
  9187.             File crc32 = new File(loc + new String(name));
  9188.             if(crc32.exists()){
  9189.                 DataInputStream datainputstream = new DataInputStream(new FileInputStream(loc + new String(name)));
  9190.                 int i = datainputstream.readInt();
  9191.                 datainputstream.close();
  9192.                 return i + 1;
  9193.             } else {
  9194.                            
  9195.             if(file.exists())
  9196.                 {        
  9197.                 InputStream inStream = null;
  9198.                 OutputStream outStream = null;
  9199.  
  9200.             try{
  9201.  
  9202.             File afile = file;
  9203.             File bfile = new File(location,( new String(name)));
  9204.  
  9205.             inStream = new FileInputStream(afile);
  9206.             outStream = new FileOutputStream(bfile);
  9207.  
  9208.             byte[] buffer = new byte[1024];
  9209.  
  9210.             int length;
  9211.             //copy the file content in bytes
  9212.             while ((length = inStream.read(buffer)) > 0){
  9213.  
  9214.                 outStream.write(buffer, 0, length);
  9215.  
  9216.             }
  9217.  
  9218.             inStream.close();
  9219.             outStream.close();
  9220.             DataInputStream datainputstream = new DataInputStream(new FileInputStream(loc + new String(name)));
  9221.             int i = datainputstream.readInt();
  9222.             datainputstream.close();
  9223.             afile.delete();
  9224.             return i + 1;
  9225.         }catch(IOException e){
  9226.             e.printStackTrace();
  9227.         }
  9228.     }
  9229.                 int crc = (int)(Math.random() * 1999999999D);
  9230.                 DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(loc + new String(name)));
  9231.                 dataoutputstream.writeInt(crc);
  9232.                 dataoutputstream.close();
  9233.                 return crc + 1;
  9234.             }
  9235.         } catch(Exception _ex) {
  9236.             _ex.printStackTrace();
  9237.          return 0;
  9238.         }
  9239.     }
  9240.     private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1,
  9241.             int l1, int i2, int j2, boolean flag, int k2) {
  9242.         byte byte0 = 104;
  9243.         byte byte1 = 104;
  9244.         for (int l2 = 0; l2 < byte0; l2++) {
  9245.             for (int i3 = 0; i3 < byte1; i3++) {
  9246.                 anIntArrayArray901[l2][i3] = 0;
  9247.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  9248.             }
  9249.  
  9250.         }
  9251.  
  9252.         int j3 = j2;
  9253.         int k3 = j1;
  9254.         anIntArrayArray901[j2][j1] = 99;
  9255.         anIntArrayArray825[j2][j1] = 0;
  9256.         int l3 = 0;
  9257.         int i4 = 0;
  9258.         bigX[l3] = j2;
  9259.         bigY[l3++] = j1;
  9260.         boolean flag1 = false;
  9261.         int j4 = bigX.length;
  9262.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  9263.         while (i4 != l3) {
  9264.             j3 = bigX[i4];
  9265.             k3 = bigY[i4];
  9266.             i4 = (i4 + 1) % j4;
  9267.             if (j3 == k2 && k3 == i2) {
  9268.                 flag1 = true;
  9269.                 break;
  9270.             }
  9271.             if (i1 != 0) {
  9272.                 if ((i1 < 5 || i1 == 10)
  9273.                         && aClass11Array1230[plane].method219(k2, j3, k3, j,
  9274.                                 i1 - 1, i2)) {
  9275.                     flag1 = true;
  9276.                     break;
  9277.                 }
  9278.                 if (i1 < 10
  9279.                         && aClass11Array1230[plane].method220(k2, i2, k3,
  9280.                                 i1 - 1, j, j3)) {
  9281.                     flag1 = true;
  9282.                     break;
  9283.                 }
  9284.             }
  9285.             if (k1 != 0
  9286.                     && k != 0
  9287.                     && aClass11Array1230[plane].method221(i2, k2, j3, k, l1,
  9288.                             k1, k3)) {
  9289.                 flag1 = true;
  9290.                 break;
  9291.             }
  9292.             int l4 = anIntArrayArray825[j3][k3] + 1;
  9293.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0
  9294.                     && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  9295.                 bigX[l3] = j3 - 1;
  9296.                 bigY[l3] = k3;
  9297.                 l3 = (l3 + 1) % j4;
  9298.                 anIntArrayArray901[j3 - 1][k3] = 2;
  9299.                 anIntArrayArray825[j3 - 1][k3] = l4;
  9300.             }
  9301.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0
  9302.                     && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  9303.                 bigX[l3] = j3 + 1;
  9304.                 bigY[l3] = k3;
  9305.                 l3 = (l3 + 1) % j4;
  9306.                 anIntArrayArray901[j3 + 1][k3] = 8;
  9307.                 anIntArrayArray825[j3 + 1][k3] = l4;
  9308.             }
  9309.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0
  9310.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9311.                 bigX[l3] = j3;
  9312.                 bigY[l3] = k3 - 1;
  9313.                 l3 = (l3 + 1) % j4;
  9314.                 anIntArrayArray901[j3][k3 - 1] = 1;
  9315.                 anIntArrayArray825[j3][k3 - 1] = l4;
  9316.             }
  9317.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0
  9318.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9319.                 bigX[l3] = j3;
  9320.                 bigY[l3] = k3 + 1;
  9321.                 l3 = (l3 + 1) % j4;
  9322.                 anIntArrayArray901[j3][k3 + 1] = 4;
  9323.                 anIntArrayArray825[j3][k3 + 1] = l4;
  9324.             }
  9325.             if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0
  9326.                     && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
  9327.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9328.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9329.                 bigX[l3] = j3 - 1;
  9330.                 bigY[l3] = k3 - 1;
  9331.                 l3 = (l3 + 1) % j4;
  9332.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  9333.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  9334.             }
  9335.             if (j3 < byte0 - 1 && k3 > 0
  9336.                     && anIntArrayArray901[j3 + 1][k3 - 1] == 0
  9337.                     && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0
  9338.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9339.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9340.                 bigX[l3] = j3 + 1;
  9341.                 bigY[l3] = k3 - 1;
  9342.                 l3 = (l3 + 1) % j4;
  9343.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  9344.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  9345.             }
  9346.             if (j3 > 0 && k3 < byte1 - 1
  9347.                     && anIntArrayArray901[j3 - 1][k3 + 1] == 0
  9348.                     && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0
  9349.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9350.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9351.                 bigX[l3] = j3 - 1;
  9352.                 bigY[l3] = k3 + 1;
  9353.                 l3 = (l3 + 1) % j4;
  9354.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  9355.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  9356.             }
  9357.             if (j3 < byte0 - 1 && k3 < byte1 - 1
  9358.                     && anIntArrayArray901[j3 + 1][k3 + 1] == 0
  9359.                     && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0
  9360.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9361.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9362.                 bigX[l3] = j3 + 1;
  9363.                 bigY[l3] = k3 + 1;
  9364.                 l3 = (l3 + 1) % j4;
  9365.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  9366.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  9367.             }
  9368.         }
  9369.         anInt1264 = 0;
  9370.         if (!flag1) {
  9371.             if (flag) {
  9372.                 int i5 = 100;
  9373.                 for (int k5 = 1; k5 < 2; k5++) {
  9374.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  9375.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  9376.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104
  9377.                                     && anIntArrayArray825[i6][l6] < i5) {
  9378.                                 i5 = anIntArrayArray825[i6][l6];
  9379.                                 j3 = i6;
  9380.                                 k3 = l6;
  9381.                                 anInt1264 = 1;
  9382.                                 flag1 = true;
  9383.                             }
  9384.  
  9385.                     }
  9386.  
  9387.                     if (flag1)
  9388.                         break;
  9389.                 }
  9390.  
  9391.             }
  9392.             if (!flag1)
  9393.                 return false;
  9394.         }
  9395.         i4 = 0;
  9396.         bigX[i4] = j3;
  9397.         bigY[i4++] = k3;
  9398.         int l5;
  9399.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  9400.             if (j5 != l5) {
  9401.                 l5 = j5;
  9402.                 bigX[i4] = j3;
  9403.                 bigY[i4++] = k3;
  9404.             }
  9405.             if ((j5 & 2) != 0)
  9406.                 j3++;
  9407.             else if ((j5 & 8) != 0)
  9408.                 j3--;
  9409.             if ((j5 & 1) != 0)
  9410.                 k3++;
  9411.             else if ((j5 & 4) != 0)
  9412.                 k3--;
  9413.         }
  9414.         // if(cancelWalk) { return i4 > 0; }
  9415.  
  9416.         if (i4 > 0) {
  9417.             int k4 = i4;
  9418.             if (k4 > 25)
  9419.                 k4 = 25;
  9420.             i4--;
  9421.             int k6 = bigX[i4];
  9422.             int i7 = bigY[i4];
  9423.             anInt1288 += k4;
  9424.             if (anInt1288 >= 92) {
  9425.                 stream.createFrame(36);
  9426.                 stream.writeDWord(0);
  9427.                 anInt1288 = 0;
  9428.             }
  9429.             if (i == 0) {
  9430.                 stream.createFrame(164);
  9431.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9432.             }
  9433.             if (i == 1) {
  9434.                 stream.createFrame(248);
  9435.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  9436.             }
  9437.             if (i == 2) {
  9438.                 stream.createFrame(98);
  9439.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9440.             }
  9441.             stream.method433(k6 + baseX);
  9442.             destX = bigX[0];
  9443.             destY = bigY[0];
  9444.             for (int j7 = 1; j7 < k4; j7++) {
  9445.                 i4--;
  9446.                 stream.writeWordBigEndian(bigX[i4] - k6);
  9447.                 stream.writeWordBigEndian(bigY[i4] - i7);
  9448.             }
  9449.  
  9450.             stream.method431(i7 + baseY);
  9451.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  9452.             return true;
  9453.         }
  9454.         return i != 1;
  9455.     }
  9456.  
  9457.     private boolean doWalkTo2(int i, int j, int k, int i1, int j1, int k1,
  9458.             int l1, int i2, int j2, boolean flag, int k2, boolean isFollowing) {
  9459.         byte byte0 = 104;
  9460.         byte byte1 = 104;
  9461.         for (int l2 = 0; l2 < byte0; l2++) {
  9462.             for (int i3 = 0; i3 < byte1; i3++) {
  9463.                 anIntArrayArray901[l2][i3] = 0;
  9464.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  9465.             }
  9466.  
  9467.         }
  9468.         int j3 = j2;
  9469.         int k3 = j1;
  9470.         anIntArrayArray901[j2][j1] = 99;
  9471.         anIntArrayArray825[j2][j1] = 0;
  9472.         int l3 = 0;
  9473.         int i4 = 0;
  9474.         bigX[l3] = j2;
  9475.         bigY[l3++] = j1;
  9476.         boolean flag1 = false;
  9477.         int j4 = bigX.length;
  9478.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  9479.         while (i4 != l3) {
  9480.             j3 = bigX[i4];
  9481.             k3 = bigY[i4];
  9482.             i4 = (i4 + 1) % j4;
  9483.             if (j3 == k2 && k3 == i2) {
  9484.                 flag1 = true;
  9485.                 break;
  9486.             }
  9487.             if (i1 != 0) {
  9488.                 if ((i1 < 5 || i1 == 10)
  9489.                         && aClass11Array1230[plane].method219(k2, j3, k3, j,
  9490.                                 i1 - 1, i2)) {
  9491.                     flag1 = true;
  9492.                     break;
  9493.                 }
  9494.                 if (i1 < 10
  9495.                         && aClass11Array1230[plane].method220(k2, i2, k3,
  9496.                                 i1 - 1, j, j3)) {
  9497.                     flag1 = true;
  9498.                     break;
  9499.                 }
  9500.             }
  9501.             if (k1 != 0
  9502.                     && k != 0
  9503.                     && aClass11Array1230[plane].method221(i2, k2, j3, k, l1,
  9504.                             k1, k3)) {
  9505.                 flag1 = true;
  9506.                 break;
  9507.             }
  9508.             int l4 = anIntArrayArray825[j3][k3] + 1;
  9509.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0
  9510.                     && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  9511.                 bigX[l3] = j3 - 1;
  9512.                 bigY[l3] = k3;
  9513.                 l3 = (l3 + 1) % j4;
  9514.                 anIntArrayArray901[j3 - 1][k3] = 2;
  9515.                 anIntArrayArray825[j3 - 1][k3] = l4;
  9516.             }
  9517.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0
  9518.                     && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  9519.                 bigX[l3] = j3 + 1;
  9520.                 bigY[l3] = k3;
  9521.                 l3 = (l3 + 1) % j4;
  9522.                 anIntArrayArray901[j3 + 1][k3] = 8;
  9523.                 anIntArrayArray825[j3 + 1][k3] = l4;
  9524.             }
  9525.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0
  9526.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9527.                 bigX[l3] = j3;
  9528.                 bigY[l3] = k3 - 1;
  9529.                 l3 = (l3 + 1) % j4;
  9530.                 anIntArrayArray901[j3][k3 - 1] = 1;
  9531.                 anIntArrayArray825[j3][k3 - 1] = l4;
  9532.             }
  9533.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0
  9534.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9535.                 bigX[l3] = j3;
  9536.                 bigY[l3] = k3 + 1;
  9537.                 l3 = (l3 + 1) % j4;
  9538.                 anIntArrayArray901[j3][k3 + 1] = 4;
  9539.                 anIntArrayArray825[j3][k3 + 1] = l4;
  9540.             }
  9541.             if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0
  9542.                     && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
  9543.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9544.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9545.                 bigX[l3] = j3 - 1;
  9546.                 bigY[l3] = k3 - 1;
  9547.                 l3 = (l3 + 1) % j4;
  9548.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  9549.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  9550.             }
  9551.             if (j3 < byte0 - 1 && k3 > 0
  9552.                     && anIntArrayArray901[j3 + 1][k3 - 1] == 0
  9553.                     && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0
  9554.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9555.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9556.                 bigX[l3] = j3 + 1;
  9557.                 bigY[l3] = k3 - 1;
  9558.                 l3 = (l3 + 1) % j4;
  9559.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  9560.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  9561.             }
  9562.             if (j3 > 0 && k3 < byte1 - 1
  9563.                     && anIntArrayArray901[j3 - 1][k3 + 1] == 0
  9564.                     && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0
  9565.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9566.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9567.                 bigX[l3] = j3 - 1;
  9568.                 bigY[l3] = k3 + 1;
  9569.                 l3 = (l3 + 1) % j4;
  9570.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  9571.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  9572.             }
  9573.             if (j3 < byte0 - 1 && k3 < byte1 - 1
  9574.                     && anIntArrayArray901[j3 + 1][k3 + 1] == 0
  9575.                     && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0
  9576.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9577.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9578.                 bigX[l3] = j3 + 1;
  9579.                 bigY[l3] = k3 + 1;
  9580.                 l3 = (l3 + 1) % j4;
  9581.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  9582.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  9583.             }
  9584.         }
  9585.         anInt1264 = 0;
  9586.         if (!flag1) {
  9587.             if (flag) {
  9588.                 int i5 = 100;
  9589.                 for (int k5 = 1; k5 < 2; k5++) {
  9590.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  9591.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  9592.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104
  9593.                                     && anIntArrayArray825[i6][l6] < i5) {
  9594.                                 i5 = anIntArrayArray825[i6][l6];
  9595.                                 j3 = i6;
  9596.                                 k3 = l6;
  9597.                                 anInt1264 = 1;
  9598.                                 flag1 = true;
  9599.                             }
  9600.  
  9601.                     }
  9602.  
  9603.                     if (flag1)
  9604.                         break;
  9605.                 }
  9606.  
  9607.             }
  9608.             if (!flag1)
  9609.                 return false;
  9610.         }
  9611.         i4 = 0;
  9612.         bigX[i4] = j3;
  9613.         bigY[i4++] = k3;
  9614.         int l5;
  9615.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  9616.             if (j5 != l5) {
  9617.                 l5 = j5;
  9618.                 bigX[i4] = j3;
  9619.                 bigY[i4++] = k3;
  9620.             }
  9621.             if ((j5 & 2) != 0)
  9622.                 j3++;
  9623.             else if ((j5 & 8) != 0)
  9624.                 j3--;
  9625.             if ((j5 & 1) != 0)
  9626.                 k3++;
  9627.             else if ((j5 & 4) != 0)
  9628.                 k3--;
  9629.         }
  9630.         // if(cancelWalk) { return i4 > 0; }
  9631.  
  9632.         if (i4 > 0) {
  9633.             int k4 = i4;
  9634.             if (k4 > 25)
  9635.                 k4 = 25;
  9636.             i4--;
  9637.             int k6 = bigX[i4];
  9638.             int i7 = bigY[i4];
  9639.             anInt1288 += k4;
  9640.             if (anInt1288 >= 92) {
  9641.                 stream.createFrame(36);
  9642.                 stream.writeDWord(0);
  9643.                 anInt1288 = 0;
  9644.             }
  9645.             if (!isFollowing) {
  9646.                 if (followPlayer > 0 || followNPC > 0) {
  9647.                     followPlayer = 0;
  9648.                     followNPC = 0;
  9649.                     stream.createFrame(36);
  9650.                     stream.writeDWord(5);
  9651.                     anInt1288 = 0;
  9652.                 }
  9653.             }
  9654.             if (i == 0) {
  9655.                 stream.createFrame(164);
  9656.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9657.             }
  9658.             if (i == 1) {
  9659.                 stream.createFrame(248);
  9660.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  9661.             }
  9662.             if (i == 2) {
  9663.                 stream.createFrame(98);
  9664.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9665.             }
  9666.             stream.method433(k6 + baseX);
  9667.             destX = bigX[0];
  9668.             destY = bigY[0];
  9669.             for (int j7 = 1; j7 < k4; j7++) {
  9670.                 i4--;
  9671.                 stream.writeWordBigEndian(bigX[i4] - k6);
  9672.                 stream.writeWordBigEndian(bigY[i4] - i7);
  9673.             }
  9674.  
  9675.             stream.method431(i7 + baseY);
  9676.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  9677.             return true;
  9678.         }
  9679.         return i != 1;
  9680.     }
  9681.  
  9682.     private void method86(Stream stream) {
  9683.         for (int j = 0; j < anInt893; j++) {
  9684.             int k = anIntArray894[j];
  9685.             NPC npc = npcArray[k];
  9686.             int l = stream.readUnsignedByte();
  9687.             if ((l & 0x10) != 0) {
  9688.                 int i1 = stream.method434();
  9689.                 if (i1 == 65535)
  9690.                     i1 = -1;
  9691.                 int i2 = stream.readUnsignedByte();
  9692.                 if (i1 == npc.anim && i1 != -1) {
  9693.                     int l2 = Animation.anims[i1].anInt365;
  9694.                     if (l2 == 1) {
  9695.                         npc.anInt1527 = 0;
  9696.                         npc.anInt1528 = 0;
  9697.                         npc.anInt1529 = i2;
  9698.                         npc.anInt1530 = 0;
  9699.                     }
  9700.                     if (l2 == 2)
  9701.                         npc.anInt1530 = 0;
  9702.                 } else if (i1 == -1
  9703.                         || npc.anim == -1
  9704.                         || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359) {
  9705.                     npc.anim = i1;
  9706.                     npc.anInt1527 = 0;
  9707.                     npc.anInt1528 = 0;
  9708.                     npc.anInt1529 = i2;
  9709.                     npc.anInt1530 = 0;
  9710.                     npc.anInt1542 = npc.smallXYIndex;
  9711.                 }
  9712.             }
  9713.             if ((l & 8) != 0) {
  9714.                 int j1 = stream.method426();
  9715.                 int j2 = stream.method427();
  9716.                 npc.updateHitData(j2, j1, loopCycle);
  9717.                 npc.loopCycleStatus = loopCycle + 300;
  9718.                 npc.currentHealth = stream.method426();
  9719.                 npc.maxHealth = stream.readUnsignedByte();
  9720.             }
  9721.             if ((l & 0x80) != 0) {
  9722.                 npc.anInt1520 = stream.readUnsignedWord();
  9723.                 int k1 = stream.readDWord();
  9724.                 npc.anInt1524 = k1 >> 16;
  9725.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  9726.                 npc.anInt1521 = 0;
  9727.                 npc.anInt1522 = 0;
  9728.                 if (npc.anInt1523 > loopCycle)
  9729.                     npc.anInt1521 = -1;
  9730.                 if (npc.anInt1520 == 65535)
  9731.                     npc.anInt1520 = -1;
  9732.             }
  9733.             if ((l & 0x20) != 0) {
  9734.                 npc.interactingEntity = stream.readUnsignedWord();
  9735.                 if (npc.interactingEntity == 65535)
  9736.                     npc.interactingEntity = -1;
  9737.             }
  9738.             if ((l & 1) != 0) {
  9739.                 npc.textSpoken = stream.readString();
  9740.                 npc.textCycle = 100;
  9741.                 // entityMessage(npc);
  9742.  
  9743.             }
  9744.             if ((l & 0x40) != 0) {
  9745.                 int l1 = stream.method427();
  9746.                 int k2 = stream.method428();
  9747.                 npc.updateHitData(k2, l1, loopCycle);
  9748.                 npc.loopCycleStatus = loopCycle + 300;
  9749.                 npc.currentHealth = stream.method428();
  9750.                 npc.maxHealth = stream.method427();
  9751.             }
  9752.             if ((l & 2) != 0) {
  9753.                 npc.desc = EntityDef.forID(stream.method436());
  9754.                 npc.anInt1540 = npc.desc.aByte68;
  9755.                 npc.anInt1504 = npc.desc.anInt79;
  9756.                 npc.anInt1554 = npc.desc.walkAnim;
  9757.                 npc.anInt1555 = npc.desc.anInt58;
  9758.                 npc.anInt1556 = npc.desc.anInt83;
  9759.                 npc.anInt1557 = npc.desc.anInt55;
  9760.                 npc.anInt1511 = npc.desc.standAnim;
  9761.             }
  9762.             if ((l & 4) != 0) {
  9763.                 npc.anInt1538 = stream.method434();
  9764.                 npc.anInt1539 = stream.method434();
  9765.             }
  9766.         }
  9767.     }
  9768.  
  9769.     private void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k) {
  9770.         if (menuActionRow >= 400)
  9771.             return;
  9772.         if (entityDef.childrenIDs != null)
  9773.             entityDef = entityDef.method161();
  9774.         if (entityDef == null)
  9775.             return;
  9776.         if (!entityDef.aBoolean84)
  9777.             return;
  9778.         String s = entityDef.name;
  9779.         if (entityDef.combatLevel != 0)
  9780.             s = s
  9781.                     + combatDiffColor(myPlayer.combatLevel,
  9782.                             entityDef.combatLevel) + " (level-"
  9783.                     + entityDef.combatLevel + ")";
  9784.         if (itemSelected == 1) {
  9785.             menuActionName[menuActionRow] = "Use " + selectedItemName
  9786.                     + " with @yel@" + s;
  9787.             menuActionID[menuActionRow] = 582;
  9788.             menuActionCmd1[menuActionRow] = i;
  9789.             menuActionCmd2[menuActionRow] = k;
  9790.             menuActionCmd3[menuActionRow] = j;
  9791.             menuActionRow++;
  9792.             return;
  9793.         }
  9794.         if (spellSelected == 1) {
  9795.             if ((spellUsableOn & 2) == 2) {
  9796.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  9797.                 menuActionID[menuActionRow] = 413;
  9798.                 menuActionCmd1[menuActionRow] = i;
  9799.                 menuActionCmd2[menuActionRow] = k;
  9800.                 menuActionCmd3[menuActionRow] = j;
  9801.                 menuActionRow++;
  9802.             }
  9803.         } else {
  9804.             if (entityDef.actions != null) {
  9805.                 for (int l = 4; l >= 0; l--)
  9806.                     if (entityDef.actions[l] != null
  9807.                             && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  9808.                         menuActionName[menuActionRow] = entityDef.actions[l]
  9809.                                 + " @yel@" + s;
  9810.                         if (l == 0)
  9811.                             menuActionID[menuActionRow] = 20;
  9812.                         if (l == 1)
  9813.                             menuActionID[menuActionRow] = 412;
  9814.                         if (l == 2)
  9815.                             menuActionID[menuActionRow] = 225;
  9816.                         if (l == 3)
  9817.                             menuActionID[menuActionRow] = 965;
  9818.                         if (l == 4)
  9819.                             menuActionID[menuActionRow] = 478;
  9820.                         menuActionCmd1[menuActionRow] = i;
  9821.                         menuActionCmd2[menuActionRow] = k;
  9822.                         menuActionCmd3[menuActionRow] = j;
  9823.                         menuActionRow++;
  9824.                     }
  9825.  
  9826.             }
  9827.             if (entityDef.actions != null) {
  9828.                 for (int i1 = 4; i1 >= 0; i1--)
  9829.                     if (entityDef.actions[i1] != null
  9830.                             && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  9831.                         char c = '\0';
  9832.                         if (entityDef.combatLevel > myPlayer.combatLevel)
  9833.                             c = '\u07D0';
  9834.                         menuActionName[menuActionRow] = entityDef.actions[i1]
  9835.                                 + " @yel@" + s;
  9836.                         if (i1 == 0)
  9837.                             menuActionID[menuActionRow] = 20 + c;
  9838.                         if (i1 == 1)
  9839.                             menuActionID[menuActionRow] = 412 + c;
  9840.                         if (i1 == 2)
  9841.                             menuActionID[menuActionRow] = 225 + c;
  9842.                         if (i1 == 3)
  9843.                             menuActionID[menuActionRow] = 965 + c;
  9844.                         if (i1 == 4)
  9845.                             menuActionID[menuActionRow] = 478 + c;
  9846.                         menuActionCmd1[menuActionRow] = i;
  9847.                         menuActionCmd2[menuActionRow] = k;
  9848.                         menuActionCmd3[menuActionRow] = j;
  9849.                         menuActionRow++;
  9850.                     }
  9851.  
  9852.             }
  9853.             // menuActionName[menuActionRow] = "Examine @yel@" + s +
  9854.             // " @gre@(@whi@" + entityDef.type + "@gre@)";
  9855.             menuActionName[menuActionRow] = "Examine @yel@" + s;
  9856.             menuActionID[menuActionRow] = 1025;
  9857.             menuActionCmd1[menuActionRow] = i;
  9858.             menuActionCmd2[menuActionRow] = k;
  9859.             menuActionCmd3[menuActionRow] = j;
  9860.             menuActionRow++;
  9861.         }
  9862.     }
  9863.  
  9864.     private void buildAtPlayerMenu(int i, int j, Player player, int k) {
  9865.         if (player == myPlayer)
  9866.             return;
  9867.         if (menuActionRow >= 400)
  9868.             return;
  9869.         String s;
  9870.         String title = getSpecialColor(player.skill) + player.title + "@whi@";
  9871.         if (player.skill == 0)
  9872.             s = player.name
  9873.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  9874.                     + " (level-" + player.combatLevel + ")";
  9875.         else
  9876.             s = title + player.name
  9877.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  9878.                     + " (level-" + player.combatLevel + ")";
  9879.         if (itemSelected == 1) {
  9880.             menuActionName[menuActionRow] = "Use " + selectedItemName
  9881.                     + " with @whi@" + s;
  9882.             menuActionID[menuActionRow] = 491;
  9883.             menuActionCmd1[menuActionRow] = j;
  9884.             menuActionCmd2[menuActionRow] = i;
  9885.             menuActionCmd3[menuActionRow] = k;
  9886.             menuActionRow++;
  9887.         } else if (spellSelected == 1) {
  9888.             if ((spellUsableOn & 8) == 8) {
  9889.                 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  9890.                 menuActionID[menuActionRow] = 365;
  9891.                 menuActionCmd1[menuActionRow] = j;
  9892.                 menuActionCmd2[menuActionRow] = i;
  9893.                 menuActionCmd3[menuActionRow] = k;
  9894.                 menuActionRow++;
  9895.             }
  9896.         } else {
  9897.             for (int l = 4; l >= 0; l--)
  9898.                 if (atPlayerActions[l] != null) {
  9899.                     menuActionName[menuActionRow] = atPlayerActions[l]
  9900.                             + " @whi@" + s;
  9901.                     char c = '\0';
  9902.                     if (atPlayerActions[l].equalsIgnoreCase("attack")) {
  9903.                         if (player.combatLevel > myPlayer.combatLevel)
  9904.                             c = '\u07D0';
  9905.                         if (myPlayer.team != 0 && player.team != 0)
  9906.                             if (myPlayer.team == player.team)
  9907.                                 c = '\u07D0';
  9908.                             else
  9909.                                 c = '\0';
  9910.                     } else if (atPlayerArray[l])
  9911.                         c = '\u07D0';
  9912.                     if (l == 0)
  9913.                         menuActionID[menuActionRow] = 561 + c;
  9914.                     if (l == 1)
  9915.                         menuActionID[menuActionRow] = 779 + c;
  9916.                     if (l == 2)
  9917.                         menuActionID[menuActionRow] = 27 + c;
  9918.                     if (l == 3)
  9919.                         menuActionID[menuActionRow] = 577 + c;
  9920.                     if (l == 4)
  9921.                         menuActionID[menuActionRow] = 729 + c;
  9922.                     menuActionCmd1[menuActionRow] = j;
  9923.                     menuActionCmd2[menuActionRow] = i;
  9924.                     menuActionCmd3[menuActionRow] = k;
  9925.                     menuActionRow++;
  9926.                 }
  9927.  
  9928.         }
  9929.         for (int i1 = 0; i1 < menuActionRow; i1++)
  9930.             if (menuActionID[i1] == 516) {
  9931.                 menuActionName[i1] = "Walk here @whi@" + s;
  9932.                 return;
  9933.             }
  9934.  
  9935.     }
  9936.  
  9937.     private void method89(Class30_Sub1 class30_sub1) {
  9938.         int i = 0;
  9939.         int j = -1;
  9940.         int k = 0;
  9941.         int l = 0;
  9942.         if (class30_sub1.anInt1296 == 0)
  9943.             i = worldController.method300(class30_sub1.anInt1295,
  9944.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9945.         if (class30_sub1.anInt1296 == 1)
  9946.             i = worldController.method301(class30_sub1.anInt1295,
  9947.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9948.         if (class30_sub1.anInt1296 == 2)
  9949.             i = worldController.method302(class30_sub1.anInt1295,
  9950.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9951.         if (class30_sub1.anInt1296 == 3)
  9952.             i = worldController.method303(class30_sub1.anInt1295,
  9953.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9954.         if (i != 0) {
  9955.             int i1 = worldController.method304(class30_sub1.anInt1295,
  9956.                     class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  9957.             j = i >> 14 & 0x7fff;
  9958.             k = i1 & 0x1f;
  9959.             l = i1 >> 6;
  9960.         }
  9961.         class30_sub1.anInt1299 = j;
  9962.         class30_sub1.anInt1301 = k;
  9963.         class30_sub1.anInt1300 = l;
  9964.     }
  9965.  
  9966.     /*
  9967.      * private void method90() { for(int i = 0; i < anInt1062; i++)
  9968.      * if(anIntArray1250[i] <= 0) { boolean flag1 = false; try {
  9969.      * if(anIntArray1207[i] == anInt874 && anIntArray1241[i] == anInt1289) {
  9970.      * if(!replayWave()) flag1 = true; } else { Stream stream =
  9971.      * Sounds.method241(anIntArray1241[i], anIntArray1207[i]);
  9972.      * if(System.currentTimeMillis() + (long)(stream.currentOffset / 22) >
  9973.      * aLong1172 + (long)(anInt1257 / 22)) { anInt1257 = stream.currentOffset;
  9974.      * aLong1172 = System.currentTimeMillis(); if(saveWave(stream.buffer,
  9975.      * stream.currentOffset)) { anInt874 = anIntArray1207[i]; anInt1289 =
  9976.      * anIntArray1241[i]; } else { flag1 = true; } } } } catch(Exception
  9977.      * exception) { } if(!flag1 || anIntArray1250[i] == -5) { anInt1062--;
  9978.      * for(int j = i; j < anInt1062; j++) { anIntArray1207[j] = anIntArray1207[j
  9979.      * + 1]; anIntArray1241[j] = anIntArray1241[j + 1]; anIntArray1250[j] =
  9980.      * anIntArray1250[j + 1]; }
  9981.      *
  9982.      * i--; } else { anIntArray1250[i] = -5; } } else { anIntArray1250[i]--; }
  9983.      *
  9984.      * if(prevSong > 0) { prevSong -= 20; if(prevSong < 0) prevSong = 0;
  9985.      * if(prevSong == 0 && musicEnabled && !lowMem) { nextSong = currentSong;
  9986.      * songChanging = true; onDemandFetcher.method558(2, nextSong); } } }
  9987.      */
  9988.     public final void method90(boolean flag) {
  9989.         if (flag)
  9990.             pktType = -1;
  9991.  
  9992.         for (int i = 0; i < anInt1062; i++)
  9993.  
  9994.             if (anIntArray1250[i] <= 0) {
  9995.                 boolean flag1 = false;
  9996.                 try {
  9997.  
  9998.                     Stream stream = Sounds.method241(anIntArray1241[i],
  9999.                             anIntArray1207[i]);
  10000.  
  10001.                     new SoundPlayer((InputStream) new ByteArrayInputStream(
  10002.                             stream.buffer, 0, stream.currentOffset));
  10003.  
  10004.                     if (System.currentTimeMillis()
  10005.                             + (long) (stream.currentOffset / 22) > aLong1172
  10006.                             + (long) (anInt1257 / 22)) {
  10007.                         anInt1257 = stream.currentOffset;
  10008.                         aLong1172 = System.currentTimeMillis();
  10009.                     }
  10010.                 } catch (Exception exception) {
  10011.                 }
  10012.  
  10013.                 if (!flag1 || anIntArray1250[i] == -5) {
  10014.                     anInt1062--;
  10015.                     for (int j = i; j < anInt1062; j++) {
  10016.                         anIntArray1207[j] = anIntArray1207[j + 1];
  10017.                         anIntArray1241[j] = anIntArray1241[j + 1];
  10018.                         anIntArray1250[j] = anIntArray1250[j + 1];
  10019.                     }
  10020.                     i--;
  10021.                 } else {
  10022.                     anIntArray1250[i] = -5;
  10023.                 }
  10024.             } else {
  10025.                 anIntArray1250[i]--;
  10026.             }
  10027.  
  10028.         if (prevSong > 0) {
  10029.             prevSong -= 20;
  10030.             if (prevSong < 0)
  10031.                 prevSong = 0;
  10032.             if (prevSong == 0 && musicEnabled) {// && !lowMem) {
  10033.                 nextSong = currentSong;
  10034.                 songChanging = true;
  10035.                 onDemandFetcher.method558(2, nextSong);
  10036.             }
  10037.         }
  10038.     }
  10039.  
  10040.     void startUp() {
  10041.         drawLoadingText(20, "Starting up");
  10042.         new CacheDownloader(this).downloadCache();
  10043.         UserLoader.loaduser();
  10044.         UserLoader.finalload();
  10045.         if (hpH) {
  10046.             sendFrame36(731,3);
  10047.         }
  10048.         if (newHpBar) {
  10049.             sendFrame36(730,1);
  10050.         }
  10051.         if (newHits) {
  10052.             sendFrame36(732,5);
  10053.         }
  10054.        
  10055.         if (signlink.sunjava)
  10056.             super.minDelay = 5;
  10057.         if (aBoolean993) {
  10058.             // rsAlreadyLoaded = true;
  10059.             // return;
  10060.         }
  10061.         aBoolean993 = true;
  10062.         boolean flag = true;
  10063.         String s = getDocumentBaseHost();
  10064.         if (signlink.cache_dat != null) {
  10065.             for (int i = 0; i < 5; i++)
  10066.                 decompressors[i] = new Decompressor(signlink.cache_dat,
  10067.                         signlink.cache_idx[i], i + 1);
  10068.         }
  10069.         try {
  10070.             titleStreamLoader = streamLoaderForName(1, "title screen", "title",
  10071.                     expectedCRCs[1], 25);
  10072.             smallText = new TextDrawingArea(false, "p11_full",
  10073.                     titleStreamLoader);
  10074.             aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full",
  10075.                     titleStreamLoader);
  10076.             chatTextDrawingArea = new TextDrawingArea(false, "b12_full",
  10077.                     titleStreamLoader);
  10078.             TextDrawingArea aTextDrawingArea_1273 = new TextDrawingArea(true,
  10079.                     "q8_full", titleStreamLoader);
  10080.             drawLogo();
  10081.             loadTitleScreen();
  10082.             StreamLoader streamLoader = streamLoaderForName(2, "config",
  10083.                     "config", expectedCRCs[2], 30);
  10084.             StreamLoader streamLoader_1 = streamLoaderForName(3, "interface",
  10085.                     "interface", expectedCRCs[3], 35);
  10086.             StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics",
  10087.                     "media", expectedCRCs[4], 40);
  10088.             StreamLoader streamLoader_3 = streamLoaderForName(6, "textures",
  10089.                     "textures", expectedCRCs[6], 45);
  10090.             StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system",
  10091.                     "wordenc", expectedCRCs[7], 50);
  10092.             StreamLoader streamLoader_5 = streamLoaderForName(8,
  10093.                     "sound effects", "sounds", expectedCRCs[8], 55);
  10094.             byteGroundArray = new byte[4][104][104];
  10095.             intGroundArray = new int[4][105][105];
  10096.             worldController = new WorldController(intGroundArray);
  10097.             for (int j = 0; j < 4; j++)
  10098.                 aClass11Array1230[j] = new Class11();
  10099.  
  10100.             aClass30_Sub2_Sub1_Sub1_1263 = new Sprite(512, 512);
  10101.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list",
  10102.                     "versionlist", expectedCRCs[5], 60);
  10103.             drawLoadingText(60, "Loading Models");
  10104.             onDemandFetcher = new OnDemandFetcher();
  10105.             onDemandFetcher.start(streamLoader_6, this);
  10106.             setNewMaps();
  10107.             Class36.method528(onDemandFetcher.getAnimCount());
  10108.             Model.method459(80000, onDemandFetcher);
  10109.             ModelDecompressor.unpackModels("newstuff");
  10110.             // Class36.unpackAnimationData();
  10111.             preloadModels();// Raw Folder
  10112.             // repackCacheIndex(1);
  10113.             /*
  10114.              * drawLoadingText(65, "Requesting animations"); int k =
  10115.              * onDemandFetcher.getVersionCount(1); for(int i1 = 0; i1 < k; i1++)
  10116.              * onDemandFetcher.method558(1, i1);
  10117.              *
  10118.              * while(onDemandFetcher.getNodeCount() > 0) { int j1 = k -
  10119.              * onDemandFetcher.getNodeCount(); if(j1 > 0) drawLoadingText(65,
  10120.              * "Loading animations - " + (j1 * 100) / k + "%");
  10121.              * processOnDemandQueue(); try { Thread.sleep(100L); }
  10122.              * catch(Exception _ex) { _ex.printStackTrace();}
  10123.              * if(onDemandFetcher.anInt1349 > 3) { loadError(); return; } }
  10124.              * drawLoadingText(70, "Loading Models"); k =
  10125.              * onDemandFetcher.getVersionCount(0);
  10126.              * System.out.println("Loading Models"); for(int k1 = 0; k1 < k;
  10127.              * k1++) { int l1 = onDemandFetcher.getModelIndex(k1); if((l1 & 1)
  10128.              * != 0) onDemandFetcher.method558(0, k1); }
  10129.              * System.out.println("Finished!"); k =
  10130.              * onDemandFetcher.getNodeCount();
  10131.              * while(onDemandFetcher.getNodeCount() > 0) { int i2 = k -
  10132.              * onDemandFetcher.getNodeCount(); if(i2 > 0) drawLoadingText(70,
  10133.              * "Loading models - " + (i2 * 100) / k + "%");
  10134.              * processOnDemandQueue(); try { Thread.sleep(100L); }
  10135.              * catch(Exception _ex) { _ex.printStackTrace(); }
  10136.              *
  10137.              * } if(decompressors[0] != null) { drawLoadingText(75,
  10138.              * "Loading Maps"); onDemandFetcher.method558(3,
  10139.              * onDemandFetcher.method562(0, 48, 47));
  10140.              * onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48,
  10141.              * 47)); onDemandFetcher.method558(3, onDemandFetcher.method562(0,
  10142.              * 48, 48)); onDemandFetcher.method558(3,
  10143.              * onDemandFetcher.method562(1, 48, 48));
  10144.              * onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48,
  10145.              * 49)); onDemandFetcher.method558(3, onDemandFetcher.method562(1,
  10146.              * 48, 49)); onDemandFetcher.method558(3,
  10147.              * onDemandFetcher.method562(0, 47, 47));
  10148.              * onDemandFetcher.method558(3, onDemandFetcher.method562(1, 47,
  10149.              * 47)); onDemandFetcher.method558(3, onDemandFetcher.method562(0,
  10150.              * 47, 48)); onDemandFetcher.method558(3,
  10151.              * onDemandFetcher.method562(1, 47, 48));
  10152.              * onDemandFetcher.method558(3, onDemandFetcher.method562(0, 148,
  10153.              * 48)); onDemandFetcher.method558(3, onDemandFetcher.method562(1,
  10154.              * 148, 48)); k = onDemandFetcher.getNodeCount();
  10155.              * while(onDemandFetcher.getNodeCount() > 0) { int j2 = k -
  10156.              * onDemandFetcher.getNodeCount(); if(j2 > 0) drawLoadingText(75,
  10157.              * "Loading maps - " + (j2 * 100) / k + "%");
  10158.              * processOnDemandQueue(); try { Thread.sleep(100L); }
  10159.              * catch(Exception _ex) { } } }
  10160.              *
  10161.              * k = onDemandFetcher.getVersionCount(0); for(int k2 = 0; k2 < k;
  10162.              * k2++) { int l2 = onDemandFetcher.getModelIndex(k2); byte byte0 =
  10163.              * 0; if((l2 & 8) != 0) byte0 = 10; else if((l2 & 0x20) != 0) byte0
  10164.              * = 9; else if((l2 & 0x10) != 0) byte0 = 8; else if((l2 & 0x40) !=
  10165.              * 0) byte0 = 7; else if((l2 & 0x80) != 0) byte0 = 6; else if((l2 &
  10166.              * 2) != 0) byte0 = 5; else if((l2 & 4) != 0) byte0 = 4; if((l2 & 1)
  10167.              * != 0) byte0 = 3; if(byte0 != 0) onDemandFetcher.method563(byte0,
  10168.              * 0, k2); } onDemandFetcher.method554(isMembers); if(!lowMem) { int
  10169.              * l = onDemandFetcher.getVersionCount(2); for(int i3 = 1; i3 < l;
  10170.              * i3++) if(onDemandFetcher.method569(i3))
  10171.              * onDemandFetcher.method563((byte)1, 2, i3);
  10172.              *
  10173.              * }
  10174.              */
  10175.  
  10176.             drawLoadingText(80, "Unpacking media");
  10177.             /* Custom sprite unpacking */
  10178.             xpFlag = new Sprite("xpFlag");
  10179.             hitMarks[20] = new Sprite("hitMark");
  10180.             hitMarks[21] = new Sprite("hitMark2");
  10181.             HPBarFull = new Sprite("HITPOINTS_0.PNG");
  10182.             HPBarEmpty = new Sprite("HITPOINTS_1.PNG");
  10183.             infinity = new Sprite("infinity");
  10184.             multiOverlay = new Sprite("multi");
  10185.             duelingOverlay = new Sprite("overlay_duelway");
  10186.             chatArea = new Sprite("chatarea");
  10187.             chatButtons = new Sprite("chatbuttons");
  10188.             chatButtonH = new Sprite("chathover");
  10189.             chatButtonC = new Sprite("chatclicked");
  10190.             chatButtonHC = new Sprite("chatclickedh");
  10191.             reportH = new Sprite("reporthover");
  10192.             tabArea = new Sprite("tabarea");
  10193.             mapArea = new Sprite("maparea");
  10194.             logIconH = new Sprite("logiconh");
  10195.             logIconC = new Sprite("logiconc");
  10196.             worldMapIcon = new Sprite("mapicon");
  10197.             emptyOrb = new Sprite("emptyorb");
  10198.             hitPointsFill = new Sprite("hitpointsfill");
  10199.             hitPointsIcon = new Sprite("hitpointsicon");
  10200.             prayerFill = new Sprite("prayerfill");
  10201.             prayerIcon = new Sprite("prayericon");
  10202.             /**/
  10203.             mapBack = new Background(streamLoader_2, "mapback", 0);
  10204.             for (int j3 = 0; j3 < 14; j3++)
  10205.                 sideIcons[j3] = new Sprite(streamLoader_2, "sideicons", j3);
  10206.             for (int r1 = 0; r1 < 5; r1++)
  10207.                 redStones[r1] = new Sprite(streamLoader_2, "redstones", r1);
  10208.             for (int i = 0; i < 3; i++)
  10209.                 counter[i] = new Sprite("XP_" + i);
  10210.             compass = new Sprite(streamLoader_2, "compass", 0);
  10211.             mapEdge = new Sprite(streamLoader_2, "mapedge", 0);
  10212.             mapEdge.method345();
  10213.             try {
  10214.                 for (int k3 = 0; k3 < 100; k3++)
  10215.                     mapScenes[k3] = new Background(streamLoader_2, "mapscene",
  10216.                             k3);
  10217.             } catch (Exception _ex) {
  10218.             }
  10219.             try {
  10220.                 for (int l3 = 0; l3 < 100; l3++)
  10221.                     if (l3 < 75) {
  10222.                         mapFunctions[l3] = new Sprite(streamLoader_2,
  10223.                                 "mapfunction", l3);
  10224.                     } else {
  10225.                         mapFunctions[l3] = new Sprite(streamLoader_2,
  10226.                                 "mapfunctions2", (l3 - 76));
  10227.                     }
  10228.             } catch (Exception _ex) {
  10229.             }
  10230.             try {
  10231.                 for (int i4 = 0; i4 < 20; i4++)
  10232.                     hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
  10233.             } catch (Exception _ex) {
  10234.             }
  10235.             try {
  10236.                 for (int h1 = 0; h1 < 6; h1++)
  10237.                     headIconsHint[h1] = new Sprite(streamLoader_2,
  10238.                             "headicons_hint", h1);
  10239.             } catch (Exception _ex) {
  10240.             }
  10241.             try {
  10242.                 for (int j4 = 0; j4 < 18; j4++)
  10243.                     headIcons[j4] = new Sprite(streamLoader_2,
  10244.                             "headicons_prayer", j4);
  10245.                 for (int j45 = 0; j45 < 3; j45++)
  10246.                     skullIcons[j45] = new Sprite(streamLoader_2,
  10247.                             "headicons_pk", j45);
  10248.             } catch (Exception _ex) {
  10249.             }
  10250.             mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
  10251.             mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
  10252.             for (int k4 = 0; k4 < 8; k4++)
  10253.                 crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
  10254.  
  10255.             mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
  10256.             mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
  10257.             mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
  10258.             mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
  10259.             mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
  10260.             mapDotBL = new Sprite(streamLoader_2, "mapdots", 4); // temp
  10261.             scrollBar1 = new Background(streamLoader_2, "scrollbar", 0);
  10262.             scrollBar2 = new Background(streamLoader_2, "scrollbar", 1);
  10263.             alertBack = new Sprite("alertback");
  10264.             alertBorder = new Sprite("alertborder");
  10265.             alertBorderH = new Sprite("alertborderh");
  10266.             // for(int l4 = 0; l4 < 11; l4++)
  10267.             // modIcons[l4] = new Background(streamLoader_2, "mod_icons", l4);
  10268.             try {
  10269.                 modIcons[0] = new Sprite("MOD_ICONS 1");// Player Rights 1
  10270.                 modIcons[1] = new Sprite("MOD_ICONS 2");// Player Rights 2
  10271.                 modIcons[2] = new Sprite("MOD_ICONS 3");// player Rights 3
  10272.                 modIcons[3] = new Sprite("MOD_ICONS 5");// Player Rights 4
  10273.                 modIcons[4] = new Sprite("MOD_ICONS 4");// Player Rights 5
  10274.                 modIcons[5] = new Sprite("MOD_ICONS 6");// Player Rights 6
  10275.                 modIcons[6] = new Sprite("MOD_ICONS 7");// Player Rights 7
  10276.                 modIcons[7] = new Sprite("MOD_ICONS 8");// player Rights 8
  10277.                 modIcons[8] = new Sprite("MOD_ICONS 9");// Player Rights 9
  10278.                 modIcons[9] = new Sprite("MOD_ICONS 10");// Player Rights 10
  10279.                 modIcons[10] = new Sprite("MOD_ICONS 11");// Player Rights 11
  10280.                 modIcons[11] = new Sprite("MOD_ICONS 12");// Player Rights 11
  10281.             } catch (Exception _ex) {
  10282.  
  10283.             }
  10284.             // Sprite sprite = new Sprite("frame");
  10285.             // frame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10286.             // getGameComponent());
  10287.             // sprite.method346(0, 0);
  10288.  
  10289.             Sprite sprite = new Sprite("Frame1");
  10290.             frame[0] = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10291.                     getGameComponent());
  10292.             sprite.method346(0, 0);
  10293.  
  10294.             sprite = new Sprite("Frame2");
  10295.             frame[1] = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10296.                     getGameComponent());
  10297.             sprite.method346(0, 0);
  10298.  
  10299.             sprite = new Sprite("Frame3");
  10300.             frame[2] = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10301.                     getGameComponent());
  10302.             sprite.method346(0, 0);
  10303.  
  10304.             int i5 = (int) (Math.random() * 21D) - 10;
  10305.             int j5 = (int) (Math.random() * 21D) - 10;
  10306.             int k5 = (int) (Math.random() * 21D) - 10;
  10307.             int l5 = (int) (Math.random() * 41D) - 20;
  10308.             for (int i6 = 0; i6 < 100; i6++) {
  10309.                 if (mapFunctions[i6] != null)
  10310.                     mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  10311.                 if (mapScenes[i6] != null)
  10312.                     mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  10313.             }
  10314.  
  10315.             drawLoadingText(83, "Unpacking textures");
  10316.             Texture.method368(streamLoader_3);
  10317.             Texture.method372(0.80000000000000004D);
  10318.             Texture.method367();
  10319.             drawLoadingText(86, "Unpacking config");
  10320.             Animation.unpackConfig(streamLoader);
  10321.             // Animation.unpackSkillCapes(streamLoader);
  10322.             ObjectDef.unpackConfig(streamLoader);
  10323.             Flo.unpackConfig(streamLoader);
  10324.             ItemDef.unpackConfig(streamLoader);
  10325.             EntityDef.unpackConfig(streamLoader);
  10326.             IDK.unpackConfig(streamLoader);
  10327.             SpotAnim.unpackConfig(streamLoader);
  10328.             Varp.unpackConfig(streamLoader);
  10329.             VarBit.unpackConfig(streamLoader);
  10330.             ItemDef.isMembers = isMembers;
  10331.             drawLoadingText(90, "Unpacking sounds");
  10332.             byte abyte0[] = streamLoader_5.getDataForName("sounds.dat");
  10333.             Stream stream = new Stream(abyte0);
  10334.             Sounds.unpack(stream);
  10335.             drawLoadingText(95, "Unpacking interfaces");
  10336.             TextDrawingArea aclass30_sub2_sub1_sub4s[] = { smallText,
  10337.                     aTextDrawingArea_1271, chatTextDrawingArea,
  10338.                     aTextDrawingArea_1273 };
  10339.             RSInterface.fonts = aclass30_sub2_sub1_sub4s;
  10340.             RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s,
  10341.                     streamLoader_2);
  10342.             drawLoadingText(100, "Preparing game engine");
  10343.             for (int j6 = 0; j6 < 33; j6++) {
  10344.                 int k6 = 999;
  10345.                 int i7 = 0;
  10346.                 for (int k7 = 0; k7 < 34; k7++) {
  10347.                     if (mapBack.aByteArray1450[k7 + j6 * mapBack.anInt1452] == 0) {
  10348.                         if (k6 == 999)
  10349.                             k6 = k7;
  10350.                         continue;
  10351.                     }
  10352.                     if (k6 == 999)
  10353.                         continue;
  10354.                     i7 = k7;
  10355.                     break;
  10356.                 }
  10357.  
  10358.                 anIntArray968[j6] = k6;
  10359.                 anIntArray1057[j6] = i7 - k6;
  10360.             }
  10361.  
  10362.             for (int l6 = 5; l6 < 156; l6++) {
  10363.                 int j7 = 999;
  10364.                 int l7 = 0;
  10365.                 for (int j8 = 25; j8 < 172; j8++) {
  10366.                     if (mapBack.aByteArray1450[j8 + l6 * mapBack.anInt1452] == 0
  10367.                             && (j8 > 34 || l6 > 34)) {
  10368.                         if (j7 == 999)
  10369.                             j7 = j8;
  10370.                         continue;
  10371.                     }
  10372.                     if (j7 == 999)
  10373.                         continue;
  10374.                     l7 = j8;
  10375.                     break;
  10376.                 }
  10377.  
  10378.                 anIntArray1052[l6 - 5] = j7 - 25;
  10379.                 anIntArray1229[l6 - 5] = l7 - j7;
  10380.             }
  10381.  
  10382.             Texture.method365(519, 165);
  10383.             anIntArray1180 = Texture.anIntArray1472;
  10384.             Texture.method365(246, 335);
  10385.             anIntArray1181 = Texture.anIntArray1472;
  10386.             Texture.method365(512, 334);
  10387.             anIntArray1182 = Texture.anIntArray1472;
  10388.             int ai[] = new int[9];
  10389.             for (int i8 = 0; i8 < 9; i8++) {
  10390.                 int k8 = 128 + i8 * 32 + 15;
  10391.                 int l8 = 600 + k8 * 3;
  10392.                 int i9 = Texture.anIntArray1470[k8];
  10393.                 ai[i8] = l8 * i9 >> 16;
  10394.             }
  10395.  
  10396.             WorldController.method310(500, 800, 512, 334, ai);
  10397.             Censor.loadConfig(streamLoader_4);
  10398.             mouseDetection = new MouseDetection(this);
  10399.             startRunnable(mouseDetection, 10);
  10400.             Animable_Sub5.clientInstance = this;
  10401.             ObjectDef.clientInstance = this;
  10402.             EntityDef.clientInstance = this;
  10403.             sendQuest("DarkWorldPk - the new era, always use the", 2451);
  10404.             sendQuest("DarkWorldPk - the new era", 3985);
  10405.             sendQuest("5: Staff impersonation", 5975);
  10406.             sendQuest("", 5985);
  10407.             sendQuest("", 6572);
  10408.             sendQuest("", 6664);
  10409.             sendQuest("", 18684);
  10410.             sendQuest("", 15098);
  10411.             sendQuest("", 249);
  10412.             sendQuest("", 18517);
  10413.             sendQuest("The Bank of DarkWorldPk - the new era", 5383);
  10414.             sendQuest("", 7332);
  10415.             sendQuest("", 7333);
  10416.             sendQuest("", 7334);
  10417.             sendQuest("", 7336);
  10418.             sendQuest("", 7383);
  10419.             sendQuest("", 7339);
  10420.             sendQuest("", 7338);
  10421.             sendQuest("", 7340);
  10422.             sendQuest("", 7346);
  10423.             sendQuest("", 7341);
  10424.             sendQuest("", 7342);
  10425.             sendQuest("", 7337);
  10426.             sendQuest("", 7343);
  10427.             sendQuest("", 7335);
  10428.             sendQuest("", 7344);
  10429.             sendQuest("", 7345);
  10430.             sendQuest("", 7347);
  10431.             sendQuest("", 7348);
  10432.             sendQuest("", 12772);
  10433.             sendQuest("", 673);
  10434.             sendQuest("", 7352);
  10435.             sendQuest("", 17510);
  10436.             sendQuest("", 7353);
  10437.             sendQuest("", 12129);
  10438.             sendQuest("", 8438);
  10439.             sendQuest("", 12852);
  10440.             sendQuest("", 15841);
  10441.             sendQuest("", 7354);
  10442.             sendQuest("", 7355);
  10443.             sendQuest("", 7356);
  10444.             sendQuest("", 8679);
  10445.             sendQuest("", 7459);
  10446.             sendQuest("", 16149);
  10447.             sendQuest("", 6987);
  10448.             sendQuest("", 7357);
  10449.             sendQuest("", 12836);
  10450.             sendQuest("", 7358);
  10451.             sendQuest("", 7359);
  10452.             sendQuest("", 14169);
  10453.             sendQuest("", 10115);
  10454.             sendQuest("", 14604);
  10455.             sendQuest("", 7360);
  10456.             sendQuest("", 12282);
  10457.             sendQuest("", 13577);
  10458.             sendQuest("", 12839);
  10459.             sendQuest("", 7361);
  10460.             sendQuest("", 16128);
  10461.             sendQuest("", 11857);
  10462.             sendQuest("", 7362);
  10463.             sendQuest("", 7363);
  10464.             sendQuest("", 7364);
  10465.             sendQuest("", 10135);
  10466.             sendQuest("", 4508);
  10467.             sendQuest("", 11907);
  10468.             sendQuest("", 7365);
  10469.             sendQuest("", 7366);
  10470.             sendQuest("", 7367);
  10471.             sendQuest("", 13389);
  10472.             sendQuest("", 15487);
  10473.             sendQuest("", 7368);
  10474.             sendQuest("", 11132);
  10475.             sendQuest("", 7369);
  10476.             sendQuest("", 12389);
  10477.             sendQuest("", 13974);
  10478.             sendQuest("", 6027);
  10479.             sendQuest("", 7370);
  10480.             sendQuest("", 8137);
  10481.             sendQuest("", 7371);
  10482.             sendQuest("", 12345);
  10483.             sendQuest("", 7372);
  10484.             sendQuest("", 8115);
  10485.             sendQuest("", 15499);
  10486.             sendQuest("", 18306);
  10487.             sendQuest("", 668);
  10488.             sendQuest("", 8576);
  10489.             sendQuest("", 12139);
  10490.             sendQuest("", 14912);
  10491.             sendQuest("", 7373);
  10492.             sendQuest("", 7374);
  10493.             sendQuest("", 8969);
  10494.             sendQuest("", 7375);
  10495.             sendQuest("", 7376);
  10496.             sendQuest("", 1740);
  10497.             sendQuest("", 3278);
  10498.             sendQuest("", 7378);
  10499.             sendQuest("", 6518);
  10500.             sendQuest("", 7379);
  10501.             sendQuest("", 15352);
  10502.             sendQuest("", 15592);
  10503.             sendQuest("", 15235);
  10504.             sendQuest("", 191);
  10505.             sendQuest("", 6024);
  10506.             sendQuest("", 7380);
  10507.             sendQuest("", 7381);
  10508.             sendQuest("", 11858);
  10509.             sendQuest("", 9927);
  10510.             sendQuest("", 7349);
  10511.             sendQuest("", 7350);
  10512.             sendQuest("", 7351);
  10513.             sendQuest("", 13356);
  10514.             sendQuest("", 355);
  10515.             sendQuest("", 427);
  10516.             sendQuest("", 778);
  10517.             sendQuest("", 1700);
  10518.             sendQuest("", 1751);
  10519.             sendQuest("", 1766);
  10520.             sendQuest("", 2278);
  10521.             sendQuest("", 2425);
  10522.             sendQuest("", 3798);
  10523.             sendQuest("", 4448);
  10524.             sendQuest("", 4681);
  10525.             sendQuest("", 4707);
  10526.             sendQuest("", 5572);
  10527.             sendQuest("", 5856);
  10528.             sendQuest("", 6131);
  10529.             sendQuest("", 7764);
  10530.             sendQuest("", 8462);
  10531.             sendQuest("", 12292);
  10532.             sendQuest("", 13976);
  10533.             /*
  10534.              * try { new Animate(); } catch(java.io.IOException io) {
  10535.              * io.printStackTrace(); } try { new Gfx(); }
  10536.              * catch(java.io.IOException io) { io.printStackTrace(); }
  10537.              */
  10538.             return;
  10539.  
  10540.         } catch (Exception exception) {
  10541.             signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  10542.             // ErrorLogger.writeLog(exception.s
  10543.             exception.printStackTrace();
  10544.         }
  10545.         loadingError = true;
  10546.     }
  10547.  
  10548.     private void method91(Stream stream, int i) {
  10549.     try {  
  10550.     while (stream.bitPosition + 10 < i * 8) {
  10551.             int j = stream.readBits(11);
  10552.             if (j == 2047)
  10553.                 break;
  10554.             if (playerArray[j] == null) {
  10555.                 playerArray[j] = new Player();
  10556.                 if (aStreamArray895s[j] != null)
  10557.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  10558.             }
  10559.             playerIndices[playerCount++] = j;
  10560.             Player player = playerArray[j];
  10561.             player.anInt1537 = loopCycle;
  10562.             int k = stream.readBits(1);
  10563.             if (k == 1)
  10564.                 anIntArray894[anInt893++] = j;
  10565.             int l = stream.readBits(1);
  10566.             int i1 = stream.readBits(5);
  10567.             if (i1 > 15)
  10568.                 i1 -= 32;
  10569.             int j1 = stream.readBits(5);
  10570.             if (j1 > 15)
  10571.                 j1 -= 32;
  10572.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1,
  10573.                     l == 1);
  10574.         }
  10575.         stream.finishBitAccess();
  10576.         } catch (Exception e) {//jags
  10577.         }
  10578.     }
  10579.  
  10580.     private void processMainScreenClick() {
  10581.         if (anInt1021 != 0)
  10582.             return;
  10583.         if (super.clickMode3 == 1) {
  10584.             int i = super.saveClickX - 10 - 550;
  10585.             int j = super.saveClickY - 5 - 4;
  10586.             if (i >= 0 && j >= 0 && i < 146 && j < 151) {
  10587.                 i -= 73;
  10588.                 j -= 75;
  10589.                 int k = minimapInt1 + minimapInt2 & 0x7ff;
  10590.                 int i1 = Texture.anIntArray1470[k];
  10591.                 int j1 = Texture.anIntArray1471[k];
  10592.                 i1 = i1 * (minimapInt3 + 256) >> 8;
  10593.                 j1 = j1 * (minimapInt3 + 256) >> 8;
  10594.                 int k1 = j * i1 + i * j1 >> 11;
  10595.                 int l1 = j * j1 - i * i1 >> 11;
  10596.                 int i2 = myPlayer.x + k1 >> 7;
  10597.                 int j2 = myPlayer.y - l1 >> 7;
  10598.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0,
  10599.                         j2, myPlayer.smallX[0], true, i2);
  10600.                 if (flag1) {
  10601.                     stream.writeWordBigEndian(i);
  10602.                     stream.writeWordBigEndian(j);
  10603.                     stream.writeWord(minimapInt1);
  10604.                     stream.writeWordBigEndian(57);
  10605.                     stream.writeWordBigEndian(minimapInt2);
  10606.                     stream.writeWordBigEndian(minimapInt3);
  10607.                     stream.writeWordBigEndian(89);
  10608.                     stream.writeWord(myPlayer.x);
  10609.                     stream.writeWord(myPlayer.y);
  10610.                     stream.writeWordBigEndian(anInt1264);
  10611.                     stream.writeWordBigEndian(63);
  10612.                 }
  10613.             }
  10614.             anInt1117++;
  10615.             if (anInt1117 > 1151) {
  10616.                 anInt1117 = 0;
  10617.                 stream.createFrame(246);
  10618.                 stream.writeWordBigEndian(0);
  10619.                 int l = stream.currentOffset;
  10620.                 if ((int) (Math.random() * 2D) == 0)
  10621.                     stream.writeWordBigEndian(101);
  10622.                 stream.writeWordBigEndian(197);
  10623.                 stream.writeWord((int) (Math.random() * 65536D));
  10624.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  10625.                 stream.writeWordBigEndian(67);
  10626.                 stream.writeWord(14214);
  10627.                 if ((int) (Math.random() * 2D) == 0)
  10628.                     stream.writeWord(29487);
  10629.                 stream.writeWord((int) (Math.random() * 65536D));
  10630.                 if ((int) (Math.random() * 2D) == 0)
  10631.                     stream.writeWordBigEndian(220);
  10632.                 stream.writeWordBigEndian(180);
  10633.                 stream.writeBytes(stream.currentOffset - l);
  10634.             }
  10635.         }
  10636.     }
  10637.  
  10638.     private String interfaceIntToString(int j) {
  10639.         if (j < 0x3b9ac9ff)
  10640.             return String.valueOf(j);
  10641.         else
  10642.             return "*";
  10643.     }
  10644.  
  10645.     private void showErrorScreen() {
  10646.         Graphics g = getGameComponent().getGraphics();
  10647.         g.setColor(Color.black);
  10648.         g.fillRect(0, 0, 765, 503);
  10649.         method4(1);
  10650.         if (loadingError) {
  10651.             aBoolean831 = false;
  10652.             g.setFont(new Font("Helvetica", 1, 16));
  10653.             g.setColor(Color.yellow);
  10654.             int k = 35;
  10655.             g.drawString(
  10656.                     "Sorry, an error has occured whilst loading DarkWorldPk - the new era",
  10657.                     30, k);
  10658.             k += 50;
  10659.             g.setColor(Color.white);
  10660.             g.drawString("To fix this try the following (in order):", 30, k);
  10661.             k += 50;
  10662.             g.setColor(Color.white);
  10663.             g.setFont(new Font("Helvetica", 1, 12));
  10664.             g
  10665.                     .drawString(
  10666.                             "1: Try closing ALL open web-browser windows, and reloading",
  10667.                             30, k);
  10668.             k += 30;
  10669.             g
  10670.                     .drawString(
  10671.                             "2: Try clearing your web-browsers cache from tools->internet options",
  10672.                             30, k);
  10673.             k += 30;
  10674.             g.drawString("3: Try updating your java", 30, k);
  10675.             k += 30;
  10676.             g.drawString("4: Try rebooting your computer", 30, k);
  10677.             k += 30;
  10678.             g.drawString("5: USB Wireless internet cards 99% do not work!", 30,
  10679.                     k);
  10680.         }
  10681.         if (genericLoadingError) {
  10682.             aBoolean831 = false;
  10683.             g.setFont(new Font("Helvetica", 1, 20));
  10684.             g.setColor(Color.white);
  10685.             g.drawString("Error - unable to load game!", 50, 50);
  10686.             g.drawString("To play DarkWorldPk - the new era make sure you play from", 50,
  10687.                     100);
  10688.             g.drawString("http://www.Vanityrsps.com", 50, 150);
  10689.         }
  10690.         if (rsAlreadyLoaded) {
  10691.             aBoolean831 = false;
  10692.             g.setColor(Color.yellow);
  10693.             int l = 35;
  10694.             g
  10695.                     .drawString(
  10696.                             "Error a copy of DarkWorldPk already appears to be loaded",
  10697.                             30, l);
  10698.             l += 50;
  10699.             g.setColor(Color.white);
  10700.             g.drawString("To fix this try the following (in order):", 30, l);
  10701.             l += 50;
  10702.             g.setColor(Color.white);
  10703.             g.setFont(new Font("Helvetica", 1, 12));
  10704.             g
  10705.                     .drawString(
  10706.                             "1: Try closing ALL open web-browser windows, and reloading",
  10707.                             30, l);
  10708.             l += 30;
  10709.             g
  10710.                     .drawString(
  10711.                             "2: Try rebooting your computer, and reloading",
  10712.                             30, l);
  10713.             l += 30;
  10714.         }
  10715.     }
  10716.  
  10717.     public URL getCodeBase() {
  10718.         try {
  10719.             return new URL(server + ":" + (80 + portOff));
  10720.         } catch (Exception _ex) {
  10721.         }
  10722.         return null;
  10723.     }
  10724.  
  10725.     private void method95() {
  10726.         for (int j = 0; j < npcCount; j++) {
  10727.             int k = npcIndices[j];
  10728.             NPC npc = npcArray[k];
  10729.             if (npc != null)
  10730.                 method96(npc);
  10731.         }
  10732.     }
  10733.  
  10734.     private void method96(Entity entity) {
  10735.         if (entity.x < 128 || entity.y < 128 || entity.x >= 13184
  10736.                 || entity.y >= 13184) {
  10737.             entity.anim = -1;
  10738.             entity.anInt1520 = -1;
  10739.             entity.anInt1547 = 0;
  10740.             entity.anInt1548 = 0;
  10741.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  10742.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  10743.             entity.method446();
  10744.         }
  10745.         if (entity == myPlayer
  10746.                 && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  10747.             entity.anim = -1;
  10748.             entity.anInt1520 = -1;
  10749.             entity.anInt1547 = 0;
  10750.             entity.anInt1548 = 0;
  10751.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  10752.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  10753.             entity.method446();
  10754.         }
  10755.         if (entity.anInt1547 > loopCycle)
  10756.             method97(entity);
  10757.         else if (entity.anInt1548 >= loopCycle)
  10758.             method98(entity);
  10759.         else
  10760.             method99(entity);
  10761.         method100(entity);
  10762.         method101(entity);
  10763.     }
  10764.  
  10765.     private void method97(Entity entity) {
  10766.         int i = entity.anInt1547 - loopCycle;
  10767.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  10768.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  10769.         entity.x += (j - entity.x) / i;
  10770.         entity.y += (k - entity.y) / i;
  10771.         entity.anInt1503 = 0;
  10772.         if (entity.anInt1549 == 0)
  10773.             entity.turnDirection = 1024;
  10774.         if (entity.anInt1549 == 1)
  10775.             entity.turnDirection = 1536;
  10776.         if (entity.anInt1549 == 2)
  10777.             entity.turnDirection = 0;
  10778.         if (entity.anInt1549 == 3)
  10779.             entity.turnDirection = 512;
  10780.     }
  10781.  
  10782.     private void method98(Entity entity) {
  10783.     try { if (entity.anInt1548 == loopCycle
  10784.                 || entity.anim == -1
  10785.                 || entity.anInt1529 != 0
  10786.                 || ((Animation.anims.length > entity.anim)  && (entity.anInt1528 + 1 > Animation.anims[entity.anim]
  10787.                         .method258(entity.anInt1527)))) {
  10788.             int i = entity.anInt1548 - entity.anInt1547;
  10789.             int j = loopCycle - entity.anInt1547;
  10790.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  10791.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  10792.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  10793.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  10794.             if (i == 0) { return; }
  10795.             entity.x = (k * (i - j) + i1 * j) / i;
  10796.             entity.y = (l * (i - j) + j1 * j) / i;
  10797.         }
  10798.         entity.anInt1503 = 0;
  10799.         if (entity.anInt1549 == 0)
  10800.             entity.turnDirection = 1024;
  10801.         if (entity.anInt1549 == 1)
  10802.             entity.turnDirection = 1536;
  10803.         if (entity.anInt1549 == 2)
  10804.             entity.turnDirection = 0;
  10805.         if (entity.anInt1549 == 3)
  10806.             entity.turnDirection = 512;
  10807.         entity.anInt1552 = entity.turnDirection;
  10808.         } catch (Exception e) {}
  10809.     }
  10810.  
  10811.     private void method99(Entity entity) {
  10812.         try {entity.anInt1517 = entity.anInt1511;
  10813.         if (entity.smallXYIndex == 0) {
  10814.             entity.anInt1503 = 0;
  10815.             return;
  10816.         }
  10817.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  10818.             Animation animation = Animation.anims[entity.anim];
  10819.             if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  10820.                 entity.anInt1503++;
  10821.                 return;
  10822.             }
  10823.             if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
  10824.                 entity.anInt1503++;
  10825.                 return;
  10826.             }
  10827.         }
  10828.         int i = entity.x;
  10829.         int j = entity.y;
  10830.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  10831.                 * 64;
  10832.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  10833.                 * 64;
  10834.         if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  10835.             entity.x = k;
  10836.             entity.y = l;
  10837.             return;
  10838.         }
  10839.         if (i < k) {
  10840.             if (j < l)
  10841.                 entity.turnDirection = 1280;
  10842.             else if (j > l)
  10843.                 entity.turnDirection = 1792;
  10844.             else
  10845.                 entity.turnDirection = 1536;
  10846.         } else if (i > k) {
  10847.             if (j < l)
  10848.                 entity.turnDirection = 768;
  10849.             else if (j > l)
  10850.                 entity.turnDirection = 256;
  10851.             else
  10852.                 entity.turnDirection = 512;
  10853.         } else if (j < l)
  10854.             entity.turnDirection = 1024;
  10855.         else
  10856.             entity.turnDirection = 0;
  10857.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  10858.         if (i1 > 1024)
  10859.             i1 -= 2048;
  10860.         int j1 = entity.anInt1555;
  10861.         if (i1 >= -256 && i1 <= 256)
  10862.             j1 = entity.anInt1554;
  10863.         else if (i1 >= 256 && i1 < 768)
  10864.             j1 = entity.anInt1557;
  10865.         else if (i1 >= -768 && i1 <= -256)
  10866.             j1 = entity.anInt1556;
  10867.         if (j1 == -1)
  10868.             j1 = entity.anInt1554;
  10869.         entity.anInt1517 = j1;
  10870.         int k1 = 4;
  10871.         if (entity.anInt1552 != entity.turnDirection
  10872.                 && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  10873.             k1 = 2;
  10874.         if (entity.smallXYIndex > 2)
  10875.             k1 = 6;
  10876.         if (entity.smallXYIndex > 3)
  10877.             k1 = 8;
  10878.         if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  10879.             k1 = 8;
  10880.             entity.anInt1503--;
  10881.         }
  10882.         if (entity.aBooleanArray1553[entity.smallXYIndex - 1])
  10883.             k1 <<= 1;
  10884.         if (k1 >= 8 && entity.anInt1517 == entity.anInt1554
  10885.                 && entity.anInt1505 != -1)
  10886.             entity.anInt1517 = entity.anInt1505;
  10887.         if (i < k) {
  10888.             entity.x += k1;
  10889.             if (entity.x > k)
  10890.                 entity.x = k;
  10891.         } else if (i > k) {
  10892.             entity.x -= k1;
  10893.             if (entity.x < k)
  10894.                 entity.x = k;
  10895.         }
  10896.         if (j < l) {
  10897.             entity.y += k1;
  10898.             if (entity.y > l)
  10899.                 entity.y = l;
  10900.         } else if (j > l) {
  10901.             entity.y -= k1;
  10902.             if (entity.y < l)
  10903.                 entity.y = l;
  10904.         }
  10905.         if (entity.x == k && entity.y == l) {
  10906.             entity.smallXYIndex--;
  10907.             if (entity.anInt1542 > 0)
  10908.                 entity.anInt1542--;
  10909.         }
  10910.     } catch (Exception e) {}
  10911.     }
  10912.  
  10913.     private void method100(Entity entity) {
  10914.     try{
  10915.         if (entity.anInt1504 == 0)
  10916.             return;
  10917.         if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  10918.             NPC npc = npcArray[entity.interactingEntity];
  10919.             if (npc != null) {
  10920.                 int i1 = entity.x - npc.x;
  10921.                 int k1 = entity.y - npc.y;
  10922.                 if (i1 != 0 || k1 != 0)
  10923.                     entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  10924.             }
  10925.         }
  10926.         if (entity.interactingEntity >= 32768) {
  10927.             int j = entity.interactingEntity - 32768;
  10928.             if (j == unknownInt10)
  10929.                 j = myPlayerIndex;
  10930.                 if(j > playerArray.length)
  10931.                     j=0;
  10932.             Player player = playerArray[j];
  10933.             if (player != null) {
  10934.                 int l1 = entity.x - player.x;
  10935.                 int i2 = entity.y - player.y;
  10936.                 if (l1 != 0 || i2 != 0)
  10937.                     entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  10938.             }
  10939.         }
  10940.         if ((entity.anInt1538 != 0 || entity.anInt1539 != 0)
  10941.                 && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  10942.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  10943.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  10944.             if (k != 0 || j1 != 0)
  10945.                 entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  10946.             entity.anInt1538 = 0;
  10947.             entity.anInt1539 = 0;
  10948.         }
  10949.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  10950.         if (l != 0) {
  10951.             if (l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  10952.                 entity.anInt1552 = entity.turnDirection;
  10953.             else if (l > 1024)
  10954.                 entity.anInt1552 -= entity.anInt1504;
  10955.             else
  10956.                 entity.anInt1552 += entity.anInt1504;
  10957.             entity.anInt1552 &= 0x7ff;
  10958.             if (entity.anInt1517 == entity.anInt1511
  10959.                     && entity.anInt1552 != entity.turnDirection) {
  10960.                 if (entity.anInt1512 != -1) {
  10961.                     entity.anInt1517 = entity.anInt1512;
  10962.                     return;
  10963.                 }
  10964.                 entity.anInt1517 = entity.anInt1554;
  10965.             }
  10966.         }
  10967.         } catch(Exception e){
  10968.         e.printStackTrace();
  10969.         }
  10970.     }
  10971.  
  10972.     // String value = new String(Model.byteArray323);
  10973.     private void method101(Entity entity) {
  10974.         if (entity == null) {
  10975.             System.out.println("uh oh");
  10976.             return;
  10977.         }
  10978.         entity.aBoolean1541 = false;
  10979.         if (entity.anInt1517 != -1) {
  10980.             try {
  10981.                 Animation animation = Animation.anims[(entity.anInt1517 >= 17000 ? 808 : entity.anInt1517)];
  10982.                 entity.anInt1519++;
  10983.                 if (entity.anInt1518 < animation.anInt352
  10984.                         && entity.anInt1519 > animation
  10985.                                 .method258(entity.anInt1518)) {
  10986.                     entity.anInt1519 = 1;// this is the frame delay. 0 is what
  10987.                                             // it's normally at. higher number =
  10988.                                             // faster animations.
  10989.                     entity.anInt1518++;
  10990.                 }
  10991.                 if (entity.anInt1518 >= animation.anInt352) {
  10992.                     entity.anInt1519 = 1;
  10993.                     entity.anInt1518 = 0;
  10994.                 }
  10995.             } catch (Exception e) {
  10996.                 e.printStackTrace();
  10997.                 entity.anInt1517 = -1;
  10998.                 // openinterface(1,3559);
  10999.             }
  11000.         }
  11001.         /*
  11002.          * if(entity.anInt1517 != -1){ try {
  11003.          *
  11004.          * if(entity.anInt1517 < Animation.anims.length){ Animation animation =
  11005.          * Animation.anims[entity.anInt1517]; entity.anInt1519++;
  11006.          * if(entity.anInt1518 < animation.anInt352 && entity.anInt1519 >
  11007.          * animation.method258(entity.anInt1518)){ entity.anInt1519 = 0;
  11008.          * entity.anInt1518++; } if(entity.anInt1518 >= animation.anInt352){
  11009.          * entity.anInt1519 = 0; entity.anInt1518 = 0; } } else {
  11010.          * entity.anInt1517 = 0; } } catch (Exception e) { e.printStackTrace();
  11011.          * entity.anInt1517 = -1; //openinterface(1,3559); } }
  11012.          */
  11013.  
  11014.         if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
  11015.             if (entity.anInt1521 < 0)
  11016.                 entity.anInt1521 = 0;
  11017.             if (entity.anInt1520 > MAXGFXID)// gfx anti-freeze
  11018.                 entity.anInt1520 = 0;
  11019.             Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  11020.             if (animation_1 == null) {
  11021.                 System.out.println("uh oh");
  11022.                 return;
  11023.             }
  11024.             for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352
  11025.                     && entity.anInt1522 > animation_1
  11026.                             .method258(entity.anInt1521); entity.anInt1521++)
  11027.                 entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  11028.  
  11029.             if (entity.anInt1521 >= animation_1.anInt352
  11030.                     && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  11031.                 entity.anInt1520 = -1;
  11032.         }
  11033.         if (entity.anim != -1 && entity.anInt1529 <= 1) {
  11034.             if (entity.anim > MAXANIMID)// anim anti-freeze
  11035.                 entity.anim = 0x328;
  11036.             Animation animation_2 = Animation.anims[entity.anim];
  11037.             if (animation_2.anInt363 == 1 && entity.anInt1542 > 0
  11038.                     && entity.anInt1547 <= loopCycle
  11039.                     && entity.anInt1548 < loopCycle) {
  11040.                 entity.anInt1529 = 1;
  11041.                 return;
  11042.             }
  11043.         }
  11044.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  11045.             Animation animation_3 = Animation.anims[entity.anim];
  11046.             for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352
  11047.                     && entity.anInt1528 > animation_3
  11048.                             .method258(entity.anInt1527); entity.anInt1527++)
  11049.                 entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  11050.  
  11051.             if (entity.anInt1527 >= animation_3.anInt352) {
  11052.                 entity.anInt1527 -= animation_3.anInt356;
  11053.                 entity.anInt1530++;
  11054.                 if (entity.anInt1530 >= animation_3.anInt362)
  11055.                     entity.anim = -1;
  11056.                 if (entity.anInt1527 < 0
  11057.                         || entity.anInt1527 >= animation_3.anInt352)
  11058.                     entity.anim = -1;
  11059.             }
  11060.             entity.aBoolean1541 = animation_3.aBoolean358;
  11061.         }
  11062.         if (entity.anInt1529 > 0)
  11063.             entity.anInt1529--;
  11064.     }
  11065.  
  11066.     private void drawGameScreen() {
  11067.         if (fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  11068.             if (loadingStage == 2) {
  11069.                 method119(anInt945, fullscreenInterfaceID);
  11070.                 if (openInterfaceID != -1) {
  11071.                     method119(anInt945, openInterfaceID);
  11072.                 }
  11073.                 anInt945 = 0;
  11074.                 resetAllImageProducers();
  11075.                 super.fullGameScreen.initDrawingArea();
  11076.                 Texture.anIntArray1472 = fullScreenTextureArray;
  11077.                 DrawingArea.setAllPixelsToZero();
  11078.                 welcomeScreenRaised = true;
  11079.                 if (openInterfaceID != -1) {
  11080.                     RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  11081.                     if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  11082.                         rsInterface_1.width = 765;
  11083.                         rsInterface_1.height = 503;
  11084.                     }
  11085.                     drawInterface(0, 0, rsInterface_1, 8);
  11086.                 }
  11087.                 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  11088.                 if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  11089.                     rsInterface.width = 765;
  11090.                     rsInterface.height = 503;
  11091.                 }
  11092.                 drawInterface(0, 0, rsInterface, 8);
  11093.  
  11094.                 if (!menuOpen) {
  11095.                     processRightClick();
  11096.                     drawTooltip();
  11097.                 } else {
  11098.                     drawMenu();
  11099.                 }
  11100.             }
  11101.             drawCount++;
  11102.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  11103.             return;
  11104.         } else {
  11105.             if (drawCount != 0) {
  11106.                 resetImageProducers2();
  11107.             }
  11108.         }
  11109.         if (welcomeScreenRaised) {
  11110.             welcomeScreenRaised = false;
  11111.             frame[0].drawGraphics(0, super.graphics, 0);
  11112.             frame[1].drawGraphics(0, super.graphics, 4);
  11113.             frame[2].drawGraphics(0, super.graphics, 515);
  11114.             needDrawTabArea = true;
  11115.             inputTaken = true;
  11116.             tabAreaAltered = true;
  11117.             aBoolean1233 = true;
  11118.             if (loadingStage != 2) {
  11119.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  11120.                 aRSImageProducer_1164.drawGraphics(0, super.graphics, 519);
  11121.             }
  11122.         }
  11123.         if (loadingStage == 2)
  11124.             method146();
  11125.         if (menuOpen && menuScreenArea == 1)
  11126.             needDrawTabArea = true;
  11127.         if (invOverlayInterfaceID != -1) {
  11128.             boolean flag1 = method119(anInt945, invOverlayInterfaceID);
  11129.             if (flag1)
  11130.                 needDrawTabArea = true;
  11131.         }
  11132.         if (atInventoryInterfaceType == 2)
  11133.             needDrawTabArea = true;
  11134.         if (activeInterfaceType == 2)
  11135.             needDrawTabArea = true;
  11136.         if (needDrawTabArea) {
  11137.             drawTabArea();
  11138.             needDrawTabArea = false;
  11139.         }
  11140.         if (backDialogID == -1) {
  11141.             aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110;
  11142.             if (super.mouseX > 478 && super.mouseX < 580 && super.mouseY > 342)
  11143.                 method65(494, 110, super.mouseX - 0, super.mouseY - 348,
  11144.                         aClass9_1059, 0, false, anInt1211);
  11145.             int i = anInt1211 - 110 - aClass9_1059.scrollPosition;
  11146.             if (i < 0)
  11147.                 i = 0;
  11148.             if (i > anInt1211 - 110)
  11149.                 i = anInt1211 - 110;
  11150.             if (anInt1089 != i) {
  11151.                 anInt1089 = i;
  11152.                 inputTaken = true;
  11153.             }
  11154.         }
  11155.         if (backDialogID != -1) {
  11156.             boolean flag2 = method119(anInt945, backDialogID);
  11157.             if (flag2)
  11158.                 inputTaken = true;
  11159.         }
  11160.         if (atInventoryInterfaceType == 3)
  11161.             inputTaken = true;
  11162.         if (activeInterfaceType == 3)
  11163.             inputTaken = true;
  11164.         if (aString844 != null)
  11165.             inputTaken = true;
  11166.         if (menuOpen && menuScreenArea == 2)
  11167.             inputTaken = true;
  11168.         if (inputTaken) {
  11169.             drawChatArea();
  11170.             inputTaken = false;
  11171.         }
  11172.         if (loadingStage == 2) {
  11173.             drawMinimap();
  11174.             aRSImageProducer_1164.drawGraphics(0, super.graphics, 519);
  11175.         }
  11176.  
  11177.         if (anInt1054 != -1)
  11178.             tabAreaAltered = true;
  11179.         if (tabAreaAltered) {
  11180.             if (anInt1054 != -1 && anInt1054 == tabID) {
  11181.                 anInt1054 = -1;
  11182.                 stream.createFrame(120);
  11183.                 stream.writeWordBigEndian(tabID);
  11184.             }
  11185.             tabAreaAltered = false;
  11186.             aRSImageProducer_1125.initDrawingArea();
  11187.             aRSImageProducer_1165.initDrawingArea();
  11188.         }
  11189.         anInt945 = 0;
  11190.     }
  11191.  
  11192.     private boolean buildFriendsListMenu(RSInterface class9) {
  11193.         int i = class9.contentType;
  11194.         if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  11195.             if (i >= 801)
  11196.                 i -= 701;
  11197.             else if (i >= 701)
  11198.                 i -= 601;
  11199.             else if (i >= 101)
  11200.                 i -= 101;
  11201.             else
  11202.                 i--;
  11203.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  11204.             menuActionID[menuActionRow] = 792;
  11205.             menuActionRow++;
  11206.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  11207.             menuActionID[menuActionRow] = 639;
  11208.             menuActionRow++;
  11209.             return true;
  11210.         }
  11211.         if (i >= 401 && i <= 500) {
  11212.             menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  11213.             menuActionID[menuActionRow] = 322;
  11214.             menuActionRow++;
  11215.             return true;
  11216.         } else {
  11217.             return false;
  11218.         }
  11219.     }
  11220.  
  11221.     private void method104() {
  11222.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  11223.                 .reverseGetFirst();
  11224.         for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  11225.                 .reverseGetNext())
  11226.             if (class30_sub2_sub4_sub3.anInt1560 != plane
  11227.                     || class30_sub2_sub4_sub3.aBoolean1567)
  11228.                 class30_sub2_sub4_sub3.unlink();
  11229.             else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  11230.                 class30_sub2_sub4_sub3.method454(anInt945);
  11231.                 if (class30_sub2_sub4_sub3.aBoolean1567)
  11232.                     class30_sub2_sub4_sub3.unlink();
  11233.                 else
  11234.                     worldController.method285(class30_sub2_sub4_sub3.anInt1560,
  11235.                             0, class30_sub2_sub4_sub3.anInt1563, -1,
  11236.                             class30_sub2_sub4_sub3.anInt1562, 60,
  11237.                             class30_sub2_sub4_sub3.anInt1561,
  11238.                             class30_sub2_sub4_sub3, false);
  11239.             }
  11240.  
  11241.     }
  11242.  
  11243.     private void drawInterface(int j, int k, RSInterface class9, int l) {
  11244.         if (class9.type != 0 || class9.children == null)
  11245.             return;
  11246.         if (class9.isMouseoverTriggered && anInt1026 != class9.id
  11247.                 && anInt1048 != class9.id && anInt1039 != class9.id)
  11248.             return;
  11249.         int i1 = DrawingArea.topX;
  11250.         int j1 = DrawingArea.topY;
  11251.         int k1 = DrawingArea.bottomX;
  11252.         int l1 = DrawingArea.bottomY;
  11253.         DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
  11254.         int i2 = class9.children.length;
  11255.         for (int j2 = 0; j2 < i2; j2++) {
  11256.             int k2 = class9.childX[j2] + k;
  11257.             int l2 = (class9.childY[j2] + l) - j;
  11258.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j2]];
  11259.             k2 += class9_1.anInt263;
  11260.             l2 += class9_1.anInt265;
  11261.             if (class9_1.contentType > 0)
  11262.                 drawFriendsListOrWelcomeScreen(class9_1);
  11263.             int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258,
  11264.                     1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315, 1324, 1333,
  11265.                     1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404, 1583,
  11266.                     12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469,
  11267.                     15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503,
  11268.                     1512, 1521, 1530, 1544, 1553, 1563, 1593, 1635, 12426,
  11269.                     12436, 12446, 12456, 6004, 18471,
  11270.                     /* Ancients */
  11271.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012,
  11272.                     13054, 12920, 12882, 13062, 12952, 13000, 13070, 12912,
  11273.                     12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096,
  11274.             /* Lunar */
  11275.  
  11276.             };
  11277.             /*
  11278.              * for(int m5 = 0; m5 < IDs.length; m5++) { if(class9_1.id ==
  11279.              * IDs[m5] + 1) { if(m5 > 61) drawBlackBox(k2 + 1, l2); else
  11280.              * drawBlackBox(k2, l2 + 1); } }
  11281.              */
  11282.             for (int m5 = 0; m5 < IDs.length; m5++) {
  11283.                 if (class9_1.id == IDs[m5] + 1) {
  11284.                     drawBlackBox(k2, l2 + 1);
  11285.                 }
  11286.             }
  11287.             if (class9_1.type == 0) {
  11288.                 if (class9_1.scrollPosition > class9_1.scrollMax
  11289.                         - class9_1.height)
  11290.                     class9_1.scrollPosition = class9_1.scrollMax
  11291.                             - class9_1.height;
  11292.                 if (class9_1.scrollPosition < 0)
  11293.                     class9_1.scrollPosition = 0;
  11294.                 drawInterface(class9_1.scrollPosition, k2, class9_1, l2);
  11295.                 if (class9_1.scrollMax > class9_1.height)
  11296.                     drawScrollbar(class9_1.height, class9_1.scrollPosition, l2,
  11297.                             k2 + class9_1.width, class9_1.scrollMax);
  11298.             } else if (class9_1.type != 1)
  11299.                 if (class9_1.type == 2) {
  11300.                     int i3 = 0;
  11301.                     for (int l3 = 0; l3 < class9_1.height; l3++) {
  11302.                         for (int l4 = 0; l4 < class9_1.width; l4++) {
  11303.                             int k5 = k2 + l4 * (32 + class9_1.invSpritePadX);
  11304.                             int j6 = l2 + l3 * (32 + class9_1.invSpritePadY);
  11305.                             if (i3 < 20) {
  11306.                                 k5 += class9_1.spritesX[i3];
  11307.                                 j6 += class9_1.spritesY[i3];
  11308.                             }
  11309.                             if (class9_1.inv[i3] > 0) {
  11310.                                 int k6 = 0;
  11311.                                 int j7 = 0;
  11312.                                 int j9 = class9_1.inv[i3] - 1;
  11313.                                 if (k5 > DrawingArea.topX - 32
  11314.                                         && k5 < DrawingArea.bottomX
  11315.                                         && j6 > DrawingArea.topY - 32
  11316.                                         && j6 < DrawingArea.bottomY
  11317.                                         || activeInterfaceType != 0
  11318.                                         && anInt1085 == i3) {
  11319.                                     int l9 = 0;
  11320.                                     if (itemSelected == 1 && anInt1283 == i3
  11321.                                             && anInt1284 == class9_1.id)
  11322.                                         l9 = 0xffffff;
  11323.                                     Sprite class30_sub2_sub1_sub1_2 = ItemDef
  11324.                                             .getSprite(j9,
  11325.                                                     class9_1.invStackSizes[i3],
  11326.                                                     l9);
  11327.                                     if (class30_sub2_sub1_sub1_2 != null) {
  11328.                                         if (activeInterfaceType != 0
  11329.                                                 && anInt1085 == i3
  11330.                                                 && anInt1084 == class9_1.id) {
  11331.                                             k6 = super.mouseX - anInt1087;
  11332.                                             j7 = super.mouseY - anInt1088;
  11333.                                             if (k6 < 5 && k6 > -5)
  11334.                                                 k6 = 0;
  11335.                                             if (j7 < 5 && j7 > -5)
  11336.                                                 j7 = 0;
  11337.                                             if (anInt989 < 10) {
  11338.                                                 k6 = 0;
  11339.                                                 j7 = 0;
  11340.                                             }
  11341.                                             class30_sub2_sub1_sub1_2
  11342.                                                     .drawSprite1(k5 + k6, j6
  11343.                                                             + j7);
  11344.                                             if (j6 + j7 < DrawingArea.topY
  11345.                                                     && class9.scrollPosition > 0) {
  11346.                                                 int i10 = (anInt945 * (DrawingArea.topY
  11347.                                                         - j6 - j7)) / 3;
  11348.                                                 if (i10 > anInt945 * 10)
  11349.                                                     i10 = anInt945 * 10;
  11350.                                                 if (i10 > class9.scrollPosition)
  11351.                                                     i10 = class9.scrollPosition;
  11352.                                                 class9.scrollPosition -= i10;
  11353.                                                 anInt1088 += i10;
  11354.                                             }
  11355.                                             if (j6 + j7 + 32 > DrawingArea.bottomY
  11356.                                                     && class9.scrollPosition < class9.scrollMax
  11357.                                                             - class9.height) {
  11358.                                                 int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  11359.                                                 if (j10 > anInt945 * 10)
  11360.                                                     j10 = anInt945 * 10;
  11361.                                                 if (j10 > class9.scrollMax
  11362.                                                         - class9.height
  11363.                                                         - class9.scrollPosition)
  11364.                                                     j10 = class9.scrollMax
  11365.                                                             - class9.height
  11366.                                                             - class9.scrollPosition;
  11367.                                                 class9.scrollPosition += j10;
  11368.                                                 anInt1088 -= j10;
  11369.                                             }
  11370.                                         } else if (atInventoryInterfaceType != 0
  11371.                                                 && atInventoryIndex == i3
  11372.                                                 && atInventoryInterface == class9_1.id)
  11373.                                             class30_sub2_sub1_sub1_2
  11374.                                                     .drawSprite1(k5, j6);
  11375.                                         else
  11376.                                             class30_sub2_sub1_sub1_2
  11377.                                                     .drawSprite(k5, j6);
  11378.                                         if (class30_sub2_sub1_sub1_2.anInt1444 == 33
  11379.                                                 || class9_1.invStackSizes[i3] != 1) {
  11380.                                             int k10 = class9_1.invStackSizes[i3];
  11381.                                             // smallText.method385(0,
  11382.                                             // intToKOrMil(k10), j6 + 10 + j7,
  11383.                                             // k5 + 1 + k6);
  11384.                                             // smallText.method385(0xffff00,
  11385.                                             // intToKOrMil(k10), j6 + 9 + j7, k5
  11386.                                             // + k6);
  11387.                                             if (intToKOrMil(k10) == "@inf@")
  11388.                                                 infinity.drawSprite(k5 + k6, j6
  11389.                                                         + j7);
  11390.                                             if (k10 == 99999)
  11391.                                                 smallText.method385(0xffff00,
  11392.                                                         "oo", j6 + 9 + j7, k5
  11393.                                                                 + k6);
  11394.                                             if (k10 >= 1)
  11395.                                                 smallText.method385(0xFFFF00,
  11396.                                                         intToKOrMil(k10), j6
  11397.                                                                 + 9 + j7, k5
  11398.                                                                 + k6);
  11399.                                             if (k10 >= 100000)
  11400.                                                 smallText.method385(0xFFFFFF,
  11401.                                                         intToKOrMil(k10), j6
  11402.                                                                 + 9 + j7, k5
  11403.                                                                 + k6);
  11404.                                             if (k10 >= 10000000)
  11405.                                                 smallText.method385(0x00FF80,
  11406.                                                         intToKOrMil(k10), j6
  11407.                                                                 + 9 + j7, k5
  11408.                                                                 + k6);
  11409.                                         }
  11410.                                     }
  11411.                                 }
  11412.                             } else if (class9_1.sprites != null && i3 < 20) {
  11413.                                 Sprite class30_sub2_sub1_sub1_1 = class9_1.sprites[i3];
  11414.                                 if (class30_sub2_sub1_sub1_1 != null)
  11415.                                     class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  11416.                             }
  11417.                             i3++;
  11418.                         }
  11419.  
  11420.                     }
  11421.  
  11422.                 } else if (class9_1.type == 10) {
  11423.                     Sprite sprite;
  11424.                     if (interfaceIsSelected(class9_1)) {
  11425.                         sprite = class9_1.sprite2;
  11426.                     } else {
  11427.                         sprite = class9_1.sprite1;
  11428.                     }
  11429.  
  11430.                     if (sprite != null) {
  11431.                         sprite.drawSpriteWithOpacity(k2, l2, class9_1.aByte254);
  11432.                     }
  11433.  
  11434.                 } else if (class9_1.type == 3) {
  11435.                     boolean flag = false;
  11436.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  11437.                             || anInt1026 == class9_1.id)
  11438.                         flag = true;
  11439.                     int j3;
  11440.                     if (interfaceIsSelected(class9_1)) {
  11441.                         j3 = class9_1.anInt219;
  11442.                         if (flag && class9_1.anInt239 != 0)
  11443.                             j3 = class9_1.anInt239;
  11444.                     } else {
  11445.                         j3 = class9_1.textColor;
  11446.                         if (flag && class9_1.anInt216 != 0)
  11447.                             j3 = class9_1.anInt216;
  11448.                     }
  11449.                     if (class9_1.aByte254 == 0) {
  11450.                         if (class9_1.aBoolean227)
  11451.                             DrawingArea.drawPixels(class9_1.height, l2, k2, j3,
  11452.                                     class9_1.width);
  11453.                         else
  11454.                             DrawingArea.fillPixels(k2, class9_1.width,
  11455.                                     class9_1.height, j3, l2);
  11456.                     } else if (class9_1.aBoolean227)
  11457.                         DrawingArea.method335(j3, l2, class9_1.width,
  11458.                                 class9_1.height,
  11459.                                 256 - (class9_1.aByte254 & 0xff), k2);
  11460.                     else
  11461.                         DrawingArea.method338(l2, class9_1.height,
  11462.                                 256 - (class9_1.aByte254 & 0xff), j3,
  11463.                                 class9_1.width, k2);
  11464.                 } else if (class9_1.type == 4) {
  11465.                     TextDrawingArea textDrawingArea = class9_1.textDrawingAreas;
  11466.                     String s = class9_1.message;
  11467.                     boolean flag1 = false;
  11468.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  11469.                             || anInt1026 == class9_1.id)
  11470.                         flag1 = true;
  11471.                     int i4;
  11472.                     if (interfaceIsSelected(class9_1)) {
  11473.                         i4 = class9_1.anInt219;
  11474.                         if (flag1 && class9_1.anInt239 != 0)
  11475.                             i4 = class9_1.anInt239;
  11476.                         if (class9_1.aString228.length() > 0)
  11477.                             s = class9_1.aString228;
  11478.                     } else {
  11479.                         i4 = class9_1.textColor;
  11480.                         if (flag1 && class9_1.anInt216 != 0)
  11481.                             i4 = class9_1.anInt216;
  11482.                     }
  11483.                     if (class9_1.atActionType == 6 && aBoolean1149) {
  11484.                         s = "Please wait...";
  11485.                         i4 = class9_1.textColor;
  11486.                     }
  11487.                     if (DrawingArea.width == 519) {
  11488.                         if (i4 == 0xffff00)
  11489.                             i4 = 255;
  11490.                         if (i4 == 49152)
  11491.                             i4 = 0xffffff;
  11492.                     }
  11493.                     if ((class9_1.parentID == 1151)
  11494.                             || (class9_1.parentID == 12855)) {
  11495.                         switch (i4) {
  11496.                         case 16773120:
  11497.                             i4 = 0xFE981F;
  11498.                             break;
  11499.                         case 7040819:
  11500.                             i4 = 0xAF6A1A;
  11501.                             break;
  11502.                         }
  11503.                     }
  11504.                     for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  11505.                         if (s.indexOf("%") != -1) {
  11506.                             do {
  11507.                                 int k7 = s.indexOf("%1");
  11508.                                 if (k7 == -1)
  11509.                                     break;
  11510.                                 s = s.substring(0, k7)
  11511.                                         + interfaceIntToString(extractInterfaceValues(
  11512.                                                 class9_1, 0))
  11513.                                         + s.substring(k7 + 2);
  11514.                             } while (true);
  11515.                             do {
  11516.                                 int l7 = s.indexOf("%2");
  11517.                                 if (l7 == -1)
  11518.                                     break;
  11519.                                 s = s.substring(0, l7)
  11520.                                         + interfaceIntToString(extractInterfaceValues(
  11521.                                                 class9_1, 1))
  11522.                                         + s.substring(l7 + 2);
  11523.                             } while (true);
  11524.                             do {
  11525.                                 int i8 = s.indexOf("%3");
  11526.                                 if (i8 == -1)
  11527.                                     break;
  11528.                                 s = s.substring(0, i8)
  11529.                                         + interfaceIntToString(extractInterfaceValues(
  11530.                                                 class9_1, 2))
  11531.                                         + s.substring(i8 + 2);
  11532.                             } while (true);
  11533.                             do {
  11534.                                 int j8 = s.indexOf("%4");
  11535.                                 if (j8 == -1)
  11536.                                     break;
  11537.                                 s = s.substring(0, j8)
  11538.                                         + interfaceIntToString(extractInterfaceValues(
  11539.                                                 class9_1, 3))
  11540.                                         + s.substring(j8 + 2);
  11541.                             } while (true);
  11542.                             do {
  11543.                                 int k8 = s.indexOf("%5");
  11544.                                 if (k8 == -1)
  11545.                                     break;
  11546.                                 s = s.substring(0, k8)
  11547.                                         + interfaceIntToString(extractInterfaceValues(
  11548.                                                 class9_1, 4))
  11549.                                         + s.substring(k8 + 2);
  11550.                             } while (true);
  11551.                         }
  11552.                         int l8 = s.indexOf("\\n");
  11553.                         String s1;
  11554.                         if (l8 != -1) {
  11555.                             s1 = s.substring(0, l8);
  11556.                             s = s.substring(l8 + 2);
  11557.                         } else {
  11558.                             s1 = s;
  11559.                             s = "";
  11560.                         }
  11561.                         if (class9_1.centerText)
  11562.                             textDrawingArea.method382(i4, k2 + class9_1.width
  11563.                                     / 2, s1, l6, class9_1.textShadow);
  11564.                         else
  11565.                             textDrawingArea.method389(class9_1.textShadow, k2,
  11566.                                     i4, s1, l6);
  11567.                     }
  11568.                 } else if (class9_1.type == 5) {
  11569.                     Sprite sprite;
  11570.                     if (interfaceIsSelected(class9_1))
  11571.                         sprite = class9_1.sprite2;
  11572.                     else
  11573.                         sprite = class9_1.sprite1;
  11574.                     if (sprite != null)
  11575.                         if (spellSelected == 1 && class9_1.id == spellID
  11576.                                 && spellID != 0) {
  11577.                             sprite.drawSprite3(k2, l2, 0xffffff);
  11578.                         } else {
  11579.                             sprite.drawSprite(k2, l2);
  11580.                         }
  11581.                     if (sprite != null)
  11582.                         sprite.drawSprite(k2, l2);
  11583.                 } else if (class9_1.type == 6) {
  11584.                     int k3 = Texture.textureInt1;
  11585.                     int j4 = Texture.textureInt2;
  11586.                     Texture.textureInt1 = k2 + class9_1.width / 2;
  11587.                     Texture.textureInt2 = l2 + class9_1.height / 2;
  11588.                     int i5 = Texture.anIntArray1470[class9_1.modelRotation1]
  11589.                             * class9_1.anInt269 >> 16;
  11590.                     int l5 = Texture.anIntArray1471[class9_1.modelRotation1]
  11591.                             * class9_1.anInt269 >> 16;
  11592.                     boolean flag2 = interfaceIsSelected(class9_1);
  11593.                     int i7;
  11594.                     if (flag2)
  11595.                         i7 = class9_1.anInt258;
  11596.                     else
  11597.                         i7 = class9_1.anInt257;
  11598.                     Model model;
  11599.                     if (i7 == -1) {
  11600.                         model = class9_1.method209(-1, -1, flag2);
  11601.                     } else {
  11602.                         Animation animation = Animation.anims[i7];
  11603.                         model = class9_1.method209(
  11604.                                 animation.anIntArray354[class9_1.anInt246],
  11605.                                 animation.anIntArray353[class9_1.anInt246],
  11606.                                 flag2);
  11607.                     }
  11608.                     if (model != null)
  11609.                         model.method482(class9_1.modelRotation2, 0,
  11610.                                 class9_1.modelRotation1, 0, i5, l5);
  11611.                     Texture.textureInt1 = k3;
  11612.                     Texture.textureInt2 = j4;
  11613.                 } else if (class9_1.type == 7) {
  11614.                     TextDrawingArea textDrawingArea_1 = class9_1.textDrawingAreas;
  11615.                     int k4 = 0;
  11616.                     for (int j5 = 0; j5 < class9_1.height; j5++) {
  11617.                         for (int i6 = 0; i6 < class9_1.width; i6++) {
  11618.                             if (class9_1.inv[k4] > 0) {
  11619.                                 ItemDef itemDef = ItemDef
  11620.                                         .forID(class9_1.inv[k4] - 1);
  11621.                                 String s2 = itemDef.name;
  11622.                                 if (itemDef.stackable
  11623.                                         || class9_1.invStackSizes[k4] != 1)
  11624.                                     s2 = s2
  11625.                                             + " x"
  11626.                                             + intToKOrMilLongName(
  11627.                                                     class9_1.invStackSizes[k4],
  11628.                                                     0);
  11629.                                 int i9 = k2 + i6
  11630.                                         * (115 + class9_1.invSpritePadX);
  11631.                                 int k9 = l2 + j5
  11632.                                         * (12 + class9_1.invSpritePadY);
  11633.                                 if (class9_1.centerText)
  11634.                                     textDrawingArea_1.method382(
  11635.                                             class9_1.textColor, i9
  11636.                                                     + class9_1.width / 2, s2,
  11637.                                             k9, class9_1.textShadow);
  11638.                                 else
  11639.                                     textDrawingArea_1.method389(
  11640.                                             class9_1.textShadow, i9,
  11641.                                             class9_1.textColor, s2, k9);
  11642.                             }
  11643.                             k4++;
  11644.                         }
  11645.  
  11646.                     }
  11647.  
  11648.                 } else if (class9_1.type == 8
  11649.                         && (anInt1500 == class9_1.id
  11650.                                 || anInt1044 == class9_1.id || anInt1129 == class9_1.id)
  11651.                         && anInt1501 == 50 && !menuOpen) {
  11652.                     int boxWidth = 0;
  11653.                     int boxHeight = 0;
  11654.                     TextDrawingArea textDrawingArea_2 = aTextDrawingArea_1271;
  11655.                     for (String s1 = class9_1.message; s1.length() > 0;) {
  11656.                         if (s1.indexOf("%") != -1) {
  11657.                             do {
  11658.                                 int k7 = s1.indexOf("%1");
  11659.                                 if (k7 == -1)
  11660.                                     break;
  11661.                                 s1 = s1.substring(0, k7)
  11662.                                         + interfaceIntToString(extractInterfaceValues(
  11663.                                                 class9_1, 0))
  11664.                                         + s1.substring(k7 + 2);
  11665.                             } while (true);
  11666.                             do {
  11667.                                 int l7 = s1.indexOf("%2");
  11668.                                 if (l7 == -1)
  11669.                                     break;
  11670.                                 s1 = s1.substring(0, l7)
  11671.                                         + interfaceIntToString(extractInterfaceValues(
  11672.                                                 class9_1, 1))
  11673.                                         + s1.substring(l7 + 2);
  11674.                             } while (true);
  11675.                             do {
  11676.                                 int i8 = s1.indexOf("%3");
  11677.                                 if (i8 == -1)
  11678.                                     break;
  11679.                                 s1 = s1.substring(0, i8)
  11680.                                         + interfaceIntToString(extractInterfaceValues(
  11681.                                                 class9_1, 2))
  11682.                                         + s1.substring(i8 + 2);
  11683.                             } while (true);
  11684.                             do {
  11685.                                 int j8 = s1.indexOf("%4");
  11686.                                 if (j8 == -1)
  11687.                                     break;
  11688.                                 s1 = s1.substring(0, j8)
  11689.                                         + interfaceIntToString(extractInterfaceValues(
  11690.                                                 class9_1, 3))
  11691.                                         + s1.substring(j8 + 2);
  11692.                             } while (true);
  11693.                             do {
  11694.                                 int k8 = s1.indexOf("%5");
  11695.                                 if (k8 == -1)
  11696.                                     break;
  11697.                                 s1 = s1.substring(0, k8)
  11698.                                         + interfaceIntToString(extractInterfaceValues(
  11699.                                                 class9_1, 4))
  11700.                                         + s1.substring(k8 + 2);
  11701.                             } while (true);
  11702.                         }
  11703.                         int l7 = s1.indexOf("\\n");
  11704.                         String s4;
  11705.                         if (l7 != -1) {
  11706.                             s4 = s1.substring(0, l7);
  11707.                             s1 = s1.substring(l7 + 2);
  11708.                         } else {
  11709.                             s4 = s1;
  11710.                             s1 = "";
  11711.                         }
  11712.                         int j10 = textDrawingArea_2.getTextWidth(s4);
  11713.                         if (j10 > boxWidth) {
  11714.                             boxWidth = j10;
  11715.                         }
  11716.                         boxHeight += textDrawingArea_2.anInt1497 + 1;
  11717.                     }
  11718.                     boxWidth += 6;
  11719.                     boxHeight += 7;
  11720.                     int xPos = (k2 + class9_1.width) - 5 - boxWidth;
  11721.                     int yPos = l2 + class9_1.height + 5;
  11722.                     if (xPos < k2 + 5)
  11723.                         xPos = k2 + 5;
  11724.                     if (xPos + boxWidth > k + class9.width)
  11725.                         xPos = (k + class9.width) - boxWidth;
  11726.                     if (yPos + boxHeight > l + class9.height)
  11727.                         yPos = (l2 - boxHeight);
  11728.                     DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0,
  11729.                             boxWidth);
  11730.                     DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  11731.                     String s2 = class9_1.message;
  11732.                     for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
  11733.                             .length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  11734.                         if (s2.indexOf("%") != -1) {
  11735.                             do {
  11736.                                 int k7 = s2.indexOf("%1");
  11737.                                 if (k7 == -1)
  11738.                                     break;
  11739.                                 s2 = s2.substring(0, k7)
  11740.                                         + interfaceIntToString(extractInterfaceValues(
  11741.                                                 class9_1, 0))
  11742.                                         + s2.substring(k7 + 2);
  11743.                             } while (true);
  11744.                             do {
  11745.                                 int l7 = s2.indexOf("%2");
  11746.                                 if (l7 == -1)
  11747.                                     break;
  11748.                                 s2 = s2.substring(0, l7)
  11749.                                         + interfaceIntToString(extractInterfaceValues(
  11750.                                                 class9_1, 1))
  11751.                                         + s2.substring(l7 + 2);
  11752.                             } while (true);
  11753.                             do {
  11754.                                 int i8 = s2.indexOf("%3");
  11755.                                 if (i8 == -1)
  11756.                                     break;
  11757.                                 s2 = s2.substring(0, i8)
  11758.                                         + interfaceIntToString(extractInterfaceValues(
  11759.                                                 class9_1, 2))
  11760.                                         + s2.substring(i8 + 2);
  11761.                             } while (true);
  11762.                             do {
  11763.                                 int j8 = s2.indexOf("%4");
  11764.                                 if (j8 == -1)
  11765.                                     break;
  11766.                                 s2 = s2.substring(0, j8)
  11767.                                         + interfaceIntToString(extractInterfaceValues(
  11768.                                                 class9_1, 3))
  11769.                                         + s2.substring(j8 + 2);
  11770.                             } while (true);
  11771.                             do {
  11772.                                 int k8 = s2.indexOf("%5");
  11773.                                 if (k8 == -1)
  11774.                                     break;
  11775.                                 s2 = s2.substring(0, k8)
  11776.                                         + interfaceIntToString(extractInterfaceValues(
  11777.                                                 class9_1, 4))
  11778.                                         + s2.substring(k8 + 2);
  11779.                             } while (true);
  11780.                         }
  11781.                         int l11 = s2.indexOf("\\n");
  11782.                         String s5;
  11783.                         if (l11 != -1) {
  11784.                             s5 = s2.substring(0, l11);
  11785.                             s2 = s2.substring(l11 + 2);
  11786.                         } else {
  11787.                             s5 = s2;
  11788.                             s2 = "";
  11789.                         }
  11790.                         if (class9_1.centerText) {
  11791.                             textDrawingArea_2.method382(yPos, xPos
  11792.                                     + class9_1.width / 2, s5, j11, false);
  11793.                         } else {
  11794.                             if (s5.contains("\\r")) {
  11795.                                 String text = s5
  11796.                                         .substring(0, s5.indexOf("\\r"));
  11797.                                 String text2 = s5
  11798.                                         .substring(s5.indexOf("\\r") + 2);
  11799.                                 textDrawingArea_2.method389(false, xPos + 3, 0,
  11800.                                         text, j11);
  11801.                                 int rightX = boxWidth + xPos
  11802.                                         - textDrawingArea_2.getTextWidth(text2)
  11803.                                         - 2;
  11804.                                 textDrawingArea_2.method389(false, rightX, 0,
  11805.                                         text2, j11);
  11806.                                 System.out.println("Box: " + boxWidth + "");
  11807.                             } else
  11808.                                 textDrawingArea_2.method389(false, xPos + 3, 0,
  11809.                                         s5, j11);
  11810.                         }
  11811.                     }
  11812.                 } else if (class9_1.type == 9) {
  11813.                     drawHoverBox(k2, l2, class9_1.popupString);
  11814.                 } else if (class9_1.type == 11 && (anInt1500 == class9_1.id || anInt1044 == class9_1.id || anInt1129 == class9_1.id) && !menuOpen) {
  11815.                     int boxWidth = 0;
  11816.                     int boxHeight = 0;
  11817.                     TextDrawingArea textDrawingArea_2 = aTextDrawingArea_1271;
  11818.                     for (String s1 = class9_1.message; s1.length() > 0;) {
  11819.                         int l7 = s1.indexOf("\\n");
  11820.                         String s4;
  11821.                         if (l7 != -1) {
  11822.                             s4 = s1.substring(0, l7);
  11823.                             s1 = s1.substring(l7 + 2);
  11824.                         } else {
  11825.                             s4 = s1;
  11826.                             s1 = "";
  11827.                         }
  11828.                         int j10 = textDrawingArea_2.getTextWidth(s4);
  11829.                         if (j10 > boxWidth) {
  11830.                             boxWidth = j10;
  11831.                         }
  11832.                         boxHeight += textDrawingArea_2.anInt1497 + 1;
  11833.                     }
  11834.                     boxWidth += 6;
  11835.                     boxHeight += 7;
  11836.                     int xPos = (k2 + class9_1.width) - 5 - boxWidth;
  11837.                     int yPos = l2 + class9_1.height + 5;
  11838.                     if (xPos < k2 + 5) {
  11839.                         xPos = k2 + 5;
  11840.                     }
  11841.                     if (xPos + boxWidth > k + class9.width) {
  11842.                         xPos = (k + class9.width) - boxWidth;
  11843.                     }
  11844.                     if (yPos + boxHeight > l + class9.height) {
  11845.                         yPos = (l + class9.height) - boxHeight;
  11846.                     }
  11847.                     if(class9_1.inventoryhover){
  11848.                         if(xPos + boxWidth+k > 249){
  11849.                             xPos = 251 - boxWidth-k;
  11850.                         }
  11851.                         if(yPos+boxHeight+l >261 ){
  11852.                             yPos = 245 - boxHeight - l;
  11853.                         }
  11854.                     }
  11855.                     DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  11856.                     DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  11857.                     String s2 = class9_1.message;
  11858.                     for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {
  11859.                         int l11 = s2.indexOf("\\n");
  11860.                         String s5;
  11861.                         if (l11 != -1) {
  11862.                             s5 = s2.substring(0, l11);
  11863.                             s2 = s2.substring(l11 + 2);
  11864.                         } else {
  11865.                             s5 = s2;
  11866.                             s2 = "";
  11867.                         }
  11868.                         textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  11869.                     }
  11870.                 }
  11871.         }
  11872.         // DrawingArea.setDrawingArea(l1, i1, k1, j1);
  11873.  
  11874.         /*
  11875.          * else if(class9_1.type == 8) { String hoverText; if
  11876.          * (interfaceIsSelected(class9_1)){ hoverText = class9_1.aString228;
  11877.          * }else hoverText = class9_1.message; drawHoverBox(k2, l2, hoverText);
  11878.          * }
  11879.          */
  11880.  
  11881.         DrawingArea.setDrawingArea(l1, i1, k1, j1);
  11882.     }
  11883.    
  11884.     public int drawCount;
  11885.     public int fullscreenInterfaceID;
  11886. public int[] fullScreenTextureArray;
  11887. public void resetAllImageProducers() {
  11888.         if (super.fullGameScreen != null) {
  11889.             return;
  11890.         }
  11891.         aRSImageProducer_1166 = null;
  11892.         aRSImageProducer_1164 = null;
  11893.         aRSImageProducer_1163 = null;
  11894.         aRSImageProducer_1165 = null;
  11895.         aRSImageProducer_1123 = null;
  11896.         aRSImageProducer_1124 = null;
  11897.         aRSImageProducer_1125 = null;
  11898.         aRSImageProducer_1107 = null;
  11899.         aRSImageProducer_1108 = null;
  11900.         aRSImageProducer_1109 = null;
  11901.         aRSImageProducer_1110 = null;
  11902.         aRSImageProducer_1111 = null;
  11903.         aRSImageProducer_1112 = null;
  11904.         aRSImageProducer_1113 = null;
  11905.         aRSImageProducer_1114 = null;
  11906.         aRSImageProducer_1115 = null;
  11907.         super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  11908.         welcomeScreenRaised = true;
  11909.  
  11910.     }
  11911.  
  11912.     public void drawHoverBox(int xPos, int yPos, String text) {
  11913.         String[] results = text.split("\n");
  11914.         int height = (results.length * 16) + 6;
  11915.         int width;
  11916.         width = smallText.getTextWidth(results[0]) + 6;
  11917.         for (int i = 1; i < results.length; i++)
  11918.             if (width <= smallText.getTextWidth(results[i]) + 6)
  11919.                 width = smallText.getTextWidth(results[i]) + 6;
  11920.         DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  11921.         DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  11922.         yPos += 14;
  11923.         for (int i = 0; i < results.length; i++) {
  11924.             smallText.method389(false, xPos + 3, 0, results[i], yPos);
  11925.             yPos += 16;
  11926.         }
  11927.     }
  11928.  
  11929.     private void randomizeBackground(Background background) {
  11930.         int j = 256;
  11931.         for (int k = 0; k < anIntArray1190.length; k++)
  11932.             anIntArray1190[k] = 0;
  11933.  
  11934.         for (int l = 0; l < 5000; l++) {
  11935.             int i1 = (int) (Math.random() * 128D * (double) j);
  11936.             anIntArray1190[i1] = (int) (Math.random() * 256D);
  11937.         }
  11938.  
  11939.         for (int j1 = 0; j1 < 20; j1++) {
  11940.             for (int k1 = 1; k1 < j - 1; k1++) {
  11941.                 for (int i2 = 1; i2 < 127; i2++) {
  11942.                     int k2 = i2 + (k1 << 7);
  11943.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1]
  11944.                             + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  11945.                 }
  11946.  
  11947.             }
  11948.  
  11949.             int ai[] = anIntArray1190;
  11950.             anIntArray1190 = anIntArray1191;
  11951.             anIntArray1191 = ai;
  11952.         }
  11953.  
  11954.         if (background != null) {
  11955.             int l1 = 0;
  11956.             for (int j2 = 0; j2 < background.anInt1453; j2++) {
  11957.                 for (int l2 = 0; l2 < background.anInt1452; l2++)
  11958.                     if (background.aByteArray1450[l1++] != 0) {
  11959.                         int i3 = l2 + 16 + background.anInt1454;
  11960.                         int j3 = j2 + 16 + background.anInt1455;
  11961.                         int k3 = i3 + (j3 << 7);
  11962.                         anIntArray1190[k3] = 0;
  11963.                     }
  11964.  
  11965.             }
  11966.  
  11967.         }
  11968.     }
  11969.  
  11970.     private void method107(int i, int j, Stream stream, Player player) {
  11971.     try {
  11972.         if ((i & 0x400) != 0) {
  11973.             player.anInt1543 = stream.method428();
  11974.             player.anInt1545 = stream.method428();
  11975.             player.anInt1544 = stream.method428();
  11976.             player.anInt1546 = stream.method428();
  11977.             player.anInt1547 = stream.method436() + loopCycle;
  11978.             player.anInt1548 = stream.method435() + loopCycle;
  11979.             player.anInt1549 = stream.method428();
  11980.             player.method446();
  11981.         }
  11982.         if ((i & 0x100) != 0) {
  11983.             player.anInt1520 = stream.method434();
  11984.             int k = stream.readDWord();
  11985.             player.anInt1524 = k >> 16;
  11986.             player.anInt1523 = loopCycle + (k & 0xffff);
  11987.             player.anInt1521 = 0;
  11988.             player.anInt1522 = 0;
  11989.             if (player.anInt1523 > loopCycle)
  11990.                 player.anInt1521 = -1;
  11991.             if (player.anInt1520 == 65535)
  11992.                 player.anInt1520 = -1;
  11993.         }
  11994.         if ((i & 8) != 0) {
  11995.             int l = stream.method434();
  11996.             if (l > Animation.anims.length) { l = -1; }
  11997.             if (l == 65535)
  11998.                 l = -1;
  11999.             int i2 = stream.method427();
  12000.             if ( l < Animation.anims.length && l == player.anim && l != -1) {
  12001.                 int i3 = Animation.anims[l].anInt365;
  12002.                 if (i3 == 1) {
  12003.                     player.anInt1527 = 0;
  12004.                     player.anInt1528 = 0;
  12005.                     player.anInt1529 = i2;
  12006.                     player.anInt1530 = 0;
  12007.                 }
  12008.                 if (i3 == 2)
  12009.                     player.anInt1530 = 0;
  12010.             } else if (l == -1 || player.anim == -1 ||
  12011.             ((l < Animation.anims.length && player.anim < Animation.anims.length) && (Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359))) {
  12012.                 player.anim = l;
  12013.                 player.anInt1527 = 0;
  12014.                 player.anInt1528 = 0;
  12015.                 player.anInt1529 = i2;
  12016.                 player.anInt1530 = 0;
  12017.                 player.anInt1542 = player.smallXYIndex;
  12018.             }
  12019.         }
  12020.         if ((i & 4) != 0) {
  12021.             player.textSpoken = stream.readString();
  12022.             if(player.textSpoken.length() < 1)
  12023.                 return;
  12024.             if (player.textSpoken.charAt(0) == '~') {
  12025.                 player.textSpoken = player.textSpoken.substring(1);
  12026.                 pushMessage(player.textSpoken, 2, player.name);
  12027.             } else if (player == myPlayer)
  12028.                 pushMessage(player.textSpoken, 2, player.name);
  12029.             player.anInt1513 = 0;
  12030.             player.anInt1531 = 0;
  12031.             player.textCycle = 150;
  12032.         }
  12033.         if ((i & 0x80) != 0) {
  12034.             int i1 = stream.method434();
  12035.             int j2 = stream.readUnsignedByte();
  12036.             int j3 = stream.method427();
  12037.             int k3 = stream.currentOffset;
  12038.             if (player.name != null && player.visible) {
  12039.                 long l3 = TextClass.longForName(player.name);
  12040.                 boolean flag = false;
  12041.                 if (j2 <= 1) {
  12042.                     for (int i4 = 0; i4 < ignoreCount; i4++) {
  12043.                         if (ignoreListAsLongs[i4] != l3)
  12044.                             continue;
  12045.                         flag = true;
  12046.                         break;
  12047.                     }
  12048.  
  12049.                 }
  12050.                 if (!flag && anInt1251 == 0)
  12051.                     try {
  12052.                         aStream_834.currentOffset = 0;
  12053.                         stream.method442(j3, 0, aStream_834.buffer);
  12054.                         aStream_834.currentOffset = 0;
  12055.                         String s = TextInput.method525(j3, aStream_834);
  12056.                         // s = Censor.doCensor(s);
  12057.                         player.textSpoken = s;
  12058.                         player.anInt1513 = i1 >> 8;
  12059.                         player.privelage = j2;
  12060.  
  12061.                         // entityMessage(player);
  12062.  
  12063.                         player.anInt1531 = i1 & 0xff;
  12064.                         player.textCycle = 150;
  12065.                         String title = getSpecialColor(player.skill) + player.title + "@bla@";
  12066.                         if (j2 == 11)
  12067.                             pushMessage(s, 1, "@crA@" + title + player.name);
  12068.                         else if (j2 == 10)
  12069.                             pushMessage(s, 1, "@cr9@" + title + player.name);
  12070.                         else if (j2 == 13)
  12071.                             pushMessage(s, 1, "@c10@" + title + player.name);
  12072.                         else if (j2 == 9)
  12073.                             pushMessage(s, 1, "@cr8@" + title + player.name);
  12074.                         else if (j2 == 8)
  12075.                             pushMessage(s, 1, "@cr7@" + title + player.name);
  12076.                         else if (j2 == 7)
  12077.                             pushMessage(s, 1, "@cr6@" + title + player.name);
  12078.                         else if (j2 == 6)
  12079.                             pushMessage(s, 1, "@cr5@" + title + player.name);
  12080.                         else if (j2 == 5)
  12081.                             pushMessage(s, 1, "@cr4@" + title + player.name);
  12082.                         else if (j2 == 4)
  12083.                             pushMessage(s, 1, "@cr3@" + title + player.name);
  12084.                         else if (j2 == 3)
  12085.                             pushMessage(s, 1, "@cr2@" + title + player.name);
  12086.                         else if (j2 == 2)
  12087.                             pushMessage(s, 1, "@cr1@" + title + player.name);
  12088.                         else if (j2 == 1)
  12089.                             pushMessage(s, 1, "@cr0@" + title + player.name);
  12090.                         else
  12091.                             pushMessage(s, 2, title + player.name);
  12092.                     } catch (Exception exception) {
  12093.                         signlink.reporterror("cde2");
  12094.                     }
  12095.             }
  12096.             stream.currentOffset = k3 + j3;
  12097.         }
  12098.         if ((i & 1) != 0) {
  12099.             player.interactingEntity = stream.method434();
  12100.             if (player.interactingEntity == 65535)
  12101.                 player.interactingEntity = -1;
  12102.         }
  12103.         if ((i & 0x10) != 0) {
  12104.             int j1 = stream.method427();
  12105.             byte abyte0[] = new byte[j1];
  12106.             Stream stream_1 = new Stream(abyte0);
  12107.             stream.readBytes(j1, 0, abyte0);
  12108.             aStreamArray895s[j] = stream_1;
  12109.             player.updatePlayer(stream_1);
  12110.         }
  12111.         if ((i & 2) != 0) {
  12112.             player.anInt1538 = stream.method436();
  12113.             player.anInt1539 = stream.method434();
  12114.         }
  12115.         if ((i & 0x20) != 0) {
  12116.             int k1 = stream.readUnsignedByte();
  12117.             int k2 = stream.method426();
  12118.             player.updateHitData(k2, k1, loopCycle);
  12119.             player.loopCycleStatus = loopCycle + 300;
  12120.             player.currentHealth = stream.method427();
  12121.             player.maxHealth = stream.readUnsignedByte();
  12122.         }
  12123.         if ((i & 0x200) != 0) {
  12124.             int l1 = stream.readUnsignedByte();
  12125.             int l2 = stream.method428();
  12126.             player.updateHitData(l2, l1, loopCycle);
  12127.             player.loopCycleStatus = loopCycle + 300;
  12128.             player.currentHealth = stream.readUnsignedByte();
  12129.             player.maxHealth = stream.method427();
  12130.         }
  12131.         } catch (Exception e){
  12132.         e.printStackTrace();
  12133.         }
  12134.     }
  12135.  
  12136.     private void method108() {
  12137.         try {
  12138.             int j = myPlayer.x + anInt1278;
  12139.             int k = myPlayer.y + anInt1131;
  12140.             if (anInt1014 - j < -500 || anInt1014 - j > 500
  12141.                     || anInt1015 - k < -500 || anInt1015 - k > 500) {
  12142.                 anInt1014 = j;
  12143.                 anInt1015 = k;
  12144.             }
  12145.             if (anInt1014 != j)
  12146.                 anInt1014 += (j - anInt1014) / 16;
  12147.             if (anInt1015 != k)
  12148.                 anInt1015 += (k - anInt1015) / 16;
  12149.             if (super.keyArray[1] == 1)
  12150.                 anInt1186 += (-24 - anInt1186) / 2;
  12151.             else if (super.keyArray[2] == 1)
  12152.                 anInt1186 += (24 - anInt1186) / 2;
  12153.             else
  12154.                 anInt1186 /= 2;
  12155.             if (super.keyArray[3] == 1)
  12156.                 anInt1187 += (12 - anInt1187) / 2;
  12157.             else if (super.keyArray[4] == 1)
  12158.                 anInt1187 += (-12 - anInt1187) / 2;
  12159.             else
  12160.                 anInt1187 /= 2;
  12161.             minimapInt1 = minimapInt1 + anInt1186 / 2 & 0x7ff;
  12162.             anInt1184 += anInt1187 / 2;
  12163.             if (anInt1184 < 128)
  12164.                 anInt1184 = 128;
  12165.             if (anInt1184 > 383)
  12166.                 anInt1184 = 383;
  12167.             int l = anInt1014 >> 7;
  12168.             int i1 = anInt1015 >> 7;
  12169.             int j1 = method42(plane, anInt1015, anInt1014);
  12170.             int k1 = 0;
  12171.             if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  12172.                 for (int l1 = l - 4; l1 <= l + 4; l1++) {
  12173.                     for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  12174.                         int l2 = plane;
  12175.                         if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  12176.                             l2++;
  12177.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  12178.                         if (i3 > k1)
  12179.                             k1 = i3;
  12180.                     }
  12181.  
  12182.                 }
  12183.  
  12184.             }
  12185.             anInt1005++;
  12186.             if (anInt1005 > 1512) {
  12187.                 anInt1005 = 0;
  12188.                 stream.createFrame(77);
  12189.                 stream.writeWordBigEndian(0);
  12190.                 int i2 = stream.currentOffset;
  12191.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  12192.                 stream.writeWordBigEndian(101);
  12193.                 stream.writeWordBigEndian(233);
  12194.                 stream.writeWord(45092);
  12195.                 if ((int) (Math.random() * 2D) == 0)
  12196.                     stream.writeWord(35784);
  12197.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  12198.                 stream.writeWordBigEndian(64);
  12199.                 stream.writeWordBigEndian(38);
  12200.                 stream.writeWord((int) (Math.random() * 65536D));
  12201.                 stream.writeWord((int) (Math.random() * 65536D));
  12202.                 stream.writeBytes(stream.currentOffset - i2);
  12203.             }
  12204.             int j2 = k1 * 192;
  12205.             if (j2 > 0x17f00)
  12206.                 j2 = 0x17f00;
  12207.             if (j2 < 32768)
  12208.                 j2 = 32768;
  12209.             if (j2 > anInt984) {
  12210.                 anInt984 += (j2 - anInt984) / 24;
  12211.                 return;
  12212.             }
  12213.             if (j2 < anInt984) {
  12214.                 anInt984 += (j2 - anInt984) / 80;
  12215.             }
  12216.         } catch (Exception _ex) {
  12217.             signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y
  12218.                     + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + ","
  12219.                     + anInt1070 + "," + baseX + "," + baseY);
  12220.             throw new RuntimeException("eek");
  12221.         }
  12222.     }
  12223.  
  12224.     public void processDrawing() {
  12225.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  12226.             showErrorScreen();
  12227.             return;
  12228.         }
  12229.         anInt1061++;
  12230.         if (!loggedIn)
  12231.             drawLoginScreen(false);
  12232.         else
  12233.             drawGameScreen();
  12234.         anInt1213 = 0;
  12235.        
  12236.     }
  12237.  
  12238.     private boolean isFriendOrSelf(String s) {
  12239.         if (s == null)
  12240.             return false;
  12241.         for (int i = 0; i < friendsCount; i++)
  12242.             if (s.equalsIgnoreCase(friendsList[i]))
  12243.                 return true;
  12244.         return s.equalsIgnoreCase(myPlayer.name);
  12245.     }
  12246.  
  12247.     private static String combatDiffColor(int i, int j) {
  12248.         int k = i - j;
  12249.         if (k < -9)
  12250.             return "@red@";
  12251.         if (k < -6)
  12252.             return "@or3@";
  12253.         if (k < -3)
  12254.             return "@or2@";
  12255.         if (k < 0)
  12256.             return "@or1@";
  12257.         if (k > 9)
  12258.             return "@gre@";
  12259.         if (k > 6)
  12260.             return "@gr3@";
  12261.         if (k > 3)
  12262.             return "@gr2@";
  12263.         if (k > 0)
  12264.             return "@gr1@";
  12265.         else
  12266.             return "@yel@";
  12267.     }
  12268.  
  12269.     private void setWaveVolume(int i) {
  12270.         signlink.wavevol = i;
  12271.     }
  12272.  
  12273.     private void draw3dScreen() {
  12274.         alertHandler.processAlerts();
  12275.         drawSplitPrivateChat();
  12276.         if (crossType == 1) {
  12277.             crosses[crossIndex / 100]
  12278.                     .drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  12279.             anInt1142++;
  12280.             if (anInt1142 > 67) {
  12281.                 anInt1142 = 0;
  12282.                 stream.createFrame(78);
  12283.             }
  12284.         }
  12285.         if (crossType == 2)
  12286.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4,
  12287.                     crossY - 8 - 4);
  12288.         if (anInt1018 != -1) {
  12289.             method119(anInt945, anInt1018);
  12290.             drawInterface(0, 0, RSInterface.interfaceCache[anInt1018], 0);
  12291.         }
  12292.         if (openInterfaceID != -1) {
  12293.             method119(anInt945, openInterfaceID);
  12294.             drawInterface(0, 0, RSInterface.interfaceCache[openInterfaceID], 0);
  12295.         }
  12296.         method70();
  12297.         if (!menuOpen) {
  12298.             processRightClick();
  12299.             drawTooltip();
  12300.         } else if (menuScreenArea == 0)
  12301.             drawMenu();
  12302.         if (anInt1055 == 1) { // Multi icon outside of Wilderness
  12303.             multiOverlay.drawSprite(472, 296);
  12304.         } else if (anInt1055 == 2) { // Multi icon inside of Wilderness
  12305.             multiOverlay.drawSprite(472, 278);
  12306.         } else if (anInt1055 == 3) { // Dueling icon in dueling area
  12307.             duelingOverlay.drawSprite(472, 278);
  12308.         }
  12309.         if (fpsOn) {
  12310.             char c = '\u01FB';
  12311.             int k = 20;
  12312.             int i1 = 0xffff00;
  12313.             if (super.fps < 15)
  12314.                 i1 = 0xff0000;
  12315.             aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
  12316.             k += 15;
  12317.             Runtime runtime = Runtime.getRuntime();
  12318.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  12319.             i1 = 0xffff00;
  12320.             if (j1 > 0x2000000 && lowMem)
  12321.                 i1 = 0xff0000;
  12322.             aTextDrawingArea_1271.method380("Mem:" + j1 + "k", c, 0xffff00, k);
  12323.             k += 15;
  12324.         }
  12325.         int i1 = 0xffff00;
  12326.         int x = baseX + (myPlayer.x - 6 >> 7);
  12327.         int y = baseY + (myPlayer.y - 6 >> 7);
  12328.         if (clientData) {
  12329.             char c = '\u01FB';
  12330.             int k = 20;
  12331.             if (super.fps < 15)
  12332.                 i1 = 0xff0000;
  12333.             aTextDrawingArea_1271.method385(0xffff00, "Fps: " + super.fps, 285,
  12334.                     5);
  12335.             Runtime runtime = Runtime.getRuntime();
  12336.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  12337.             i1 = 0xffff00;
  12338.             if (j1 > 0x2000000 && lowMem)
  12339.                 i1 = 0xff0000;
  12340.             k += 15;
  12341.             aTextDrawingArea_1271.method385(0xffff00, "Mem: " + j1 + "k", 299,
  12342.                     5);
  12343.             aTextDrawingArea_1271.method385(0xffff00, "Mouse X: "
  12344.                     + super.mouseX + " , Mouse Y: " + super.mouseY, 314, 5);
  12345.             aTextDrawingArea_1271.method385(0xffff00,
  12346.                     "Coords: " + x + ", " + y, 329, 5);
  12347.         }
  12348.         if (coordinates || performanceCounter) {
  12349.             int k = 20;
  12350.             char c = '\u01FB';
  12351.             if (coordinates) {
  12352.                 i1 = 0xffff00;
  12353.                 x = baseX + (myPlayer.x - 6 >> 7);
  12354.                 y = baseY + (myPlayer.y - 6 >> 7);
  12355.                 aTextDrawingArea_1271.method380("Coordinates: X:" + x + " Y:"
  12356.                         + y, c, i1, k);
  12357.                 k += 15;
  12358.             }
  12359.             if (performanceCounter) {
  12360.                 i1 = 0xffff00;
  12361.                 Runtime runtime = Runtime.getRuntime();
  12362.                 double j1 = (int) ((runtime.totalMemory() - runtime
  12363.                         .freeMemory()) / 1024L); // Used memory
  12364.                 double j2 = (int) (runtime.totalMemory() / 1024L); // Total
  12365.                                                                     // Memory
  12366.                 double j3 = j1 / j2 * 100; // Percent used
  12367.                 i1 = 0xffff00;
  12368.                 if (j3 > 90D) // If memory usage(j3) > 90, change text color to
  12369.                                 // red
  12370.                     i1 = 0xff0000;
  12371.                 aTextDrawingArea_1271.method380("MemUsage: " + (int) j1 + " / "
  12372.                         + (int) j2 + "KB", c, i1, k);
  12373.                 k += 15;
  12374.                 i1 = 0xffff00;
  12375.                 if (super.fps < 15) // Frames too slow :D
  12376.                     i1 = 0xff0000;
  12377.                 aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
  12378.                 k += 15;
  12379.             }
  12380.         }
  12381.         if (anInt1104 != 0) {
  12382.             int j = anInt1104 / 50;
  12383.             int l = j / 60;
  12384.             j %= 60;
  12385.             if (j < 10)
  12386.                 aTextDrawingArea_1271.method385(0xffff00,
  12387.                         "System update please logout to save your data: " + l
  12388.                                 + ":0" + j, 329, 4);
  12389.             else
  12390.                 aTextDrawingArea_1271.method385(0xffff00,
  12391.                         "System update please logout to save your data: " + l
  12392.                                 + ":" + j, 329, 4);
  12393.             anInt849++;
  12394.             if (anInt849 > 75) {
  12395.                 anInt849 = 0;
  12396.                 stream.createFrame(148);
  12397.             }
  12398.         }
  12399.     }
  12400.  
  12401.     private void addIgnore(long l) {
  12402.         try {
  12403.             if (l == 0L)
  12404.                 return;
  12405.             if (ignoreCount >= 100) {
  12406.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  12407.                 return;
  12408.             }
  12409.             String s = TextClass.fixName(TextClass.nameForLong(l));
  12410.             for (int j = 0; j < ignoreCount; j++)
  12411.                 if (ignoreListAsLongs[j] == l) {
  12412.                     pushMessage(s + " is already on your ignore list", 0, "");
  12413.                     return;
  12414.                 }
  12415.             for (int k = 0; k < friendsCount; k++)
  12416.                 if (friendsListAsLongs[k] == l) {
  12417.                     pushMessage("Please remove " + s
  12418.                             + " from your friend list first", 0, "");
  12419.                     return;
  12420.                 }
  12421.  
  12422.             ignoreListAsLongs[ignoreCount++] = l;
  12423.             needDrawTabArea = true;
  12424.             stream.createFrame(133);
  12425.             stream.writeQWord(l);
  12426.             return;
  12427.         } catch (RuntimeException runtimeexception) {
  12428.             signlink.reporterror("45688, " + l + ", " + 4 + ", "
  12429.                     + runtimeexception.toString());
  12430.         }
  12431.         throw new RuntimeException();
  12432.     }
  12433.  
  12434.     private void method114() {
  12435.         for (int i = -1; i < playerCount; i++) {
  12436.             int j;
  12437.             if (i == -1)
  12438.                 j = myPlayerIndex;
  12439.             else
  12440.                 j = playerIndices[i];
  12441.             Player player = playerArray[j];
  12442.             if (player != null)
  12443.                 method96(player);
  12444.         }
  12445.  
  12446.     }
  12447.  
  12448.     private void method115() {
  12449.         if (loadingStage == 2) {
  12450.             for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  12451.                     .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  12452.                     .reverseGetNext()) {
  12453.                 if (class30_sub1.anInt1294 > 0)
  12454.                     class30_sub1.anInt1294--;
  12455.                 if (class30_sub1.anInt1294 == 0) {
  12456.                     if (class30_sub1.anInt1299 < 0
  12457.                             || ObjectManager.method178(class30_sub1.anInt1299,
  12458.                                     class30_sub1.anInt1301)) {
  12459.                         method142(class30_sub1.anInt1298,
  12460.                                 class30_sub1.anInt1295, class30_sub1.anInt1300,
  12461.                                 class30_sub1.anInt1301, class30_sub1.anInt1297,
  12462.                                 class30_sub1.anInt1296, class30_sub1.anInt1299);
  12463.                         class30_sub1.unlink();
  12464.                     }
  12465.                 } else {
  12466.                     if (class30_sub1.anInt1302 > 0)
  12467.                         class30_sub1.anInt1302--;
  12468.                     if (class30_sub1.anInt1302 == 0
  12469.                             && class30_sub1.anInt1297 >= 1
  12470.                             && class30_sub1.anInt1298 >= 1
  12471.                             && class30_sub1.anInt1297 <= 102
  12472.                             && class30_sub1.anInt1298 <= 102
  12473.                             && (class30_sub1.anInt1291 < 0 || ObjectManager
  12474.                                     .method178(class30_sub1.anInt1291,
  12475.                                             class30_sub1.anInt1293))) {
  12476.                         method142(class30_sub1.anInt1298,
  12477.                                 class30_sub1.anInt1295, class30_sub1.anInt1292,
  12478.                                 class30_sub1.anInt1293, class30_sub1.anInt1297,
  12479.                                 class30_sub1.anInt1296, class30_sub1.anInt1291);
  12480.                         class30_sub1.anInt1302 = -1;
  12481.                         if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  12482.                                 && class30_sub1.anInt1299 == -1)
  12483.                             class30_sub1.unlink();
  12484.                         else if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  12485.                                 && class30_sub1.anInt1292 == class30_sub1.anInt1300
  12486.                                 && class30_sub1.anInt1293 == class30_sub1.anInt1301)
  12487.                             class30_sub1.unlink();
  12488.                     }
  12489.                 }
  12490.             }
  12491.  
  12492.         }
  12493.     }
  12494.  
  12495.     private void determineMenuSize() {
  12496.         int i = chatTextDrawingArea.getTextWidth("Choose Option");
  12497.         for (int j = 0; j < menuActionRow; j++) {
  12498.             int k = chatTextDrawingArea.getTextWidth(menuActionName[j]);
  12499.             if (k > i)
  12500.                 i = k;
  12501.         }
  12502.  
  12503.         i += 8;
  12504.         int l = 15 * menuActionRow + 21;
  12505.         if (super.saveClickX > 4 && super.saveClickY > 4
  12506.                 && super.saveClickX < 516 && super.saveClickY < 338) {
  12507.             int i1 = super.saveClickX - 4 - i / 2;
  12508.             if (i1 + i > 512)
  12509.                 i1 = 512 - i;
  12510.             if (i1 < 0)
  12511.                 i1 = 0;
  12512.             int l1 = super.saveClickY - 4;
  12513.             if (l1 + l > 334)
  12514.                 l1 = 334 - l;
  12515.             if (l1 < 0)
  12516.                 l1 = 0;
  12517.             menuOpen = true;
  12518.             menuScreenArea = 0;
  12519.             menuOffsetX = i1;
  12520.             menuOffsetY = l1;
  12521.             menuWidth = i;
  12522.             anInt952 = 15 * menuActionRow + 22;
  12523.         }
  12524.  
  12525.         if (super.saveClickX > 519 && super.saveClickY > 168
  12526.                 && super.saveClickX < 765 && super.saveClickY < 503) {
  12527.             int j1 = super.saveClickX - 519 - i / 2;
  12528.             if (j1 < 0)
  12529.                 j1 = 0;
  12530.             else if (j1 + i > 245)
  12531.                 j1 = 245 - i;
  12532.             int i2 = super.saveClickY - 168;
  12533.             if (i2 < 0)
  12534.                 i2 = 0;
  12535.             else if (i2 + l > 333)
  12536.                 i2 = 333 - l;
  12537.             menuOpen = true;
  12538.             menuScreenArea = 1;
  12539.             menuOffsetX = j1;
  12540.             menuOffsetY = i2;
  12541.             menuWidth = i;
  12542.             anInt952 = 15 * menuActionRow + 22;
  12543.         }
  12544.         if (super.saveClickX > 0 && super.saveClickY > 338
  12545.                 && super.saveClickX < 516 && super.saveClickY < 503) {
  12546.             int k1 = super.saveClickX - 0 - i / 2;
  12547.             if (k1 < 0)
  12548.                 k1 = 0;
  12549.             else if (k1 + i > 516)
  12550.                 k1 = 516 - i;
  12551.             int j2 = super.saveClickY - 338;
  12552.             if (j2 < 0)
  12553.                 j2 = 0;
  12554.             else if (j2 + l > 165)
  12555.                 j2 = 165 - l;
  12556.             menuOpen = true;
  12557.             menuScreenArea = 2;
  12558.             menuOffsetX = k1;
  12559.             menuOffsetY = j2;
  12560.             menuWidth = i;
  12561.             anInt952 = 15 * menuActionRow + 22;
  12562.         }
  12563.         if (super.saveClickX >= 515 && super.saveClickY >= 0
  12564.                 && super.saveClickX <= 765 && super.saveClickY <= 169) {
  12565.             int k1 = super.saveClickX - 515 - i / 2;
  12566.             if (k1 < 0)
  12567.                 k1 = 0;
  12568.             else if (k1 + i > 249)
  12569.                 k1 = 249 - i;
  12570.             int j2 = super.saveClickY;
  12571.             if (j2 < 0)
  12572.                 j2 = 0;
  12573.             else if (j2 + l > 168)
  12574.                 j2 = 168 - l;
  12575.             menuOpen = true;
  12576.             menuScreenArea = 3;
  12577.             menuOffsetX = k1;
  12578.             menuOffsetY = j2;
  12579.             menuWidth = i;
  12580.             anInt952 = 15 * menuActionRow + 22;
  12581.         }
  12582.     }
  12583.  
  12584.     private void method117(Stream stream) {
  12585.         stream.initBitAccess();
  12586.         int j = stream.readBits(1);
  12587.         if (j == 0)
  12588.             return;
  12589.         int k = stream.readBits(2);
  12590.         if (k == 0) {
  12591.             anIntArray894[anInt893++] = myPlayerIndex;
  12592.             return;
  12593.         }
  12594.         if (k == 1) {
  12595.             int l = stream.readBits(3);
  12596.             myPlayer.moveInDir(false, l);
  12597.             int k1 = stream.readBits(1);
  12598.             if (k1 == 1)
  12599.                 anIntArray894[anInt893++] = myPlayerIndex;
  12600.             return;
  12601.         }
  12602.         if (k == 2) {
  12603.             int i1 = stream.readBits(3);
  12604.             myPlayer.moveInDir(true, i1);
  12605.             int l1 = stream.readBits(3);
  12606.             myPlayer.moveInDir(true, l1);
  12607.             int j2 = stream.readBits(1);
  12608.             if (j2 == 1)
  12609.                 anIntArray894[anInt893++] = myPlayerIndex;
  12610.             return;
  12611.         }
  12612.         if (k == 3) {
  12613.             plane = stream.readBits(2);
  12614.             int j1 = stream.readBits(1);
  12615.             int i2 = stream.readBits(1);
  12616.             if (i2 == 1)
  12617.                 anIntArray894[anInt893++] = myPlayerIndex;
  12618.             int k2 = stream.readBits(7);
  12619.             int l2 = stream.readBits(7);
  12620.             myPlayer.setPos(l2, k2, j1 == 1);
  12621.         }
  12622.     }
  12623.  
  12624.     private void nullLoader() {
  12625.         aBoolean831 = false;
  12626.         while (drawingFlames) {
  12627.             aBoolean831 = false;
  12628.             try {
  12629.                 Thread.sleep(50L);
  12630.             } catch (Exception _ex) {
  12631.             }
  12632.         }
  12633.         aBackground_966 = null;
  12634.         aBackground_967 = null;
  12635.         aBackgroundArray1152s = null;
  12636.         anIntArray850 = null;
  12637.         anIntArray851 = null;
  12638.         anIntArray852 = null;
  12639.         anIntArray853 = null;
  12640.         anIntArray1190 = null;
  12641.         anIntArray1191 = null;
  12642.         anIntArray828 = null;
  12643.         anIntArray829 = null;
  12644.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  12645.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  12646.     }
  12647.  
  12648.     private boolean method119(int i, int j) {
  12649.         boolean flag1 = false;
  12650.         RSInterface class9 = RSInterface.interfaceCache[j];
  12651.         for (int k = 0; k < class9.children.length; k++) {
  12652.             if (class9.children[k] == -1)
  12653.                 break;
  12654.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  12655.             if (class9_1.type == 1)
  12656.                 flag1 |= method119(i, class9_1.id);
  12657.             if (class9_1.type == 6
  12658.                     && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  12659.                 boolean flag2 = interfaceIsSelected(class9_1);
  12660.                 int l;
  12661.                 if (flag2)
  12662.                     l = class9_1.anInt258;
  12663.                 else
  12664.                     l = class9_1.anInt257;
  12665.                 if (l != -1) {
  12666.                     Animation animation = Animation.anims[l];
  12667.                     for (class9_1.anInt208 += i; class9_1.anInt208 > animation
  12668.                             .method258(class9_1.anInt246);) {
  12669.                         class9_1.anInt208 -= animation
  12670.                                 .method258(class9_1.anInt246) + 1;
  12671.                         class9_1.anInt246++;
  12672.                         if (class9_1.anInt246 >= animation.anInt352) {
  12673.                             class9_1.anInt246 -= animation.anInt356;
  12674.                             if (class9_1.anInt246 < 0
  12675.                                     || class9_1.anInt246 >= animation.anInt352)
  12676.                                 class9_1.anInt246 = 0;
  12677.                         }
  12678.                         flag1 = true;
  12679.                     }
  12680.  
  12681.                 }
  12682.             }
  12683.         }
  12684.  
  12685.         return flag1;
  12686.     }
  12687.  
  12688.     private int method120() {
  12689.         int j = 3;
  12690.         if (yCameraCurve < 310) {
  12691.             int k = xCameraPos >> 7;
  12692.             int l = yCameraPos >> 7;
  12693.             int i1 = myPlayer.x >> 7;
  12694.             int j1 = myPlayer.y >> 7;
  12695.             if ((byteGroundArray[plane][k][l] & 4) != 0)
  12696.                 j = plane;
  12697.             int k1;
  12698.             if (i1 > k)
  12699.                 k1 = i1 - k;
  12700.             else
  12701.                 k1 = k - i1;
  12702.             int l1;
  12703.             if (j1 > l)
  12704.                 l1 = j1 - l;
  12705.             else
  12706.                 l1 = l - j1;
  12707.             if (k1 > l1) {
  12708.                 int i2 = (l1 * 0x10000) / k1;
  12709.                 int k2 = 32768;
  12710.                 while (k != i1) {
  12711.                     if (k < i1)
  12712.                         k++;
  12713.                     else if (k > i1)
  12714.                         k--;
  12715.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  12716.                         j = plane;
  12717.                     k2 += i2;
  12718.                     if (k2 >= 0x10000) {
  12719.                         k2 -= 0x10000;
  12720.                         if (l < j1)
  12721.                             l++;
  12722.                         else if (l > j1)
  12723.                             l--;
  12724.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  12725.                             j = plane;
  12726.                     }
  12727.                 }
  12728.             } else {
  12729.                 int j2 = (k1 * 0x10000) / l1;
  12730.                 int l2 = 32768;
  12731.                 while (l != j1) {
  12732.                     if (l < j1)
  12733.                         l++;
  12734.                     else if (l > j1)
  12735.                         l--;
  12736.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  12737.                         j = plane;
  12738.                     l2 += j2;
  12739.                     if (l2 >= 0x10000) {
  12740.                         l2 -= 0x10000;
  12741.                         if (k < i1)
  12742.                             k++;
  12743.                         else if (k > i1)
  12744.                             k--;
  12745.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  12746.                             j = plane;
  12747.                     }
  12748.                 }
  12749.             }
  12750.         }
  12751.         if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  12752.             j = plane;
  12753.         return j;
  12754.     }
  12755.  
  12756.     private int method121() {
  12757.         int j = method42(plane, yCameraPos, xCameraPos);
  12758.         if (j - zCameraPos < 800
  12759.                 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  12760.             return plane;
  12761.         else
  12762.             return 3;
  12763.     }
  12764.  
  12765.     private void delIgnore(long l) {
  12766.         try {
  12767.             if (l == 0L)
  12768.                 return;
  12769.             for (int j = 0; j < ignoreCount; j++)
  12770.                 if (ignoreListAsLongs[j] == l) {
  12771.                     ignoreCount--;
  12772.                     needDrawTabArea = true;
  12773.                     System.arraycopy(ignoreListAsLongs, j + 1,
  12774.                             ignoreListAsLongs, j, ignoreCount - j);
  12775.  
  12776.                     stream.createFrame(74);
  12777.                     stream.writeQWord(l);
  12778.                     return;
  12779.                 }
  12780.  
  12781.             return;
  12782.         } catch (RuntimeException runtimeexception) {
  12783.             signlink.reporterror("47229, " + 3 + ", " + l + ", "
  12784.                     + runtimeexception.toString());
  12785.         }
  12786.         throw new RuntimeException();
  12787.     }
  12788.  
  12789.     public String getParameter(String s) {
  12790.         if (signlink.mainapp != null)
  12791.             return signlink.mainapp.getParameter(s);
  12792.         else
  12793.             return super.getParameter(s);
  12794.     }
  12795.  
  12796.     private void adjustVolume(boolean flag, int i) {
  12797.         signlink.midivol = i;
  12798.         if (flag)
  12799.             signlink.midi = "voladjust";
  12800.     }
  12801.  
  12802.     private int extractInterfaceValues(RSInterface class9, int j) {
  12803.         if (class9.valueIndexArray == null
  12804.                 || j >= class9.valueIndexArray.length)
  12805.             return -2;
  12806.         try {
  12807.             int ai[] = class9.valueIndexArray[j];
  12808.             int k = 0;
  12809.             int l = 0;
  12810.             int i1 = 0;
  12811.             do {
  12812.                 int j1 = ai[l++];
  12813.                 int k1 = 0;
  12814.                 byte byte0 = 0;
  12815.                 if (j1 == 0)
  12816.                     return k;
  12817.                 if (j1 == 1)
  12818.                     k1 = currentStats[ai[l++]];
  12819.                 if (j1 == 2)
  12820.                     k1 = maxStats[ai[l++]];
  12821.                 if (j1 == 3)
  12822.                     k1 = currentExp[ai[l++]];
  12823.                 if (j1 == 4) {
  12824.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  12825.                     int k2 = ai[l++];
  12826.                     if (k2 >= 0 && k2 < ItemDef.totalItems
  12827.                             && (!ItemDef.forID(k2).membersObject || isMembers)) {
  12828.                         for (int j3 = 0; j3 < class9_1.inv.length; j3++)
  12829.                             if (class9_1.inv[j3] == k2 + 1)
  12830.                                 k1 += class9_1.invStackSizes[j3];
  12831.  
  12832.                     }
  12833.                 }
  12834.                 if (j1 == 5)
  12835.                     k1 = variousSettings[ai[l++]];
  12836.                 if (j1 == 6)
  12837.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  12838.                 if (j1 == 7)
  12839.                     k1 = (variousSettings[ai[l++]] * 100) / 46875;
  12840.                 if (j1 == 8)
  12841.                     k1 = myPlayer.combatLevel;
  12842.                 if (j1 == 9) {
  12843.                     for (int l1 = 0; l1 < Skills.skillsCount; l1++)
  12844.                         if (Skills.skillEnabled[l1])
  12845.                             k1 += maxStats[l1];
  12846.  
  12847.                 }
  12848.                 if (j1 == 10) {
  12849.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  12850.                     int l2 = ai[l++] + 1;
  12851.                     if (l2 >= 0 && l2 < ItemDef.totalItems
  12852.                             && (!ItemDef.forID(l2).membersObject || isMembers)) {
  12853.                         for (int k3 = 0; k3 < class9_2.inv.length; k3++) {
  12854.                             if (class9_2.inv[k3] != l2)
  12855.                                 continue;
  12856.                             k1 = 0x3b9ac9ff;
  12857.                             break;
  12858.                         }
  12859.  
  12860.                     }
  12861.                 }
  12862.                 if (j1 == 11)
  12863.                     k1 = energy;
  12864.                 if (j1 == 12)
  12865.                     k1 = weight;
  12866.                 if (j1 == 13) {
  12867.                     int i2 = variousSettings[ai[l++]];
  12868.                     int i3 = ai[l++];
  12869.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  12870.                 }
  12871.                 if (j1 == 14) {
  12872.                     int j2 = ai[l++];
  12873.                     VarBit varBit = VarBit.cache[j2];
  12874.                     int l3 = varBit.anInt648;
  12875.                     int i4 = varBit.anInt649;
  12876.                     int j4 = varBit.anInt650;
  12877.                     int k4 = anIntArray1232[j4 - i4];
  12878.                     k1 = variousSettings[l3] >> i4 & k4;
  12879.                 }
  12880.                 if (j1 == 15)
  12881.                     byte0 = 1;
  12882.                 if (j1 == 16)
  12883.                     byte0 = 2;
  12884.                 if (j1 == 17)
  12885.                     byte0 = 3;
  12886.                 if (j1 == 18)
  12887.                     k1 = (myPlayer.x >> 7) + baseX;
  12888.                 if (j1 == 19)
  12889.                     k1 = (myPlayer.y >> 7) + baseY;
  12890.                 if (j1 == 20)
  12891.                     k1 = ai[l++];
  12892.                 if (byte0 == 0) {
  12893.                     if (i1 == 0)
  12894.                         k += k1;
  12895.                     if (i1 == 1)
  12896.                         k -= k1;
  12897.                     if (i1 == 2 && k1 != 0)
  12898.                         k /= k1;
  12899.                     if (i1 == 3)
  12900.                         k *= k1;
  12901.                     i1 = 0;
  12902.                 } else {
  12903.                     i1 = byte0;
  12904.                 }
  12905.             } while (true);
  12906.         } catch (Exception _ex) {
  12907.             return -1;
  12908.         }
  12909.     }
  12910.  
  12911.     private void drawTooltip() {
  12912.         if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
  12913.             return;
  12914.         String s;
  12915.         if (itemSelected == 1 && menuActionRow < 2)
  12916.             s = "Use " + selectedItemName + " with...";
  12917.         else if (spellSelected == 1 && menuActionRow < 2)
  12918.             s = spellTooltip + "...";
  12919.         else
  12920.             s = menuActionName[menuActionRow - 1];
  12921.         if (menuActionRow > 2)
  12922.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  12923.         chatTextDrawingArea.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  12924.     }
  12925.  
  12926.     public void drawHPOrb() {
  12927.         try {
  12928.         int health;
  12929.         String cHP = RSInterface.interfaceCache[4016].message;
  12930.         cHP = cHP.replaceAll("%", "");
  12931.         int currentHP = Integer.parseInt(cHP);
  12932.         int drawHP = currentHP;
  12933.         if (newHits)
  12934.             drawHP = drawHP * 10;
  12935.         String curHP = "" + drawHP;
  12936.         // int maxHP2 =
  12937.         // Integer.parseInt(RSInterface.interfaceCache[31160].message);
  12938.         String maxHP3 = RSInterface.interfaceCache[4017].message;
  12939.         maxHP3 = maxHP3.replaceAll("%", "");
  12940.         int maxHP2 = Integer.parseInt(maxHP3);
  12941.         health = (int) (((double) currentHP / (double) maxHP2) * 100D);
  12942.         int hpPercent = 0;
  12943.         hpPercent = currentHP * 34 / maxHP2;
  12944.         Sprite orbDrawn = emptyOrb;
  12945.         orbDrawn.drawSprite(170, 13);
  12946.         if (currentHP > 99) {
  12947.             hpPercent = 34;
  12948.             orbDrawn = new Sprite("emptyorb", 57, 34 - hpPercent);
  12949.         } else {
  12950.             orbDrawn = new Sprite("emptyorb", 57, 34 - hpPercent);
  12951.         }
  12952.         hitPointsFill.drawSprite(173, 16);
  12953.         orbDrawn.drawSprite(170, 13);
  12954.         double fillHp;
  12955.         double percent = (health / 100d);
  12956.         fillHp = 27 * percent;
  12957.         int depleteFill = 27 - (int) fillHp;
  12958.         int col = 65280;
  12959.         if (health >= 75)
  12960.             col = 65280;
  12961.         else if (health >= 50)
  12962.             col = 0xffff00;
  12963.         else if (health >= 25)
  12964.             col = 0xfca607;
  12965.         else
  12966.             col = 0xf50d0d;
  12967.         smallText.method382(col, 212, curHP, 39, true);
  12968.         // hitPointsFill.myHeight = depleteFill;
  12969.         // hitPointsFill.height = depleteFill;
  12970.         // hitPointsFill.drawSprite(173, 16);
  12971.         hitPointsIcon.drawSprite(179, 24);
  12972.         } catch(Exception e){
  12973.        
  12974.         }
  12975.     }
  12976.  
  12977.     public void drawPrayerOrb() {
  12978.         try {
  12979.         int prayer;
  12980.         String cP = RSInterface.interfaceCache[4012].message;
  12981.         cP = cP.replaceAll("%", "");
  12982.         int currentPrayer = Integer.parseInt(cP);
  12983.         String maxPrayer1 = RSInterface.interfaceCache[4013].message;
  12984.         maxPrayer1 = maxPrayer1.replaceAll("%", "");
  12985.         int maxPrayer = Integer.parseInt(maxPrayer1);
  12986.         prayer = (int) (((double) currentPrayer / (double) maxPrayer) * 100D);
  12987.         int prayPercent = currentPrayer * 34 / maxPrayer;
  12988.         Sprite orbDrawn = emptyOrb;
  12989.         orbDrawn.drawSprite(184, 49);
  12990.         orbDrawn = new Sprite("emptyorb", 57, 34 - prayPercent);
  12991.         prayerFill.drawSprite(187, 52);
  12992.         orbDrawn.drawSprite(184, 49);
  12993.         double fillPray;
  12994.         double percent = (prayer / 100d);
  12995.         fillPray = 27 * percent;
  12996.         int depleteFill = 27 - (int) fillPray;
  12997.         int col = 65280;
  12998.         if (prayer >= 75)
  12999.             col = 65280;
  13000.         else if (prayer >= 50)
  13001.             col = 0xffff00;
  13002.         else if (prayer >= 25)
  13003.             col = 0xfca607;
  13004.         else
  13005.             col = 0xf50d0d;
  13006.         smallText.method382(col, 227, cP, 75, true);
  13007.         // prayerFill.myHeight = depleteFill;
  13008.         // prayerFill.height = depleteFill;
  13009.         // prayerFill.drawSprite(187, 52);
  13010.         prayerIcon.drawSprite(191, 56);
  13011.         } catch(Exception e){
  13012.        
  13013.         }
  13014.     }
  13015.  
  13016.     private void drawMinimap() {
  13017.         aRSImageProducer_1164.initDrawingArea();
  13018.         if (anInt1021 == 2) {
  13019.             byte abyte0[] = mapBack.aByteArray1450;
  13020.             int ai[] = DrawingArea.pixels;
  13021.             int k2 = abyte0.length;
  13022.             for (int i5 = 0; i5 < k2; i5++)
  13023.                 if (abyte0[i5] == 0)
  13024.                     ai[i5] = 0;
  13025.             compass.method352(33, minimapInt1, anIntArray1057, 256,
  13026.                     anIntArray968, 25, 8, 8, 33, 25);
  13027.             aRSImageProducer_1165.initDrawingArea();
  13028.             return;
  13029.         }
  13030.         int i = minimapInt1 + minimapInt2 & 0x7ff;
  13031.         int j = 48 + myPlayer.x / 32;
  13032.         int l2 = 464 - myPlayer.y / 32;
  13033.         for (int x = 0; x < anIntArray1229.length; x++) {
  13034.             anIntArray1229[x] = 170;
  13035.             anIntArray1052[x] = -23;
  13036.         }
  13037.         aClass30_Sub2_Sub1_Sub1_1263.method352(151, i, anIntArray1229,
  13038.                 256 + minimapInt3, anIntArray1052, l2, 10, 45, 146, j);
  13039.         compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968,
  13040.                 25, 8, 8, 33, 25);
  13041.         for (int j5 = 0; j5 < anInt1071; j5++) {
  13042.             int k = (anIntArray1072[j5] * 4 + 2) - myPlayer.x / 32;
  13043.             int i3 = (anIntArray1073[j5] * 4 + 2) - myPlayer.y / 32;
  13044.             markMinimap(aClass30_Sub2_Sub1_Sub1Array1140[j5], k, i3);
  13045.         }
  13046.  
  13047.         for (int k5 = 0; k5 < 104; k5++) {
  13048.             for (int l5 = 0; l5 < 104; l5++) {
  13049.                 NodeList class19 = groundArray[plane][k5][l5];
  13050.                 if (class19 != null) {
  13051.                     int l = (k5 * 4 + 2) - myPlayer.x / 32;
  13052.                     int j3 = (l5 * 4 + 2) - myPlayer.y / 32;
  13053.                     markMinimap(mapDotItem, l, j3);
  13054.                 }
  13055.             }
  13056.         }
  13057.  
  13058.         for (int i6 = 0; i6 < npcCount; i6++) {
  13059.             NPC npc = npcArray[npcIndices[i6]];
  13060.             if (npc != null && npc.isVisible()) {
  13061.                 EntityDef entityDef = npc.desc;
  13062.                 if (entityDef.childrenIDs != null)
  13063.                     entityDef = entityDef.method161();
  13064.                 if (entityDef != null && entityDef.aBoolean87
  13065.                         && entityDef.aBoolean84) {
  13066.                     int i1 = npc.x / 32 - myPlayer.x / 32;
  13067.                     int k3 = npc.y / 32 - myPlayer.y / 32;
  13068.                     markMinimap(mapDotNPC, i1, k3);
  13069.                 }
  13070.             }
  13071.         }
  13072.  
  13073.         for (int j6 = 0; j6 < playerCount; j6++) {
  13074.             Player player = playerArray[playerIndices[j6]];
  13075.             if (player != null && player.isVisible()) {
  13076.                 int j1 = player.x / 32 - myPlayer.x / 32;
  13077.                 int l3 = player.y / 32 - myPlayer.y / 32;
  13078.                 boolean flag1 = false;
  13079.                 long l6 = TextClass.longForName(player.name);
  13080.                 int BLStatus = -1;
  13081.  
  13082.                 for (int k6 = 0; k6 < friendsCount; k6++) {
  13083.                     if (l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0)
  13084.                         continue;
  13085.                     flag1 = true;
  13086.                     break;
  13087.                 }
  13088.                 boolean flag2 = false;
  13089.                 boolean hasTaken = false;
  13090.  
  13091.                 if (player.clan.equalsIgnoreCase(myPlayer.clan)
  13092.                         && !myPlayer.clan.equalsIgnoreCase(""))
  13093.                     BLStatus = 1;
  13094.  
  13095.                 if (myPlayer.team != 0 && player.team != 0
  13096.                         && myPlayer.team == player.team)
  13097.                     flag2 = true;
  13098.                 if (flag1) {
  13099.                     markMinimap(mapDotFriend, j1, l3);
  13100.                     hasTaken = true;
  13101.                 }
  13102.                 if (BLStatus != -1)
  13103.                     if (!hasTaken) {
  13104.                         markMinimap(mapDotBL, j1, l3);
  13105.                         hasTaken = true;
  13106.                     }
  13107.                 if (!hasTaken)
  13108.                     markMinimap(mapDotPlayer, j1, l3);
  13109.             }
  13110.         }
  13111.         if (anInt855 != 0 && loopCycle % 20 < 10) {
  13112.             if (anInt855 == 1 && anInt1222 >= 0 && anInt1222 < npcArray.length) {
  13113.                 NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  13114.                 if (class30_sub2_sub4_sub1_sub1_1 != null) {
  13115.                     int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32 - myPlayer.x
  13116.                             / 32;
  13117.                     int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32 - myPlayer.y
  13118.                             / 32;
  13119.                     method81(mapMarker, i4, k1);
  13120.                 }
  13121.             }
  13122.             if (anInt855 == 2) {
  13123.                 int l1 = ((anInt934 - baseX) * 4 + 2) - myPlayer.x / 32;
  13124.                 int j4 = ((anInt935 - baseY) * 4 + 2) - myPlayer.y / 32;
  13125.                 method81(mapMarker, j4, l1);
  13126.             }
  13127.             if (anInt855 == 10 && anInt933 >= 0
  13128.                     && anInt933 < playerArray.length) {
  13129.                 Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  13130.                 if (class30_sub2_sub4_sub1_sub2_1 != null) {
  13131.                     int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32 - myPlayer.x
  13132.                             / 32;
  13133.                     int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32 - myPlayer.y
  13134.                             / 32;
  13135.                     method81(mapMarker, k4, i2);
  13136.                 }
  13137.             }
  13138.         }
  13139.         if (destX != 0) {
  13140.             int j2 = (destX * 4 + 2) - myPlayer.x / 32;
  13141.             int l4 = (destY * 4 + 2) - myPlayer.y / 32;
  13142.             markMinimap(mapFlag, j2, l4);
  13143.         }
  13144.         DrawingArea.drawPixels(3, 78 + 5, 97 + 20, 0xffffff, 3);
  13145.         mapArea.drawSprite(0, 0);
  13146.         drawHPOrb();
  13147.         drawPrayerOrb();
  13148.         // drawRun();
  13149.         if (menuOpen && menuScreenArea == 3) {
  13150.             drawMenu();
  13151.         }
  13152.         drawXPCounter();
  13153.         drawLogoutButton();
  13154.         drawWorldMapButton();
  13155.         aRSImageProducer_1165.initDrawingArea();
  13156.     }
  13157.  
  13158.     public Sprite sprite1;
  13159.     public Sprite xpx2;
  13160.     public Sprite xpFlag;
  13161.  
  13162.     public int xpToDraw = 0;
  13163.     public int testXp = 0;
  13164.     // public int tabHPos;
  13165.     Sprite xphover = new Sprite("xp_2");
  13166.     Sprite xpnormal = new Sprite("xp_0");
  13167.  
  13168.     public void drawXPOrbz() {
  13169.         if (super.mouseX >= 516 && super.mouseX <= 550 && super.mouseY >= 46
  13170.                 && super.mouseY <= 80) {
  13171.             xpHover = true;
  13172.         } else {
  13173.             xpHover = false;
  13174.         }
  13175.         if (super.clickMode3 == 1 && super.saveClickX >= 516
  13176.                 && super.saveClickX <= 550 && super.saveClickY >= 46
  13177.                 && super.saveClickY <= 80) {
  13178.             if (!xpClicked) {
  13179.                 xpClicked = true;
  13180.                 drawXpBar = true;
  13181.             } else {
  13182.                 xpClicked = false;
  13183.                 drawXpBar = false;
  13184.             }
  13185.         }
  13186.         if (!xpClicked) {
  13187.             if (!xpHover) {
  13188.                 xpnormal.drawSprite(0, 46);
  13189.             } else {
  13190.                 xphover.drawSprite(0, 46);
  13191.             }
  13192.         } else {
  13193.             if (!xpHover) {
  13194.                 xpnormal.drawSprite(0, 46);
  13195.             } else {
  13196.                 xphover.drawSprite(0, 46);
  13197.             }
  13198.         }
  13199.     }
  13200.  
  13201.     public void drawRun() {
  13202.         // String cEnergy =
  13203.         // RSInterface.interfaceCache[149].disabledMessage.replaceAll("%", "");
  13204.         String cEnergy = "100";
  13205.         // int currentEnergy = Integer.parseInt(cEnergy);
  13206.         int currentEnergy = 100;
  13207.         int energyPercent = currentEnergy * 34 / 100;
  13208.         Sprite drain = (runClicked ? cacheSprite[14] : cacheSprite[13]);
  13209.         Sprite icon = (runClicked ? cacheSprite[16] : cacheSprite[15]);
  13210.         cacheSprite[9].drawSprite(185, 85);
  13211.         if (super.mouseX > 701 && super.mouseX < 758 && super.mouseY > 83
  13212.                 && super.mouseY < 118)
  13213.             cacheSprite[10].drawSprite(185, 85);
  13214.         drain.drawSprite(188, 88);
  13215.         double fillRun;
  13216.         double percent = (currentEnergy / 100d);
  13217.         fillRun = 27 * percent;
  13218.         int depleteFill = 27 - (int) fillRun;
  13219.         int col = 65280;
  13220.         if (currentEnergy >= 75)
  13221.             col = 65280;
  13222.         else if (currentEnergy >= 50)
  13223.             col = 0xffff00;
  13224.         else if (currentEnergy >= 25)
  13225.             col = 0xfca607;
  13226.         else
  13227.             col = 0xf50d0d;
  13228.         smallText.method382(col, 227, cEnergy, 111, true);
  13229.         cacheSprite[28].myHeight = depleteFill;
  13230.         cacheSprite[28].height = depleteFill;
  13231.         cacheSprite[28].drawSprite(188, 88);
  13232.         icon.drawSprite(195, 93);
  13233.     }
  13234.  
  13235.     public void drawLogoutButton() {
  13236.         if (tabInterfaceIDs[9] != -1 && anInt1054 == 9)
  13237.             if (loopCycle % 20 >= 10)
  13238.                 ;
  13239.         sideIcons[9].drawSprite(223, 1);
  13240.         if (logIconHPos == 1) {
  13241.             logIconH.drawSprite(223, 1);
  13242.             if (tabID == 10)
  13243.                 logIconC.drawSprite(223, 1);
  13244.         }
  13245.     }
  13246.  
  13247.     public void drawWorldMapButton() {
  13248.         worldMapIcon.drawSprite(8, 124);
  13249.     }
  13250.  
  13251.     private void npcScreenPos(Entity entity, int i) {
  13252.         calcEntityScreenPos(entity.x, i, entity.y);
  13253.     }
  13254.  
  13255.     private void calcEntityScreenPos(int i, int j, int l) {
  13256.         if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  13257.             spriteDrawX = -1;
  13258.             spriteDrawY = -1;
  13259.             return;
  13260.         }
  13261.         int i1 = method42(plane, l, i) - j;
  13262.         i -= xCameraPos;
  13263.         i1 -= zCameraPos;
  13264.         l -= yCameraPos;
  13265.         int j1 = Model.modelIntArray1[yCameraCurve];
  13266.         int k1 = Model.modelIntArray2[yCameraCurve];
  13267.         int l1 = Model.modelIntArray1[xCameraCurve];
  13268.         int i2 = Model.modelIntArray2[xCameraCurve];
  13269.         int j2 = l * l1 + i * i2 >> 16;
  13270.         l = l * i2 - i * l1 >> 16;
  13271.         i = j2;
  13272.         j2 = i1 * k1 - l * j1 >> 16;
  13273.         l = i1 * j1 + l * k1 >> 16;
  13274.         i1 = j2;
  13275.         if (l >= 50) {
  13276.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  13277.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  13278.         } else {
  13279.             spriteDrawX = -1;
  13280.             spriteDrawY = -1;
  13281.         }
  13282.     }
  13283.  
  13284.     private void buildSplitPrivateChatMenu() {
  13285.         if (splitPrivateChat == 0)
  13286.             return;
  13287.         int i = 0;
  13288.         if (anInt1104 != 0)
  13289.             i = 1;
  13290.         for (int j = 0; j < 100; j++)
  13291.             if (chatMessages[j] != null) {
  13292.                 int k = chatTypes[j];
  13293.                 String s = chatNames[j];
  13294.                 boolean flag1 = false;
  13295.                 if (s != null && s.startsWith("@cr0@")) {
  13296.                     s = s.substring(5);
  13297.                     boolean flag2 = true;
  13298.                 }
  13299.                 if (s != null && s.startsWith("@cr1@")) {
  13300.                     s = s.substring(5);
  13301.                     byte byte0 = 2;
  13302.                 }
  13303.                 if (s != null && s.startsWith("@cr2@")) {
  13304.                     s = s.substring(5);
  13305.                     byte byte0 = 3;
  13306.                 }
  13307.                 if (s != null && s.startsWith("@cr3@")) {
  13308.                     s = s.substring(5);
  13309.                     byte byte0 = 4;
  13310.                 }
  13311.                 if (s != null && s.startsWith("@cr4@")) {
  13312.                     s = s.substring(5);
  13313.                     byte byte0 = 5;
  13314.                 }
  13315.                 if (s != null && s.startsWith("@cr5@")) {
  13316.                     s = s.substring(5);
  13317.                     byte byte0 = 6;
  13318.                 }
  13319.                 if (s != null && s.startsWith("@cr6@")) {
  13320.                     s = s.substring(5);
  13321.                     byte byte0 = 7;
  13322.                 }
  13323.                 if (s != null && s.startsWith("@cr7@")) {
  13324.                     s = s.substring(5);
  13325.                     byte byte0 = 8;
  13326.                 }
  13327.                 if (s != null && s.startsWith("@cr8@")) {
  13328.                     s = s.substring(5);
  13329.                     byte byte0 = 9;
  13330.                 }
  13331.                 if (s != null && s.startsWith("@cr9@")) {
  13332.                     s = s.substring(5);
  13333.                     byte byte0 = 10;
  13334.                 }
  13335.                 if (s != null && s.startsWith("@c10@")) {
  13336.                     s = s.substring(5);
  13337.                     byte byte0 = 13;
  13338.                 }
  13339.                 if (s != null && s.startsWith("@crA@")) {
  13340.                     s = s.substring(5);
  13341.                     byte byte0 = 11;
  13342.                 }
  13343.                 if ((k == 3 || k == 7)
  13344.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  13345.                                 && isFriendOrSelf(s))) {
  13346.                     int l = 329 - i * 13;
  13347.                     if (super.mouseX > 4 && super.mouseY - 4 > l - 10
  13348.                             && super.mouseY - 4 <= l + 3) {
  13349.                         int i1 = aTextDrawingArea_1271.getTextWidth("From:  "
  13350.                                 + s + chatMessages[j]) + 25;
  13351.                         if (i1 > 450)
  13352.                             i1 = 450;
  13353.                         if (super.mouseX < 4 + i1) {
  13354.                             if (myPrivilege >= 1) {
  13355.                                 menuActionName[menuActionRow] = "Report abuse @whi@"
  13356.                                         + s;
  13357.                                 menuActionID[menuActionRow] = 2606;
  13358.                                 menuActionRow++;
  13359.                             }
  13360.                             menuActionName[menuActionRow] = "Add ignore @whi@"
  13361.                                     + s;
  13362.                             menuActionID[menuActionRow] = 2042;
  13363.                             menuActionRow++;
  13364.                             menuActionName[menuActionRow] = "Reply to @whi@"
  13365.                                     + s;
  13366.                             menuActionID[menuActionRow] = 2639;
  13367.                             menuActionRow++;
  13368.                             menuActionName[menuActionRow] = "Add friend @whi@"
  13369.                                     + s;
  13370.                             menuActionID[menuActionRow] = 2337;
  13371.                             menuActionRow++;
  13372.                         }
  13373.                     }
  13374.                     if (++i >= 5)
  13375.                         return;
  13376.                 }
  13377.                 if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5)
  13378.                     return;
  13379.             }
  13380.  
  13381.     }
  13382.  
  13383.     private void method130(int j, int k, int l, int i1, int j1, int k1, int l1,
  13384.             int i2, int j2) {
  13385.         Class30_Sub1 class30_sub1 = null;
  13386.         for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13387.                 .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13388.                 .reverseGetNext()) {
  13389.             if (class30_sub1_1.anInt1295 != l1
  13390.                     || class30_sub1_1.anInt1297 != i2
  13391.                     || class30_sub1_1.anInt1298 != j1
  13392.                     || class30_sub1_1.anInt1296 != i1)
  13393.                 continue;
  13394.             class30_sub1 = class30_sub1_1;
  13395.             break;
  13396.         }
  13397.  
  13398.         if (class30_sub1 == null) {
  13399.             class30_sub1 = new Class30_Sub1();
  13400.             class30_sub1.anInt1295 = l1;
  13401.             class30_sub1.anInt1296 = i1;
  13402.             class30_sub1.anInt1297 = i2;
  13403.             class30_sub1.anInt1298 = j1;
  13404.             method89(class30_sub1);
  13405.             aClass19_1179.insertHead(class30_sub1);
  13406.         }
  13407.         class30_sub1.anInt1291 = k;
  13408.         class30_sub1.anInt1293 = k1;
  13409.         class30_sub1.anInt1292 = l;
  13410.         class30_sub1.anInt1302 = j2;
  13411.         class30_sub1.anInt1294 = j;
  13412.     }
  13413.  
  13414.     private boolean interfaceIsSelected(RSInterface class9) {
  13415.         if (class9.anIntArray245 == null)
  13416.             return false;
  13417.         for (int i = 0; i < class9.anIntArray245.length; i++) {
  13418.             int j = extractInterfaceValues(class9, i);
  13419.             int k = class9.anIntArray212[i];
  13420.             if (class9.anIntArray245[i] == 2) {
  13421.                 if (j >= k)
  13422.                     return false;
  13423.             } else if (class9.anIntArray245[i] == 3) {
  13424.                 if (j <= k)
  13425.                     return false;
  13426.             } else if (class9.anIntArray245[i] == 4) {
  13427.                 if (j == k)
  13428.                     return false;
  13429.             } else if (j != k)
  13430.                 return false;
  13431.         }
  13432.  
  13433.         return true;
  13434.     }
  13435.  
  13436.     private DataInputStream openJagGrabInputStream(String s) throws IOException {
  13437.         // if(!aBoolean872)
  13438.         // if(signlink.mainapp != null)
  13439.         // return signlink.openurl(s);
  13440.         // else
  13441.         // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  13442.         if (aSocket832 != null) {
  13443.             try {
  13444.                 aSocket832.close();
  13445.             } catch (Exception _ex) {
  13446.             }
  13447.             aSocket832 = null;
  13448.         }
  13449.         aSocket832 = openSocket(43595);
  13450.         aSocket832.setSoTimeout(10000);
  13451.         java.io.InputStream inputstream = aSocket832.getInputStream();
  13452.         OutputStream outputstream = aSocket832.getOutputStream();
  13453.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  13454.         return new DataInputStream(inputstream);
  13455.     }
  13456.  
  13457.     private void doFlamesDrawing() {
  13458.         char c = '\u0100';
  13459.         if (anInt1040 > 0) {
  13460.             for (int i = 0; i < 256; i++)
  13461.                 if (anInt1040 > 768)
  13462.                     anIntArray850[i] = method83(anIntArray851[i],
  13463.                             anIntArray852[i], 1024 - anInt1040);
  13464.                 else if (anInt1040 > 256)
  13465.                     anIntArray850[i] = anIntArray852[i];
  13466.                 else
  13467.                     anIntArray850[i] = method83(anIntArray852[i],
  13468.                             anIntArray851[i], 256 - anInt1040);
  13469.  
  13470.         } else if (anInt1041 > 0) {
  13471.             for (int j = 0; j < 256; j++)
  13472.                 if (anInt1041 > 768)
  13473.                     anIntArray850[j] = method83(anIntArray851[j],
  13474.                             anIntArray853[j], 1024 - anInt1041);
  13475.                 else if (anInt1041 > 256)
  13476.                     anIntArray850[j] = anIntArray853[j];
  13477.                 else
  13478.                     anIntArray850[j] = method83(anIntArray853[j],
  13479.                             anIntArray851[j], 256 - anInt1041);
  13480.  
  13481.         } else {
  13482.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  13483.  
  13484.         }
  13485.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0,
  13486.                 aRSImageProducer_1110.anIntArray315, 0, 33920);
  13487.  
  13488.         int i1 = 0;
  13489.         int j1 = 1152;
  13490.         for (int k1 = 1; k1 < c - 1; k1++) {
  13491.             int l1 = (anIntArray969[k1] * (c - k1)) / c;
  13492.             int j2 = 22 + l1;
  13493.             if (j2 < 0)
  13494.                 j2 = 0;
  13495.             i1 += j2;
  13496.             for (int l2 = j2; l2 < 128; l2++) {
  13497.                 int j3 = anIntArray828[i1++];
  13498.                 if (j3 != 0) {
  13499.                     int l3 = j3;
  13500.                     int j4 = 256 - j3;
  13501.                     j3 = anIntArray850[j3];
  13502.                     int l4 = aRSImageProducer_1110.anIntArray315[j1];
  13503.                     aRSImageProducer_1110.anIntArray315[j1++] = ((j3 & 0xff00ff)
  13504.                             * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00)
  13505.                             + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  13506.                 } else {
  13507.                     j1++;
  13508.                 }
  13509.             }
  13510.  
  13511.             j1 += j2;
  13512.         }
  13513.  
  13514.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  13515.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0,
  13516.                 aRSImageProducer_1111.anIntArray315, 0, 33920);
  13517.  
  13518.         i1 = 0;
  13519.         j1 = 1176;
  13520.         for (int k2 = 1; k2 < c - 1; k2++) {
  13521.             int i3 = (anIntArray969[k2] * (c - k2)) / c;
  13522.             int k3 = 103 - i3;
  13523.             j1 += i3;
  13524.             for (int i4 = 0; i4 < k3; i4++) {
  13525.                 int k4 = anIntArray828[i1++];
  13526.                 if (k4 != 0) {
  13527.                     int i5 = k4;
  13528.                     int j5 = 256 - k4;
  13529.                     k4 = anIntArray850[k4];
  13530.                     int k5 = aRSImageProducer_1111.anIntArray315[j1];
  13531.                     aRSImageProducer_1111.anIntArray315[j1++] = ((k4 & 0xff00ff)
  13532.                             * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00)
  13533.                             + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  13534.                 } else {
  13535.                     j1++;
  13536.                 }
  13537.             }
  13538.  
  13539.             i1 += 128 - k3;
  13540.             j1 += 128 - k3 - i3;
  13541.         }
  13542.  
  13543.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  13544.     }
  13545.  
  13546.     private void method134(Stream stream) {
  13547.         int j = stream.readBits(8);
  13548.         if (j < playerCount) {
  13549.             for (int k = j; k < playerCount; k++)
  13550.                 anIntArray840[anInt839++] = playerIndices[k];
  13551.  
  13552.         }
  13553.         if (j > playerCount) {
  13554.             signlink.reporterror(myUsername + " Too many players");
  13555.             throw new RuntimeException("eek");
  13556.         }
  13557.         playerCount = 0;
  13558.         for (int l = 0; l < j; l++) {
  13559.             int i1 = playerIndices[l];
  13560.             Player player = playerArray[i1];
  13561.             int j1 = stream.readBits(1);
  13562.             if (j1 == 0) {
  13563.                 playerIndices[playerCount++] = i1;
  13564.                 player.anInt1537 = loopCycle;
  13565.             } else {
  13566.                 int k1 = stream.readBits(2);
  13567.                 if (k1 == 0) {
  13568.                     playerIndices[playerCount++] = i1;
  13569.                     player.anInt1537 = loopCycle;
  13570.                     anIntArray894[anInt893++] = i1;
  13571.                 } else if (k1 == 1) {
  13572.                     playerIndices[playerCount++] = i1;
  13573.                     player.anInt1537 = loopCycle;
  13574.                     int l1 = stream.readBits(3);
  13575.                     player.moveInDir(false, l1);
  13576.                     int j2 = stream.readBits(1);
  13577.                     if (j2 == 1)
  13578.                         anIntArray894[anInt893++] = i1;
  13579.                 } else if (k1 == 2) {
  13580.                     playerIndices[playerCount++] = i1;
  13581.                     player.anInt1537 = loopCycle;
  13582.                     int i2 = stream.readBits(3);
  13583.                     player.moveInDir(true, i2);
  13584.                     int k2 = stream.readBits(3);
  13585.                     player.moveInDir(true, k2);
  13586.                     int l2 = stream.readBits(1);
  13587.                     if (l2 == 1)
  13588.                         anIntArray894[anInt893++] = i1;
  13589.                 } else if (k1 == 3)
  13590.                     anIntArray840[anInt839++] = i1;
  13591.             }
  13592.         }
  13593.     }
  13594.  
  13595.     int w = 0;
  13596.     int h = 0;
  13597.     int world = 1;
  13598.  
  13599.     private void drawLoginScreen(boolean flag) {
  13600.         resetImageProducers();
  13601.         aRSImageProducer_1109.initDrawingArea();
  13602.         aBackground_966.method361(0, 0);
  13603.         char c = '\u0168';
  13604.         char c1 = '\310';
  13605.         if (loginScreenState == 0) {
  13606.             int i = c1 / 2 + 80;
  13607.             smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString,
  13608.                     i, true);
  13609.             i = c1 / 2 - 20;
  13610.             chatTextDrawingArea.method382(0xffff00, c / 2,
  13611.                     "Welcome to DarkWorldPk - the new era", i, true);
  13612.             i += 30;
  13613.             int l = c / 2 - 80;
  13614.             int k1 = c1 / 2 + 20;
  13615.             aBackground_967.method361(l - 73, k1 - 20);
  13616.             chatTextDrawingArea.method382(0xffffff, l, "Info", k1 + 5, true);
  13617.             l = c / 2 + 80;
  13618.             aBackground_967.method361(l - 73, k1 - 20);
  13619.             chatTextDrawingArea.method382(0xffffff, l, "Logon", k1 + 5, true);
  13620.         }
  13621.         if (loginScreenState == 2)// || loginScreenState == 0)
  13622.         {
  13623.             int j = c1 / 2 - 40;
  13624.             if (loginMessage1.length() > 0) {
  13625.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1,
  13626.                         j - 15, true);
  13627.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  13628.                         j, true);
  13629.                 j += 30;
  13630.             } else {
  13631.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  13632.                         j - 7, true);
  13633.                 j += 30;
  13634.             }
  13635.             w = (c / 2) - 38;
  13636.             h = j - 15;
  13637.             switch (world) {
  13638.             case 1:
  13639.                 w = (c / 2) + 5;
  13640.                 h = j - 15;
  13641.                 chatTextDrawingArea.method382(0xffffFF, w,
  13642.                         "World: @red@(1) Main World", h, true);
  13643.                 break;
  13644.             case 2:
  13645.                 w = (c / 2) + 5;
  13646.                 h = j - 15;
  13647.                 chatTextDrawingArea.method382(0xffffFF, w,
  13648.                         "World: @red@(2) Developer World", h, true);
  13649.                 break;
  13650.  
  13651.             }
  13652.             chatTextDrawingArea
  13653.                     .method389(true, c / 2 - 90, 0xffffff, "Username: "
  13654.                             + myUsername
  13655.                             + ((loginScreenCursorPos == 0)
  13656.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  13657.             j += 15;
  13658.             chatTextDrawingArea
  13659.                     .method389(true, c / 2 - 88, 0xffffff, "Password: "
  13660.                             + TextClass.passwordAsterisks(myPassword)
  13661.                             + ((loginScreenCursorPos == 1)
  13662.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  13663.             j += 15;
  13664.             if (!flag) {
  13665.                 int i1 = c / 2 - 80;
  13666.                 int l1 = c1 / 2 + 50;
  13667.                 aBackground_967.method361(i1 - 73, l1 - 20);
  13668.                 chatTextDrawingArea.method382(0xffffff, i1, "Login", l1 + 5,
  13669.                         true);
  13670.                 i1 = c / 2 + 80;
  13671.                 aBackground_967.method361(i1 - 73, l1 - 20);
  13672.                 chatTextDrawingArea.method382(0xffffff, i1,
  13673.                         "Select Next World?", l1 + 5, true);
  13674.             }
  13675.         }
  13676.         if (loginScreenState == 3) {
  13677.             chatTextDrawingArea.method382(0xffff00, c / 2,
  13678.                     "Create a free account", c1 / 2 - 60, true);
  13679.             int k = c1 / 2 - 35;
  13680.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13681.                     "To create a new account you need to", k, true);
  13682.             k += 15;
  13683.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13684.                     "just enter a user name and password", k, true);
  13685.             k += 15;
  13686.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13687.                     "that you wish to use.", k, true);
  13688.             k += 15;
  13689.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13690.                     "Forums: http://www.Vanityrsps.com", k, true);
  13691.             k += 15;
  13692.             int j1 = c / 2;
  13693.             int i2 = c1 / 2 + 50;
  13694.             aBackground_967.method361(j1 - 73, i2 - 20);
  13695.             chatTextDrawingArea.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  13696.         }
  13697.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  13698.         if (welcomeScreenRaised) {
  13699.             welcomeScreenRaised = false;
  13700.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  13701.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  13702.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  13703.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  13704.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  13705.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  13706.         }
  13707.     }
  13708.  
  13709.     private void drawFlames() {
  13710.         drawingFlames = true;
  13711.         try {
  13712.             long l = System.currentTimeMillis();
  13713.             int i = 0;
  13714.             int j = 20;
  13715.             while (aBoolean831) {
  13716.                 anInt1208++;
  13717.                 // calcFlamesPosition();
  13718.                 // calcFlamesPosition();
  13719.                 doFlamesDrawing();
  13720.                 if (++i > 10) {
  13721.                     long l1 = System.currentTimeMillis();
  13722.                     int k = (int) (l1 - l) / 10 - j;
  13723.                     j = 40 - k;
  13724.                     if (j < 5)
  13725.                         j = 5;
  13726.                     i = 0;
  13727.                     l = l1;
  13728.                 }
  13729.                 try {
  13730.                     Thread.sleep(j);
  13731.                 } catch (Exception _ex) {
  13732.                 }
  13733.             }
  13734.         } catch (Exception _ex) {
  13735.         }
  13736.         drawingFlames = false;
  13737.     }
  13738.  
  13739.     public void raiseWelcomeScreen() {
  13740.         welcomeScreenRaised = true;
  13741.     }
  13742.  
  13743.     private void method137(Stream stream, int j) {
  13744.         if (j == 84) {
  13745.             int k = stream.readUnsignedByte();
  13746.             int j3 = anInt1268 + (k >> 4 & 7);
  13747.             int i6 = anInt1269 + (k & 7);
  13748.             int l8 = stream.readUnsignedWord();
  13749.             int k11 = stream.readUnsignedWord();
  13750.             int l13 = stream.readUnsignedWord();
  13751.             if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  13752.                 NodeList class19_1 = groundArray[plane][j3][i6];
  13753.                 if (class19_1 != null) {
  13754.                     for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1
  13755.                             .reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1
  13756.                             .reverseGetNext()) {
  13757.                         if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff)
  13758.                                 || class30_sub2_sub4_sub2_3.anInt1559 != k11)
  13759.                             continue;
  13760.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  13761.                         break;
  13762.                     }
  13763.  
  13764.                     spawnGroundItem(j3, i6);
  13765.                 }
  13766.             }
  13767.             return;
  13768.         }
  13769.         if (j == 105) {
  13770.             int l = stream.readUnsignedByte();
  13771.             int k3 = anInt1268 + (l >> 4 & 7);
  13772.             int j6 = anInt1269 + (l & 7);
  13773.             int i9 = stream.readUnsignedWord();
  13774.             int l11 = stream.readUnsignedByte();
  13775.             int i14 = l11 >> 4 & 0xf;
  13776.             int i16 = l11 & 7;
  13777.             if (myPlayer.smallX[0] >= k3 - i14
  13778.                     && myPlayer.smallX[0] <= k3 + i14
  13779.                     && myPlayer.smallY[0] >= j6 - i14
  13780.                     && myPlayer.smallY[0] <= j6 + i14 && aBoolean848 && !lowMem
  13781.                     && anInt1062 < 50) {
  13782.                 anIntArray1207[anInt1062] = i9;
  13783.                 anIntArray1241[anInt1062] = i16;
  13784.                 anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  13785.                 anInt1062++;
  13786.             }
  13787.         }
  13788.         if (j == 215) {
  13789.             int i1 = stream.method435();
  13790.             int l3 = stream.method428();
  13791.             int k6 = anInt1268 + (l3 >> 4 & 7);
  13792.             int j9 = anInt1269 + (l3 & 7);
  13793.             int i12 = stream.method435();
  13794.             int j14 = stream.readUnsignedWord();
  13795.             if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104
  13796.                     && i12 != unknownInt10) {
  13797.                 Item class30_sub2_sub4_sub2_2 = new Item();
  13798.                 class30_sub2_sub4_sub2_2.ID = i1;
  13799.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  13800.                 if (groundArray[plane][k6][j9] == null)
  13801.                     groundArray[plane][k6][j9] = new NodeList();
  13802.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  13803.                 spawnGroundItem(k6, j9);
  13804.             }
  13805.             return;
  13806.         }
  13807.         if (j == 156) {
  13808.             int j1 = stream.method426();
  13809.             int i4 = anInt1268 + (j1 >> 4 & 7);
  13810.             int l6 = anInt1269 + (j1 & 7);
  13811.             int k9 = stream.readUnsignedWord();
  13812.             if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  13813.                 NodeList class19 = groundArray[plane][i4][l6];
  13814.                 if (class19 != null) {
  13815.                     for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  13816.                             .reverseGetNext()) {
  13817.                         if (item.ID != (k9 & 0x7fff))
  13818.                             continue;
  13819.                         item.unlink();
  13820.                         break;
  13821.                     }
  13822.  
  13823.                     if (class19.reverseGetFirst() == null)
  13824.                         groundArray[plane][i4][l6] = null;
  13825.                     spawnGroundItem(i4, l6);
  13826.                 }
  13827.             }
  13828.             return;
  13829.         }
  13830.         if (j == 160) {
  13831.             int k1 = stream.method428();
  13832.             int j4 = anInt1268 + (k1 >> 4 & 7);
  13833.             int i7 = anInt1269 + (k1 & 7);
  13834.             int l9 = stream.method428();
  13835.             int j12 = l9 >> 2;
  13836.             int k14 = l9 & 3;
  13837.             int j16 = anIntArray1177[j12];
  13838.             int j17 = stream.method435();
  13839.             if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  13840.                 int j18 = intGroundArray[plane][j4][i7];
  13841.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  13842.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  13843.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  13844.                 if (j16 == 0) {
  13845.                     Object1 class10 = worldController.method296(plane, j4, i7);
  13846.                     if (class10 != null) {
  13847.                         int k21 = class10.uid >> 14 & 0x7fff;
  13848.                         if (j12 == 2) {
  13849.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  13850.                                     k21, 4 + k14, 2, i19, l19, j18, k20, j17,
  13851.                                     false);
  13852.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(
  13853.                                     k21, k14 + 1 & 3, 2, i19, l19, j18, k20,
  13854.                                     j17, false);
  13855.                         } else {
  13856.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  13857.                                     k21, k14, j12, i19, l19, j18, k20, j17,
  13858.                                     false);
  13859.                         }
  13860.                     }
  13861.                 }
  13862.                 if (j16 == 1) {
  13863.                     Object2 class26 = worldController.method297(j4, i7, plane);
  13864.                     if (class26 != null)
  13865.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(
  13866.                                 class26.uid >> 14 & 0x7fff, 0, 4, i19, l19,
  13867.                                 j18, k20, j17, false);
  13868.                 }
  13869.                 if (j16 == 2) {
  13870.                     Object5 class28 = worldController.method298(j4, i7, plane);
  13871.                     if (j12 == 11)
  13872.                         j12 = 10;
  13873.                     if (class28 != null)
  13874.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(
  13875.                                 class28.uid >> 14 & 0x7fff, k14, j12, i19, l19,
  13876.                                 j18, k20, j17, false);
  13877.                 }
  13878.                 if (j16 == 3) {
  13879.                     Object3 class49 = worldController.method299(i7, j4, plane);
  13880.                     if (class49 != null)
  13881.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(
  13882.                                 class49.uid >> 14 & 0x7fff, k14, 22, i19, l19,
  13883.                                 j18, k20, j17, false);
  13884.                 }
  13885.             }
  13886.             return;
  13887.         }
  13888.         if (j == 147) {
  13889.             int l1 = stream.method428();
  13890.             int k4 = anInt1268 + (l1 >> 4 & 7);
  13891.             int j7 = anInt1269 + (l1 & 7);
  13892.             int i10 = stream.readUnsignedWord();
  13893.             byte byte0 = stream.method430();
  13894.             int l14 = stream.method434();
  13895.             byte byte1 = stream.method429();
  13896.             int k17 = stream.readUnsignedWord();
  13897.             int k18 = stream.method428();
  13898.             int j19 = k18 >> 2;
  13899.             int i20 = k18 & 3;
  13900.             int l20 = anIntArray1177[j19];
  13901.             byte byte2 = stream.readSignedByte();
  13902.             int l21 = stream.readUnsignedWord();
  13903.             byte byte3 = stream.method429();
  13904.             Player player;
  13905.             if (i10 == unknownInt10)
  13906.                 player = myPlayer;
  13907.             else
  13908.                 player = playerArray[i10];
  13909.             if (player != null) {
  13910.                 ObjectDef class46 = ObjectDef.forID(l21);
  13911.                 int i22 = intGroundArray[plane][k4][j7];
  13912.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  13913.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  13914.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  13915.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22,
  13916.                         -1);
  13917.                 if (model != null) {
  13918.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  13919.                     player.anInt1707 = l14 + loopCycle;
  13920.                     player.anInt1708 = k17 + loopCycle;
  13921.                     player.aModel_1714 = model;
  13922.                     int i23 = class46.anInt744;
  13923.                     int j23 = class46.anInt761;
  13924.                     if (i20 == 1 || i20 == 3) {
  13925.                         i23 = class46.anInt761;
  13926.                         j23 = class46.anInt744;
  13927.                     }
  13928.                     player.anInt1711 = k4 * 128 + i23 * 64;
  13929.                     player.anInt1713 = j7 * 128 + j23 * 64;
  13930.                     player.anInt1712 = method42(plane, player.anInt1713,
  13931.                             player.anInt1711);
  13932.                     if (byte2 > byte0) {
  13933.                         byte byte4 = byte2;
  13934.                         byte2 = byte0;
  13935.                         byte0 = byte4;
  13936.                     }
  13937.                     if (byte3 > byte1) {
  13938.                         byte byte5 = byte3;
  13939.                         byte3 = byte1;
  13940.                         byte1 = byte5;
  13941.                     }
  13942.                     player.anInt1719 = k4 + byte2;
  13943.                     player.anInt1721 = k4 + byte0;
  13944.                     player.anInt1720 = j7 + byte3;
  13945.                     player.anInt1722 = j7 + byte1;
  13946.                 }
  13947.             }
  13948.         }
  13949.         if (j == 151) {
  13950.             int i2 = stream.method426();
  13951.             int l4 = anInt1268 + (i2 >> 4 & 7);
  13952.             int k7 = anInt1269 + (i2 & 7);
  13953.             int j10 = stream.method434();
  13954.             int k12 = stream.method428();
  13955.             int i15 = k12 >> 2;
  13956.             int k16 = k12 & 3;
  13957.             int l17 = anIntArray1177[i15];
  13958.             if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  13959.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  13960.             return;
  13961.         }
  13962.         if (j == 4) {
  13963.             int j2 = stream.readUnsignedByte();
  13964.             int i5 = anInt1268 + (j2 >> 4 & 7);
  13965.             int l7 = anInt1269 + (j2 & 7);
  13966.             int k10 = stream.readUnsignedWord();
  13967.             int l12 = stream.readUnsignedByte();
  13968.             int j15 = stream.readUnsignedWord();
  13969.             if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  13970.                 i5 = i5 * 128 + 64;
  13971.                 l7 = l7 * 128 + 64;
  13972.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane,
  13973.                         loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7,
  13974.                         i5);
  13975.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  13976.             }
  13977.             return;
  13978.         }
  13979.         if (j == 44) {
  13980.             int k2 = stream.method436();
  13981.             int j5 = stream.readUnsignedWord();
  13982.             int i8 = stream.readUnsignedByte();
  13983.             int l10 = anInt1268 + (i8 >> 4 & 7);
  13984.             int i13 = anInt1269 + (i8 & 7);
  13985.             if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  13986.                 Item class30_sub2_sub4_sub2_1 = new Item();
  13987.                 class30_sub2_sub4_sub2_1.ID = k2;
  13988.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  13989.                 if (groundArray[plane][l10][i13] == null)
  13990.                     groundArray[plane][l10][i13] = new NodeList();
  13991.                 groundArray[plane][l10][i13]
  13992.                         .insertHead(class30_sub2_sub4_sub2_1);
  13993.                 spawnGroundItem(l10, i13);
  13994.             }
  13995.             return;
  13996.         }
  13997.         if (j == 101) {
  13998.             int l2 = stream.method427();
  13999.             int k5 = l2 >> 2;
  14000.             int j8 = l2 & 3;
  14001.             int i11 = anIntArray1177[k5];
  14002.             int j13 = stream.readUnsignedByte();
  14003.             int k15 = anInt1268 + (j13 >> 4 & 7);
  14004.             int l16 = anInt1269 + (j13 & 7);
  14005.             if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  14006.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  14007.             return;
  14008.         }
  14009.         if (j == 117) {
  14010.             int i3 = stream.readUnsignedByte();
  14011.             int l5 = anInt1268 + (i3 >> 4 & 7);
  14012.             int k8 = anInt1269 + (i3 & 7);
  14013.             int j11 = l5 + stream.readSignedByte();
  14014.             int k13 = k8 + stream.readSignedByte();
  14015.             int l15 = stream.readSignedWord();
  14016.             int i17 = stream.readUnsignedWord();
  14017.             int i18 = stream.readUnsignedByte() * 4;
  14018.             int l18 = stream.readUnsignedByte() * 4;
  14019.             int k19 = stream.readUnsignedWord();
  14020.             int j20 = stream.readUnsignedWord();
  14021.             int i21 = stream.readUnsignedByte();
  14022.             int j21 = stream.readUnsignedByte();
  14023.             if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0
  14024.                     && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
  14025.                 l5 = l5 * 128 + 64;
  14026.                 k8 = k8 * 128 + 64;
  14027.                 j11 = j11 * 128 + 64;
  14028.                 k13 = k13 * 128 + 64;
  14029.                 Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21,
  14030.                         l18, k19 + loopCycle, j20 + loopCycle, j21, plane,
  14031.                         method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  14032.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13,
  14033.                         method42(plane, k13, j11) - l18, j11);
  14034.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  14035.             }
  14036.         }
  14037.     }
  14038.  
  14039.     private static void setLowMem() {
  14040.         WorldController.lowMem = true;
  14041.         Texture.lowMem = true;
  14042.         lowMem = true;
  14043.         ObjectManager.lowMem = true;
  14044.         ObjectDef.lowMem = true;
  14045.         System.out.println("Running in lowmem");
  14046.     }
  14047.  
  14048.     private void method139(Stream stream) {
  14049.         stream.initBitAccess();
  14050.         int k = stream.readBits(8);
  14051.         if (k < npcCount) {
  14052.             for (int l = k; l < npcCount; l++)
  14053.                 anIntArray840[anInt839++] = npcIndices[l];
  14054.  
  14055.         }
  14056.         if (k > npcCount) {
  14057.             signlink.reporterror(myUsername + " Too many npcs");
  14058.             throw new RuntimeException("eek");
  14059.         }
  14060.         npcCount = 0;
  14061.         for (int i1 = 0; i1 < k; i1++) {
  14062.             int j1 = npcIndices[i1];
  14063.             NPC npc = npcArray[j1];
  14064.             int k1 = stream.readBits(1);
  14065.             if (k1 == 0) {
  14066.                 npcIndices[npcCount++] = j1;
  14067.                 npc.anInt1537 = loopCycle;
  14068.             } else {
  14069.                 int l1 = stream.readBits(2);
  14070.                 if (l1 == 0) {
  14071.                     npcIndices[npcCount++] = j1;
  14072.                     npc.anInt1537 = loopCycle;
  14073.                     anIntArray894[anInt893++] = j1;
  14074.                 } else if (l1 == 1) {
  14075.                     npcIndices[npcCount++] = j1;
  14076.                     npc.anInt1537 = loopCycle;
  14077.                     int i2 = stream.readBits(3);
  14078.                     npc.moveInDir(false, i2);
  14079.                     int k2 = stream.readBits(1);
  14080.                     if (k2 == 1)
  14081.                         anIntArray894[anInt893++] = j1;
  14082.                 } else if (l1 == 2) {
  14083.                     npcIndices[npcCount++] = j1;
  14084.                     npc.anInt1537 = loopCycle;
  14085.                     int j2 = stream.readBits(3);
  14086.                     npc.moveInDir(true, j2);
  14087.                     int l2 = stream.readBits(3);
  14088.                     npc.moveInDir(true, l2);
  14089.                     int i3 = stream.readBits(1);
  14090.                     if (i3 == 1)
  14091.                         anIntArray894[anInt893++] = j1;
  14092.                 } else if (l1 == 3)
  14093.                     anIntArray840[anInt839++] = j1;
  14094.             }
  14095.         }
  14096.  
  14097.     }
  14098.     private String pastNum = "Enter a name";
  14099.  
  14100.     int port = 0;
  14101.     private String hcServers[] = { "69.65.44.57", "69.39.238.176",
  14102.             "69.65.45.225", "69.65.45.233", "69.39.238.183" };
  14103.     private String realServers[] = { "69.65.44.57", "69.39.238.176",
  14104.             "69.65.45.225", "69.65.45.233", "69.39.238.183" };
  14105.  
  14106.     private void processLoginScreenInput() {
  14107.         if (loginScreenState == 0) {
  14108.             int i = super.myWidth / 2 - 80;
  14109.             int l = super.myHeight / 2 + 20;
  14110.             l += 20;
  14111.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  14112.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  14113.                     && super.saveClickY <= l + 20) {
  14114.                 loginScreenState = 3;
  14115.                 loginScreenCursorPos = 0;
  14116.             }
  14117.             i = super.myWidth / 2 + 80;
  14118.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  14119.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  14120.                     && super.saveClickY <= l + 20) {
  14121.                 loginMessage1 = "";
  14122.                 loginMessage2 = "Enter your username & password.";
  14123.                 loginScreenState = 2;
  14124.                 loginScreenCursorPos = 0;
  14125.             }
  14126.         } else {
  14127.             if (loginScreenState == 2) {
  14128.                 int j = super.myHeight / 2 - 40;
  14129.                 j += 30;
  14130.                 j += 25;
  14131.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  14132.                         && super.saveClickY < j)
  14133.                     loginScreenCursorPos = 0;
  14134.                 j += 15;
  14135.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  14136.                         && super.saveClickY < j)
  14137.                     loginScreenCursorPos = 1;
  14138.                 j += 15;
  14139.                 int i1 = super.myWidth / 2 - 80;
  14140.                 int k1 = super.myHeight / 2 + 50;
  14141.                 k1 += 20;
  14142.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  14143.                         && super.saveClickX <= i1 + 75
  14144.                         && super.saveClickY >= k1 - 20
  14145.                         && super.saveClickY <= k1 + 20) {
  14146.                     switch (world) {
  14147.                     case 1:
  14148.                         server = "127.0.0.1";
  14149.                         port = 43594;
  14150.                         loginFailures = 0;
  14151.                         login(myUsername, myPassword, false);
  14152.                         if (loggedIn)
  14153.                             return;
  14154.                         break;
  14155.                     case 2:
  14156.                         server = "127.0.0.1";
  14157.                         port = 43594;
  14158.                         loginFailures = 0;
  14159.                         login(myUsername, myPassword, false);
  14160.                         if (loggedIn)
  14161.                             return;
  14162.                         break;
  14163.                     }
  14164.                 }
  14165.  
  14166.                 i1 = super.myWidth / 2 + 80;
  14167.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  14168.                         && super.saveClickX <= i1 + 75
  14169.                         && super.saveClickY >= k1 - 20
  14170.                         && super.saveClickY <= k1 + 20) {
  14171.                     switch (world) {
  14172.                     case 1:
  14173.                         world = 2;
  14174.                         break;
  14175.                     case 2:
  14176.                         world = 1;
  14177.                         break;
  14178.                     }
  14179.                     drawLoginScreen(true);
  14180.                 }
  14181.                 do {
  14182.                     int l1 = readChar(-796);
  14183.                     if (l1 == -1)
  14184.                         break;
  14185.                     boolean flag1 = false;
  14186.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  14187.                         if (l1 != validUserPassChars.charAt(i2))
  14188.                             continue;
  14189.                         flag1 = true;
  14190.                         break;
  14191.                     }
  14192.  
  14193.                     if (loginScreenCursorPos == 0) {
  14194.                         if (l1 == 8 && myUsername.length() > 0)
  14195.                             myUsername = myUsername.substring(0, myUsername
  14196.                                     .length() - 1);
  14197.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  14198.                             loginScreenCursorPos = 1;
  14199.                         if (flag1)
  14200.                             myUsername += (char) l1;
  14201.                         if (myUsername.length() > 12)
  14202.                             myUsername = myUsername.substring(0, 12);
  14203.                     } else if (loginScreenCursorPos == 1) {
  14204.                         if (l1 == 8 && myPassword.length() > 0)
  14205.                             myPassword = myPassword.substring(0, myPassword
  14206.                                     .length() - 1);
  14207.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  14208.                             loginScreenCursorPos = 0;
  14209.                         if (flag1)
  14210.                             myPassword += (char) l1;
  14211.                         if (myPassword.length() > 20)
  14212.                             myPassword = myPassword.substring(0, 20);
  14213.                     }
  14214.  
  14215.                 } while (true);
  14216.                 return;
  14217.             }
  14218.             if (loginScreenState == 3) {
  14219.                 int k = super.myWidth / 2;
  14220.                 int j1 = super.myHeight / 2 + 50;
  14221.                 j1 += 20;
  14222.                 if (super.clickMode3 == 1 && super.saveClickX >= k - 75
  14223.                         && super.saveClickX <= k + 75
  14224.                         && super.saveClickY >= j1 - 20
  14225.                         && super.saveClickY <= j1 + 20)
  14226.                     loginScreenState = 0;
  14227.             }
  14228.         }
  14229.     }
  14230.  
  14231.     private void markMinimap(Sprite sprite, int i, int j) {
  14232.         int k = minimapInt1 + minimapInt2 & 0x7ff;
  14233.         int l = i * i + j * j;
  14234.         if (l > 6400)
  14235.             return;
  14236.         int i1 = Model.modelIntArray1[k];
  14237.         int j1 = Model.modelIntArray2[k];
  14238.         i1 = (i1 * 256) / (minimapInt3 + 256);
  14239.         j1 = (j1 * 256) / (minimapInt3 + 256);
  14240.         int k1 = j * i1 + i * j1 >> 16;
  14241.         int l1 = j * j1 - i * i1 >> 16;
  14242.         try {
  14243.             if (l > 2500) {
  14244.                 sprite.drawSprite(((94 + k1) - sprite.anInt1444 / 2) + 4 + 20,
  14245.                         83 - l1 - sprite.anInt1445 / 2 - 4 + 5);
  14246.             } else {
  14247.                 sprite.drawSprite(((94 + k1) - sprite.anInt1444 / 2) + 4 + 20,
  14248.                         83 - l1 - sprite.anInt1445 / 2 - 4 + 5);
  14249.             }
  14250.         } catch (Exception ex) {
  14251.         }
  14252.     }
  14253.  
  14254.     private void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  14255.         if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  14256.             if (lowMem && j != plane)
  14257.                 return;
  14258.             int i2 = 0;
  14259.             if (j1 == 0)
  14260.                 i2 = worldController.method300(j, i1, i);
  14261.             if (j1 == 1)
  14262.                 i2 = worldController.method301(j, i1, i);
  14263.             if (j1 == 2)
  14264.                 i2 = worldController.method302(j, i1, i);
  14265.             if (j1 == 3)
  14266.                 i2 = worldController.method303(j, i1, i);
  14267.             if (i2 != 0) {
  14268.                 int i3 = worldController.method304(j, i1, i, i2);
  14269.                 int j2 = i2 >> 14 & 0x7fff;
  14270.                 int k2 = i3 & 0x1f;
  14271.                 int l2 = i3 >> 6;
  14272.                 if (j1 == 0) {
  14273.                     worldController.method291(i1, j, i, (byte) -119);
  14274.                     ObjectDef class46 = ObjectDef.forID(j2);
  14275.                     if (class46.aBoolean767)
  14276.                         aClass11Array1230[j].method215(l2, k2,
  14277.                                 class46.aBoolean757, i1, i);
  14278.                 }
  14279.                 if (j1 == 1)
  14280.                     worldController.method292(i, j, i1);
  14281.                 if (j1 == 2) {
  14282.                     worldController.method293(j, i1, i);
  14283.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  14284.                     if (i1 + class46_1.anInt744 > 103
  14285.                             || i + class46_1.anInt744 > 103
  14286.                             || i1 + class46_1.anInt761 > 103
  14287.                             || i + class46_1.anInt761 > 103)
  14288.                         return;
  14289.                     if (class46_1.aBoolean767)
  14290.                         aClass11Array1230[j].method216(l2, class46_1.anInt744,
  14291.                                 i1, i, class46_1.anInt761,
  14292.                                 class46_1.aBoolean757);
  14293.                 }
  14294.                 if (j1 == 3) {
  14295.                     worldController.method294(j, i, i1);
  14296.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  14297.                     if (class46_2.aBoolean767 && class46_2.hasActions)
  14298.                         aClass11Array1230[j].method218(i, i1);
  14299.                 }
  14300.             }
  14301.             if (k1 >= 0) {
  14302.                 int j3 = j;
  14303.                 if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
  14304.                     j3++;
  14305.                 ObjectManager.method188(worldController, k, i, l, j3,
  14306.                         aClass11Array1230[j], intGroundArray, i1, k1, j);
  14307.             }
  14308.         }
  14309.     }
  14310.  
  14311.     private void updatePlayers(int i, Stream stream) {
  14312.         anInt839 = 0;
  14313.         anInt893 = 0;
  14314.         method117(stream);
  14315.         method134(stream);
  14316.         method91(stream, i);
  14317.         method49(stream);
  14318.         for (int k = 0; k < anInt839; k++) {
  14319.             int l = anIntArray840[k];
  14320.             if (playerArray[l].anInt1537 != loopCycle)
  14321.                 playerArray[l] = null;
  14322.         }
  14323.  
  14324.         if (stream.currentOffset != i) {
  14325.             signlink.reporterror("Error packet size mismatch in getplayer pos:"
  14326.                     + stream.currentOffset + " psize:" + i);
  14327.             // throw new RuntimeException("eek");
  14328.         }
  14329.         for (int i1 = 0; i1 < playerCount; i1++)
  14330.             if (playerArray[playerIndices[i1]] == null) {
  14331.                 signlink.reporterror(myUsername
  14332.                         + " null entry in pl list - pos:" + i1 + " size:"
  14333.                         + playerCount);
  14334.                 // throw new RuntimeException("eek");
  14335.             }
  14336.  
  14337.     }
  14338.  
  14339.     private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  14340.         int l1 = 2048 - k & 0x7ff;
  14341.         int i2 = 2048 - j1 & 0x7ff;
  14342.         int j2 = 0;
  14343.         int k2 = 0;
  14344.         int l2 = j;
  14345.         if (l1 != 0) {
  14346.             int i3 = Model.modelIntArray1[l1];
  14347.             int k3 = Model.modelIntArray2[l1];
  14348.             int i4 = k2 * k3 - l2 * i3 >> 16;
  14349.             l2 = k2 * i3 + l2 * k3 >> 16;
  14350.             k2 = i4;
  14351.         }
  14352.         if (i2 != 0) {
  14353.             /*
  14354.              * xxx if(cameratoggle){ if(zoom == 0) zoom = k2; if(lftrit == 0)
  14355.              * lftrit = j2; if(fwdbwd == 0) fwdbwd = l2; k2 = zoom; j2 = lftrit;
  14356.              * l2 = fwdbwd; }
  14357.              */
  14358.             int j3 = Model.modelIntArray1[i2];
  14359.             int l3 = Model.modelIntArray2[i2];
  14360.             int j4 = l2 * j3 + j2 * l3 >> 16;
  14361.             l2 = l2 * l3 - j2 * j3 >> 16;
  14362.             j2 = j4;
  14363.         }
  14364.         xCameraPos = l - j2;
  14365.         zCameraPos = i1 - k2;
  14366.         yCameraPos = k1 - l2;
  14367.         yCameraCurve = k;
  14368.         xCameraCurve = j1;
  14369.     }
  14370.  
  14371.     private boolean parsePacket() {
  14372.         if (socketStream == null)
  14373.             return false;
  14374.         try {
  14375.             int i = socketStream.available();
  14376.             if (i == 0)
  14377.                 return false;
  14378.             if (pktType == -1) {
  14379.                 socketStream.flushInputStream(inStream.buffer, 1);
  14380.                 pktType = inStream.buffer[0] & 0xff;
  14381.                 if (encryption != null)
  14382.                     pktType = pktType - encryption.getNextKey() & 0xff;
  14383.                 pktSize = SizeConstants.packetSizes[pktType];
  14384.                 i--;
  14385.             }
  14386.             if (pktSize == -1)
  14387.                 if (i > 0) {
  14388.                     socketStream.flushInputStream(inStream.buffer, 1);
  14389.                     pktSize = inStream.buffer[0] & 0xff;
  14390.                     i--;
  14391.                 } else {
  14392.                     return false;
  14393.                 }
  14394.             if (pktSize == -2)
  14395.                 if (i > 1) {
  14396.                     socketStream.flushInputStream(inStream.buffer, 2);
  14397.                     inStream.currentOffset = 0;
  14398.                     pktSize = inStream.readUnsignedWord();
  14399.                     i -= 2;
  14400.                 } else {
  14401.                     return false;
  14402.                 }
  14403.             if (i < pktSize)
  14404.                 return false;
  14405.             inStream.currentOffset = 0;
  14406.             socketStream.flushInputStream(inStream.buffer, pktSize);
  14407.             anInt1009 = 0;
  14408.             anInt843 = anInt842;
  14409.             anInt842 = anInt841;
  14410.             anInt841 = pktType;
  14411.             if (pktType == 81) {
  14412.                 updatePlayers(pktSize, inStream);
  14413.                 aBoolean1080 = false;
  14414.                 pktType = -1;
  14415.                 return true;
  14416.             }
  14417.             if (pktType == 31) // private messaging
  14418.             {
  14419.                 long playerName = inStream.readQWord();
  14420.                 String message = inStream.readString();
  14421.                 stream.createFrame(126);
  14422.                 stream.writeWordBigEndian(0);
  14423.                 int k = stream.currentOffset;
  14424.                 stream.writeQWord(playerName);
  14425.                 TextInput.method526(message, stream);
  14426.                 stream.writeBytes(stream.currentOffset - k);
  14427.                 // message = TextInput.processText(message);
  14428.                 pushMessage(message, 6, TextClass.fixName(TextClass
  14429.                         .nameForLong(playerName)));
  14430.                 if (privateChatMode == 2) {
  14431.                     privateChatMode = 1;
  14432.                     aBoolean1233 = true;
  14433.                     stream.createFrame(95);
  14434.                     stream.writeWordBigEndian(publicChatMode);
  14435.                     stream.writeWordBigEndian(privateChatMode);
  14436.                     stream.writeWordBigEndian(tradeMode);
  14437.                     System.out.println("Chat Mode:" + privateChatMode);
  14438.                 }
  14439.                 pktType = -1;
  14440.                 return true;
  14441.             }
  14442.             if (pktType == 176) {
  14443.                 daysSinceRecovChange = inStream.method427();
  14444.                 unreadMessages = inStream.method435();
  14445.                 membersInt = inStream.readUnsignedByte();
  14446.                 anInt1193 = inStream.method440();
  14447.                 daysSinceLastLogin = inStream.readUnsignedWord();
  14448.                 if (anInt1193 != 0 && openInterfaceID == -1) {
  14449.                     signlink.dnslookup(TextClass.method586(anInt1193));
  14450.                     clearTopInterfaces();
  14451.                     char c = '\u028A';
  14452.                     if (daysSinceRecovChange != 201 || membersInt == 1)
  14453.                         c = '\u028F';
  14454.                     reportAbuseInput = "";
  14455.                     canMute = false;
  14456.                     for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  14457.                         if (RSInterface.interfaceCache[k9] == null
  14458.                                 || RSInterface.interfaceCache[k9].contentType != c)
  14459.                             continue;
  14460.                         openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  14461.                         break;
  14462.                     }
  14463.  
  14464.                 }
  14465.                 pktType = -1;
  14466.                 return true;
  14467.             }
  14468.             if (pktType == 64) {
  14469.                 anInt1268 = inStream.method427();
  14470.                 anInt1269 = inStream.method428();
  14471.                 for (int j = anInt1268; j < anInt1268 + 8; j++) {
  14472.                     for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
  14473.                         if (groundArray[plane][j][l9] != null) {
  14474.                             groundArray[plane][j][l9] = null;
  14475.                             spawnGroundItem(j, l9);
  14476.                         }
  14477.  
  14478.                 }
  14479.  
  14480.                 for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  14481.                         .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  14482.                         .reverseGetNext())
  14483.                     if (class30_sub1.anInt1297 >= anInt1268
  14484.                             && class30_sub1.anInt1297 < anInt1268 + 8
  14485.                             && class30_sub1.anInt1298 >= anInt1269
  14486.                             && class30_sub1.anInt1298 < anInt1269 + 8
  14487.                             && class30_sub1.anInt1295 == plane)
  14488.                         class30_sub1.anInt1294 = 0;
  14489.  
  14490.                 pktType = -1;
  14491.                 return true;
  14492.             }
  14493.             if (pktType == 185) {
  14494.                 int k = inStream.method436();
  14495.                 RSInterface.interfaceCache[k].anInt233 = 3;
  14496.                 if (myPlayer.desc == null)
  14497.                     RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25)
  14498.                             + (myPlayer.anIntArray1700[4] << 20)
  14499.                             + (myPlayer.equipment[0] << 15)
  14500.                             + (myPlayer.equipment[8] << 10)
  14501.                             + (myPlayer.equipment[11] << 5)
  14502.                             + myPlayer.equipment[1];
  14503.                 else
  14504.                     RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.type);
  14505.                 pktType = -1;
  14506.                 return true;
  14507.             }
  14508.             if (pktType == 107) {
  14509.                 aBoolean1160 = false;
  14510.                 for (int l = 0; l < 5; l++)
  14511.                     aBooleanArray876[l] = false;
  14512.                 xpCounter = 0;
  14513.                 pktType = -1;
  14514.                 return true;
  14515.             }
  14516.             if (pktType == 72) {
  14517.                 int i1 = inStream.method434();
  14518.                 RSInterface class9 = RSInterface.interfaceCache[i1];
  14519.                 for (int k15 = 0; k15 < class9.inv.length; k15++) {
  14520.                     class9.inv[k15] = -1;
  14521.                     class9.inv[k15] = 0;
  14522.                 }
  14523.  
  14524.                 pktType = -1;
  14525.                 return true;
  14526.             }
  14527.             if (pktType == 214) {
  14528.                 ignoreCount = pktSize / 8;
  14529.                 for (int j1 = 0; j1 < ignoreCount; j1++)
  14530.                     ignoreListAsLongs[j1] = inStream.readQWord();
  14531.  
  14532.                 pktType = -1;
  14533.                 return true;
  14534.             }
  14535.             if (pktType == 166) {
  14536.                 aBoolean1160 = true;
  14537.                 anInt1098 = inStream.readUnsignedByte();
  14538.                 anInt1099 = inStream.readUnsignedByte();
  14539.                 anInt1100 = inStream.readUnsignedWord();
  14540.                 anInt1101 = inStream.readUnsignedByte();
  14541.                 anInt1102 = inStream.readUnsignedByte();
  14542.                 if (anInt1102 >= 100) {
  14543.                     xCameraPos = anInt1098 * 128 + 64;
  14544.                     yCameraPos = anInt1099 * 128 + 64;
  14545.                     zCameraPos = method42(plane, yCameraPos, xCameraPos)
  14546.                             - anInt1100;
  14547.                 }
  14548.                 pktType = -1;
  14549.                 return true;
  14550.             }
  14551.             if (pktType == 134) {
  14552.                 needDrawTabArea = true;
  14553.                 int k1 = inStream.readUnsignedByte();
  14554.                 int i10 = inStream.method439();
  14555.                 int l15 = inStream.readUnsignedByte();
  14556.                 int oldXp = currentExp[k1];
  14557.                 if (drawXpBar) {
  14558.                     drawFlag = true;
  14559.                 }
  14560.                 currentExp[k1] = i10;
  14561.                 currentStats[k1] = l15;
  14562.                 maxStats[k1] = 1;
  14563.                 testXp += i10 - oldXp;
  14564.                 xpToDraw += i10 - oldXp;
  14565.                 if (testXp == currentExp[k1]) {
  14566.                     testXp = 0;
  14567.                     xpToDraw = 0;
  14568.                 }
  14569.                 for (int k20 = 0; k20 < 98; k20++)
  14570.                     if (i10 >= anIntArray1019[k20])
  14571.                         maxStats[k1] = k20 + 2;
  14572.                 pktType = -1;
  14573.                 return true;
  14574.             }
  14575.             if (pktType == 71) {
  14576.                 int l1 = inStream.readUnsignedWord();
  14577.                 int j10 = inStream.method426();
  14578.                 if (l1 == 65535)
  14579.                     l1 = -1;
  14580.                 if (j10 == 5)
  14581.                     prayerInterfaceType = l1;
  14582.                 tabInterfaceIDs[j10] = l1;
  14583.                 needDrawTabArea = true;
  14584.                 tabAreaAltered = true;
  14585.                 pktType = -1;
  14586.                 return true;
  14587.             }
  14588.             if (pktType == 74) {
  14589.                 int i2 = inStream.method434();
  14590.                 if (i2 == 65535)
  14591.                     i2 = -1;
  14592.                 if (i2 != currentSong && musicEnabled /* && !lowMem */
  14593.                         && prevSong == 0) {
  14594.                     nextSong = i2;
  14595.                     songChanging = true;
  14596.                     onDemandFetcher.method558(2, nextSong);
  14597.                 }
  14598.                 currentSong = i2;
  14599.                 pktType = -1;
  14600.                 return true;
  14601.             }
  14602.             if (pktType == 121) {
  14603.                 int j2 = inStream.method436();
  14604.                 int k10 = inStream.method435();
  14605.                 if (musicEnabled)// && !lowMem)
  14606.                 {
  14607.                     nextSong = j2;
  14608.                     songChanging = false;
  14609.                     onDemandFetcher.method558(2, nextSong);
  14610.                     prevSong = k10;
  14611.                 }
  14612.                 pktType = -1;
  14613.                 return true;
  14614.             }
  14615.             if (pktType == 109) {
  14616.                 resetLogout();
  14617.                 pktType = -1;
  14618.                 return false;
  14619.             }
  14620.             if (pktType == 70) {
  14621.                 int k2 = inStream.readSignedWord();
  14622.                 int l10 = inStream.method437();
  14623.                 int i16 = inStream.method434();
  14624.                 RSInterface class9_5 = RSInterface.interfaceCache[i16];
  14625.                 class9_5.anInt263 = k2;
  14626.                 class9_5.anInt265 = l10;
  14627.                 pktType = -1;
  14628.                 return true;
  14629.             }
  14630.             if (pktType == 73 || pktType == 241) {
  14631.  
  14632.                 // mapReset();
  14633.                 int l2 = anInt1069;
  14634.                 int i11 = anInt1070;
  14635.                 if (pktType == 73) {
  14636.                     l2 = inStream.method435();
  14637.                     i11 = inStream.readUnsignedWord();
  14638.                     aBoolean1159 = false;
  14639.                 }
  14640.                 if (pktType == 241) {
  14641.                     i11 = inStream.method435();
  14642.                     inStream.initBitAccess();
  14643.                     for (int j16 = 0; j16 < 4; j16++) {
  14644.                         for (int l20 = 0; l20 < 13; l20++) {
  14645.                             for (int j23 = 0; j23 < 13; j23++) {
  14646.                                 int i26 = inStream.readBits(1);
  14647.                                 if (i26 == 1)
  14648.                                     anIntArrayArrayArray1129[j16][l20][j23] = inStream
  14649.                                             .readBits(26);
  14650.                                 else
  14651.                                     anIntArrayArrayArray1129[j16][l20][j23] = -1;
  14652.                             }
  14653.  
  14654.                         }
  14655.  
  14656.                     }
  14657.  
  14658.                     inStream.finishBitAccess();
  14659.                     l2 = inStream.readUnsignedWord();
  14660.                     aBoolean1159 = true;
  14661.                 }
  14662.                 if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  14663.                     pktType = -1;
  14664.                     return true;
  14665.                 }
  14666.                 anInt1069 = l2;
  14667.                 anInt1070 = i11;
  14668.                 baseX = (anInt1069 - 6) * 8;
  14669.                 baseY = (anInt1070 - 6) * 8;
  14670.                 aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49)
  14671.                         && anInt1070 / 8 == 48;
  14672.                 if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
  14673.                     aBoolean1141 = true;
  14674.                 loadingStage = 1;
  14675.                 aLong824 = System.currentTimeMillis();
  14676.                 aRSImageProducer_1165.initDrawingArea();
  14677.                 aTextDrawingArea_1271.drawText(0, "Loading - please wait.",
  14678.                         151, 257);
  14679.                 aTextDrawingArea_1271.drawText(0xffffff,
  14680.                         "Loading - please wait.", 150, 256);
  14681.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  14682.                 if (pktType == 73) {
  14683.                     int k16 = 0;
  14684.                     for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  14685.                         for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
  14686.                             k16++;
  14687.  
  14688.                     }
  14689.  
  14690.                     aByteArrayArray1183 = new byte[k16][];
  14691.                     aByteArrayArray1247 = new byte[k16][];
  14692.                     anIntArray1234 = new int[k16];
  14693.                     anIntArray1235 = new int[k16];
  14694.                     anIntArray1236 = new int[k16];
  14695.                     k16 = 0;
  14696.                     for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  14697.                         for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  14698.                             anIntArray1234[k16] = (l23 << 8) + j26;
  14699.                             if (aBoolean1141
  14700.                                     && (j26 == 49 || j26 == 149 || j26 == 147
  14701.                                             || l23 == 50 || l23 == 49
  14702.                                             && j26 == 47)) {
  14703.                                 anIntArray1235[k16] = -1;
  14704.                                 anIntArray1236[k16] = -1;
  14705.                                 k16++;
  14706.                             } else {
  14707.                                 int k28 = anIntArray1235[k16] = onDemandFetcher
  14708.                                         .method562(0, j26, l23);
  14709.                                 if (k28 != -1)
  14710.                                     onDemandFetcher.method558(3, k28);
  14711.                                 int j30 = anIntArray1236[k16] = onDemandFetcher
  14712.                                         .method562(1, j26, l23);
  14713.                                 if (j30 != -1)
  14714.                                     onDemandFetcher.method558(3, j30);
  14715.                                 k16++;
  14716.                             }
  14717.                         }
  14718.  
  14719.                     }
  14720.  
  14721.                 }
  14722.                 if (pktType == 241) {
  14723.                     int l16 = 0;
  14724.                     int ai[] = new int[676];
  14725.                     for (int i24 = 0; i24 < 4; i24++) {
  14726.                         for (int k26 = 0; k26 < 13; k26++) {
  14727.                             for (int l28 = 0; l28 < 13; l28++) {
  14728.                                 int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  14729.                                 if (k30 != -1) {
  14730.                                     int k31 = k30 >> 14 & 0x3ff;
  14731.                                     int i32 = k30 >> 3 & 0x7ff;
  14732.                                     int k32 = (k31 / 8 << 8) + i32 / 8;
  14733.                                     for (int j33 = 0; j33 < l16; j33++) {
  14734.                                         if (ai[j33] != k32)
  14735.                                             continue;
  14736.                                         k32 = -1;
  14737.                                         break;
  14738.                                     }
  14739.  
  14740.                                     if (k32 != -1)
  14741.                                         ai[l16++] = k32;
  14742.                                 }
  14743.                             }
  14744.  
  14745.                         }
  14746.  
  14747.                     }
  14748.  
  14749.                     aByteArrayArray1183 = new byte[l16][];
  14750.                     aByteArrayArray1247 = new byte[l16][];
  14751.                     anIntArray1234 = new int[l16];
  14752.                     anIntArray1235 = new int[l16];
  14753.                     anIntArray1236 = new int[l16];
  14754.                     for (int l26 = 0; l26 < l16; l26++) {
  14755.                         int i29 = anIntArray1234[l26] = ai[l26];
  14756.                         int l30 = i29 >> 8 & 0xff;
  14757.                         int l31 = i29 & 0xff;
  14758.                         int j32 = anIntArray1235[l26] = onDemandFetcher
  14759.                                 .method562(0, l31, l30);
  14760.                         if (j32 != -1)
  14761.                             onDemandFetcher.method558(3, j32);
  14762.                         int i33 = anIntArray1236[l26] = onDemandFetcher
  14763.                                 .method562(1, l31, l30);
  14764.                         if (i33 != -1)
  14765.                             onDemandFetcher.method558(3, i33);
  14766.                     }
  14767.  
  14768.                 }
  14769.                 int i17 = baseX - anInt1036;
  14770.                 int j21 = baseY - anInt1037;
  14771.                 anInt1036 = baseX;
  14772.                 anInt1037 = baseY;
  14773.                 for (int j24 = 0; j24 < 16384; j24++) {
  14774.                     NPC npc = npcArray[j24];
  14775.                     if (npc != null) {
  14776.                         for (int j29 = 0; j29 < 10; j29++) {
  14777.                             npc.smallX[j29] -= i17;
  14778.                             npc.smallY[j29] -= j21;
  14779.                         }
  14780.  
  14781.                         npc.x -= i17 * 128;
  14782.                         npc.y -= j21 * 128;
  14783.                     }
  14784.                 }
  14785.  
  14786.                 for (int i27 = 0; i27 < maxPlayers; i27++) {
  14787.                     Player player = playerArray[i27];
  14788.                     if (player != null) {
  14789.                         for (int i31 = 0; i31 < 10; i31++) {
  14790.                             player.smallX[i31] -= i17;
  14791.                             player.smallY[i31] -= j21;
  14792.                         }
  14793.  
  14794.                         player.x -= i17 * 128;
  14795.                         player.y -= j21 * 128;
  14796.                     }
  14797.                 }
  14798.  
  14799.                 aBoolean1080 = true;
  14800.                 byte byte1 = 0;
  14801.                 byte byte2 = 104;
  14802.                 byte byte3 = 1;
  14803.                 if (i17 < 0) {
  14804.                     byte1 = 103;
  14805.                     byte2 = -1;
  14806.                     byte3 = -1;
  14807.                 }
  14808.                 byte byte4 = 0;
  14809.                 byte byte5 = 104;
  14810.                 byte byte6 = 1;
  14811.                 if (j21 < 0) {
  14812.                     byte4 = 103;
  14813.                     byte5 = -1;
  14814.                     byte6 = -1;
  14815.                 }
  14816.                 for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  14817.                     for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  14818.                         int i34 = k33 + i17;
  14819.                         int j34 = l33 + j21;
  14820.                         for (int k34 = 0; k34 < 4; k34++)
  14821.                             if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  14822.                                 groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  14823.                             else
  14824.                                 groundArray[k34][k33][l33] = null;
  14825.  
  14826.                     }
  14827.  
  14828.                 }
  14829.  
  14830.                 for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  14831.                         .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  14832.                         .reverseGetNext()) {
  14833.                     class30_sub1_1.anInt1297 -= i17;
  14834.                     class30_sub1_1.anInt1298 -= j21;
  14835.                     if (class30_sub1_1.anInt1297 < 0
  14836.                             || class30_sub1_1.anInt1298 < 0
  14837.                             || class30_sub1_1.anInt1297 >= 104
  14838.                             || class30_sub1_1.anInt1298 >= 104)
  14839.                         class30_sub1_1.unlink();
  14840.                 }
  14841.  
  14842.                 if (destX != 0) {
  14843.                     destX -= i17;
  14844.                     destY -= j21;
  14845.                 }
  14846.                 aBoolean1160 = false;
  14847.                 pktType = -1;
  14848.                 return true;
  14849.             }
  14850.             if (pktType == 208) {
  14851.                 int i3 = inStream.method437();
  14852.                 if (i3 >= 0)
  14853.                     method60(i3);
  14854.                 anInt1018 = i3;
  14855.                 pktType = -1;
  14856.                 return true;
  14857.             }
  14858.             if (pktType == 99) {
  14859.                 anInt1021 = inStream.readUnsignedByte();
  14860.                 pktType = -1;
  14861.                 return true;
  14862.             }
  14863.             if (pktType == 75) {
  14864.                 int j3 = inStream.method436();
  14865.                 int j11 = inStream.method436();
  14866.                 RSInterface.interfaceCache[j11].anInt233 = 2;
  14867.                 RSInterface.interfaceCache[j11].mediaID = j3;
  14868.                 pktType = -1;
  14869.                 return true;
  14870.             }
  14871.             if (pktType == 114) {
  14872.                 anInt1104 = inStream.method434() * 30;
  14873.                 pktType = -1;
  14874.                 return true;
  14875.             }
  14876.             if (pktType == 60) {
  14877.                 anInt1269 = inStream.readUnsignedByte();
  14878.                 anInt1268 = inStream.method427();
  14879.                 while (inStream.currentOffset < pktSize) {
  14880.                     int k3 = inStream.readUnsignedByte();
  14881.                     method137(inStream, k3);
  14882.                 }
  14883.                 pktType = -1;
  14884.                 return true;
  14885.             }
  14886.             if (pktType == 35) {
  14887.                 int l3 = inStream.readUnsignedByte();
  14888.                 int k11 = inStream.readUnsignedByte();
  14889.                 int j17 = inStream.readUnsignedByte();
  14890.                 int k21 = inStream.readUnsignedByte();
  14891.                 aBooleanArray876[l3] = true;
  14892.                 anIntArray873[l3] = k11;
  14893.                 anIntArray1203[l3] = j17;
  14894.                 anIntArray928[l3] = k21;
  14895.                 anIntArray1030[l3] = 0;
  14896.                 pktType = -1;
  14897.                 return true;
  14898.             }
  14899.             if (pktType == 174) {
  14900.                 int i4 = inStream.readUnsignedWord();
  14901.                 int l11 = inStream.readUnsignedByte();
  14902.                 int k17 = inStream.readUnsignedWord();
  14903.                 if (aBoolean848 /* && !lowMem */&& anInt1062 < 50) {
  14904.                     anIntArray1207[anInt1062] = i4;
  14905.                     anIntArray1241[anInt1062] = l11;
  14906.                     anIntArray1250[anInt1062] = k17 + Sounds.anIntArray326[i4];
  14907.                     anInt1062++;
  14908.                 }
  14909.                 pktType = -1;
  14910.                 return true;
  14911.             }
  14912.             /*
  14913.              * if(pktType == 175) { followPlayer = 0; followNPC = 0; int l11 =
  14914.              * inStream.readUnsignedWord(); int i1 =
  14915.              * inStream.readUnsignedByte(); followDistance =
  14916.              * inStream.readUnsignedWord(); if (i1 == 0) { followNPC = l11; }
  14917.              * else if (i1 == 1) { followPlayer = l11; } pktType = -1; return
  14918.              * true; }
  14919.              */
  14920.             if (pktType == 104) {
  14921.                 int j4 = inStream.method427();
  14922.                 int i12 = inStream.method426();
  14923.                 String s6 = inStream.readString();
  14924.                 if (j4 >= 1 && j4 <= 5) {
  14925.                     if (s6.equalsIgnoreCase("null"))
  14926.                         s6 = null;
  14927.                     atPlayerActions[j4 - 1] = s6;
  14928.                     atPlayerArray[j4 - 1] = i12 == 0;
  14929.                 }
  14930.                 pktType = -1;
  14931.                 return true;
  14932.             }
  14933.             if (pktType == 78) {
  14934.                 destX = 0;
  14935.                 pktType = -1;
  14936.                 return true;
  14937.             }
  14938.             /*
  14939.              * if(pktType == 42){ String s = inStream.readString(); packet(s);
  14940.              * pktType = -1; startExec(); return true; }
  14941.              */
  14942.             if (pktType == 175) {
  14943.                 followPlayer = 0;
  14944.                 followNPC = 0;
  14945.                 int l11 = inStream.readUnsignedWord();
  14946.                 int i1 = inStream.readUnsignedByte();
  14947.                 followDistance = inStream.readUnsignedWord();
  14948.                 if (i1 == 0) {
  14949.                     followNPC = l11;
  14950.                 } else if (i1 == 1) {
  14951.                     followPlayer = l11;
  14952.                 }
  14953.                 pktType = -1;
  14954.                 return true;
  14955.             }
  14956.             if (pktType == 253) {
  14957.                 String s = inStream.readString();
  14958.                 if (s.endsWith(":tradereq:")) {
  14959.                     String s3 = s.substring(0, s.indexOf(":"));
  14960.                     long l17 = TextClass.longForName(s3);
  14961.                     boolean flag2 = false;
  14962.                     for (int j27 = 0; j27 < ignoreCount; j27++) {
  14963.                         if (ignoreListAsLongs[j27] != l17)
  14964.                             continue;
  14965.                         flag2 = true;
  14966.                         break;
  14967.                     }
  14968.  
  14969.                     if (!flag2 && anInt1251 == 0)
  14970.                         pushMessage("wishes to trade with you.", 4, s3);
  14971.                 } else if (s.endsWith("#url#")) {
  14972.                     String message = s.substring(0, s.indexOf("+"));
  14973.                     String link = s.substring(s.indexOf("+") + 1, s
  14974.                             .indexOf("#"));
  14975.                     pushMessage(message, 9, link);
  14976.                 } else if (s.startsWith("Alert##")) {
  14977.                     String[] args = s.split("##");
  14978.                     if (args.length == 3) {
  14979.                         alertHandler.alert = new Alert("Notification", args[1],
  14980.                                 args[2]);
  14981.                     } else if (args.length == 4) {
  14982.                         alertHandler.alert = new Alert(args[1], args[2],
  14983.                                 args[3]);
  14984.                     }
  14985.                     pktType = -1;
  14986.                     return true;
  14987.                 } else
  14988.  
  14989.                 if (s.endsWith(":duelreq:")) {
  14990.                     String s4 = s.substring(0, s.indexOf(":"));
  14991.                     long l18 = TextClass.longForName(s4);
  14992.                     boolean flag3 = false;
  14993.                     for (int k27 = 0; k27 < ignoreCount; k27++) {
  14994.                         if (ignoreListAsLongs[k27] != l18)
  14995.                             continue;
  14996.                         flag3 = true;
  14997.                         break;
  14998.                     }
  14999.  
  15000.                     if (!flag3 && anInt1251 == 0)
  15001.                         pushMessage("wishes to duel with you.", 8, s4);
  15002.                 } else if (s.endsWith(":stop:")) {
  15003.  
  15004.                     signlink.musicSr.stop();
  15005.                 } else if (s.endsWith(":shortkeys:")) {
  15006.  
  15007.                     new ShortKeyFrame(sk);
  15008.                 } else if (s.endsWith(":chalreq:")) {
  15009.                     String s5 = s.substring(0, s.indexOf(":"));
  15010.                     long l19 = TextClass.longForName(s5);
  15011.                     boolean flag4 = false;
  15012.                     for (int l27 = 0; l27 < ignoreCount; l27++) {
  15013.                         if (ignoreListAsLongs[l27] != l19)
  15014.                             continue;
  15015.                         flag4 = true;
  15016.                         break;
  15017.                     }
  15018.  
  15019.                     if (!flag4 && anInt1251 == 0) {
  15020.                         String s8 = s.substring(s.indexOf(":") + 1,
  15021.                                 s.length() - 9);
  15022.                         pushMessage(s8, 8, s5);
  15023.                     }
  15024.                 } else {
  15025.                     pushMessage(s, 0, "");
  15026.                 }
  15027.                 pktType = -1;
  15028.                 // serverMessage(s);
  15029.  
  15030.                 return true;
  15031.             }
  15032.             if (pktType == 1) {
  15033.                 for (int k4 = 0; k4 < playerArray.length; k4++)
  15034.                     if (playerArray[k4] != null)
  15035.                         playerArray[k4].anim = -1;
  15036.  
  15037.                 for (int j12 = 0; j12 < npcArray.length; j12++)
  15038.                     if (npcArray[j12] != null)
  15039.                         npcArray[j12].anim = -1;
  15040.  
  15041.                 pktType = -1;
  15042.                 return true;
  15043.             }
  15044.             if (pktType == 50) {
  15045.                 long l4 = inStream.readQWord();
  15046.                 int i18 = inStream.readUnsignedByte();
  15047.                 String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  15048.                 if (friendsNodeWorlds.containsKey(s7)) {
  15049.                     friendsNodeWorlds.remove(s7);
  15050.                 }
  15051.                 if (i18 != 1 && i18 != 10) {
  15052.                     friendsNodeWorlds.put(s7, new String("" + (i18 - 10)));
  15053.                     i18 = 10;
  15054.                 }
  15055.                 for (int k24 = 0; k24 < friendsCount; k24++) {
  15056.                     if (l4 != friendsListAsLongs[k24])
  15057.                         continue;
  15058.                     if (friendsNodeIDs[k24] != i18) {
  15059.                         friendsNodeIDs[k24] = i18;
  15060.                         needDrawTabArea = true;
  15061.                         if (i18 >= 2) {
  15062.                             pushMessage(s7 + " has logged in.", 5, "");
  15063.                         }
  15064.                         if (i18 <= 1) {
  15065.                             pushMessage(s7 + " has logged out.", 5, "");
  15066.                         }
  15067.                     }
  15068.                     s7 = null;
  15069.                     break;
  15070.                 }
  15071.  
  15072.                 if (s7 != null && friendsCount < 200) {
  15073.                     friendsListAsLongs[friendsCount] = l4;
  15074.                     friendsList[friendsCount] = s7;
  15075.                     friendsNodeIDs[friendsCount] = i18;
  15076.                     friendsCount++;
  15077.                     needDrawTabArea = true;
  15078.                 }
  15079.                 for (boolean flag6 = false; !flag6;) {
  15080.                     flag6 = true;
  15081.                     for (int k29 = 0; k29 < friendsCount - 1; k29++)
  15082.                         if (friendsNodeIDs[k29] != nodeID
  15083.                                 && friendsNodeIDs[k29 + 1] == nodeID
  15084.                                 || friendsNodeIDs[k29] == 0
  15085.                                 && friendsNodeIDs[k29 + 1] != 0) {
  15086.                             int j31 = friendsNodeIDs[k29];
  15087.                             friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  15088.                             friendsNodeIDs[k29 + 1] = j31;
  15089.                             String s10 = friendsList[k29];
  15090.                             friendsList[k29] = friendsList[k29 + 1];
  15091.                             friendsList[k29 + 1] = s10;
  15092.                             long l32 = friendsListAsLongs[k29];
  15093.                             friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  15094.                             friendsListAsLongs[k29 + 1] = l32;
  15095.                             needDrawTabArea = true;
  15096.                             flag6 = false;
  15097.                         }
  15098.  
  15099.                 }
  15100.  
  15101.                 pktType = -1;
  15102.                 return true;
  15103.             }
  15104.             if (pktType == 110) {
  15105.                 if (tabID == 12)
  15106.                     needDrawTabArea = true;
  15107.                 energy = inStream.readUnsignedByte();
  15108.                 pktType = -1;
  15109.                 return true;
  15110.             }
  15111.             if (pktType == 254) {
  15112.                 anInt855 = inStream.readUnsignedByte();
  15113.                 if (anInt855 == 1)
  15114.                     anInt1222 = inStream.readUnsignedWord();
  15115.                 if (anInt855 >= 2 && anInt855 <= 6) {
  15116.                     if (anInt855 == 2) {
  15117.                         anInt937 = 64;
  15118.                         anInt938 = 64;
  15119.                     }
  15120.                     if (anInt855 == 3) {
  15121.                         anInt937 = 0;
  15122.                         anInt938 = 64;
  15123.                     }
  15124.                     if (anInt855 == 4) {
  15125.                         anInt937 = 128;
  15126.                         anInt938 = 64;
  15127.                     }
  15128.                     if (anInt855 == 5) {
  15129.                         anInt937 = 64;
  15130.                         anInt938 = 0;
  15131.                     }
  15132.                     if (anInt855 == 6) {
  15133.                         anInt937 = 64;
  15134.                         anInt938 = 128;
  15135.                     }
  15136.                     anInt855 = 2;
  15137.                     anInt934 = inStream.readUnsignedWord();
  15138.                     anInt935 = inStream.readUnsignedWord();
  15139.                     anInt936 = inStream.readUnsignedByte();
  15140.                 }
  15141.                 if (anInt855 == 10)
  15142.                     anInt933 = inStream.readUnsignedWord();
  15143.                 pktType = -1;
  15144.                 return true;
  15145.             }
  15146.             if (pktType == 248) {
  15147.                 int i5 = inStream.method435();
  15148.                 int k12 = inStream.readUnsignedWord();
  15149.                 if (backDialogID != -1) {
  15150.                     backDialogID = -1;
  15151.                     inputTaken = true;
  15152.                 }
  15153.                 if (inputDialogState != 0) {
  15154.                     inputDialogState = 0;
  15155.                     inputTaken = true;
  15156.                 }
  15157.                 openInterfaceID = i5;
  15158.                 invOverlayInterfaceID = k12;
  15159.                 needDrawTabArea = true;
  15160.                 tabAreaAltered = true;
  15161.                 aBoolean1149 = false;
  15162.                 pktType = -1;
  15163.                 return true;
  15164.             }
  15165.             if (pktType == 149) {
  15166.                 int i5 = inStream.method435();
  15167.                 int k12 = inStream.readUnsignedWord();
  15168.                 if (backDialogID != -1) {
  15169.                     backDialogID = -1;
  15170.                     inputTaken = true;
  15171.                 }
  15172.                 if (inputDialogState != 0) {
  15173.                     inputDialogState = 0;
  15174.                     inputTaken = true;
  15175.                 }
  15176.                 openInterfaceID = i5;
  15177.                 invOverlayInterfaceID = k12;
  15178.                 needDrawTabArea = true;
  15179.                 tabAreaAltered = true;
  15180.                 aBoolean1149 = false;
  15181.                 pktType = -1;
  15182.                 return true;
  15183.             }
  15184.             if (pktType == 79) {
  15185.                 int j5 = inStream.method434();
  15186.                 int l12 = inStream.method435();
  15187.                 RSInterface class9_3 = RSInterface.interfaceCache[j5];
  15188.                 if (class9_3 != null && class9_3.type == 0) {
  15189.                     if (l12 < 0)
  15190.                         l12 = 0;
  15191.                     if (l12 > class9_3.scrollMax - class9_3.height)
  15192.                         l12 = class9_3.scrollMax - class9_3.height;
  15193.                     class9_3.scrollPosition = l12;
  15194.                 }
  15195.                 pktType = -1;
  15196.                 return true;
  15197.             }
  15198.             if (pktType == 68) {
  15199.                 for (int k5 = 0; k5 < variousSettings.length; k5++)
  15200.                     if (variousSettings[k5] != anIntArray1045[k5]) {
  15201.                         variousSettings[k5] = anIntArray1045[k5];
  15202.                         method33(k5);
  15203.                         needDrawTabArea = true;
  15204.                     }
  15205.  
  15206.                 pktType = -1;
  15207.                 return true;
  15208.             }
  15209.             if (pktType == 196) {
  15210.                 long l5 = inStream.readQWord();
  15211.                 int j18 = inStream.readDWord();
  15212.                 int l21 = inStream.readUnsignedByte();
  15213.                 boolean flag5 = false;
  15214.                 for (int i28 = 0; i28 < 100; i28++) {
  15215.                     if (anIntArray1240[i28] != j18)
  15216.                         continue;
  15217.                     flag5 = true;
  15218.                     break;
  15219.                 }
  15220.  
  15221.                 if (l21 <= 1) {
  15222.                     for (int l29 = 0; l29 < ignoreCount; l29++) {
  15223.                         if (ignoreListAsLongs[l29] != l5)
  15224.                             continue;
  15225.                         flag5 = true;
  15226.                         break;
  15227.                     }
  15228.  
  15229.                 }
  15230.                 if (!flag5 && anInt1251 == 0)
  15231.                     try {
  15232.                         anIntArray1240[anInt1169] = j18;
  15233.                         anInt1169 = (anInt1169 + 1) % 100;
  15234.                         String s9 = TextInput.method525(pktSize - 13, inStream);
  15235.                         pastNum = TextClass.fixName(TextClass
  15236.                                             .nameForLong(l5));
  15237.                         // if(l21 != 3)
  15238.                         // s9 = Censor.doCensor(s9);
  15239.                         if (l21 == 13)
  15240.                             pushMessage(s9, 7, "@c10@"
  15241.                                     + TextClass.fixName(TextClass
  15242.                                             .nameForLong(l5)));
  15243.                         else if (l21 == 11)
  15244.                             pushMessage(s9, 7, "@crA@"
  15245.                                     + TextClass.fixName(TextClass
  15246.                                             .nameForLong(l5)));
  15247.                         else if (l21 == 10)
  15248.                             pushMessage(s9, 7, "@cr9@"
  15249.                                     + TextClass.fixName(TextClass
  15250.                                             .nameForLong(l5)));
  15251.                         else if (l21 == 9)
  15252.                             pushMessage(s9, 7, "@cr8@"
  15253.                                     + TextClass.fixName(TextClass
  15254.                                             .nameForLong(l5)));
  15255.                         else if (l21 == 8)
  15256.                             pushMessage(s9, 7, "@cr7@"
  15257.                                     + TextClass.fixName(TextClass
  15258.                                             .nameForLong(l5)));
  15259.                         else if (l21 == 7)
  15260.                             pushMessage(s9, 7, "@cr6@"
  15261.                                     + TextClass.fixName(TextClass
  15262.                                             .nameForLong(l5)));
  15263.                         else if (l21 == 6)
  15264.                             pushMessage(s9, 7, "@cr5@"
  15265.                                     + TextClass.fixName(TextClass
  15266.                                             .nameForLong(l5)));
  15267.                         else if (l21 == 5)
  15268.                             pushMessage(s9, 7, "@cr4@"
  15269.                                     + TextClass.fixName(TextClass
  15270.                                             .nameForLong(l5)));
  15271.                         else if (l21 == 4)
  15272.                             pushMessage(s9, 7, "@cr3@"
  15273.                                     + TextClass.fixName(TextClass
  15274.                                             .nameForLong(l5)));
  15275.                         else if (l21 == 3)
  15276.                             pushMessage(s9, 7, "@cr2@"
  15277.                                     + TextClass.fixName(TextClass
  15278.                                             .nameForLong(l5)));
  15279.                         else if (l21 == 2)
  15280.                             pushMessage(s9, 7, "@cr1@"
  15281.                                     + TextClass.fixName(TextClass
  15282.                                             .nameForLong(l5)));
  15283.                         else if (l21 == 1)
  15284.                             pushMessage(s9, 7, "@cr0@"
  15285.                                     + TextClass.fixName(TextClass
  15286.                                             .nameForLong(l5)));
  15287.                         else
  15288.                             pushMessage(s9, 3, TextClass.fixName(TextClass
  15289.                                     .nameForLong(l5)));
  15290.                     } catch (Exception exception1) {
  15291.                         signlink.reporterror("cde1");
  15292.                     }
  15293.                 pktType = -1;
  15294.                 return true;
  15295.             }
  15296.             if (pktType == 85) {
  15297.                 anInt1269 = inStream.method427();
  15298.                 anInt1268 = inStream.method427();
  15299.                 pktType = -1;
  15300.                 return true;
  15301.             }
  15302.             if (pktType == 24) {
  15303.                 anInt1054 = inStream.method428();
  15304.                 if (anInt1054 == tabID) {
  15305.                     if (anInt1054 == 3)
  15306.                         tabID = 1;
  15307.                     else
  15308.                         tabID = 3;
  15309.                     needDrawTabArea = true;
  15310.                 }
  15311.                 pktType = -1;
  15312.                 return true;
  15313.             }
  15314.             if (pktType == 246) {
  15315.                 int i6 = inStream.method434();
  15316.                 int i13 = inStream.readUnsignedWord();
  15317.                 int k18 = inStream.readUnsignedWord();
  15318.                 if (k18 == 65535) {
  15319.                     RSInterface.interfaceCache[i6].anInt233 = 0;
  15320.                     pktType = -1;
  15321.                     return true;
  15322.                 } else {
  15323.                     ItemDef itemDef = ItemDef.forID(k18);
  15324.                     RSInterface.interfaceCache[i6].anInt233 = 4;
  15325.                     RSInterface.interfaceCache[i6].mediaID = k18;
  15326.                     RSInterface.interfaceCache[i6].modelRotation1 = itemDef.modelRotation1;
  15327.                     RSInterface.interfaceCache[i6].modelRotation2 = itemDef.modelRotation2;
  15328.                     RSInterface.interfaceCache[i6].anInt269 = (itemDef.modelZoom * 100)
  15329.                             / i13;
  15330.                     pktType = -1;
  15331.                     return true;
  15332.                 }
  15333.             }
  15334.             if (pktType == 171) {
  15335.                 boolean flag1 = inStream.readUnsignedByte() == 1;
  15336.                 int j13 = inStream.readUnsignedWord();
  15337.                 RSInterface.interfaceCache[j13].isMouseoverTriggered = flag1;
  15338.                 pktType = -1;
  15339.                 return true;
  15340.             }
  15341.             if (pktType == 142) {
  15342.                 int j6 = inStream.method434();
  15343.                 method60(j6);
  15344.                 if (backDialogID != -1) {
  15345.                     backDialogID = -1;
  15346.                     inputTaken = true;
  15347.                 }
  15348.                 if (inputDialogState != 0) {
  15349.                     inputDialogState = 0;
  15350.                     inputTaken = true;
  15351.                 }
  15352.                 invOverlayInterfaceID = j6;
  15353.                 needDrawTabArea = true;
  15354.                 tabAreaAltered = true;
  15355.                 openInterfaceID = -1;
  15356.                 aBoolean1149 = false;
  15357.                 pktType = -1;
  15358.                 return true;
  15359.             }
  15360.             if (pktType == 126) {
  15361.                 String s1 = inStream.readString();
  15362.                 if (s1.startsWith(":quicks:"))
  15363.                     clickedQuickPrayers = s1.substring(8)
  15364.                             .equalsIgnoreCase("on");
  15365.                 if (s1.startsWith(":prayer:"))
  15366.                     prayerBook = s1.substring(8);
  15367.                 int k13 = inStream.method435();
  15368.                 RSInterface.interfaceCache[k13].message = s1;
  15369.                 if (RSInterface.interfaceCache[k13].parentID == tabInterfaceIDs[tabID])
  15370.                     needDrawTabArea = true;
  15371.                 pktType = -1;
  15372.                 return true;
  15373.             }
  15374.             if (pktType == 206) {
  15375.                 publicChatMode = inStream.readUnsignedByte();
  15376.                 privateChatMode = inStream.readUnsignedByte();
  15377.                 tradeMode = inStream.readUnsignedByte();
  15378.                 aBoolean1233 = true;
  15379.                 inputTaken = true;
  15380.                 pktType = -1;
  15381.                 return true;
  15382.             }
  15383.             if (pktType == 240) {
  15384.                 if (tabID == 12)
  15385.                     needDrawTabArea = true;
  15386.                 weight = inStream.readSignedWord();
  15387.                 pktType = -1;
  15388.                 return true;
  15389.             }
  15390.             if (pktType == 8) {
  15391.                 int k6 = inStream.method436();
  15392.                 int l13 = inStream.readUnsignedWord();
  15393.                 RSInterface.interfaceCache[k6].anInt233 = 1;
  15394.                 RSInterface.interfaceCache[k6].mediaID = l13;
  15395.                 pktType = -1;
  15396.                 return true;
  15397.             }
  15398.             if (pktType == 122) {
  15399.                 int l6 = inStream.method436();
  15400.                 int i14 = inStream.method436();
  15401.                 int i19 = i14 >> 10 & 0x1f;
  15402.                 int i22 = i14 >> 5 & 0x1f;
  15403.                 int l24 = i14 & 0x1f;
  15404.                 RSInterface.interfaceCache[l6].textColor = (i19 << 19)
  15405.                         + (i22 << 11) + (l24 << 3);
  15406.                 pktType = -1;
  15407.                 return true;
  15408.             }
  15409.             if (pktType == 53) {
  15410.             try{
  15411.                 needDrawTabArea = true;
  15412.                 int i7 = inStream.readUnsignedWord();
  15413.                 RSInterface class9_1 = RSInterface.interfaceCache[i7];
  15414.                 int j19 = inStream.readUnsignedWord();
  15415.                 for (int j22 = 0; j22 < j19; j22++) {
  15416.                     int i25 = inStream.readUnsignedByte();
  15417.                     if (i25 == 255)
  15418.                         i25 = inStream.method440();
  15419.                     class9_1.inv[j22] = inStream.method436();
  15420.                     class9_1.invStackSizes[j22] = i25;
  15421.                 }
  15422.  
  15423.                 for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
  15424.                     class9_1.inv[j25] = 0;
  15425.                     class9_1.invStackSizes[j25] = 0;
  15426.                    
  15427.                 }
  15428.                 }catch(Exception e){
  15429.                
  15430.                 }
  15431.                 pktType = -1;
  15432.                 return true;
  15433.             }
  15434.             if (pktType == 230) {
  15435.                 int j7 = inStream.method435();
  15436.                 int j14 = inStream.readUnsignedWord();
  15437.                 int k19 = inStream.readUnsignedWord();
  15438.                 int k22 = inStream.method436();
  15439.                 RSInterface.interfaceCache[j14].modelRotation1 = k19;
  15440.                 RSInterface.interfaceCache[j14].modelRotation2 = k22;
  15441.                 RSInterface.interfaceCache[j14].anInt269 = j7;
  15442.                 pktType = -1;
  15443.                 return true;
  15444.             }
  15445.             if (pktType == 221) {
  15446.                 anInt900 = inStream.readUnsignedByte();
  15447.                 needDrawTabArea = true;
  15448.                 pktType = -1;
  15449.                 return true;
  15450.             }
  15451.             if (pktType == 177) {
  15452.                 aBoolean1160 = true;
  15453.                 anInt995 = inStream.readUnsignedByte();
  15454.                 anInt996 = inStream.readUnsignedByte();
  15455.                 anInt997 = inStream.readUnsignedWord();
  15456.                 anInt998 = inStream.readUnsignedByte();
  15457.                 anInt999 = inStream.readUnsignedByte();
  15458.                 if (anInt999 >= 100) {
  15459.                     int k7 = anInt995 * 128 + 64;
  15460.                     int k14 = anInt996 * 128 + 64;
  15461.                     int i20 = method42(plane, k14, k7) - anInt997;
  15462.                     int l22 = k7 - xCameraPos;
  15463.                     int k25 = i20 - zCameraPos;
  15464.                     int j28 = k14 - yCameraPos;
  15465.                     int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  15466.                     yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  15467.                     xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  15468.                     if (yCameraCurve < 128)
  15469.                         yCameraCurve = 128;
  15470.                     if (yCameraCurve > 383)
  15471.                         yCameraCurve = 383;
  15472.                 }
  15473.                 pktType = -1;
  15474.                 return true;
  15475.             }
  15476.             if (pktType == 249) {
  15477.                 anInt1046 = inStream.method426();
  15478.                 unknownInt10 = inStream.method436();
  15479.                 pktType = -1;
  15480.                 return true;
  15481.             }
  15482.             if (pktType == 65) {
  15483.                 updateNPCs(inStream, pktSize);
  15484.                 pktType = -1;
  15485.                 return true;
  15486.             }
  15487.             if (pktType == 27) {
  15488.                 messagePromptRaised = false;
  15489.                 inputDialogState = 1;
  15490.                 amountOrNameInput = "";
  15491.                 inputTaken = true;
  15492.                 pktType = -1;
  15493.                 return true;
  15494.             }
  15495.             if (pktType == 187) {
  15496.                 messagePromptRaised = false;
  15497.                 inputDialogState = 2;
  15498.                 amountOrNameInput = "";
  15499.                 inputTaken = true;
  15500.                 pktType = -1;
  15501.                 return true;
  15502.             }
  15503.             if (pktType == 97) {
  15504.  
  15505.                 int l7 = inStream.readUnsignedWord();
  15506.                 method60(l7);
  15507.                 if (invOverlayInterfaceID != -1) {
  15508.                     invOverlayInterfaceID = -1;
  15509.                     needDrawTabArea = true;
  15510.                     tabAreaAltered = true;
  15511.                 }
  15512.                 if (backDialogID != -1) {
  15513.                     backDialogID = -1;
  15514.                     inputTaken = true;
  15515.                 }
  15516.                 if (inputDialogState != 0) {
  15517.                     inputDialogState = 0;
  15518.                     inputTaken = true;
  15519.                 }
  15520.                 openInterfaceID = l7;
  15521.                 aBoolean1149 = false;
  15522.                 pktType = -1;
  15523.                 return true;
  15524.  
  15525.             }
  15526.             if (pktType == 218) {
  15527.                 int i8 = inStream.method438();
  15528.                 dialogID = i8;
  15529.                 inputTaken = true;
  15530.                 pktType = -1;
  15531.                 return true;
  15532.             }
  15533.             if (pktType == 87) {
  15534.                 int j8 = inStream.method434();
  15535.                 int l14 = inStream.method439();
  15536.                 anIntArray1045[j8] = l14;
  15537.                 if (variousSettings[j8] != l14) {
  15538.                     variousSettings[j8] = l14;
  15539.                     method33(j8);
  15540.                     needDrawTabArea = true;
  15541.                     if (dialogID != -1)
  15542.                         inputTaken = true;
  15543.                 }
  15544.                 pktType = -1;
  15545.                 return true;
  15546.             }
  15547.             if (pktType == 36) {
  15548.                 int k8 = inStream.method434();
  15549.                 byte byte0 = inStream.readSignedByte();
  15550.                 anIntArray1045[k8] = byte0;
  15551.                 if (variousSettings[k8] != byte0) {
  15552.                     variousSettings[k8] = byte0;
  15553.                     method33(k8);
  15554.                     needDrawTabArea = true;
  15555.                     if (dialogID != -1)
  15556.                         inputTaken = true;
  15557.                 }
  15558.                 pktType = -1;
  15559.                 return true;
  15560.             }
  15561.             if (pktType == 61) {
  15562.                 anInt1055 = inStream.readUnsignedByte();
  15563.                 pktType = -1;
  15564.                 return true;
  15565.             }
  15566.             if (pktType == 200) {
  15567.                 int l8 = inStream.readUnsignedWord();
  15568.                 int i15 = inStream.readSignedWord();
  15569.                 RSInterface class9_4 = RSInterface.interfaceCache[l8];
  15570.                 class9_4.anInt257 = i15;
  15571.                 if (i15 == 591 || i15 == 588) {
  15572.                     class9_4.anInt269 = 1600;
  15573.                 }
  15574.                 if (i15 == -1) {
  15575.                     class9_4.anInt246 = 0;
  15576.                     class9_4.anInt208 = 0;
  15577.                 }
  15578.                 pktType = -1;
  15579.                 return true;
  15580.             }
  15581.             if (pktType == 219) {
  15582.                 if (invOverlayInterfaceID != -1) {
  15583.                     invOverlayInterfaceID = -1;
  15584.                     needDrawTabArea = true;
  15585.                     tabAreaAltered = true;
  15586.                 }
  15587.                 if (backDialogID != -1) {
  15588.                     backDialogID = -1;
  15589.                     inputTaken = true;
  15590.                 }
  15591.                 if (inputDialogState != 0) {
  15592.                     inputDialogState = 0;
  15593.                     inputTaken = true;
  15594.                 }
  15595.                 openInterfaceID = -1;
  15596.                 aBoolean1149 = false;
  15597.                 pktType = -1;
  15598.                 return true;
  15599.             }
  15600.             if (pktType == 34) {
  15601.                 needDrawTabArea = true;
  15602.                 int i9 = inStream.readUnsignedWord();
  15603.                 RSInterface class9_2 = RSInterface.interfaceCache[i9];
  15604.                 while (inStream.currentOffset < pktSize) {
  15605.                     int j20 = inStream.method422();
  15606.                     int i23 = inStream.readUnsignedWord();
  15607.                     int l25 = inStream.readUnsignedByte();
  15608.                     if (l25 == 255)
  15609.                         l25 = inStream.readDWord();
  15610.                     if (j20 >= 0 && j20 < class9_2.inv.length) {
  15611.                         class9_2.inv[j20] = i23;
  15612.                         class9_2.invStackSizes[j20] = l25;
  15613.                     }
  15614.                 }
  15615.                 pktType = -1;
  15616.                 return true;
  15617.             }
  15618.             if (pktType == 105 || pktType == 84 || pktType == 147
  15619.                     || pktType == 215 || pktType == 4 || pktType == 117
  15620.                     || pktType == 156 || pktType == 44 || pktType == 160
  15621.                     || pktType == 101 || pktType == 151) {
  15622.                 method137(inStream, pktType);
  15623.                 pktType = -1;
  15624.                 return true;
  15625.             }
  15626.             if (pktType == 106) {
  15627.                 tabID = inStream.method427();
  15628.                 needDrawTabArea = true;
  15629.                 tabAreaAltered = true;
  15630.                 pktType = -1;
  15631.                 return true;
  15632.             }
  15633.             if (pktType == 164) {
  15634.                 int j9 = inStream.method434();
  15635.                 method60(j9);
  15636.                 if (invOverlayInterfaceID != -1) {
  15637.                     invOverlayInterfaceID = -1;
  15638.                     needDrawTabArea = true;
  15639.                     tabAreaAltered = true;
  15640.                 }
  15641.                 backDialogID = j9;
  15642.                 inputTaken = true;
  15643.                 openInterfaceID = -1;
  15644.                 aBoolean1149 = false;
  15645.                 pktType = -1;
  15646.                 return true;
  15647.             }
  15648.             signlink.reporterror("T1 - " + pktType + "," + pktSize + " - "
  15649.                     + anInt842 + "," + anInt843);
  15650.             resetLogout();
  15651.         } catch (IOException _ex) {
  15652.             _ex.printStackTrace();
  15653.             dropClient();
  15654.         } catch (Exception exception) {
  15655.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843
  15656.                     + " - " + pktSize + "," + (baseX + myPlayer.smallX[0])
  15657.                     + "," + (baseY + myPlayer.smallY[0]) + " - ";
  15658.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++)
  15659.                 s2 = s2 + inStream.buffer[j15] + ",";
  15660.  
  15661.             signlink.reporterror(s2);
  15662.             exception.printStackTrace();
  15663.             resetLogout();
  15664.         }
  15665.  
  15666.         return true;
  15667.  
  15668.     }
  15669.  
  15670.     private void method146() {
  15671.         anInt1265++;
  15672.         method47(true);
  15673.         method26(true);
  15674.         method47(false);
  15675.         method26(false);
  15676.         method55();
  15677.         method104();
  15678.         if (!aBoolean1160) {
  15679.             int i = anInt1184;
  15680.             if (anInt984 / 256 > i)
  15681.                 i = anInt984 / 256;
  15682.             if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
  15683.                 i = anIntArray1203[4] + 128;
  15684.             int k = minimapInt1 + anInt896 & 0x7ff;
  15685.             int val = 600;
  15686.             setCameraPos(val + i * 3, i, anInt1014, method42(plane, myPlayer.y,
  15687.                     myPlayer.x) - 50, k, anInt1015);
  15688.         }
  15689.         int j;
  15690.         if (!aBoolean1160)
  15691.             j = method120();
  15692.         else
  15693.             j = method121();
  15694.         int l = xCameraPos;
  15695.         int i1 = zCameraPos;
  15696.         int j1 = yCameraPos;
  15697.         int k1 = yCameraCurve;
  15698.         int l1 = xCameraCurve;
  15699.         for (int i2 = 0; i2 < 5; i2++)
  15700.             if (aBooleanArray876[i2]) {
  15701.                 int j2 = (int) ((Math.random()
  15702.                         * (double) (anIntArray873[i2] * 2 + 1) - (double) anIntArray873[i2]) + Math
  15703.                         .sin((double) anIntArray1030[i2]
  15704.                                 * ((double) anIntArray928[i2] / 100D))
  15705.                         * (double) anIntArray1203[i2]);
  15706.                 if (i2 == 0)
  15707.                     xCameraPos += j2;
  15708.                 if (i2 == 1)
  15709.                     zCameraPos += j2;
  15710.                 if (i2 == 2)
  15711.                     yCameraPos += j2;
  15712.                 if (i2 == 3)
  15713.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  15714.                 if (i2 == 4) {
  15715.                     yCameraCurve += j2;
  15716.                     if (yCameraCurve < 128)
  15717.                         yCameraCurve = 128;
  15718.                     if (yCameraCurve > 383)
  15719.                         yCameraCurve = 383;
  15720.                 }
  15721.             }
  15722.         int k2 = Texture.anInt1481;
  15723.         Model.aBoolean1684 = true;
  15724.         Model.anInt1687 = 0;
  15725.         Model.anInt1685 = super.mouseX - 4;
  15726.         Model.anInt1686 = super.mouseY - 4;
  15727.         DrawingArea.setAllPixelsToZero();
  15728.         /*
  15729.          * if(Config.allowSky) { DrawingArea.method336(clientHeight, 0, 0,
  15730.          * 0xC8C0A8, clientWidth); }
  15731.          */
  15732.         try {
  15733.             worldController.method313(xCameraPos, yCameraPos, xCameraCurve,
  15734.                     zCameraPos, j, yCameraCurve);
  15735.         } catch (Exception e) {
  15736.         }
  15737.         worldController.clearObj5Cache();
  15738.         updateEntities();
  15739.         drawHeadIcon();
  15740.         method37(k2);
  15741.         draw3dScreen();
  15742.         if (counterOn) {
  15743.             drawCounterOnScreen();
  15744.             if (xpToDraw != 0) {
  15745.                 if (flagPos < 125) {
  15746.                     if (flagPos < 100) {
  15747.                         flagPos += 2;
  15748.                     } else {
  15749.                         flagPos += 1;
  15750.                     }
  15751.                     xpFlag.drawSprite(410, flagPos);
  15752.                     aTextDrawingArea_1271.method389(true, 455, 0xCC6600, ""
  15753.                             + xpToDraw + "xp", flagPos + 20);
  15754.                 } else {
  15755.                 }
  15756.                 if (flagPos >= 125) {
  15757.                     drawFlag = false;
  15758.                     flagPos = 72;
  15759.                     xpToDraw = 0;
  15760.                 }
  15761.             }
  15762.         }
  15763.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  15764.         xCameraPos = l;
  15765.         zCameraPos = i1;
  15766.         yCameraPos = j1;
  15767.         yCameraCurve = k1;
  15768.         xCameraCurve = l1;
  15769.     }/*
  15770.      * private void method146() { anInt1265++; method47(true); method26(true);
  15771.      * method47(false); method26(false); method55(); method104();
  15772.      * if(!aBoolean1160) { int i = anInt1184; if(anInt984 / 256 > i) i =
  15773.      * anInt984 / 256; if(aBooleanArray876[4] && anIntArray1203[4] + 128 > i) i
  15774.      * = anIntArray1203[4] + 128; int k = minimapInt1 + anInt896 & 0x7ff;
  15775.      * setCameraPos(600 + i * 3, i, anInt1014, method42(plane, myPlayer.y,
  15776.      * myPlayer.x) - 50, k, anInt1015); } int j; if(!aBoolean1160) j =
  15777.      * method120(); else j = method121(); int l = xCameraPos; int i1 =
  15778.      * zCameraPos; int j1 = yCameraPos; int k1 = yCameraCurve; int l1 =
  15779.      * xCameraCurve; for(int i2 = 0; i2 < 5; i2++) if(aBooleanArray876[i2]) {
  15780.      * int j2 = (int)((Math.random() * (double)(anIntArray873[i2] * 2 + 1) -
  15781.      * (double)anIntArray873[i2]) + Math.sin((double)anIntArray1030[i2] *
  15782.      * ((double)anIntArray928[i2] / 100D)) * (double)anIntArray1203[i2]); if(i2
  15783.      * == 0) xCameraPos += j2; if(i2 == 1) zCameraPos += j2; if(i2 == 2)
  15784.      * yCameraPos += j2; if(i2 == 3) xCameraCurve = xCameraCurve + j2 & 0x7ff;
  15785.      * if(i2 == 4) { yCameraCurve += j2; if(yCameraCurve < 128) yCameraCurve =
  15786.      * 128; if(yCameraCurve > 383) yCameraCurve = 383; } }
  15787.      *
  15788.      * int k2 = Texture.anInt1481; Model.aBoolean1684 = true; Model.anInt1687 =
  15789.      * 0; Model.anInt1685 = super.mouseX - 4; Model.anInt1686 = super.mouseY -
  15790.      * 4; DrawingArea.setAllPixelsToZero(); //xxx disables graphics
  15791.      * if(graphicsEnabled){ worldController.method313(xCameraPos, yCameraPos,
  15792.      * xCameraCurve, zCameraPos, j, yCameraCurve);
  15793.      * worldController.clearObj5Cache(); updateEntities(); drawHeadIcon();
  15794.      * method37(k2); draw3dScreen(); aRSImageProducer_1165.drawGraphics(4,
  15795.      * super.graphics, 4); xCameraPos = l; zCameraPos = i1; yCameraPos = j1;
  15796.      * yCameraCurve = k1; xCameraCurve = l1; // } }
  15797.      */
  15798.  
  15799.     private void clearTopInterfaces() {
  15800.         stream.createFrame(130);
  15801.         if (invOverlayInterfaceID != -1) {
  15802.             invOverlayInterfaceID = -1;
  15803.             needDrawTabArea = true;
  15804.             aBoolean1149 = false;
  15805.             tabAreaAltered = true;
  15806.         }
  15807.         if (backDialogID != -1) {
  15808.             backDialogID = -1;
  15809.             inputTaken = true;
  15810.             aBoolean1149 = false;
  15811.         }
  15812.         openInterfaceID = -1;
  15813.          fullscreenInterfaceID = -1;
  15814.     }
  15815.  
  15816.     public client() {
  15817.         xpAddedPos = expAdded = 0;
  15818.          fullscreenInterfaceID = -1;
  15819.         xpLock = false;
  15820.         xpCounter = 0;
  15821.         counter = new Sprite[3];
  15822.         alertHandler = new AlertHandler(this);
  15823.         chatTypeView = 0;
  15824.         duelMode = 0;
  15825.         clanChatMode = 0;
  15826.         new Messages();
  15827.         cButtonHPos = -1;
  15828.         cButtonHCPos = -1;
  15829.         sk = new ShortKeysPanel();
  15830.         //loadShortKeys();
  15831.         cButtonCPos = 0;
  15832.         // server = "dominationx-scape.no-ip.biz";
  15833.         // server = "dominationx-scape.no-ip.biz";
  15834.         anIntArrayArray825 = new int[104][104];
  15835.         friendsNodeIDs = new int[200];
  15836.         friendsNodeWorlds = new Hashtable(200);
  15837.         groundArray = new NodeList[4][104][104];
  15838.         aBoolean831 = false;
  15839.         aStream_834 = new Stream(new byte[5000]);
  15840.         npcArray = new NPC[32768];
  15841.         npcIndices = new int[32768];
  15842.         anIntArray840 = new int[1000];
  15843.         aStream_847 = Stream.create();
  15844.         aBoolean848 = true;
  15845.         openInterfaceID = -1;
  15846.         currentExp = new int[Skills.skillsCount];
  15847.         aBoolean872 = false;
  15848.         anIntArray873 = new int[5];
  15849.         anInt874 = -1;
  15850.         aBooleanArray876 = new boolean[5];
  15851.         drawFlames = false;
  15852.         reportAbuseInput = "";
  15853.         unknownInt10 = -1;
  15854.         menuOpen = false;
  15855.         inputString = "";
  15856.         maxPlayers = 2048;
  15857.         myPlayerIndex = 2047;
  15858.         playerArray = new Player[maxPlayers];
  15859.         playerIndices = new int[maxPlayers];
  15860.         anIntArray894 = new int[maxPlayers];
  15861.         aStreamArray895s = new Stream[maxPlayers];
  15862.         anInt897 = 1;
  15863.         anIntArrayArray901 = new int[104][104];
  15864.         anInt902 = 0x766654;
  15865.         aByteArray912 = new byte[16384];
  15866.         currentStats = new int[Skills.skillsCount];
  15867.         ignoreListAsLongs = new long[100];
  15868.         loadingError = false;
  15869.         anInt927 = 0x332d25;
  15870.         anIntArray928 = new int[5];
  15871.         anIntArrayArray929 = new int[104][104];
  15872.         chatTypes = new int[500];
  15873.         chatNames = new String[500];
  15874.         chatMessages = new String[500];
  15875.         sideIcons = new Sprite[14];
  15876.         redStones = new Sprite[5];
  15877.         aBoolean954 = true;
  15878.         friendsListAsLongs = new long[200];
  15879.         currentSong = -1;
  15880.         drawingFlames = false;
  15881.         spriteDrawX = -1;
  15882.         spriteDrawY = -1;
  15883.         anIntArray968 = new int[33];
  15884.         anIntArray969 = new int[256];
  15885.         decompressors = new Decompressor[5];
  15886.         variousSettings = new int[2000];
  15887.         aBoolean972 = false;
  15888.         anInt975 = 50;
  15889.         anIntArray976 = new int[anInt975];
  15890.         anIntArray977 = new int[anInt975];
  15891.         anIntArray978 = new int[anInt975];
  15892.         anIntArray979 = new int[anInt975];
  15893.         anIntArray980 = new int[anInt975];
  15894.         anIntArray981 = new int[anInt975];
  15895.         anIntArray982 = new int[anInt975];
  15896.         aStringArray983 = new String[anInt975];
  15897.         anInt985 = -1;
  15898.         hitMarks = new Sprite[22];
  15899.         anIntArray990 = new int[5];
  15900.         aBoolean994 = false;
  15901.         anInt1002 = 0x23201b;
  15902.         amountOrNameInput = "";
  15903.         aClass19_1013 = new NodeList();
  15904.         aBoolean1017 = false;
  15905.         anInt1018 = -1;
  15906.         anIntArray1030 = new int[5];
  15907.         aBoolean1031 = false;
  15908.         mapFunctions = new Sprite[100];
  15909.         dialogID = -1;
  15910.         maxStats = new int[Skills.skillsCount];
  15911.         anIntArray1045 = new int[2000];
  15912.         aBoolean1047 = true;
  15913.         anIntArray1052 = new int[151];
  15914.         anInt1054 = -1;
  15915.         aClass19_1056 = new NodeList();
  15916.         anIntArray1057 = new int[33];
  15917.         aClass9_1059 = new RSInterface();
  15918.         mapScenes = new Background[100];
  15919.         barFillColor = 0x4d4233;
  15920.         anIntArray1065 = new int[7];
  15921.         anIntArray1072 = new int[1000];
  15922.         anIntArray1073 = new int[1000];
  15923.         aBoolean1080 = false;
  15924.         friendsList = new String[200];
  15925.         inStream = Stream.create();
  15926.         expectedCRCs = new int[9];
  15927.         menuActionCmd2 = new int[500];
  15928.         menuActionCmd3 = new int[500];
  15929.         menuActionID = new int[500];
  15930.         menuActionCmd1 = new int[500];
  15931.         headIcons = new Sprite[20];
  15932.         headIconsHint = new Sprite[20];
  15933.         skullIcons = new Sprite[20];
  15934.         tabAreaAltered = false;
  15935.         aString1121 = "";
  15936.         frame = new RSImageProducer[3];
  15937.         atPlayerActions = new String[5];
  15938.         atPlayerArray = new boolean[5];
  15939.         anIntArrayArrayArray1129 = new int[4][13][13];
  15940.         anInt1132 = 2;
  15941.         aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  15942.         aBoolean1141 = false;
  15943.         aBoolean1149 = false;
  15944.         crosses = new Sprite[8];
  15945.         musicEnabled = true;
  15946.         needDrawTabArea = false;
  15947.         loggedIn = false;
  15948.         canMute = false;
  15949.         aBoolean1159 = false;
  15950.         aBoolean1160 = false;
  15951.         anInt1171 = 1;
  15952.         myUsername = "";
  15953.         myPassword = "";
  15954.         genericLoadingError = false;
  15955.         reportAbuseInterfaceID = -1;
  15956.         aClass19_1179 = new NodeList();
  15957.         anInt1184 = 128;
  15958.         invOverlayInterfaceID = -1;
  15959.         stream = Stream.create();
  15960.         menuActionName = new String[500];
  15961.         anIntArray1203 = new int[5];
  15962.         anIntArray1207 = new int[50];
  15963.         anInt1210 = 2;
  15964.         anInt1211 = 78;
  15965.         promptInput = "";
  15966.         modIcons = new Sprite[12];
  15967.         tabID = 3;
  15968.         inputTaken = false;
  15969.         songChanging = true;
  15970.         anIntArray1229 = new int[151];
  15971.         aClass11Array1230 = new Class11[4];
  15972.         aBoolean1233 = false;
  15973.         anIntArray1240 = new int[100];
  15974.         anIntArray1241 = new int[50];
  15975.         aBoolean1242 = false;
  15976.         anIntArray1250 = new int[50];
  15977.         rsAlreadyLoaded = false;
  15978.         welcomeScreenRaised = false;
  15979.         messagePromptRaised = false;
  15980.         loginMessage1 = "";
  15981.         loginMessage2 = "";
  15982.         backDialogID = -1;
  15983.         if(!Texture_Sub1.INSTANCE.isTextureLoaded()){
  15984.             System.exit(1);
  15985.             return;
  15986.         }
  15987.         anInt1279 = 2;
  15988.         bigX = new int[4000];
  15989.         bigY = new int[4000];
  15990.         anInt1289 = -1;
  15991.     }
  15992.  
  15993.     public int chatTypeView;
  15994.     public int clanChatMode;
  15995.     public int duelMode;
  15996.     /* Declare custom sprites */
  15997.     public Sprite multiOverlay;
  15998.     public Sprite duelingOverlay;
  15999.     private Sprite chatArea;
  16000.     private Sprite chatButtons;
  16001.     private Sprite chatButtonH;
  16002.     private Sprite chatButtonHC;
  16003.     private Sprite chatButtonC;
  16004.     private Sprite reportH;
  16005.     private Sprite tabArea;
  16006.     private Sprite mapArea;
  16007.     private Sprite logIconH;
  16008.     private Sprite logIconC;
  16009.     private Sprite worldMapIcon;
  16010.     private Sprite emptyOrb;
  16011.     private Sprite hitPointsFill;
  16012.     private Sprite hitPointsIcon;
  16013.     private Sprite prayerFill;
  16014.     private Sprite prayerIcon;
  16015.     /**/
  16016.     // private RSImageProducer frame;
  16017.     private RSImageProducer[] frame;
  16018.     private int ignoreCount;
  16019.     private long aLong824;
  16020.     private int[][] anIntArrayArray825;
  16021.     private int[] friendsNodeIDs;
  16022.     private NodeList[][][] groundArray;
  16023.     private int[] anIntArray828;
  16024.     private int[] anIntArray829;
  16025.     private volatile boolean aBoolean831;
  16026.     private Socket aSocket832;
  16027.     private int loginScreenState;
  16028.     private Stream aStream_834;
  16029.     private NPC[] npcArray;
  16030.     private int npcCount;
  16031.     private int[] npcIndices;
  16032.     private int anInt839;
  16033.     private int[] anIntArray840;
  16034.     private int anInt841;
  16035.     private int anInt842;
  16036.     private int anInt843;
  16037.     private String aString844;
  16038.     private int privateChatMode;
  16039.     private Stream aStream_847;
  16040.     private boolean aBoolean848;
  16041.     private static int anInt849;
  16042.     private int[] anIntArray850;
  16043.     private int[] anIntArray851;
  16044.     private int[] anIntArray852;
  16045.     private int[] anIntArray853;
  16046.     private static int anInt854;
  16047.     private int anInt855;
  16048.     public static int openInterfaceID;
  16049.     private int xCameraPos;
  16050.     private int zCameraPos;
  16051.     private int yCameraPos;
  16052.     private int yCameraCurve;
  16053.     private int xCameraCurve;
  16054.     private int myPrivilege;
  16055.     private final int[] currentExp;
  16056.     private Sprite[] redStones;
  16057.     private Sprite mapFlag;
  16058.     private Sprite mapMarker;
  16059.     private boolean aBoolean872;
  16060.     private final int[] anIntArray873;
  16061.     private int anInt874;
  16062.     private final boolean[] aBooleanArray876;
  16063.     private int weight;
  16064.     private MouseDetection mouseDetection;
  16065.     private volatile boolean drawFlames;
  16066.     private String reportAbuseInput;
  16067.     private int unknownInt10;
  16068.     private boolean menuOpen;
  16069.     private int anInt886;
  16070.     public static String inputString;
  16071.     private final int maxPlayers;
  16072.     private final int myPlayerIndex;
  16073.     private Player[] playerArray;
  16074.     private int playerCount;
  16075.     private int[] playerIndices;
  16076.     private int anInt893;
  16077.     private int[] anIntArray894;
  16078.     private Stream[] aStreamArray895s;
  16079.     private int anInt896;
  16080.     private int anInt897;
  16081.     private int friendsCount;
  16082.     private int anInt900;
  16083.     private int[][] anIntArrayArray901;
  16084.     private final int anInt902;
  16085.     private byte[] aByteArray912;
  16086.     private int anInt913;
  16087.     private int crossX;
  16088.     private int crossY;
  16089.     private int crossIndex;
  16090.     private int crossType;
  16091.     private int plane;
  16092.     private final int[] currentStats;
  16093.     private static int anInt924;
  16094.     private final long[] ignoreListAsLongs;
  16095.     private boolean loadingError;
  16096.     private final int anInt927;
  16097.     private final int[] anIntArray928;
  16098.     private int[][] anIntArrayArray929;
  16099.     private Sprite aClass30_Sub2_Sub1_Sub1_931;
  16100.     private Sprite aClass30_Sub2_Sub1_Sub1_932;
  16101.     private int anInt933;
  16102.     private int anInt934;
  16103.     private int anInt935;
  16104.     private int anInt936;
  16105.     private int anInt937;
  16106.     private int anInt938;
  16107.     private static int anInt940;
  16108.     private final int[] chatTypes;
  16109.     private final String[] chatNames;
  16110.     private final String[] chatMessages;
  16111.     private int anInt945;
  16112.     private WorldController worldController;
  16113.     private Sprite[] sideIcons;
  16114.     private int menuScreenArea;
  16115.     private int menuOffsetX;
  16116.     private int menuOffsetY;
  16117.     private int menuWidth;
  16118.     private int anInt952;
  16119.     private long aLong953;
  16120.     private boolean aBoolean954;
  16121.     private long[] friendsListAsLongs;
  16122.     private int currentSong;
  16123.     private static int nodeID = 10;
  16124.     static int portOff;
  16125.     static boolean clientData;
  16126.     private static boolean isMembers = true;
  16127.     public static boolean lowMem;
  16128.     private volatile boolean drawingFlames;
  16129.     private int spriteDrawX;
  16130.     private int spriteDrawY;
  16131.     private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535,
  16132.             0xff00ff, 0xffffff };
  16133.     private Background aBackground_966;
  16134.     private Background aBackground_967;
  16135.     private final int[] anIntArray968;
  16136.     private final int[] anIntArray969;
  16137.     final Decompressor[] decompressors;
  16138.     public int variousSettings[];
  16139.     private boolean aBoolean972;
  16140.     private final int anInt975;
  16141.     private final int[] anIntArray976;
  16142.     private final int[] anIntArray977;
  16143.     private final int[] anIntArray978;
  16144.     private final int[] anIntArray979;
  16145.     private final int[] anIntArray980;
  16146.     private final int[] anIntArray981;
  16147.     private final int[] anIntArray982;
  16148.     private final String[] aStringArray983;
  16149.     private int anInt984;
  16150.     private int anInt985;
  16151.     private static int anInt986;
  16152.     private Sprite[] hitMarks;
  16153.     private int anInt988;
  16154.     private int anInt989;
  16155.     private final int[] anIntArray990;
  16156.     private static boolean aBoolean993;
  16157.     private final boolean aBoolean994;
  16158.     private int anInt995;
  16159.     private int anInt996;
  16160.     private int anInt997;
  16161.     private int anInt998;
  16162.     private int anInt999;
  16163.     public ISAACRandomGen encryption;
  16164.     private Sprite mapEdge;
  16165.     private final int anInt1002;
  16166.     static final int[][] anIntArrayArray1003 = {
  16167.             { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983,
  16168.                     54193 },
  16169.             { 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
  16170.                     56621, 4783, 1341, 16578, 35003, 25239 },
  16171.             { 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
  16172.                     10153, 56621, 4783, 1341, 16578, 35003 },
  16173.             { 4626, 11146, 6439, 12, 4758, 10270 },
  16174.             { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
  16175.     private String amountOrNameInput;
  16176.     private static int anInt1005;
  16177.     private int daysSinceLastLogin;
  16178.     private int pktSize;
  16179.     private int pktType;
  16180.     private int anInt1009;
  16181.     private int anInt1010;
  16182.     private int anInt1011;
  16183.     private NodeList aClass19_1013;
  16184.     private int anInt1014;
  16185.     private int anInt1015;
  16186.     private int anInt1016;
  16187.     private boolean aBoolean1017;
  16188.     private int anInt1018;
  16189.     private static final int[] anIntArray1019;
  16190.     private int anInt1021;
  16191.     private int anInt1022;
  16192.     private int loadingStage;
  16193.     private Background scrollBar1;
  16194.     private Background scrollBar2;
  16195.     private int anInt1026;
  16196.     private Background backBase1;
  16197.     private Background backBase2;
  16198.     private Background backHmid1;
  16199.     private final int[] anIntArray1030;
  16200.     private boolean aBoolean1031;
  16201.     private Sprite[] mapFunctions;
  16202.     private int baseX;
  16203.     private int baseY;
  16204.     private int anInt1036;
  16205.     private int anInt1037;
  16206.     private int loginFailures;
  16207.     private int anInt1039;
  16208.     private int anInt1040;
  16209.     private int anInt1041;
  16210.     private int dialogID;
  16211.     private final int[] maxStats;
  16212.     private final int[] anIntArray1045;
  16213.     private int anInt1046;
  16214.     private boolean aBoolean1047;
  16215.     private int anInt1048;
  16216.     private String aString1049;
  16217.     private static int anInt1051;
  16218.     private final int[] anIntArray1052;
  16219.     private StreamLoader titleStreamLoader;
  16220.     private int anInt1054;
  16221.     private int anInt1055;
  16222.     private NodeList aClass19_1056;
  16223.     private final int[] anIntArray1057;
  16224.     public final RSInterface aClass9_1059;
  16225.     private Background[] mapScenes;
  16226.     private static int anInt1061;
  16227.     private int anInt1062;
  16228.     private final int barFillColor;
  16229.     private int friendsListAction;
  16230.     private final int[] anIntArray1065;
  16231.     private int mouseInvInterfaceIndex;
  16232.     private int lastActiveInvInterface;
  16233.     public OnDemandFetcher onDemandFetcher;
  16234.     private int anInt1069;
  16235.     private int anInt1070;
  16236.     private int anInt1071;
  16237.     private int[] anIntArray1072;
  16238.     private int[] anIntArray1073;
  16239.     private Sprite mapDotItem;
  16240.     private Sprite mapDotNPC;
  16241.     private Sprite mapDotPlayer;
  16242.     private Sprite mapDotFriend;
  16243.     private Sprite mapDotBL;
  16244.     private Sprite mapDotTeam;
  16245.     private int anInt1079;
  16246.     private boolean aBoolean1080;
  16247.     private String[] friendsList;
  16248.     private Stream inStream;
  16249.     private int anInt1084;
  16250.     private int anInt1085;
  16251.     private int activeInterfaceType;
  16252.     private int anInt1087;
  16253.     private int anInt1088;
  16254.     public static int anInt1089;
  16255.     public final int[] expectedCRCs;
  16256.     private int[] menuActionCmd2;
  16257.     private int[] menuActionCmd3;
  16258.     public int[] menuActionID;
  16259.     private int[] menuActionCmd1;
  16260.     private Sprite[] headIcons;
  16261.     private Sprite[] headIconsHint;
  16262.     private Sprite[] skullIcons;
  16263.     private static int anInt1097;
  16264.     private int anInt1098;
  16265.     private int anInt1099;
  16266.     private int anInt1100;
  16267.     private int anInt1101;
  16268.     private int anInt1102;
  16269.     public static boolean tabAreaAltered;
  16270.     private int anInt1104;
  16271.     private RSImageProducer aRSImageProducer_1107;
  16272.     private RSImageProducer aRSImageProducer_1108;
  16273.     private RSImageProducer aRSImageProducer_1109;
  16274.     private RSImageProducer aRSImageProducer_1110;
  16275.     private RSImageProducer aRSImageProducer_1111;
  16276.     private RSImageProducer aRSImageProducer_1112;
  16277.     private RSImageProducer aRSImageProducer_1113;
  16278.     private RSImageProducer aRSImageProducer_1114;
  16279.     private RSImageProducer aRSImageProducer_1115;
  16280.     private static int anInt1117;
  16281.     private int membersInt;
  16282.     private String aString1121;
  16283.     private Sprite compass;
  16284.     private RSImageProducer aRSImageProducer_1123;
  16285.     private RSImageProducer aRSImageProducer_1124;
  16286.     private RSImageProducer aRSImageProducer_1125;
  16287.     public static Player myPlayer;
  16288.     private final String[] atPlayerActions;
  16289.     private final boolean[] atPlayerArray;
  16290.     private final int[][][] anIntArrayArrayArray1129;
  16291.     public static final int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1,
  16292.             -1, -1, -1, -1, -1, -1, -1, -1 };
  16293.     private int anInt1131;
  16294.     private int anInt1132;
  16295.     public int menuActionRow;
  16296.     private static int anInt1134;
  16297.     private int spellSelected;
  16298.     private int anInt1137;
  16299.     private int spellUsableOn;
  16300.     private String spellTooltip;
  16301.     private Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  16302.     private boolean aBoolean1141;
  16303.     private static int anInt1142;
  16304.     private int energy;
  16305.     private boolean aBoolean1149;
  16306.     private Sprite[] crosses;
  16307.     public int anInt1044;// 377
  16308.     public int anInt1129;// 377
  16309.     public int anInt1315;// 377
  16310.     public int anInt1500;// 377
  16311.     public int anInt1501;// 377
  16312.     private boolean musicEnabled;
  16313.     private Background[] aBackgroundArray1152s;
  16314.     public static boolean needDrawTabArea;
  16315.     private int unreadMessages;
  16316.     private static int anInt1155;
  16317.     public static boolean fpsOn;
  16318.     public boolean loggedIn;
  16319.     private boolean canMute;
  16320.     private boolean aBoolean1159;
  16321.     private boolean aBoolean1160;
  16322.     static int loopCycle;
  16323.     private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  16324.     private RSImageProducer aRSImageProducer_1163;
  16325.     private RSImageProducer aRSImageProducer_1164;
  16326.     private RSImageProducer aRSImageProducer_1165;
  16327.     private RSImageProducer aRSImageProducer_1166;
  16328.     private int daysSinceRecovChange;
  16329.     private RSSocket socketStream;
  16330.     private int anInt1169;
  16331.     private int minimapInt3;
  16332.     private int anInt1171;
  16333.     private long aLong1172;
  16334.     public static String myUsername;
  16335.     public static String myPassword;
  16336.     private static int anInt1175;
  16337.     private boolean genericLoadingError;
  16338.     private final int[] anIntArray1177 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
  16339.             2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 };
  16340.     private int reportAbuseInterfaceID;
  16341.     private NodeList aClass19_1179;
  16342.     private int[] anIntArray1180;
  16343.     private int[] anIntArray1181;
  16344.     private int[] anIntArray1182;
  16345.     private byte[][] aByteArrayArray1183;
  16346.     private int anInt1184;
  16347.     private int minimapInt1;
  16348.     private int anInt1186;
  16349.     private int anInt1187;
  16350.     private static int anInt1188;
  16351.     private int invOverlayInterfaceID;
  16352.     private int[] anIntArray1190;
  16353.     private int[] anIntArray1191;
  16354.     private Stream stream;
  16355.     private int anInt1193;
  16356.     private int splitPrivateChat;
  16357.     private Background mapBack;
  16358.     public String[] menuActionName;
  16359.     private Sprite aClass30_Sub2_Sub1_Sub1_1201;
  16360.     private Sprite aClass30_Sub2_Sub1_Sub1_1202;
  16361.     private final int[] anIntArray1203;
  16362.     static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975, 8526,
  16363.             918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486 };
  16364.     private static boolean flagged;
  16365.     private final int[] anIntArray1207;
  16366.     private int anInt1208;
  16367.     private int minimapInt2;
  16368.     private int anInt1210;
  16369.     private int anInt1211;
  16370.     private String promptInput;
  16371.     private int anInt1213;
  16372.     private int[][][] intGroundArray;
  16373.     public long aLong1215;
  16374.     private int loginScreenCursorPos;
  16375.     private final Sprite[] modIcons;
  16376.     private long aLong1220;
  16377.     public static int tabID;
  16378.     private int anInt1222;
  16379.     public static boolean inputTaken;
  16380.     private int inputDialogState;
  16381.     private static int anInt1226;
  16382.     private int nextSong;
  16383.     private boolean songChanging;
  16384.     private final int[] anIntArray1229;
  16385.     private Class11[] aClass11Array1230;
  16386.     public static int anIntArray1232[];
  16387.     private boolean aBoolean1233;
  16388.     private int[] anIntArray1234;
  16389.     private int[] anIntArray1235;
  16390.     private int[] anIntArray1236;
  16391.     private int anInt1237;
  16392.     private int anInt1238;
  16393.     public final int anInt1239 = 100;
  16394.     private final int[] anIntArray1240;
  16395.     private final int[] anIntArray1241;
  16396.     private boolean aBoolean1242;
  16397.     private int atInventoryLoopCycle;
  16398.     private int atInventoryInterface;
  16399.     private int atInventoryIndex;
  16400.     private int atInventoryInterfaceType;
  16401.     private byte[][] aByteArrayArray1247;
  16402.     private int tradeMode;
  16403.     private int anInt1249;
  16404.     private final int[] anIntArray1250;
  16405.     private int anInt1251;
  16406.     private final boolean rsAlreadyLoaded;
  16407.     private int anInt1253;
  16408.     private int anInt1254;
  16409.     private boolean welcomeScreenRaised;
  16410.     private boolean messagePromptRaised;
  16411.     private int anInt1257;
  16412.     private byte[][][] byteGroundArray;
  16413.     private int prevSong;
  16414.     private int destX;
  16415.     private int destY;
  16416.     private Sprite aClass30_Sub2_Sub1_Sub1_1263;
  16417.     private int anInt1264;
  16418.     private int anInt1265;
  16419.     private String loginMessage1;
  16420.     private String loginMessage2;
  16421.     private int anInt1268;
  16422.     private int anInt1269;
  16423.     public TextDrawingArea smallText;
  16424.     public TextDrawingArea aTextDrawingArea_1271;
  16425.     private TextDrawingArea chatTextDrawingArea;
  16426.     private int anInt1275;
  16427.     private int backDialogID;
  16428.     private int anInt1278;
  16429.     private int anInt1279;
  16430.     private int[] bigX;
  16431.     private int[] bigY;
  16432.     private int itemSelected;
  16433.     private int anInt1283;
  16434.     private int anInt1284;
  16435.     private int anInt1285;
  16436.     private String selectedItemName;
  16437.     private int publicChatMode;
  16438.     private static int anInt1288;
  16439.     private int anInt1289;
  16440.     public static int anInt1290;
  16441.     public static String server = "";
  16442.     public int settime, size2, size, chatsize;
  16443.     public boolean autochat = false;
  16444.     public int autotime = 200;
  16445.     public String textchat = null;
  16446.     public String automsg = null;
  16447.     public boolean hp = false;
  16448.     public boolean ranks = true;
  16449.     public boolean names = false;
  16450.     static boolean coordinates;
  16451.     public static int spellID = 0;
  16452.     public boolean noClip = false;
  16453.     private Sprite infinity;
  16454.     public static boolean hpH = true;
  16455.     public static boolean newHpBar = true;
  16456.     public static boolean newHits = true;
  16457.     static boolean performanceCounter;
  16458.     public int followPlayer = 0;
  16459.     public int followNPC = 0;
  16460.     public int MAXGFXID = 3038;
  16461.     public int MAXANIMID = 16858;
  16462.     public int followDistance = 1;
  16463.     private Hashtable friendsNodeWorlds;
  16464.     static {
  16465.         anIntArray1019 = new int[99];
  16466.         int i = 0;
  16467.         for (int j = 0; j < 99; j++) {
  16468.             int l = j + 1;
  16469.             int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D));
  16470.             i += i1;
  16471.             anIntArray1019[j] = i / 4;
  16472.         }
  16473.  
  16474.         anIntArray1232 = new int[32];
  16475.         i = 2;
  16476.         for (int k = 0; k < 32; k++) {
  16477.             anIntArray1232[k] = i - 1;
  16478.             i += i;
  16479.         }
  16480.  
  16481.     }
  16482. }
Advertisement
Add Comment
Please, Sign In to add comment