Guest User

Untitled

a guest
Jul 16th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 498.85 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.util.zip.ZipEntry;
  23. import java.util.zip.*;
  24. import java.io.BufferedWriter;
  25. import java.io.ByteArrayInputStream;
  26. import java.io.DataInputStream;
  27. import java.io.EOFException;
  28. import java.text.*;
  29. import java.util.*;
  30. import java.io.File;
  31. import java.io.FileInputStream;
  32. import java.io.FileOutputStream;
  33. import java.io.FileReader;
  34. import java.io.IOException;
  35. import java.io.InputStream;
  36. import java.io.InputStreamReader;
  37. import java.io.OutputStream;
  38. import java.io.PrintWriter;
  39. import java.lang.reflect.Method;
  40. import java.net.InetAddress;
  41. import java.net.MalformedURLException;
  42. import java.net.Socket;
  43. import java.net.URL;
  44. import java.net.URLConnection;
  45. import java.util.Hashtable;
  46. import javax.swing.*;
  47. import java.util.Scanner;
  48. import sign.signlink;
  49.  
  50. public class client extends RSApplet {
  51. public static String FileSection = System.getProperty("file.separator") + System.getProperty("user.home") + System.getProperty("file.separator");
  52.     private boolean loadTickSelection = false;
  53.     public int positions[] = new int[2000];
  54.     public int landScapes[] = new int[2000];
  55.     public int objects[] = new int[2000];
  56.     public AlertHandler alertHandler;
  57.     public Sprite alertBack;
  58.     public Sprite alertBorder;
  59.     public Sprite alertBorderH;
  60.     private Sprite HPBarFull;
  61.     private Sprite HPBarEmpty;
  62.     public int flagPos = 72, xpCounter;
  63.     public boolean xpHover = false;
  64.     public boolean xpClicked = false;
  65.     public boolean drawXpBar = false;
  66.     public boolean drawFlag = false;
  67.     private String prayerBook;
  68.     private ShortKeysPanel sk;
  69.     public String fName;
  70.     public String dir;
  71.    
  72.     public String getTitle(int rank) {
  73.         switch (rank) {
  74.                 /**Server Rankings**/
  75.                    case 0:
  76.                         return "Donator ";
  77.                 case 1:
  78.                         return "Donator ";
  79.                 case 2:
  80.                         return "Respected Donator ";
  81.                 case 3:
  82.                         return "Server Support ";
  83.                 case 4:
  84.                         return "Moderator ";
  85.                 case 5:
  86.                         return "Administrator ";
  87.                 case 8:
  88.                         return "Advisor ";
  89.                 case 9:
  90.                         return "Developer ";
  91.                 /**Loyalty Names**/
  92.                 case 10:
  93.                         return "Lord ";
  94.                 case 11:
  95.                         return "Lady ";
  96.                 case 12:
  97.                         return "Sir ";
  98.                 case 13:
  99.                         return "Dame ";
  100.                 case 14:
  101.                         return "Duderino ";
  102.                 case 15:
  103.                         return "Dudette ";
  104.                 case 16:
  105.                         return "Lionheart ";
  106.                 case 17:
  107.                         return "Crusader ";
  108.                 case 18:
  109.                         return "Hellraiser ";
  110.                 case 19:
  111.                         return "Desperado ";
  112.                 case 20:
  113.                         return "Baron ";
  114.                 case 21:
  115.                         return "Baroness ";
  116.                 case 22:
  117.                         return "Count ";
  118.                 case 23:
  119.                         return "Countess ";
  120.                 case 24:
  121.                         return "Overlord ";
  122.                 case 25:
  123.                         return "Overlordess ";
  124.                 case 26:
  125.                         return "Prince ";
  126.                 case 27:
  127.                         return "Princess ";
  128.                 case 28:
  129.                         return "Bandito ";
  130.                 case 29:
  131.                         return "Duke ";
  132.                 case 30:
  133.                         return "Dutchess ";
  134.                 case 31:
  135.                         return "Justiciar ";
  136.                 case 32:
  137.                         return "Big Cheese ";
  138.                 case 33:
  139.                         return "Bigwig ";
  140.                 case 34:
  141.                         return "King ";
  142.                 case 35:
  143.                         return "Queen ";
  144.                 case 36:
  145.                         return "Archon ";
  146.                 case 37:
  147.                         return "Emperor ";
  148.                 case 38:
  149.                         return "Empress ";
  150.                 case 39:
  151.                         return "Wunderkind ";
  152.                 case 40:
  153.                         return "Witch king ";
  154.                 case 41:
  155.                         return "Witch queen ";
  156.                 case 42:
  157.                         return "The Awesome ";
  158.                 case 43:
  159.                         return "Official Middleman ";
  160.                 case 44:
  161.                         return "Veteran ";
  162.                 /*case 39: //Go in front of name TO-DO
  163.                         return " the Magnificent";
  164.                 case 40:
  165.                         return " the Undefeated";
  166.                 case 41:
  167.                         return " the Strange";
  168.                 case 42:
  169.                         return " the Divine";
  170.                 case 43:
  171.                         return " the Fallen";
  172.                 case 44:
  173.                         return " the Warrior";*/
  174.                 /**Mobilising Armies**/
  175.                 case 45:
  176.                         return "Junior Cadet ";
  177.                 case 46:
  178.                         return "Sergeant ";
  179.                 case 47:
  180.                         return "Commander ";
  181.                 case 48:
  182.                         return "War-chief ";
  183.                 /**Vampyric**/
  184.                 case 49:
  185.                         return "Vyreling ";
  186.                 case 50:
  187.                         return "Vyre Grunt ";
  188.                 case 51:
  189.                         return "Vyrewatch ";
  190.                 case 52:
  191.                         return "Vyrelord ";
  192.                 case 53:
  193.                         return "Vyrelady ";
  194.                 /**Tzhaar**/
  195.                 case 54:
  196.                         return "YtHaar ";
  197.                 case 55:
  198.                         return "GFX Artist ";
  199.                 case 59:
  200.                                 return "Ownage ";
  201.                 /**Custom**/
  202.                 case 60:
  203.                         return "GOD ";
  204.                 case 61:
  205.                         return "Pro ";
  206.                 case 62:
  207.                         return "Legend ";
  208.                 case 63:
  209.                         return "Pker ";
  210.                 case 64:
  211.                         return "Staker ";
  212.                 case 65:
  213.                         return "Merchant ";
  214.                 case 66:
  215.                         return "Skiller ";
  216.                 case 67:
  217.                         return "Expert ";
  218.                 case 68:
  219.                         return "Guardian ";
  220.                 case 69:
  221.                         return "Master ";
  222.                 case 70:
  223.                         return "E Dater ";
  224.                 case 71:
  225.                         return "Recruit ";
  226.                 case 72:
  227.                         return "Owner ";
  228.                 case 73:
  229.                         return "The Almighty ";
  230.                 case 74:
  231.                         return "The Best ";
  232.                 case 75:
  233.                         return "Black ";
  234.                 case 76:
  235.                         return "Crybaby ";
  236.                 case 77:
  237.                         return "President ";
  238.                 case 78:
  239.                         return "Prime Minister ";
  240.                 case 79:
  241.                         return "Grand Master ";
  242.                 case 80:
  243.                         return "Cadet ";
  244.                 case 81:
  245.                         return "gwasballer ";
  246.                 case 82:
  247.                         return "Winner ";
  248.                 case 83:
  249.                         return "Bad ";
  250.                 case 84:
  251.                         return "Amazing ";
  252.                 case 85:
  253.                         return "Beast ";
  254.                 case 86:
  255.                         return "Beastmode ";
  256.                 case 87:
  257.                         return "Baller ";
  258.                 case 88:
  259.                         return "Pure ";
  260.                 case 89:
  261.                         return "Destroyer ";
  262.                 case 90:
  263.                         return "Elite ";
  264.                 case 91:
  265.                         return "1337 ";
  266.                 case 92:
  267.                         return "Muchacho ";
  268.                 case 93:
  269.                         return "Santa ";
  270.                 case 94:
  271.                         return "Sugar Daddy ";
  272.                 case 95:
  273.                         return "Just A Small Town Girl ";//BILLYS RANK FUCK YOU
  274.                        
  275.                        
  276.                        
  277.                        
  278.                
  279.                                
  280.         }
  281.         return "";
  282. }
  283.  
  284.     public int getColor(int color) {
  285.         if (color >= 6 && color <= 38)
  286.             return 0xC86400;
  287.         switch (color) {
  288.         case 45:
  289.         case 46:
  290.         case 47:
  291.         case 48:
  292.             return 0xAF64A0;
  293.         case 49:
  294.         case 50:
  295.         case 51:
  296.         case 52:
  297.         case 53:
  298.         case 54:
  299.             return 0xC12006;
  300.         }
  301.         return 0xC86400;
  302.     }
  303.  
  304.     public String getSpecialColor(int rank) {
  305.         // if (rank >= 6 && rank <= 38)
  306.         if (rank > 0)
  307.             return "@bas@";
  308.         /*
  309.          * switch (rank) { case 45: case 46: case 47: case 48: return "@mbl@";
  310.          * case 49: case 50: case 51: case 52: case 53: case 54: return "@vth@";
  311.          * }
  312.          */
  313.         return "@blk@";
  314.     }
  315.  
  316.     public void setSidebarInterface(int sidebarID, int interfaceID) {
  317.         tabInterfaceIDs[sidebarID] = interfaceID;
  318.         tabID = sidebarID;
  319.         needDrawTabArea = true;
  320.         tabAreaAltered = true;
  321.     }
  322.  
  323.     public static boolean logHover = false, spriteChanged = false,
  324.             selectAction, isChatInterface, displayChat, runClicked = true,
  325.             runHover = false, xpLock = false;
  326.     public Sprite[] cacheSprite;
  327.     public static int clientWidth = 765, clientHeight = 503, clientSize = 0;
  328.     private boolean counterOn = false;
  329.  
  330.     /**
  331.      * Place a String on the clipboard, and make this class the owner of the
  332.      * Clipboard's contents.
  333.      */
  334.     public static void saveValue(BufferedWriter buffer, String value,
  335.             String variable, boolean last) {
  336.         try {
  337.             if (value == null || variable.equals("null"))
  338.                 System.out.println("Error: saveValue had no identifier.");
  339.             if (variable == null || variable.equals("null"))
  340.                 variable = "0";
  341.             if (value.startsWith("[") && value.endsWith("]")) {
  342.                 buffer.write(value, 0, value.length());
  343.             } else {
  344.                 value = value + " = ";
  345.                 buffer.write(value, 0, value.length());
  346.                 buffer.write(variable, 0, variable.length());
  347.             }
  348.             buffer.newLine();
  349.             if (last)
  350.                 buffer.newLine();
  351.         } catch (IOException ioexception) {
  352.             ioexception.printStackTrace();
  353.         } catch (NullPointerException nullpointerexception) {
  354.             nullpointerexception.printStackTrace();
  355.         }
  356.     }
  357.  
  358.     public static int[] quickPrayers = new int[26];
  359.     public static int[] quickCurses = new int[20];
  360.     private boolean clickedQuickPrayers;
  361.     public int prayerInterfaceType = 22500;
  362.  
  363.     private void configureQuickTicks() {
  364.         if (prayerInterfaceType == 5608) {
  365.             if (getQuickPrayersSet() > 0) {
  366.                 for (int index = 0; index < quickPrayers.length; index++) {
  367.                     if (quickPrayers[index] == 1) {// where did u get this
  368.                                                     // method from lol
  369.                         if (index >= 0 && index <= 25) {
  370.                             if (getOrbValues(1, null)[1] >= prayerLevelRequirements[index]) {
  371.                                 int[] types = getPrayerTypeForIndex(index);
  372.                                 if (types != null) {
  373.                                     for (int g = 0; g < rangeAndMagePray.length; g++) {
  374.                                         if (index == rangeAndMagePray[g]) {
  375.                                             types = rangeAndMagePrayOff;
  376.                                         }
  377.                                     }
  378.                                     for (int i = 0; i < types.length; i++) {
  379.                                         if (index != types[i]) {
  380.                                             if (index == 24 || index == 25) {
  381.                                                 types = superiorPray;
  382.                                             }
  383.                                             quickPrayers[types[i]] = 0;
  384.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  385.                                             method33(quickConfigIDs[types[i]]);
  386.                                             needDrawTabArea = true;
  387.                                             if (dialogID != -1)
  388.                                                 inputTaken = true;
  389.                                         } else {
  390.                                             quickPrayers[index] = 1;
  391.                                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  392.                                             method33(quickConfigIDs[index]);
  393.                                             needDrawTabArea = true;
  394.                                             if (dialogID != -1)
  395.                                                 inputTaken = true;
  396.                                         }
  397.                                     }
  398.                                 } else {
  399.                                     quickPrayers[index] = 1;
  400.                                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  401.                                     method33(quickConfigIDs[index]);
  402.                                     needDrawTabArea = true;
  403.                                     if (dialogID != -1)
  404.                                         inputTaken = true;
  405.                                 }
  406.                             }
  407.                         }
  408.                     }
  409.                 }
  410.             }
  411.         } else if (prayerInterfaceType == 22500) {
  412.             if (getQuickCursesSet() > 0) {
  413.                 for (int index = 0; index < quickCurses.length; index++) {
  414.                     if (quickCurses[index] == 1) {
  415.                         if (index >= 0 && index <= 20) {
  416.                             if (getOrbValues(1, null)[1] >= curseLevelRequirements[index]) {
  417.                                 int[] types = getCurseTypeForIndex(index);
  418.                                 if (types != null) {
  419.                                     for (int i = 0; i < types.length; i++) {
  420.                                         if (index != types[i]) {
  421.                                             quickCurses[types[i]] = 0;
  422.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  423.                                             method33(quickConfigIDs[types[i]]);
  424.                                             needDrawTabArea = true;
  425.                                             if (dialogID != -1)
  426.                                                 inputTaken = true;
  427.                                         }
  428.                                     }
  429.                                 }
  430.                                 quickCurses[index] = 1;
  431.                                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  432.                                 method33(quickConfigIDs[index]);
  433.                                 needDrawTabArea = true;
  434.                                 if (dialogID != -1)
  435.                                     inputTaken = true;
  436.                             }
  437.                         }
  438.                     }
  439.                 }
  440.             }
  441.         }
  442.     }
  443.  
  444.     public int[] oldPrayerButtons = { 5609, 5610, 5611, 18000, 18002, 5612,
  445.             5613, 5614, 5615, 5616, 5617, 18004, 18006, 5618, 5619, 5620, 5621,
  446.             5622, 5623, 18008, 18010, 683, 684, 685, 18012, 18014 };
  447.  
  448.     public void handePrayerCorrection(int button) {
  449.         int index = button - 25000;
  450.         if (index > 0)
  451.             index = index / 2;
  452.         sendPacket185(oldPrayerButtons[index], 0, 169);
  453.     }
  454.  
  455.     public void sendFrame36(int id, int state) {
  456.         anIntArray1045[id] = state;
  457.         if (variousSettings[id] != state) {
  458.             variousSettings[id] = state;
  459.             method33(id);
  460.             needDrawTabArea = true;
  461.             if (dialogID != -1)
  462.                 inputTaken = true;
  463.         } else {
  464.             variousSettings[id] = 0;
  465.             method33(id);
  466.             needDrawTabArea = true;
  467.             if (dialogID != -1)
  468.                 inputTaken = true;
  469.         }
  470.     }
  471.  
  472.     public void sendPacket185(int button, int toggle, int type) {
  473.         if (button >= 17202 && button <= 17227)
  474.             togglePrayerState(button);
  475.         switch (button) {
  476.         case 17231:// Quick prayr confirm
  477.             saveQuickSelection();
  478.             break;
  479.         case 19144:
  480.             sendFrame248(15106, 3213);
  481.             method60(15106);
  482.             inputTaken = true;
  483.             break;
  484.         }
  485.         switch (type) {
  486.         case 135:
  487.             RSInterface class9 = RSInterface.interfaceCache[button];
  488.             boolean flag8 = true;
  489.             if (class9.contentType > 0)
  490.                 flag8 = promptUserForInput(class9);
  491.             if (flag8) {
  492.                 stream.createFrame(185);
  493.                 stream.writeWord(button);
  494.             }
  495.             break;
  496.         case 646:
  497.             stream.createFrame(185);
  498.             stream.writeWord(button);
  499.             RSInterface class9_2 = RSInterface.interfaceCache[button];
  500.             if (class9_2.valueIndexArray != null
  501.                     && class9_2.valueIndexArray[0][0] == 5) {
  502.                 if (variousSettings[toggle] != class9_2.anIntArray212[0]) {
  503.                     variousSettings[toggle] = class9_2.anIntArray212[0];
  504.                     method33(toggle);
  505.                     needDrawTabArea = true;
  506.                 }
  507.             }
  508.             break;
  509.         case 169:
  510.             stream.createFrame(185);
  511.             stream.writeWord(button);
  512.             RSInterface class9_3 = RSInterface.interfaceCache[button];
  513.             if (class9_3 == null)
  514.                 return;
  515.             if (class9_3.valueIndexArray != null) {
  516.                 if (class9_3.valueIndexArray[0][0] == 5) {
  517.                     if (toggle != -1) {
  518.                         variousSettings[toggle] = 1 - variousSettings[toggle];
  519.                         method33(toggle);
  520.                         needDrawTabArea = true;
  521.                     }
  522.                 }
  523.             }
  524.             switch (button) {
  525.             case 19136:
  526.                 if (toggle == 0)
  527.                     sendFrame36(173, toggle);
  528.                 if (toggle == 1)
  529.                     sendPacket185(153, 173, 646);
  530.                 break;
  531.             }
  532.             break;
  533.         }
  534.     }
  535.  
  536.     private void saveQuickSelection() {
  537.         // Save selections
  538.         UserLoader.saveuser();
  539.         tabInterfaceIDs[5] = prayerInterfaceType;
  540.     }
  541.     long time = System.currentTimeMillis();
  542.     private void handleQuickAidsActive() {
  543.         if (prayerInterfaceType == 5608) {
  544.             if(System.currentTimeMillis() - time > 2000){
  545.             if (getQuickPrayersSet() > 0) {
  546.                 if (!orbToggle[1]){
  547.                     for (int i = 0; i < quickPrayers.length; i++) {
  548.                         if (quickPrayers[i] == 1) {
  549.                             sendPacket185((i * 2) + 25000, 0, 169);
  550.                         }
  551.                     }
  552.                 time = System.currentTimeMillis(); 
  553.                 }else {
  554.                     turnOffPrayers();
  555.                 orbToggle[1] = !orbToggle[1];
  556.             }
  557.             } else {
  558.                 if (orbToggle[1]) {
  559.                     turnOffPrayers();
  560.                     orbToggle[1] = false;
  561.                 } else {
  562.                     pushMessage("You don't have any quick prayers selected.",
  563.                             0, "");
  564.                     pushMessage(
  565.                             "Right-click the Prayer button next to the minimap to select some.",
  566.                             0, "");
  567.                 }
  568.             }
  569.             } else {
  570.                 pushMessage("@red@You must wait before performing this action!",
  571.                             0, "");
  572.             }
  573.         } else if (prayerInterfaceType == 22500) {
  574.         if(System.currentTimeMillis() - time > 2000){
  575.             if (getQuickCursesSet() > 0) {
  576.                 if (!orbToggle[1]) {
  577.                     for (int i = 0; i < quickCurses.length; i++) {
  578.                         if (quickCurses[i] == 1) {
  579.                             sendPacket185((i * 2) + 22503, 0, 169);
  580.                         }
  581.                     }
  582.                     time = System.currentTimeMillis();
  583.                 } else {
  584.                     turnOffCurses();
  585.                     orbToggle[1] = !orbToggle[1];
  586.                 }
  587.             } else {
  588.                 if (orbToggle[1]) {
  589.                     turnOffCurses();
  590.                     orbToggle[1] = false;
  591.                 } else {
  592.                     pushMessage("You don't have any quick curses selected.", 0,
  593.                             "");
  594.                     pushMessage(
  595.                             "Right-click the Curses button next to the minimap to select some.",
  596.                             0, "");
  597.                 }
  598.             }
  599.                 } else {
  600.                 pushMessage("@red@You must wait before performing this action!",
  601.                             0, "");
  602.             }
  603.         }
  604.        
  605.     }
  606.  
  607.     private int getQuickPrayersSet() {
  608.         int amount = 0;
  609.         for (int i = 0; i < quickPrayers.length; i++)
  610.             if (quickPrayers[i] == 1) {
  611.                 amount++;
  612.             }
  613.         return amount;
  614.     }
  615.  
  616.     private int getQuickCursesSet() {
  617.         int amount = 0;
  618.         for (int i = 0; i < quickCurses.length; i++)
  619.             if (quickCurses[i] == 1) {
  620.                 amount++;
  621.             }
  622.         return amount;
  623.     }
  624.  
  625.     private void turnOffPrayers() {
  626.         int toggle = -1;
  627.         for (int i = 0; i < quickPrayers.length; i++) {
  628.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 25000];
  629.             if (rsInterface.valueIndexArray != null
  630.                     && rsInterface.valueIndexArray[0][0] == 5) {
  631.                 toggle = rsInterface.valueIndexArray[0][1];
  632.                 if (variousSettings[toggle] == 1)
  633.                     sendPacket185((i * 2) + 25000, 0, 169);
  634.             }
  635.         }
  636.     }
  637.  
  638.     private void turnOffCurses() {
  639.         int toggle = -1;
  640.         for (int i = 0; i < quickCurses.length; i++) {
  641.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 22503];
  642.             if (rsInterface == null)
  643.                 return;
  644.             if (rsInterface.valueIndexArray != null) {
  645.                 if (rsInterface.valueIndexArray[0][0] == 5) {
  646.                     toggle = rsInterface.valueIndexArray[0][1];
  647.                     if (variousSettings[toggle] == 1)
  648.                         sendPacket185((i * 2) + 22503, 0, 169);
  649.                 }
  650.             }
  651.         }
  652.     }
  653.  
  654.     private void turnOffQuickTicks() {
  655.         int toggle = -1;
  656.         for (int i = 0; i < quickCurses.length; i++) {
  657.             RSInterface rsInterface = RSInterface.interfaceCache[17202 + i];
  658.             if (rsInterface == null)
  659.                 return;
  660.             if (rsInterface.valueIndexArray != null) {
  661.                 if (rsInterface.valueIndexArray[0][0] == 5) {
  662.                     toggle = rsInterface.valueIndexArray[0][1];
  663.                     if (variousSettings[toggle] == 1)
  664.                         sendPacket185(17202 + i, 0, 169);
  665.                 }
  666.             }
  667.         }
  668.     }
  669.  
  670.     // save
  671.     public void toggleQuickAidsSelection() {
  672.         boolean inProcess = (tabInterfaceIDs[5] == 17200 || tabInterfaceIDs[5] == 17234);
  673.         if (inProcess)
  674.             saveQuickSelection();
  675.         else {
  676.             if (prayerInterfaceType == 5608) {
  677.                 if (!inProcess) {
  678.                     tabInterfaceIDs[5] = 17200;
  679.                     needDrawTabArea = true;
  680.                     tabAreaAltered = true;
  681.                 } else {
  682.                     tabInterfaceIDs[5] = 5608;
  683.                     needDrawTabArea = true;
  684.                     tabAreaAltered = true;
  685.                 }
  686.             } else if (prayerInterfaceType == 22500) {
  687.                 if (!inProcess) {
  688.                     tabInterfaceIDs[5] = 17234;
  689.                     needDrawTabArea = true;
  690.                     tabAreaAltered = true;
  691.                 } else {
  692.                     tabInterfaceIDs[5] = 22500;
  693.                     needDrawTabArea = true;
  694.                     tabAreaAltered = true;
  695.                 }
  696.             }
  697.             tabID = 5;
  698.         }
  699.     }
  700.  
  701.     public final int[] curseLevelRequirements = { 50, 50, 52, 54, 56, 59, 62,
  702.             65, 68, 71, 74, 76, 78, 80, 82, 84, 86, 89, 92, 95 };
  703.     public final String[] curseName = { "Protect Item", "Sap Warrior",
  704.             "Sap Ranger", "Sap Mage", "Sap Spirit", "Berserker",
  705.             "Deflect Summoning", "Deflect Magic", "Deflect Missiles",
  706.             "Deflect Melee", "Leech Attack", "Leech Ranged", "Leech Magic",
  707.             "Leech Defence", "Leech Strength", "Leech Energy",
  708.             "Leech Special Attack", "Wrath", "Soul Split", "Turmoil" };
  709.     public int[] quickConfigIDs = { 630, 631, 632, 633, 634, 635, 636, 637,
  710.             638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650,
  711.             651, 652, 653, 654, 655, 656 };
  712.     public final int[] prayerLevelRequirements = { 1, 4, 7, 8, 9, 10, 13, 16,
  713.             19, 22, 25, 26, 27, 28, 31, 34, 37, 40, 43, 44, 45, 46, 49, 52, 60,
  714.             70 };
  715.     public final String[] prayerName = { "Thick Skin", "Burst of Strength",
  716.             "Clarity of Thought", "Sharp Eye", "Mystic Will", "Rock Skin",
  717.             "Superhuman Strength", "Improved Reflexes", "Rapid Restore",
  718.             "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore",
  719.             "Steel Skin", "Ultimate Strength", "Incredible Reflexes",
  720.             "Protect from Magic", "Protect from Missiles",
  721.             "Protect from Melee", "Eagle Eye", "Mystic Might", "Retribution",
  722.             "Redemption", "Smite", "Chivalry", "Piety" };
  723.     private int[] defPray = { 0, 5, 13, 24, 25 };
  724.     private int[] strPray = { 1, 3, 4, 6, 11, 12, 14, 19, 20, 24, 25 };
  725.     private int[] atkPray = { 2, 3, 4, 7, 11, 12, 15, 19, 20, 24, 25 };
  726.     private int[] rangeAndMagePray = { 3, 4, 11, 12, 19, 20, 24, 25 };
  727.     private int[] rangeAndMagePrayOff = { 1, 2, 3, 4, 6, 7, 11, 12, 14, 15, 19,
  728.             20, 24, 25 };
  729.     private int[] headPray = { 16, 17, 18, 21, 22, 23 };
  730.     private int[] superiorPray = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15,
  731.             19, 20, 24, 25 };
  732.     private int[][] prayer = { defPray, strPray, atkPray, rangeAndMagePray,
  733.             headPray };
  734.  
  735.     private int[] getPrayerTypeForIndex(int index) {
  736.         int[] type = null;
  737.         for (int i = 0; i < prayer.length; i++) {
  738.             for (int il = 0; il < prayer[i].length; il++) {
  739.                 if (index == prayer[i][il]) {
  740.                     type = prayer[i];
  741.                 }
  742.             }
  743.         }
  744.         return type;
  745.     }
  746.  
  747.     private int[] sapCurse = { 1, 2, 3, 4, 19 };
  748.     private int[] leechCurse = { 10, 11, 12, 13, 14, 15, 16, 19 };
  749.     private int[] deflectCurse = { 7, 8, 9, 17, 18 };
  750.  
  751.     private int[] getCurseTypeForIndex(int index) {
  752.         int[] types = null;
  753.         for (int g = 0; g < leechCurse.length; g++) {
  754.             if (index == leechCurse[g])
  755.                 types = sapCurse;
  756.         }
  757.         for (int g = 0; g < sapCurse.length; g++) {
  758.             if (index == sapCurse[g])
  759.                 types = leechCurse;
  760.         }
  761.         for (int g = 0; g < deflectCurse.length; g++) {
  762.             if (index == deflectCurse[g])
  763.                 types = deflectCurse;
  764.         }
  765.         if (index == 6) {
  766.             int[] type = { 17, 18 };
  767.             types = type;
  768.         }
  769.         if (index == 17 || index == 18) {
  770.             int[] type = { 6, 7, 8, 9, 17, 18 };
  771.             types = type;
  772.         }
  773.         if (index == 19) {
  774.             int[] turmoilCurseOff = { 1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16,
  775.                     19 };
  776.             types = turmoilCurseOff;
  777.         }
  778.         return types;
  779.     }
  780.  
  781.     public void togglePrayerState(int button) {
  782.         int index = button - 17202;
  783.         if (prayerInterfaceType == 5608) {
  784.             if (getOrbValues(1, null)[1] >= prayerLevelRequirements[index]) {
  785.                 int[] types = getPrayerTypeForIndex(index);
  786.                 if (types != null) {
  787.                     for (int g = 0; g < rangeAndMagePray.length; g++) {
  788.                         if (index == rangeAndMagePray[g]) {
  789.                             types = rangeAndMagePrayOff;
  790.                         }
  791.                     }
  792.                     for (int i = 0; i < types.length; i++) {
  793.                         if (index != types[i]) {
  794.                             if (index == 24 || index == 25) {
  795.                                 types = superiorPray;
  796.                             }
  797.                             quickPrayers[types[i]] = 0;
  798.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  799.                             method33(quickConfigIDs[types[i]]);
  800.                             needDrawTabArea = true;
  801.                             if (dialogID != -1)
  802.                                 inputTaken = true;
  803.                         } else {
  804.                             quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  805.                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  806.                             method33(quickConfigIDs[index]);
  807.                             needDrawTabArea = true;
  808.                             if (dialogID != -1)
  809.                                 inputTaken = true;
  810.                         }
  811.                     }
  812.                 } else {
  813.                     quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  814.                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  815.                     method33(quickConfigIDs[index]);
  816.                     needDrawTabArea = true;
  817.                     if (dialogID != -1)
  818.                         inputTaken = true;
  819.                 }
  820.             } else {
  821.                 pushMessage("You need a Prayer level of atleast "
  822.                         + prayerLevelRequirements[index] + " to use "
  823.                         + prayerName[index] + ".", 0, "");
  824.             }
  825.         } else if (prayerInterfaceType == 22500) {
  826.             if (getOrbValues(1, null)[1] >= curseLevelRequirements[index]) {
  827.                 int[] types = getCurseTypeForIndex(index);
  828.                 if (types != null) {
  829.                     for (int i = 0; i < types.length; i++) {
  830.                         if (index != types[i]) {
  831.                             quickCurses[types[i]] = 0;
  832.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  833.                             method33(quickConfigIDs[types[i]]);
  834.                             needDrawTabArea = true;
  835.                             if (dialogID != -1)
  836.                                 inputTaken = true;
  837.                         }
  838.                     }
  839.                 }
  840.                 quickCurses[index] = (quickCurses[index] + 1) % 2;
  841.                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  842.                 method33(quickConfigIDs[index]);
  843.                 needDrawTabArea = true;
  844.                 if (dialogID != -1)
  845.                     inputTaken = true;
  846.             } else {
  847.                 pushMessage("You need a Prayer level of atleast "
  848.                         + curseLevelRequirements[index] + " to use "
  849.                         + curseName[index] + ".", 0, "");
  850.             }
  851.         }
  852.     }
  853.  
  854.     public boolean[] orbToggle = new boolean[4];
  855.  
  856.     private int[] getOrbValues(int type, Sprite orbSprite) {
  857.     try {
  858.         int[] values = new int[2];
  859.         int offsetX = 0, offsetY = 0;
  860.         switch (type) {
  861.         case 0:// Health
  862.             values[0] = Integer
  863.                     .parseInt(RSInterface.interfaceCache[4016].message);
  864.             values[1] = Integer
  865.                     .parseInt(RSInterface.interfaceCache[4017].message
  866.                             .replaceAll("%", ""));
  867.             offsetX = 9;
  868.             offsetY = 10;
  869.             break;
  870.  
  871.         case 1:// Prayer
  872.             values[0] = Integer
  873.                     .parseInt(RSInterface.interfaceCache[4012].message);
  874.             values[1] = Integer
  875.                     .parseInt(RSInterface.interfaceCache[4013].message
  876.                             .replaceAll("%", ""));
  877.             offsetX = 7;
  878.             offsetY = 7;
  879.             break;
  880.  
  881.         case 2:// Energy
  882.             values[0] = Integer
  883.                     .parseInt(RSInterface.interfaceCache[149].message
  884.                             .replaceAll("%", ""));
  885.             values[1] = 100;
  886.             offsetX = 10;
  887.             offsetY = 8;
  888.             break;
  889.         case 3:// Magica
  890.             values[0] = 99;
  891.             values[1] = 99;
  892.             offsetX = 8;
  893.             offsetY = 8;
  894.             break;
  895.  
  896.         default:
  897.             return null;
  898.         }
  899.         try {
  900.             if (offsetX > 0 && offsetY > 0) {
  901.                 // orbSprite.configXDrawOffset(offsetX);
  902.                 // orbSprite.configYDrawOffset(offsetY);
  903.             }
  904.         } catch (NullPointerException ex) {
  905.  
  906.         }
  907.             return values;
  908.         } catch (Exception e){
  909.        
  910.         }
  911.         return null;
  912.     }
  913.  
  914.     private void processXPCounterClick() {
  915.         int x = super.mouseX;
  916.         int y = super.mouseY;
  917.         if (x >= 520 && x <= 554 && y >= 47 && y <= 81 && clientSize == 0) {
  918.             menuActionName[3] = counterOn ? "Off" : "On";
  919.             menuActionID[3] = 474;
  920.             menuActionName[2] = "Reset";
  921.             menuActionID[2] = 475;
  922.             menuActionName[1] = xpLock ? "Unlock XP" : "Lock XP";
  923.             menuActionID[1] = 476;
  924.             menuActionRow = 4;
  925.         }
  926.     }
  927.  
  928.     private int xpAddedPos;
  929.     private int expAdded;
  930.  
  931.     private void drawCounterOnScreen() {
  932.         int x = 520;
  933.         int y = 47;
  934.         int txtWidth = aTextDrawingArea_1271.getTextWidth(Integer
  935.                 .toString(testXp));
  936.         int drawX = 507 - txtWidth;
  937.         counter[2].drawSprite(x - 100, y + 8);
  938.         int i = aTextDrawingArea_1271.getTextWidth(Integer.toString(testXp));
  939.         aTextDrawingArea_1271.drawText(0xffffff, "XP: ", y + 21, x - 88);
  940.         if (testXp == 0) {
  941.             aTextDrawingArea_1271.drawText(0xffffff, Integer.toString(testXp),
  942.                     y + 21, x - 10 - i);
  943.  
  944.         } else {
  945.             // aTextDrawingArea_1271.drawText(0xffffff,
  946.             // Integer.toString(testXp), y+21, x-8-i);
  947.             aTextDrawingArea_1271.method389(true, drawX, 0xFFFFFD, Integer
  948.                     .toString(testXp), 68);
  949.         }
  950.         if (expAdded != 0) {
  951.             i = smallText.getTextWidth(Integer.toString(expAdded) + "xp");
  952.             smallText.drawText(0xff9933, Integer.toString(expAdded) + "xp", y
  953.                     + 21 + 18 + xpAddedPos, x);
  954.             xpAddedPos += 2;
  955.             if (xpAddedPos >= 50) {
  956.                 xpAddedPos = 0;
  957.                 expAdded = 0;
  958.             }
  959.         }
  960.     }
  961.  
  962.     Sprite[] counter;
  963.  
  964.     private void drawXPCounter() {
  965.         int x = 1;
  966.         int y = 47;
  967.         int x1 = super.mouseX;
  968.         int y1 = super.mouseY;
  969.         counter[(counterOn || (x1 >= 520 && x1 <= 554 && y1 >= 47 && y1 <= 81) ? 1
  970.                 : 0)].drawSprite(x, y);
  971.         if (super.clickMode3 == 1 && super.saveClickX >= 520
  972.                 && super.saveClickX <= 554 && super.saveClickY >= 47
  973.                 && super.saveClickY <= 81) {
  974.             counterOn = !counterOn;
  975.         }
  976.  
  977.     }
  978.  
  979.     public static void setClipboardContents(String aString) {
  980.         StringSelection stringSelection = new StringSelection(aString);
  981.         Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  982.         clipboard.setContents(stringSelection, null);
  983.     }
  984.  
  985.     /**
  986.      * Get the String residing on the clipboard.
  987.      *
  988.      * @return any text found on the Clipboard; if none found, return an empty
  989.      *         String.
  990.      */
  991.     public static String webVersion() {
  992.  
  993.         String webVersion = null;
  994.         try {
  995.             URL url = new URL("http://runeps.com/models/models.txt");
  996.             InputStream is = url.openStream();
  997.             InputStreamReader isr = new InputStreamReader(is);
  998.             BufferedReader r = new BufferedReader(isr);
  999.             String str = r.readLine();
  1000.             if (str != null)
  1001.                 webVersion = str;
  1002.         } catch (MalformedURLException e) {
  1003.             System.out.println("Invalid URL");
  1004.         } catch (IOException e) {
  1005.             System.out.println("Can not connect");
  1006.         }
  1007.         return webVersion;
  1008.  
  1009.     }
  1010.  
  1011.     public String indexLocation(int cacheIndex, int index) {
  1012.         return signlink.findcachedir() + "index" + cacheIndex + "/"
  1013.                 + (index != -1 ? index + ".gz" : "");
  1014.     }
  1015.  
  1016.     public void repackCacheIndex(int cacheIndex) {
  1017.         System.out.println("Started repacking index " + cacheIndex + ".");
  1018.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  1019.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  1020.         try {
  1021.             for (int index = 0; index < indexLength; index++) {
  1022.                 int fileIndex = Integer
  1023.                         .parseInt(getFileNameWithoutExtension(file[index]
  1024.                                 .toString()));
  1025.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  1026.                 if (data != null && data.length > 0) {
  1027.                     decompressors[cacheIndex].method234(data.length, data,
  1028.                             fileIndex);
  1029.                     System.out.println("Repacked " + fileIndex + ".");
  1030.                 } else {
  1031.                     System.out.println("Unable to locate index " + fileIndex
  1032.                             + ".");
  1033.                 }
  1034.             }
  1035.         } catch (Exception e) {
  1036.             System.out.println("Error packing cache index " + cacheIndex + ".");
  1037.         }
  1038.         System.out.println("Finished repacking " + cacheIndex + ".");
  1039.     }
  1040.  
  1041.     public byte[] fileToByteArray(int cacheIndex, int index) {
  1042.         try {
  1043.             if (indexLocation(cacheIndex, index).length() <= 0
  1044.                     || indexLocation(cacheIndex, index) == null) {
  1045.                 return null;
  1046.             }
  1047.             File file = new File(indexLocation(cacheIndex, index));
  1048.             byte[] fileData = new byte[(int) file.length()];
  1049.             FileInputStream fis = new FileInputStream(file);
  1050.             fis.read(fileData);
  1051.             fis.close();
  1052.             return fileData;
  1053.         } catch (Exception e) {
  1054.             return null;
  1055.         }
  1056.     }
  1057.  
  1058.     public static void downloadNewVersion() {
  1059.  
  1060.         String webVersion = null;
  1061.         try {
  1062.             URL url = new URL("http://runeps.com/models/newmodels.txt");
  1063.             InputStream is = url.openStream();
  1064.             InputStreamReader isr = new InputStreamReader(is);
  1065.             BufferedReader r = new BufferedReader(isr);
  1066.             String str = r.readLine();
  1067.             while (str != null) {
  1068.                 getDownload(str);
  1069.                 str = r.readLine();
  1070.             }
  1071.         } catch (MalformedURLException e) {
  1072.             System.out.println("Invalid URL");
  1073.         } catch (IOException e) {
  1074.             System.out.println("Can not connect");
  1075.         }
  1076.     }
  1077.  
  1078.     public static void checkClientVersion() {
  1079.         Scanner dIn = null;
  1080.         int length = 0;
  1081.         String clientVersion = null;
  1082.         String line = null;
  1083.         try {
  1084.             dIn = new Scanner(new BufferedReader(new FileReader(
  1085.                     "./Settings/models.txt")));
  1086.             while (dIn.hasNextLine()) {
  1087.                 line = dIn.nextLine();
  1088.                 length = line.length();
  1089.                 if (length != 0) {
  1090.                     clientVersion = line;
  1091.                 }
  1092.             }
  1093.         } catch (IOException e) {
  1094.             e.printStackTrace();
  1095.         } finally {
  1096.             dIn.close();
  1097.         }
  1098.  
  1099.         /*if (clientVersion.equals(webVersion())) {
  1100.             System.out.println("All up to date!");
  1101.         } else {
  1102.             System.out.println("Downloading new models...");
  1103.             downloadNewVersion();
  1104.             getDownload("http://runeps.com/models/models.txt");
  1105.         }*/
  1106.     }
  1107.  
  1108.     public static String getFileName(String fileName) {
  1109.         int dirSplitIndex = fileName.lastIndexOf("/");
  1110.         fileName = fileName.substring(dirSplitIndex + 1);
  1111.         return fileName;
  1112.     }
  1113.  
  1114.     public static void getDownload(String link) {
  1115.         try {
  1116.             URL url = new URL(link);
  1117.             URLConnection connection = url.openConnection();
  1118.             long fileLength = connection.getContentLength();
  1119.             String fileName = getFileName(url.getFile());
  1120.             FileOutputStream out = null;
  1121.             if (fileName.equals("models.txt")) {
  1122.                 out = new FileOutputStream(new File("./Settings/" + fileName));
  1123.             } else {
  1124.                 out = new FileOutputStream(new File("./Raw/" + fileName));
  1125.             }
  1126.             // FileOutputStream out = new FileOutputStream(new
  1127.             // File("./Raw/"+fileName));
  1128.             DataInputStream in = new DataInputStream(connection
  1129.                     .getInputStream());
  1130.             for (long readIn = 0L; readIn < fileLength;) {
  1131.                 byte buffer[];
  1132.                 if (fileLength - readIn > 1024L)
  1133.                     buffer = new byte[1024];
  1134.                 else
  1135.                     buffer = new byte[(int) (fileLength - readIn)];
  1136.                 int read = in.read(buffer);
  1137.                 if (read == -1)
  1138.                     throw new EOFException("End of file reached unexpectedly");
  1139.                 readIn += read;
  1140.                 out.write(buffer, 0, read);
  1141.             }
  1142.             out.close();
  1143.             in.close();
  1144.         } catch (IOException ioe) {
  1145.             ioe.printStackTrace();
  1146.         }
  1147.     }
  1148.  
  1149.     public static String getClipboardContents() {
  1150.         String result = "";
  1151.         Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  1152.         // odd: the Object param of getContents is not currently used
  1153.         Transferable contents = clipboard.getContents(null);
  1154.         boolean hasTransferableText = (contents != null)
  1155.                 && contents.isDataFlavorSupported(DataFlavor.stringFlavor);
  1156.         if (hasTransferableText) {
  1157.             try {
  1158.                 result = (String) contents
  1159.                         .getTransferData(DataFlavor.stringFlavor);
  1160.             } catch (UnsupportedFlavorException ex) {
  1161.                 // highly unlikely since we are using a standard DataFlavor
  1162.                 System.out.println(ex);
  1163.                 ex.printStackTrace();
  1164.             } catch (IOException ex) {
  1165.                 System.out.println(ex);
  1166.                 ex.printStackTrace();
  1167.             }
  1168.         }
  1169.         return result;
  1170.     }
  1171.  
  1172.     public void launchURL(String url) {
  1173.         String osName = System.getProperty("os.name");
  1174.         try {
  1175.             if (osName.startsWith("Mac OS")) {
  1176.                 Class fileMgr = Class.forName("com.apple.eio.FileManager");
  1177.                 Method openURL = fileMgr.getDeclaredMethod("openURL",
  1178.                         new Class[] { String.class });
  1179.                 openURL.invoke(null, new Object[] { url });
  1180.             } else if (osName.startsWith("Windows"))
  1181.                 Runtime.getRuntime().exec(
  1182.                         "rundll32 url.dll,FileProtocolHandler " + url);
  1183.             else { // assume Unix or Linux
  1184.                 String[] browsers = { "firefox", "opera", "konqueror",
  1185.                         "epiphany", "mozilla", "netscape", "safari" };
  1186.                 String browser = null;
  1187.                 for (int count = 0; count < browsers.length && browser == null; count++)
  1188.                     if (Runtime.getRuntime().exec(
  1189.                             new String[] { "which", browsers[count] })
  1190.                             .waitFor() == 0)
  1191.                         browser = browsers[count];
  1192.                 if (browser == null) {
  1193.                     throw new Exception("Could not find web browser");
  1194.                 } else
  1195.                     Runtime.getRuntime().exec(new String[] { browser, url });
  1196.             }
  1197.         } catch (Exception e) {
  1198.             pushMessage("Failed to open URL.", 0, "");
  1199.         }
  1200.     }
  1201.  
  1202.     public void setNewMaps() {
  1203.         try {
  1204.             BufferedReader in = new BufferedReader(new FileReader(
  1205.                     "./Cache/mapConfig.txt"));
  1206.             String s;
  1207.             int D = 0;
  1208.             while ((s = in.readLine()) != null) {
  1209.                 positions[D] = Integer.parseInt(s.substring(s.indexOf("=") + 1,
  1210.                         s.indexOf("(")));
  1211.                 landScapes[D] = Integer.parseInt(s.substring(
  1212.                         s.indexOf("(") + 1, s.indexOf(")")));
  1213.                 objects[D] = Integer.parseInt(s.substring(s.indexOf("[") + 1, s
  1214.                         .indexOf("]")));
  1215.                 D++;
  1216.             }
  1217.         } catch (IOException e) {
  1218.             e.printStackTrace();
  1219.         }
  1220.     }
  1221.  
  1222.     public void openinterface(int type, int id) {
  1223.         if (type == 1) { // normal interface
  1224.             method60(id);
  1225.             openInterfaceID = id;
  1226.             aBoolean1149 = false;
  1227.  
  1228.         }
  1229.         if (type == 2) { // walkable interface
  1230.             method60(id);
  1231.             anInt1018 = id;
  1232.             aBoolean1149 = false;
  1233.  
  1234.         }
  1235.     }
  1236.  
  1237.     public void sendQuest(String s, int i) {
  1238.         RSInterface.interfaceCache[i].message = s;
  1239.         if (RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID]) {
  1240.             needDrawTabArea = true;
  1241.         }
  1242.     }
  1243.  
  1244.     public void sendFrame248(int interfaceID, int sideInterfaceID) {
  1245.         if (backDialogID != -1) {
  1246.             backDialogID = -1;
  1247.             inputTaken = true;
  1248.         }
  1249.         if (inputDialogState != 0) {
  1250.             inputDialogState = 0;
  1251.             inputTaken = true;
  1252.         }
  1253.         openInterfaceID = interfaceID;
  1254.         invOverlayInterfaceID = sideInterfaceID;
  1255.         needDrawTabArea = true;
  1256.         tabAreaAltered = true;
  1257.         aBoolean1149 = false;
  1258.     }
  1259.  
  1260.     public void drawBlackBox(int xPos, int yPos) {
  1261.         DrawingArea.drawPixelsWithOpacity(0x000000, yPos - 2, 178, 72, 220,
  1262.                 xPos - 2);
  1263.         DrawingArea.fillPixels(xPos - 1, 177, 71, 0x2E2B23, yPos - 1);// DrawingArea.method337
  1264.         DrawingArea.fillPixels(xPos - 2, 177, 71, 0x726451, yPos - 2);// DrawingArea.method337
  1265.     }
  1266.  
  1267.     public void autochat(int amount, String msg) {
  1268.         settime = amount;
  1269.         automsg = msg;
  1270.     }
  1271.  
  1272.     public void processauto() {
  1273.         inputString = automsg;
  1274.         autotime = 200;
  1275.         settime--;
  1276.         drawChatArea();
  1277.     }
  1278.  
  1279.     public void autotalk() {
  1280.         // so while setime is greater than 0 do the below
  1281.         while (settime > 0 && autochat)
  1282.             ;
  1283.         { // set = 10
  1284.             System.out.println("settime = " + settime);
  1285.             for (int x = autotime; x > 0; x--)
  1286.                 // auto // auto timer = delay witch 200 is 200 > 0 x--
  1287.                 switch (x) { // auto timer = 1
  1288.                 case 1:
  1289.                     processauto();
  1290.                     break;
  1291.                 }
  1292.         }
  1293.     }
  1294.  
  1295.     public static void detail() {
  1296.         if (UserLoader.chatdetail == 1) {
  1297.             setHighMem(); //setLowMem();
  1298.         } else {
  1299.             setHighMem(); //setLowMem();
  1300.         }
  1301.     }
  1302.  
  1303.     public void seteffect(int movement) {
  1304.         // UserLoader.chateffectmove = movement;
  1305.     }
  1306.  
  1307.     public void setHpAboveHeads(int id) {
  1308.         UserLoader.hpAboveHeads = id;
  1309.     }
  1310.  
  1311.     public void setNewHits(int id) {
  1312.         UserLoader.newHitSplat = id;
  1313.     }
  1314.  
  1315.     public void setNewHpBar(int id) {
  1316.         UserLoader.newHpBars = id;
  1317.     }
  1318.  
  1319.     public void Setcolour(int id, int colour, String bot, String crown) {
  1320.         switch (id) {
  1321.  
  1322.         case 1:
  1323.             // UserLoader.namesetcolour = colour;
  1324.             break;
  1325.  
  1326.         case 2:
  1327.             // UserLoader.chatsetcolour = colour;
  1328.             break;
  1329.         }
  1330.         pushMessage(bot, 9, crown);
  1331.     }
  1332.  
  1333.     public void setchat(int colour) {
  1334.         // UserLoader.chateffectcolour = colour;
  1335.     }
  1336.  
  1337.     private static String intToKOrMilLongName(int i, int j) {
  1338.         String s = String.valueOf(i);
  1339.         for (int k = s.length() - 3; k > 0; k -= 3)
  1340.             s = s.substring(0, k) + "," + s.substring(k);
  1341.         if (j != 0)
  1342.             if (s.length() > 8)
  1343.                 s = "@gre@" + s.substring(0, s.length() - 8)
  1344.                         + " million @whi@(" + s + ")";
  1345.             else if (s.length() > 4)
  1346.                 s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s
  1347.                         + ")";
  1348.         return " " + s;
  1349.     }
  1350.  
  1351.     private void stopMidi() {
  1352.         signlink.midifade = 0;
  1353.         signlink.midi = "stop";
  1354.     }
  1355.  
  1356.     private boolean menuHasAddFriend(int j) {
  1357.         if (j < 0)
  1358.             return false;
  1359.         int k = menuActionID[j];
  1360.         if (k >= 2000)
  1361.             k -= 2000;
  1362.         return k == 337;
  1363.     }
  1364.     public boolean takingSS = false;
  1365.     public void drawChannelButtons() {
  1366.         String text[] = { "On", "Friends", "Off", "Hide" };
  1367.         int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  1368.         /* Draws main buttons sprite */
  1369.         chatButtons.drawSprite(5, 143);
  1370.         /* Button hovering */
  1371.         if (cButtonHPos == 7) {
  1372.             reportH.drawSprite(404, 143);
  1373.         }
  1374.         if (cButtonCPos == 0)
  1375.             chatButtonC.drawSprite(5, 143);
  1376.         else if (cButtonCPos == 1)
  1377.             chatButtonC.drawSprite(62, 143);
  1378.         else if (cButtonCPos == 2)
  1379.             chatButtonC.drawSprite(119, 143);
  1380.         else if (cButtonCPos == 3)
  1381.             chatButtonC.drawSprite(176, 143);
  1382.         else if (cButtonCPos == 4)
  1383.             chatButtonC.drawSprite(233, 143);
  1384.         else if (cButtonCPos == 5)
  1385.             chatButtonC.drawSprite(290, 143);
  1386.         else if (cButtonCPos == 6)
  1387.             chatButtonC.drawSprite(347, 143);
  1388.         if (cButtonHPos == cButtonCPos) {
  1389.             if (cButtonHPos == 0)
  1390.                 chatButtonHC.drawSprite(5, 143);
  1391.             else if (cButtonHPos == 1)
  1392.                 chatButtonHC.drawSprite(62, 143);
  1393.             else if (cButtonHPos == 2)
  1394.                 chatButtonHC.drawSprite(119, 143);
  1395.             else if (cButtonHPos == 3)
  1396.                 chatButtonHC.drawSprite(176, 143);
  1397.             else if (cButtonHPos == 4)
  1398.                 chatButtonHC.drawSprite(233, 143);
  1399.             else if (cButtonHPos == 5)
  1400.                 chatButtonHC.drawSprite(290, 143);
  1401.             else if (cButtonHPos == 6)
  1402.                 chatButtonHC.drawSprite(347, 143);
  1403.         } else {
  1404.             if (cButtonHPos == 0)
  1405.                 chatButtonH.drawSprite(5, 143);
  1406.             else if (cButtonHPos == 1)
  1407.                 chatButtonH.drawSprite(62, 143);
  1408.             else if (cButtonHPos == 2)
  1409.                 chatButtonH.drawSprite(119, 143);
  1410.             else if (cButtonHPos == 3)
  1411.                 chatButtonH.drawSprite(176, 143);
  1412.             else if (cButtonHPos == 4)
  1413.                 chatButtonH.drawSprite(233, 143);
  1414.             else if (cButtonHPos == 5)
  1415.                 chatButtonH.drawSprite(290, 143);
  1416.             else if (cButtonHPos == 6)
  1417.                 chatButtonH.drawSprite(347, 143);
  1418.         }
  1419.         /* Button text */
  1420.         if(!takingSS)
  1421.             smallText.method389(true, 427, 0xffffff, "Report Bugs", 158);
  1422.         else {
  1423.             DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
  1424.             Date date = new Date();
  1425.             smallText.method389(true, 420, 0xffffff, dateFormat.format(date), 158);
  1426.         }  
  1427.     //  System.out.println(takingSS);
  1428.         smallText.method389(true, 26, 0xffffff, "All", 158);
  1429.         smallText.method389(true, 77, 0xffffff, "Game", 158);
  1430.         smallText.method389(true, 131, 0xffffff, "Public", 153);
  1431.         smallText.method389(true, 185, 0xffffff, "Private", 153);
  1432.         smallText.method389(true, 249, 0xffffff, "Clan", 153);
  1433.         smallText.method389(true, 304, 0xffffff, "Trade", 153);
  1434.         smallText.method389(true, 363, 0xffffff, "Duel", 153);
  1435.         /* Chat modes */
  1436.         smallText.method382(textColor[publicChatMode], 146,
  1437.                 text[publicChatMode], 164, true);
  1438.         smallText.method382(textColor[privateChatMode], 203,
  1439.                 text[privateChatMode], 164, true);
  1440.         smallText.method382(textColor[clanChatMode], 260, text[clanChatMode],
  1441.                 164, true);
  1442.         smallText.method382(textColor[tradeMode], 317, text[tradeMode], 164,
  1443.                 true);
  1444.         smallText
  1445.                 .method382(textColor[duelMode], 374, text[duelMode], 164, true);
  1446.     }
  1447.  
  1448.     private void drawChatArea() /* This draws/displays the chat area */
  1449.     {
  1450.         aRSImageProducer_1166.initDrawingArea();
  1451.         Texture.anIntArray1472 = anIntArray1180;
  1452.         chatArea.drawSprite(0, 0);
  1453.         drawChannelButtons();
  1454.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  1455.         if (messagePromptRaised) {
  1456.             chatTextDrawingArea.drawText(0, aString1121, 60, 259);
  1457.             chatTextDrawingArea.drawText(128, promptInput + "*", 80, 259);
  1458.         } else if (inputDialogState == 1) {
  1459.             chatTextDrawingArea.drawText(0, "Enter amount:", 60, 259);
  1460.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 80, 259);
  1461.         } else if (inputDialogState == 2) {
  1462.             chatTextDrawingArea.drawText(0, "Enter name:", 60, 259);
  1463.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 80, 259);
  1464.         } else if (aString844 != null) {
  1465.             chatTextDrawingArea.drawText(0, aString844, 60, 259);
  1466.             chatTextDrawingArea.drawText(128, "Click to continue", 80, 259);
  1467.         } else if (backDialogID != -1)
  1468.             drawInterface(0, 20, RSInterface.interfaceCache[backDialogID], 20);
  1469.         else if (dialogID != -1) {
  1470.             drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20);
  1471.         } else {
  1472.             int j77 = -3;
  1473.             int j = 0;
  1474.             DrawingArea.setDrawingArea(121, 8, 497, 7);
  1475.             for (int k = 0; k < 500; k++)
  1476.                 if (chatMessages[k] != null) {
  1477.                     int l = chatTypes[k];
  1478.                     int i1 = (70 - j77 * 14) + anInt1089 + 5;
  1479.                     String s1 = chatNames[k];
  1480.                     byte byte0 = 0;
  1481.                     if (s1 != null && s1.startsWith("@cr0@")) {
  1482.                         s1 = s1.substring(5);
  1483.                         byte0 = 1;
  1484.                     }
  1485.                     if (s1 != null && s1.startsWith("@cr1@")) {
  1486.                         s1 = s1.substring(5);
  1487.                         byte0 = 2;
  1488.                     }
  1489.                     if (s1 != null && s1.startsWith("@cr2@")) {
  1490.                         s1 = s1.substring(5);
  1491.                         byte0 = 3;
  1492.                     }
  1493.                     if (s1 != null && s1.startsWith("@cr3@")) {
  1494.                         s1 = s1.substring(5);
  1495.                         byte0 = 4;
  1496.                     }
  1497.                     if (s1 != null && s1.startsWith("@cr4@")) {
  1498.                         s1 = s1.substring(5);
  1499.                         byte0 = 5;
  1500.                     }
  1501.                     if (s1 != null && s1.startsWith("@cr5@")) {
  1502.                         s1 = s1.substring(5);
  1503.                         byte0 = 6;
  1504.                     }
  1505.                     if (s1 != null && s1.startsWith("@cr6@")) {
  1506.                         s1 = s1.substring(5);
  1507.                         byte0 = 7;
  1508.                     }
  1509.                     if (s1 != null && s1.startsWith("@cr7@")) {
  1510.                         s1 = s1.substring(5);
  1511.                         byte0 = 8;
  1512.                     }
  1513.                     if (s1 != null && s1.startsWith("@cr8@")) {
  1514.                         s1 = s1.substring(5);
  1515.                         byte0 = 9;
  1516.                     }
  1517.                     if (s1 != null && s1.startsWith("@cr9@")) {
  1518.                         s1 = s1.substring(5);
  1519.                         byte0 = 10;
  1520.                     }
  1521.                     if (s1 != null && s1.startsWith("@c10@")) {
  1522.                         s1 = s1.substring(5);
  1523.                         byte0 = 13;
  1524.                     }
  1525.                     if (s1 != null && s1.startsWith("@crA@")) {
  1526.                         s1 = s1.substring(5);
  1527.                         byte0 = 11;
  1528.                     }
  1529.                     if (l == 0) {
  1530.                         if (chatTypeView == 5 || chatTypeView == 0) {
  1531.                             if (i1 > 0 && i1 < 210)
  1532.                                 textDrawingArea.method389(false, 9, 0,
  1533.                                         chatMessages[k], i1 - 1);// chat color
  1534.                                                                     // enabled
  1535.                             j++;
  1536.                             j77++;
  1537.                         }
  1538.                     }
  1539.                     if (l == 9) {
  1540.                         if (chatTypeView == 5 || chatTypeView == 0) {
  1541.                             if (i1 > 0 && i1 < 210)
  1542.                                 textDrawingArea.method389(false, 9, 0,
  1543.                                         chatMessages[k] + "@blu@" + s1
  1544.                                                 + "@bla@.", i1 - 1);
  1545.                             j++;
  1546.                             j77++;
  1547.                         }
  1548.                     }
  1549.                     if ((l == 1 || l == 2)
  1550.                             && (l == 1 || publicChatMode == 0 || publicChatMode == 1
  1551.                                     && isFriendOrSelf(s1))) {
  1552.                         if (chatTypeView == 1 || chatTypeView == 0) {
  1553.                             if (i1 > 0 && i1 < 210) {
  1554.                                 int j1 = 8;
  1555.                                 if (byte0 == 1) {
  1556.                                     modIcons[0].drawSprite(j1, i1 - 12);
  1557.                                     j1 += 12;
  1558.                                 }
  1559.                                 if (byte0 == 2) {
  1560.                                     modIcons[1].drawSprite(j1, i1 - 12);
  1561.                                     j1 += 12;
  1562.                                 }
  1563.                                 if (byte0 == 3) {
  1564.                                     modIcons[2].drawSprite(j1, i1 - 12);
  1565.                                     j1 += 12;
  1566.                                 }
  1567.                                 if (byte0 == 4) {
  1568.                                     modIcons[3].drawSprite(j1, i1 - 12);
  1569.                                     j1 += 12;
  1570.                                 }
  1571.                                 if (byte0 == 5) {
  1572.                                     modIcons[4].drawSprite(j1, i1 - 12);
  1573.                                     j1 += 12;
  1574.                                 }
  1575.                                 if (byte0 == 6) {
  1576.                                     modIcons[5].drawSprite(j1, i1 - 12);
  1577.                                     j1 += 12;
  1578.                                 }
  1579.                                 if (byte0 == 7) {
  1580.                                     modIcons[6].drawSprite(j1, i1 - 12);
  1581.                                     j1 += 12;
  1582.                                 }
  1583.                                 if (byte0 == 8) {
  1584.                                     modIcons[7].drawSprite(j1, i1 - 12);
  1585.                                     j1 += 12;
  1586.                                 }
  1587.                                 if (byte0 == 9) {
  1588.                                     modIcons[8].drawSprite(j1, i1 - 12);
  1589.                                     j1 += 12;
  1590.                                 }
  1591.                                 if (byte0 == 10) {
  1592.                                     modIcons[9].drawSprite(j1, i1 - 12);
  1593.                                     j1 += 12;
  1594.                                 }
  1595.                                 if (byte0 == 11) {
  1596.                                     modIcons[10].drawSprite(j1, i1 - 12);
  1597.                                     j1 += 12;
  1598.                                 }
  1599.                                 if (byte0 == 13) {
  1600.                                     modIcons[11].drawSprite(j1, i1 - 12);
  1601.                                     j1 += 12;
  1602.                                 }
  1603.                                 /* draws playername in chatbox[history] */
  1604.                                 // textDrawingArea.method385(0, s1 + ":", i1 -
  1605.                                 // 1, j1 + 1);
  1606.                                 textDrawingArea.method389(false, j1 + 1, 0, s1
  1607.                                         + ":", i1 - 1);
  1608.                                 j1 += textDrawingArea.getTextWidth(s1) + 8;
  1609.                                 /* draws chat in chatbox[history] */
  1610.                                 textDrawingArea.method389(false, j1 + 1, 255,
  1611.                                         chatMessages[k], i1 - 1);// chat color
  1612.                                                                     // enabled;
  1613.                             }
  1614.                             j++;
  1615.                             j77++;
  1616.                         }
  1617.                     }
  1618.                     if ((l == 3 || l == 7)
  1619.                             && (splitPrivateChat == 0 || chatTypeView == 2)
  1620.                             && (l == 7 || privateChatMode == 0 || privateChatMode == 1
  1621.                                     && isFriendOrSelf(s1))) {
  1622.                         if (chatTypeView == 2 || chatTypeView == 0) {
  1623.                             if (i1 > 0 && i1 < 210) {
  1624.                                 int k1 = 8;
  1625.                                 textDrawingArea.method385(0, "From", i1, k1);
  1626.                                 k1 += textDrawingArea.getTextWidth("From ");
  1627.                                 if (byte0 == 1) {
  1628.                                     modIcons[0].drawSprite(k1, i1 - 12);
  1629.                                     k1 += 12;
  1630.                                 }
  1631.                                 if (byte0 == 2) {
  1632.                                     modIcons[1].drawSprite(k1, i1 - 12);
  1633.                                     k1 += 12;
  1634.                                 }
  1635.                                 if (byte0 == 3) {
  1636.                                     modIcons[2].drawSprite(k1, i1 - 12);
  1637.                                     k1 += 12;
  1638.                                     k1 += 12;
  1639.                                 }
  1640.                                 if (byte0 == 4) {
  1641.                                     modIcons[3].drawSprite(k1, i1 - 12);
  1642.                                     k1 += 12;
  1643.                                     k1 += 12;
  1644.                                 }
  1645.                                 if (byte0 == 5) {
  1646.                                     modIcons[4].drawSprite(k1, i1 - 12);
  1647.                                     k1 += 12;
  1648.                                     k1 += 12;
  1649.                                 }
  1650.                                 if (byte0 == 6) {
  1651.                                     modIcons[5].drawSprite(k1, i1 - 12);
  1652.                                     k1 += 12;
  1653.                                     k1 += 12;
  1654.                                 }
  1655.                                 if (byte0 == 7) {
  1656.                                     modIcons[6].drawSprite(k1, i1 - 12);
  1657.                                     k1 += 12;
  1658.                                     k1 += 12;
  1659.                                 }
  1660.                                 if (byte0 == 8) {
  1661.                                     modIcons[7].drawSprite(k1, i1 - 12);
  1662.                                     k1 += 12;
  1663.                                     k1 += 12;
  1664.                                 }
  1665.                                 if (byte0 == 9) {
  1666.                                     modIcons[8].drawSprite(k1, i1 - 12);
  1667.                                     k1 += 12;
  1668.                                     k1 += 12;
  1669.                                 }
  1670.                                 if (byte0 == 10) {
  1671.                                     modIcons[9].drawSprite(k1, i1 - 12);
  1672.                                     k1 += 12;
  1673.                                     k1 += 12;
  1674.                                 }
  1675.                                 if (byte0 == 11) {
  1676.                                     modIcons[10].drawSprite(k1, i1 - 12);
  1677.                                     k1 += 12;
  1678.                                     k1 += 12;
  1679.                                 }
  1680.                                 if (byte0 == 13) {
  1681.                                     modIcons[11].drawSprite(k1, i1 - 12);
  1682.                                     k1 += 12;
  1683.                                     k1 += 12;
  1684.                                 }
  1685.                                 textDrawingArea.method385(0, s1 + ":", i1 - 1,
  1686.                                         k1 + 1);
  1687.                                 k1 += textDrawingArea.getTextWidth(s1) + 8;
  1688.                                 textDrawingArea.method385(0x800000,
  1689.                                         chatMessages[k], i1 - 1, k1 + 1);
  1690.                             }
  1691.                             j++;
  1692.                             j77++;
  1693.                         }
  1694.                     }
  1695.                     if (l == 4
  1696.                             && (tradeMode == 0 || tradeMode == 1
  1697.                                     && isFriendOrSelf(s1))) {
  1698.                         if (chatTypeView == 3 || chatTypeView == 0) {
  1699.                             if (i1 > 0 && i1 < 210)
  1700.                                 textDrawingArea.method385(0x800080, s1 + " "
  1701.                                         + chatMessages[k], i1, 8);
  1702.                             j++;
  1703.                             j77++;
  1704.                         }
  1705.                     }
  1706.                     if (l == 5 && splitPrivateChat == 0 && privateChatMode < 2) {
  1707.                         if (chatTypeView == 2 || chatTypeView == 0) {
  1708.                             if (i1 > 0 && i1 < 210)
  1709.                                 textDrawingArea.method385(0x800000,
  1710.                                         chatMessages[k], i1, 8);
  1711.                             j++;
  1712.                             j77++;
  1713.                         }
  1714.                     }
  1715.                     if (l == 6 && (splitPrivateChat == 0 || chatTypeView == 2)
  1716.                             && privateChatMode < 2) {
  1717.                         if (chatTypeView == 2 || chatTypeView == 0) {
  1718.                             if (i1 > 0 && i1 < 210) {
  1719.                                 textDrawingArea.method385(0, "To " + s1 + ":",
  1720.                                         i1, 8);
  1721.                                 textDrawingArea.method385(0x800000,
  1722.                                         chatMessages[k], i1,
  1723.                                         12 + textDrawingArea
  1724.                                                 .getTextWidth("To :" + s1));
  1725.                             }
  1726.                             j++;
  1727.                             j77++;
  1728.                         }
  1729.                     }
  1730.                     if (l == 8
  1731.                             && (duelMode == 0 || duelMode == 1
  1732.                                     && isFriendOrSelf(s1))) {
  1733.                         if (chatTypeView == 4 || chatTypeView == 0) {
  1734.                             if (i1 > 0 && i1 < 210)
  1735.                                 textDrawingArea.method385(0x7e3200, s1 + " "
  1736.                                         + chatMessages[k], i1, 8);
  1737.                             j++;
  1738.                             j77++;
  1739.                         }
  1740.                         if (l == 11 && (clanChatMode == 0)) {
  1741.                             if (chatTypeView == 11) {
  1742.                                 if (i1 > 0 && i1 < 210)
  1743.                                     textDrawingArea.method385(0x7e3200, s1
  1744.                                             + " " + chatMessages[k], i1, 8);
  1745.                                 j++;
  1746.                                 j77++;
  1747.                             }
  1748.                             if (l == 12)// link
  1749.                             {
  1750.                                 if (i1 > 0 && i1 < 110)
  1751.                                     textDrawingArea.method385(0x7e3200,
  1752.                                             chatMessages[k] + " @blu@" + s1,
  1753.                                             i1, 8);
  1754.                                 j++;
  1755.                             }
  1756.                         }
  1757.                     }
  1758.                 }
  1759.             DrawingArea.defaultDrawingAreaSize();
  1760.             anInt1211 = j * 14 + 7 + 5;
  1761.             if (anInt1211 < 111)
  1762.                 anInt1211 = 111;
  1763.             drawScrollbar(113, anInt1211 - anInt1089 - 113, 7, 496, anInt1211);
  1764.             String s;
  1765.             String title = myPlayer.title;
  1766.             if (myPlayer != null && myPlayer.name != null)
  1767.                 s = myPlayer.name;
  1768.             else
  1769.                 s = TextClass.fixName(myUsername);
  1770.             /*
  1771.              * textDrawingArea.method385(0, s + ":", 132, 9);
  1772.              * textDrawingArea.drawChatInput(255, 10 +
  1773.              * textDrawingArea.getTextWidth(s + ": "), inputString + "*", 132,
  1774.              * false); DrawingArea.method339(120, 0x807660, 504, 7);
  1775.              */
  1776.             if (inputString.startsWith("/r")) {
  1777.                         inputString = "::pm " + pastNum +","+inputString.substring(2,inputString.length());
  1778.             }
  1779.             for(Entry d : sk.getShortKeys()){
  1780.                         // search using regex
  1781.                         String pattern = "(^|)"+d.getKey()+"(\\s|$)";
  1782.                         Pattern p = Pattern.compile(pattern); // use regex to break up string
  1783.                         Matcher m = p.matcher(inputString);
  1784.                         inputString  = m.replaceAll(d.getValue());
  1785.             }
  1786.             //System.out.println("printing " + inputString);
  1787.             textDrawingArea.method385(getColor(myPlayer.skill), title, 132, 9); // title
  1788.             textDrawingArea.method385(0, s + ":", 132, 9 + textDrawingArea
  1789.                     .getTextWidth(title)); // name
  1790.             textDrawingArea.method389(false, 10 + textDrawingArea
  1791.                     .getTextWidth(title + s + ": "), 255, inputString
  1792.                     + ((loopCycle % 40 < 20) ? "@bla@|" : ""), 132);
  1793.             DrawingArea.method339(120, 0x807660, 504, 7);
  1794.         }
  1795.         if (menuOpen && menuScreenArea == 2) {
  1796.             drawMenu();
  1797.         }
  1798.         aRSImageProducer_1166.drawGraphics(338, super.graphics, 0);
  1799.         aRSImageProducer_1165.initDrawingArea();
  1800.         Texture.anIntArray1472 = anIntArray1182;
  1801.  
  1802.     }
  1803.  
  1804.     public static client instance;
  1805.  
  1806.     public void init() {
  1807.         try {
  1808.             nodeID = 10;
  1809.             portOff = 0;
  1810.             setLowMem();
  1811.             isMembers = true;
  1812.             signlink.storeid = 32;
  1813.             signlink.startpriv(InetAddress.getLocalHost());
  1814.             initClientFrame(505,767);
  1815.         }
  1816.         catch (Exception exception) {
  1817.             return;
  1818.         }
  1819.     }
  1820.  
  1821.     public void startRunnable(Runnable runnable, int i) {
  1822.         if (i > 10)
  1823.             i = 10;
  1824.         if (signlink.mainapp != null) {
  1825.             signlink.startthread(runnable, i);
  1826.         } else {
  1827.             super.startRunnable(runnable, i);
  1828.         }
  1829.     }
  1830.  
  1831.     public Socket openSocket(int port) throws IOException {
  1832.         return new Socket(InetAddress.getByName(server), port);
  1833.     }
  1834.  
  1835.     private void processMenuClick() {
  1836.         if (activeInterfaceType != 0)
  1837.             return;
  1838.         int j = super.clickMode3;
  1839.         if (spellSelected == 1 && super.saveClickX >= 516
  1840.                 && super.saveClickY >= 160 && super.saveClickX <= 765
  1841.                 && super.saveClickY <= 205)
  1842.             j = 0;
  1843.         if (menuOpen) {
  1844.             if (j != 1) {
  1845.                 int k = super.mouseX;
  1846.                 int j1 = super.mouseY;
  1847.                 if (menuScreenArea == 0) {
  1848.                     k -= 4;
  1849.                     j1 -= 4;
  1850.                 }
  1851.                 if (menuScreenArea == 1) {
  1852.                     k -= 516;
  1853.                     j1 -= 168;
  1854.                 }
  1855.                 if (menuScreenArea == 2) {
  1856.                     k -= 17;
  1857.                     j1 -= 338;
  1858.                 }
  1859.                 if (menuScreenArea == 3) {
  1860.                     k -= 515;
  1861.                     j1 -= 0;
  1862.                 }
  1863.                 if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10
  1864.                         || j1 < menuOffsetY - 10
  1865.                         || j1 > menuOffsetY + anInt952 + 10) {
  1866.                     menuOpen = false;
  1867.                     if (menuScreenArea == 1)
  1868.                         needDrawTabArea = true;
  1869.                     if (menuScreenArea == 2)
  1870.                         inputTaken = true;
  1871.                 }
  1872.             }
  1873.             if (j == 1) {
  1874.                 int l = menuOffsetX;
  1875.                 int k1 = menuOffsetY;
  1876.                 int i2 = menuWidth;
  1877.                 int k2 = super.saveClickX;
  1878.                 int l2 = super.saveClickY;
  1879.                 if (menuScreenArea == 0) {
  1880.                     k2 -= 4;
  1881.                     l2 -= 4;
  1882.                 }
  1883.                 if (menuScreenArea == 1) {
  1884.                     k2 -= 516;
  1885.                     l2 -= 168;
  1886.                 }
  1887.                 if (menuScreenArea == 2) {
  1888.                     k2 -= 17;
  1889.                     l2 -= 338;
  1890.                 }
  1891.                 if (menuScreenArea == 3) {
  1892.                     k2 -= 519;
  1893.                     l2 -= 0;
  1894.                 }
  1895.                 int i3 = -1;
  1896.                 for (int j3 = 0; j3 < menuActionRow; j3++) {
  1897.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  1898.                     if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  1899.                         i3 = j3;
  1900.                 }
  1901.                 //System.out.println("Menu action click value: " + i3);
  1902.                 if (i3 != -1)
  1903.                     doAction(i3);
  1904.                 menuOpen = false;
  1905.                 if (menuScreenArea == 1)
  1906.                     needDrawTabArea = true;
  1907.                 if (menuScreenArea == 2) {
  1908.                     inputTaken = true;
  1909.                 }
  1910.             }
  1911.         } else {
  1912.             if (j == 1 && menuActionRow > 0) {
  1913.                 int i1 = menuActionID[menuActionRow - 1];
  1914.                 if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53
  1915.                         || i1 == 74 || i1 == 454 || i1 == 539 || i1 == 493
  1916.                         || i1 == 847 || i1 == 447 || i1 == 1125) {
  1917.                     int l1 = menuActionCmd2[menuActionRow - 1];
  1918.                     int j2 = menuActionCmd3[menuActionRow - 1];
  1919.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  1920.                     if (class9.aBoolean259 || class9.aBoolean235) {
  1921.                         aBoolean1242 = false;
  1922.                         anInt989 = 0;
  1923.                         anInt1084 = j2;
  1924.                         anInt1085 = l1;
  1925.                         activeInterfaceType = 2;
  1926.                         anInt1087 = super.saveClickX;
  1927.                         anInt1088 = super.saveClickY;
  1928.                         if (RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  1929.                             activeInterfaceType = 1;
  1930.                         if (RSInterface.interfaceCache[j2].parentID == backDialogID)
  1931.                             activeInterfaceType = 3;
  1932.                         return;
  1933.                     }
  1934.                 }
  1935.             }
  1936.             if (j == 1
  1937.                     && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
  1938.                     && menuActionRow > 2)
  1939.                 j = 2;
  1940.             if (j == 1 && menuActionRow > 0)
  1941.                 doAction(menuActionRow - 1);
  1942.             if (j == 2 && menuActionRow > 0)
  1943.                 determineMenuSize();
  1944.         }
  1945.     }
  1946.  
  1947.     public static int totalRead = 0;
  1948.  
  1949.     public static String getFileNameWithoutExtension(String fileName) {
  1950.         File tmpFile = new File(fileName);
  1951.         tmpFile.getName();
  1952.         int whereDot = tmpFile.getName().lastIndexOf('.');
  1953.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  1954.             return tmpFile.getName().substring(0, whereDot);
  1955.         }
  1956.         return "";
  1957.     }
  1958.  
  1959.     public void preloadModels() {
  1960.         File file = new File("./Raw/");
  1961.         File[] fileArray = file.listFiles();
  1962.         for (int y = 0; y < fileArray.length; y++) {
  1963.             String s = fileArray[y].getName();
  1964.             byte[] buffer = ReadFile("./Raw/" + s);
  1965.             // System.out.println(s);
  1966.             Model.method460(buffer, Integer
  1967.                     .parseInt(getFileNameWithoutExtension(s)));
  1968.         }
  1969.     }
  1970.  
  1971.     public static final byte[] ReadFile(String s) {
  1972.         try {
  1973.             byte abyte0[];
  1974.             File file = new File(s);
  1975.             int i = (int) file.length();
  1976.             abyte0 = new byte[i];
  1977.             DataInputStream datainputstream = new DataInputStream(
  1978.                     new BufferedInputStream(new FileInputStream(s)));
  1979.             datainputstream.readFully(abyte0, 0, i);
  1980.             datainputstream.close();
  1981.             totalRead++;
  1982.             return abyte0;
  1983.         } catch (Exception e) {
  1984.             System.out.println((new StringBuilder()).append("Read Error: ")
  1985.                     .append(s).toString());
  1986.             return null;
  1987.         }
  1988.     }
  1989.  
  1990.     public void models() {
  1991.         for (int ModelIndex = 0; ModelIndex < 50000; ModelIndex++) {
  1992.             byte[] abyte0 = getModel(ModelIndex);
  1993.             if (abyte0 != null && abyte0.length > 0) {
  1994.                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  1995.                 pushMessage("Model added successfully!", 0, "");
  1996.             }
  1997.         }
  1998.     }
  1999.  
  2000.     private void saveMidi(boolean flag, byte abyte0[]) {
  2001.         signlink.midifade = flag ? 1 : 0;
  2002.         signlink.midisave(abyte0, abyte0.length);
  2003.     }
  2004.  
  2005.     public final void method22(boolean flag) {
  2006.         try {
  2007.             anInt985 = -1;
  2008.             aClass19_1056.removeAll();
  2009.             aClass19_1013.removeAll();
  2010.             Texture.method366();
  2011.             unlinkMRUNodes();
  2012.             worldController.initToNull();
  2013.  
  2014.             System.gc();
  2015.             for (int i = 0; i < 4; i++)
  2016.                 aClass11Array1230[i].method210();
  2017.  
  2018.             for (int l = 0; l < 4; l++) {
  2019.                 for (int k1 = 0; k1 < 104; k1++) {
  2020.                     for (int j2 = 0; j2 < 104; j2++)
  2021.                         byteGroundArray[l][k1][j2] = 0;
  2022.  
  2023.                 }
  2024.  
  2025.             }
  2026.  
  2027.             ObjectManager objectManager = new ObjectManager(byteGroundArray,
  2028.                     intGroundArray);
  2029.  
  2030.             int k2 = aByteArrayArray1183.length;
  2031.  
  2032.             int k18 = 62;
  2033.             for (int A = 0; A < k2; A++)
  2034.                 for (int B = 0; B < 2000; B++)
  2035.                     if (anIntArray1234[A] == positions[B]) {
  2036.                         anIntArray1235[A] = landScapes[B];
  2037.                         anIntArray1236[A] = objects[B];
  2038.                     }
  2039.  
  2040.             stream.createFrame(0);
  2041.  
  2042.             if (!aBoolean1159) {
  2043.                 for (int i3 = 0; i3 < k2; i3++) {
  2044.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  2045.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  2046.  
  2047.                     byte abyte0[] = aByteArrayArray1183[i3];
  2048.                     if (FileOperations.FileExists("./Cache/FloorMaps/"
  2049.                             + anIntArray1235[i3] + ".dat"))
  2050.                         abyte0 = FileOperations.ReadFile("./Cache/FloorMaps/"
  2051.                                 + anIntArray1235[i3] + ".dat");
  2052.  
  2053.                     if (abyte0 != null)
  2054.                         // objectManager.method180(abyte0, k5, i4, (anInt1069 -
  2055.                         // 6) * 8, (anInt1070 - 6) * 8, (byte)4,
  2056.                         // aClass11Array1230);
  2057.                         objectManager.method180(abyte0, k5, i4,
  2058.                                 (anInt1069 - 6) * 8, (anInt1070 - 6) * 8,
  2059.                                 aClass11Array1230);
  2060.                 }
  2061.  
  2062.                 for (int j4 = 0; j4 < k2; j4++) {
  2063.                     int l5 = (anIntArray1234[j4] >> 8) * k18 - baseX;
  2064.                     int k7 = (anIntArray1234[j4] & 0xff) * k18 - baseY;
  2065.                     byte abyte2[] = aByteArrayArray1183[j4];
  2066.                     if (abyte2 == null && anInt1070 < 800)
  2067.                         // ObjectManager.method174(k7, 64, 0, 64, l5);
  2068.                         objectManager.method174(k7, 64, 64, l5);
  2069.                 }
  2070.  
  2071.                 anInt1097++;
  2072.                 if (anInt1097 > 160) {
  2073.                     anInt1097 = 0;
  2074.                     stream.createFrame(238);
  2075.                     stream.writeWordBigEndian(96);
  2076.  
  2077.                 }
  2078.                 stream.createFrame(0);
  2079.  
  2080.                 for (int i6 = 0; i6 < k2; i6++) {
  2081.                     byte abyte1[] = aByteArrayArray1247[i6];
  2082.                     if (FileOperations.FileExists("./Cache/ObjectMaps/"
  2083.                             + anIntArray1236[i6] + ".dat"))
  2084.                         abyte1 = FileOperations.ReadFile("./Cache/ObjectMaps/"
  2085.                                 + anIntArray1236[i6] + ".dat");
  2086.                     if (abyte1 != null) {
  2087.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  2088.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  2089.                         // ObjectManager.method190(l8, aClass11Array1230, k9, 7,
  2090.                         // aClass25_946, abyte1);
  2091.                         objectManager.method190(l8, aClass11Array1230, k9,
  2092.                                 worldController, abyte1);
  2093.                     }
  2094.                 }
  2095.  
  2096.             }
  2097.             if (aBoolean1159) {
  2098.                 for (int j3 = 0; j3 < 4; j3++) {
  2099.                     for (int k4 = 0; k4 < 13; k4++) {
  2100.                         for (int j6 = 0; j6 < 13; j6++) {
  2101.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  2102.                             if (l7 != -1) {
  2103.                                 int i9 = l7 >> 24 & 3;
  2104.                                 int l9 = l7 >> 1 & 3;
  2105.                                 int j10 = l7 >> 14 & 0x3ff;
  2106.                                 int l10 = l7 >> 3 & 0x7ff;
  2107.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  2108.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  2109.                                     if (anIntArray1234[l11] != j11
  2110.                                             || aByteArrayArray1183[l11] == null)
  2111.                                         continue;
  2112.                                     // ObjectManager.method179(i9, l9,
  2113.                                     // aClass11Array1230, 9, k4 * 8, (j10 & 7) *
  2114.                                     // 8, aByteArrayArray1183[l11], (l10 & 7) *
  2115.                                     // 8, j3, j6 * 8);
  2116.                                     objectManager.method179(i9, l9,
  2117.                                             aClass11Array1230, k4 * 8,
  2118.                                             (j10 & 7) * 8,
  2119.                                             aByteArrayArray1183[l11],
  2120.                                             (l10 & 7) * 8, j3, j6 * 8);
  2121.                                     break;
  2122.                                 }
  2123.  
  2124.                             }
  2125.                         }
  2126.  
  2127.                     }
  2128.  
  2129.                 }
  2130.  
  2131.                 for (int l4 = 0; l4 < 13; l4++) {
  2132.                     for (int k6 = 0; k6 < 13; k6++) {
  2133.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  2134.                         if (i8 == -1)
  2135.                             // ObjectManager.method174(k6 * 8, 8, 0, 8, l4 * 8);
  2136.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  2137.                     }
  2138.  
  2139.                 }
  2140.  
  2141.                 stream.createFrame(0);
  2142.  
  2143.                 for (int l6 = 0; l6 < 4; l6++) {
  2144.                     for (int j8 = 0; j8 < 13; j8++) {
  2145.                         for (int j9 = 0; j9 < 13; j9++) {
  2146.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  2147.                             if (i10 != -1) {
  2148.                                 int k10 = i10 >> 24 & 3;
  2149.                                 int i11 = i10 >> 1 & 3;
  2150.                                 int k11 = i10 >> 14 & 0x3ff;
  2151.                                 int i12 = i10 >> 3 & 0x7ff;
  2152.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  2153.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  2154.                                     if (anIntArray1234[k12] != j12
  2155.                                             || aByteArrayArray1247[k12] == null)
  2156.                                         continue;
  2157.                                     byte abyte0[] = aByteArrayArray1247[k12];
  2158.                                     if (FileOperations
  2159.                                             .FileExists("./Cache/FloorMaps/"
  2160.                                                     + anIntArray1235[k12]
  2161.                                                     + ".dat"))
  2162.                                         abyte0 = FileOperations
  2163.                                                 .ReadFile(signlink
  2164.                                                         .findcachedir()
  2165.                                                         + "FloorMaps/"
  2166.                                                         + anIntArray1235[k12]
  2167.                                                         + ".dat");
  2168.                                     // ObjectManager.method183(aClass11Array1230,
  2169.                                     // aClass25_946, k10, j8 * 8, (i12 & 7) * 8,
  2170.                                     // true, l6, abyte0, (k11 & 7) * 8, i11, j9
  2171.                                     // * 8);
  2172.                                     objectManager.method183(aClass11Array1230,
  2173.                                             worldController, k10, j8 * 8,
  2174.                                             (i12 & 7) * 8, l6,
  2175.                                             aByteArrayArray1247[k12],
  2176.                                             (k11 & 7) * 8, i11, j9 * 8);
  2177.                                     break;
  2178.                                 }
  2179.  
  2180.                             }
  2181.                         }
  2182.  
  2183.                     }
  2184.  
  2185.                 }
  2186.  
  2187.             }
  2188.             stream.createFrame(0);
  2189.  
  2190.             // ObjectManager.method171(aClass11Array1230, aClass25_946, 2);
  2191.             // aClass15_1165.method237(0);
  2192.             objectManager.method171(aClass11Array1230, worldController);
  2193.             aRSImageProducer_1165.initDrawingArea();
  2194.             stream.createFrame(0);
  2195.  
  2196.             int k3 = ObjectManager.anInt145;
  2197.             if (k3 > plane)
  2198.                 k3 = plane;
  2199.  
  2200.             if (k3 < plane - 1)
  2201.                 k3 = plane - 1;
  2202.             if (lowMem)
  2203.  
  2204.                 worldController.method275(ObjectManager.anInt145);
  2205.             else
  2206.                 worldController.method275(0);
  2207.             for (int i5 = 0; i5 < 104; i5++) {
  2208.                 for (int i7 = 0; i7 < 104; i7++)
  2209.                     spawnGroundItem(i5, i7);
  2210.  
  2211.             }
  2212.  
  2213.             anInt1051++;
  2214.             if (anInt1051 > 98) {
  2215.                 anInt1051 = 0;
  2216.                 stream.createFrame(150);
  2217.  
  2218.             }
  2219.             method63();
  2220.         } catch (Exception exception) {
  2221.         }
  2222.         ObjectDef.mruNodes1.unlinkAll();
  2223.  
  2224.         if (super.gameFrame != null) {
  2225.             stream.createFrame(210);
  2226.  
  2227.             stream.writeDWord(0x3f008edd);
  2228.         }
  2229.         if (lowMem && signlink.cache_dat != null) {
  2230.             int j = 32767;
  2231.  
  2232.             for (int i1 = 0; i1 < j; i1++) {
  2233.                 int l1 = 32767;
  2234.  
  2235.                 if ((l1 & 0x79) == 0)
  2236.                     Model.method461(i1);
  2237.             }
  2238.  
  2239.         }
  2240.         System.gc();
  2241.         Texture.method367();
  2242.         onDemandFetcher.method566();
  2243.  
  2244.         int k = (anInt1069 - 6) / 8 - 1;
  2245.         int j1 = (anInt1069 + 6) / 8 + 1;
  2246.         int i2 = (anInt1070 - 6) / 8 - 1;
  2247.         int l2 = (anInt1070 + 6) / 8 + 1;
  2248.         if (aBoolean1141) {
  2249.             k = 49;
  2250.             j1 = 50;
  2251.             i2 = 49;
  2252.             l2 = 50;
  2253.         }
  2254.         for (int l3 = k; l3 <= j1; l3++) {
  2255.             for (int j5 = i2; j5 <= l2; j5++)
  2256.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  2257.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  2258.                     if (j7 != -1)
  2259.                         onDemandFetcher.method560(j7, 3);
  2260.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  2261.                     if (k8 != -1)
  2262.                         onDemandFetcher.method560(k8, 3);
  2263.                 }
  2264.  
  2265.         }
  2266.  
  2267.     }
  2268.  
  2269.     private void unlinkMRUNodes() {
  2270.         ObjectDef.mruNodes1.unlinkAll();
  2271.         ObjectDef.mruNodes2.unlinkAll();
  2272.         EntityDef.mruNodes.unlinkAll();
  2273.         ItemDef.mruNodes2.unlinkAll();
  2274.         ItemDef.mruNodes1.unlinkAll();
  2275.         Player.mruNodes.unlinkAll();
  2276.         SpotAnim.aMRUNodes_415.unlinkAll();
  2277.     }
  2278.  
  2279.     private void method24(int i) {
  2280.         int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  2281.         int j = ai.length;
  2282.         for (int k = 0; k < j; k++)
  2283.             ai[k] = 0;
  2284.  
  2285.         for (int l = 1; l < 103; l++) {
  2286.             int i1 = 24628 + (103 - l) * 512 * 4;
  2287.             for (int k1 = 1; k1 < 103; k1++) {
  2288.                 if ((byteGroundArray[i][k1][l] & 0x18) == 0)
  2289.                     worldController.method309(ai, i1, i, k1, l);
  2290.                 if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  2291.                     worldController.method309(ai, i1, i + 1, k1, l);
  2292.                 i1 += 4;
  2293.             }
  2294.  
  2295.         }
  2296.  
  2297.         int j1 = ((238 + (int) (Math.random() * 20D)) - 10 << 16)
  2298.                 + ((238 + (int) (Math.random() * 20D)) - 10 << 8)
  2299.                 + ((238 + (int) (Math.random() * 20D)) - 10);
  2300.         int l1 = (238 + (int) (Math.random() * 20D)) - 10 << 16;
  2301.         aClass30_Sub2_Sub1_Sub1_1263.method343();
  2302.         for (int i2 = 1; i2 < 103; i2++) {
  2303.             for (int j2 = 1; j2 < 103; j2++) {
  2304.                 if ((byteGroundArray[i][j2][i2] & 0x18) == 0)
  2305.                     method50(i2, j1, j2, l1, i);
  2306.                 if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  2307.                     method50(i2, j1, j2, l1, i + 1);
  2308.             }
  2309.  
  2310.         }
  2311.  
  2312.         aRSImageProducer_1165.initDrawingArea();
  2313.         anInt1071 = 0;
  2314.         for (int k2 = 0; k2 < 104; k2++) {
  2315.             for (int l2 = 0; l2 < 104; l2++) {
  2316.                 int i3 = worldController.method303(plane, k2, l2);
  2317.                 if (i3 != 0) {
  2318.                     i3 = i3 >> 14 & 0x7fff;
  2319.                     int j3 = ObjectDef.forID(i3).anInt746;
  2320.                     if (j3 >= 0) {
  2321.                         int k3 = k2;
  2322.                         int l3 = l2;
  2323.                         if (j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36
  2324.                                 && j3 != 46 && j3 != 47 && j3 != 48) {
  2325.                             byte byte0 = 104;
  2326.                             byte byte1 = 104;
  2327.                             int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  2328.                             for (int i4 = 0; i4 < 10; i4++) {
  2329.                                 int j4 = (int) (Math.random() * 4D);
  2330.                                 if (j4 == 0 && k3 > 0 && k3 > k2 - 3
  2331.                                         && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  2332.                                     k3--;
  2333.                                 if (j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3
  2334.                                         && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  2335.                                     k3++;
  2336.                                 if (j4 == 2 && l3 > 0 && l3 > l2 - 3
  2337.                                         && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  2338.                                     l3--;
  2339.                                 if (j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3
  2340.                                         && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  2341.                                     l3++;
  2342.                             }
  2343.  
  2344.                         }
  2345.                         try {
  2346.                             aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  2347.                         } catch (Exception ex) {
  2348.                         }
  2349.                         anIntArray1072[anInt1071] = k3;
  2350.                         anIntArray1073[anInt1071] = l3;
  2351.                         anInt1071++;
  2352.                     }
  2353.                 }
  2354.             }
  2355.  
  2356.         }
  2357.  
  2358.     }
  2359.  
  2360.     private void spawnGroundItem(int i, int j) {
  2361.         NodeList class19 = groundArray[plane][i][j];
  2362.         if (class19 == null) {
  2363.             worldController.method295(plane, i, j);
  2364.             return;
  2365.         }
  2366.         int k = 0xfa0a1f01;
  2367.         Object obj = null;
  2368.         for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  2369.                 .reverseGetNext()) {
  2370.             ItemDef itemDef = ItemDef.forID(item.ID);
  2371.             int l = itemDef.value;
  2372.             if (itemDef.stackable)
  2373.                 l *= item.anInt1559 + 1;
  2374.             // notifyItemSpawn(item, i + baseX, j + baseY);
  2375.  
  2376.             if (l > k) {
  2377.                 k = l;
  2378.                 obj = item;
  2379.             }
  2380.         }
  2381.  
  2382.         class19.insertTail(((Node) (obj)));
  2383.         Object obj1 = null;
  2384.         Object obj2 = null;
  2385.         for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19
  2386.                 .reverseGetNext()) {
  2387.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  2388.                     && obj1 == null)
  2389.                 obj1 = class30_sub2_sub4_sub2_1;
  2390.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  2391.                     && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID
  2392.                     && obj2 == null)
  2393.                 obj2 = class30_sub2_sub4_sub2_1;
  2394.         }
  2395.  
  2396.         int i1 = i + (j << 7) + 0x60000000;
  2397.         worldController.method281(i, i1, ((Animable) (obj1)), method42(plane,
  2398.                 j * 128 + 64, i * 128 + 64), ((Animable) (obj2)),
  2399.                 ((Animable) (obj)), plane, j);
  2400.     }
  2401.  
  2402.     private void method26(boolean flag) {
  2403.         for (int j = 0; j < npcCount; j++) {
  2404.             NPC npc = npcArray[npcIndices[j]];
  2405.             int k = 0x20000000 + (npcIndices[j] << 14);
  2406.             if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  2407.                 continue;
  2408.             int l = npc.x >> 7;
  2409.             int i1 = npc.y >> 7;
  2410.             if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  2411.                 continue;
  2412.             if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64
  2413.                     && (npc.y & 0x7f) == 64) {
  2414.                 if (anIntArrayArray929[l][i1] == anInt1265)
  2415.                     continue;
  2416.                 anIntArrayArray929[l][i1] = anInt1265;
  2417.             }
  2418.             if (!npc.desc.aBoolean84)
  2419.                 k += 0x80000000;
  2420.             worldController.method285(plane, npc.anInt1552, method42(plane,
  2421.                     npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60,
  2422.                     npc.x, npc, npc.aBoolean1541);
  2423.         }
  2424.     }
  2425.  
  2426.     private boolean replayWave() {
  2427.         return signlink.wavereplay();
  2428.     }
  2429.  
  2430.     private void loadError() {
  2431.         String s = "ondemand";// was a constant parameter
  2432.         System.out.println(s);
  2433.         try {
  2434.             getAppletContext().showDocument(
  2435.                     new URL(getCodeBase(), "loaderror_" + s + ".html"));
  2436.         } catch (Exception exception) {
  2437.             exception.printStackTrace();
  2438.         }
  2439.         do
  2440.             try {
  2441.                 Thread.sleep(1000L);
  2442.             } catch (Exception _ex) {
  2443.             }
  2444.         while (true);
  2445.     }
  2446.  
  2447.     private void buildInterfaceMenu(int i, RSInterface class9, int k, int l,
  2448.             int i1, int j1) {
  2449.         if (class9.type != 0 || class9.children == null
  2450.                 || class9.isMouseoverTriggered)
  2451.             return;
  2452.         if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height)
  2453.             return;
  2454.         int k1 = class9.children.length;
  2455.         for (int l1 = 0; l1 < k1; l1++) {
  2456.             int i2 = class9.childX[l1] + i;
  2457.             int j2 = (class9.childY[l1] + l) - j1;
  2458.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  2459.             i2 += class9_1.anInt263;
  2460.             j2 += class9_1.anInt265;
  2461.             if ((class9_1.mOverInterToTrigger >= 0 || class9_1.anInt216 != 0)
  2462.                     && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2463.                     && i1 < j2 + class9_1.height)
  2464.                 if (class9_1.mOverInterToTrigger >= 0)
  2465.                     anInt886 = class9_1.mOverInterToTrigger;
  2466.                 else
  2467.                     anInt886 = class9_1.id;
  2468.             if (class9_1.type == 8 && k >= i2 && i1 >= j2
  2469.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2470.                 anInt1315 = class9_1.id;
  2471.             }
  2472.             if (class9_1.type == 9 && k >= i2 && i1 >= j2
  2473.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2474.                 anInt1315 = class9_1.id;
  2475.             }
  2476.             if (class9_1.type == 11 && k >= i2 && i1 >= j2
  2477.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2478.                 anInt1315 = class9_1.id;
  2479.             }
  2480.             if (class9_1.type == 0) {
  2481.                 buildInterfaceMenu(i2, class9_1, k, j2, i1,
  2482.                         class9_1.scrollPosition);
  2483.                 if (class9_1.scrollMax > class9_1.height)
  2484.                     method65(i2 + class9_1.width, class9_1.height, k, i1,
  2485.                             class9_1, j2, true, class9_1.scrollMax);
  2486.             } else {
  2487.                 if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2
  2488.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2489.                     boolean flag = false;
  2490.                     if (class9_1.contentType != 0)
  2491.                         flag = buildFriendsListMenu(class9_1);
  2492.                     if (!flag) {
  2493.                         // System.out.println("1"+class9_1.tooltip + ", " +
  2494.                         // class9_1.interfaceID);
  2495.                         menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2496.                                 + class9_1.id;
  2497.                         menuActionID[menuActionRow] = 315;
  2498.                         menuActionCmd3[menuActionRow] = class9_1.id;
  2499.                         menuActionRow++;
  2500.                     }
  2501.                 }
  2502.                 if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2
  2503.                         && i1 >= j2 && k < i2 + class9_1.width
  2504.                         && i1 < j2 + class9_1.height) {
  2505.                     String s = class9_1.selectedActionName;
  2506.                     if (s.indexOf(" ") != -1)
  2507.                         s = s.substring(0, s.indexOf(" "));
  2508.                     if (class9_1.parentID == 12855) {
  2509.                         menuActionName[menuActionRow] = "Autocast" + "@gre@ "
  2510.                                 + class9_1.spellName;
  2511.                         menuActionID[menuActionRow] = 104;// autocast
  2512.                         menuActionCmd3[menuActionRow] = class9_1.id;
  2513.                         menuActionRow++;
  2514.                     }
  2515.                     menuActionName[menuActionRow] = s + " @gre@"
  2516.                             + class9_1.spellName;
  2517.                     menuActionID[menuActionRow] = 626;
  2518.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2519.                     menuActionRow++;
  2520.                 }
  2521.                 if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2
  2522.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2523.                     menuActionName[menuActionRow] = "Close";
  2524.                     menuActionID[menuActionRow] = 200;
  2525.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2526.                     menuActionRow++;
  2527.                 }
  2528.                 if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2
  2529.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2530.                     // System.out.println("2"+class9_1.tooltip + ", " +
  2531.                     // class9_1.interfaceID);
  2532.                     menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2533.                             + class9_1.id;
  2534.                     menuActionID[menuActionRow] = 169;
  2535.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2536.                     menuActionRow++;
  2537.                 }
  2538.                 if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2
  2539.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2540.                     // System.out.println("3"+class9_1.tooltip + ", " +
  2541.                     // class9_1.interfaceID);
  2542.                     menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2543.                             + class9_1.id;
  2544.                     menuActionID[menuActionRow] = 646;
  2545.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2546.                     menuActionRow++;
  2547.                 }
  2548.                 if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2
  2549.                         && i1 >= j2 && k < i2 + class9_1.width
  2550.                         && i1 < j2 + class9_1.height) {
  2551.                     // System.out.println("4"+class9_1.tooltip + ", " +
  2552.                     // class9_1.interfaceID);
  2553.                     menuActionName[menuActionRow] = class9_1.tooltip + ", "
  2554.                             + class9_1.id;
  2555.                     menuActionID[menuActionRow] = 679;
  2556.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2557.                     menuActionRow++;
  2558.                 }
  2559.                 if (class9_1.type == 2) {
  2560.                     int k2 = 0;
  2561.                     for (int l2 = 0; l2 < class9_1.height; l2++) {
  2562.                         for (int i3 = 0; i3 < class9_1.width; i3++) {
  2563.                             int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  2564.                             int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  2565.                             if (k2 < 20) {
  2566.                                 j3 += class9_1.spritesX[k2];
  2567.                                 k3 += class9_1.spritesY[k2];
  2568.                             }
  2569.                             if (k >= j3 && i1 >= k3 && k < j3 + 32
  2570.                                     && i1 < k3 + 32) {
  2571.                                 mouseInvInterfaceIndex = k2;
  2572.                                 lastActiveInvInterface = class9_1.id;
  2573.                                 if (class9_1.inv[k2] > 0) {
  2574.                                     ItemDef itemDef = ItemDef
  2575.                                             .forID(class9_1.inv[k2] - 1);
  2576.                                     if (itemSelected == 1
  2577.                                             && class9_1.isInventoryInterface) {
  2578.                                         if (class9_1.id != anInt1284
  2579.                                                 || k2 != anInt1283) {
  2580.                                             menuActionName[menuActionRow] = "Use "
  2581.                                                     + selectedItemName
  2582.                                                     + " with @lre@"
  2583.                                                     + itemDef.name;
  2584.                                             menuActionID[menuActionRow] = 870;
  2585.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2586.                                             menuActionCmd2[menuActionRow] = k2;
  2587.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2588.                                             menuActionRow++;
  2589.                                         }
  2590.                                     } else if (spellSelected == 1
  2591.                                             && class9_1.isInventoryInterface) {
  2592.                                         if ((spellUsableOn & 0x10) == 16) {
  2593.                                             menuActionName[menuActionRow] = spellTooltip
  2594.                                                     + " @lre@" + itemDef.name;
  2595.                                             menuActionID[menuActionRow] = 543;
  2596.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2597.                                             menuActionCmd2[menuActionRow] = k2;
  2598.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2599.                                             menuActionRow++;
  2600.                                         }
  2601.                                     } else {
  2602.                                         if (class9_1.isInventoryInterface) {
  2603.                                             for (int l3 = 4; l3 >= 3; l3--)
  2604.                                                 if (itemDef.actions != null
  2605.                                                         && itemDef.actions[l3] != null) {
  2606.                                                     menuActionName[menuActionRow] = itemDef.actions[l3]
  2607.                                                             + " @lre@"
  2608.                                                             + itemDef.name;
  2609.                                                     if (l3 == 3)
  2610.                                                         menuActionID[menuActionRow] = 493;
  2611.                                                     if (l3 == 4)
  2612.                                                         menuActionID[menuActionRow] = 847;
  2613.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2614.                                                     menuActionCmd2[menuActionRow] = k2;
  2615.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2616.                                                     menuActionRow++;
  2617.                                                 } else if (l3 == 4) {
  2618.                                                     menuActionName[menuActionRow] = "Drop @lre@"
  2619.                                                             + itemDef.name;
  2620.                                                     menuActionID[menuActionRow] = 847;
  2621.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2622.                                                     menuActionCmd2[menuActionRow] = k2;
  2623.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2624.                                                     menuActionRow++;
  2625.                                                 }
  2626.  
  2627.                                         }
  2628.                                         if (class9_1.usableItemInterface) {
  2629.                                             menuActionName[menuActionRow] = "Use @lre@"
  2630.                                                     + itemDef.name;
  2631.                                             menuActionID[menuActionRow] = 447;
  2632.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2633.                                             menuActionCmd2[menuActionRow] = k2;
  2634.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2635.                                             menuActionRow++;
  2636.                                         }
  2637.                                         if (class9_1.isInventoryInterface
  2638.                                                 && itemDef.actions != null) {
  2639.                                             for (int i4 = 2; i4 >= 0; i4--)
  2640.                                                 if (itemDef.actions[i4] != null) {
  2641.                                                     menuActionName[menuActionRow] = itemDef.actions[i4]
  2642.                                                             + " @lre@"
  2643.                                                             + itemDef.name;
  2644.                                                     if (i4 == 0)
  2645.                                                         menuActionID[menuActionRow] = 74;
  2646.                                                     if (i4 == 1)
  2647.                                                         menuActionID[menuActionRow] = 454;
  2648.                                                     if (i4 == 2)
  2649.                                                         menuActionID[menuActionRow] = 539;
  2650.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2651.                                                     menuActionCmd2[menuActionRow] = k2;
  2652.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2653.                                                     menuActionRow++;
  2654.                                                 }
  2655.  
  2656.                                         }
  2657.                                         if (class9_1.actions != null) {
  2658.                                             for (int j4 = 4; j4 >= 0; j4--)
  2659.                                                 if (class9_1.actions[j4] != null) {
  2660.                                                     menuActionName[menuActionRow] = class9_1.actions[j4]
  2661.                                                             + " @lre@"
  2662.                                                             + itemDef.name;
  2663.                                                     if (j4 == 0)
  2664.                                                         menuActionID[menuActionRow] = 632;
  2665.                                                     if (j4 == 1)
  2666.                                                         menuActionID[menuActionRow] = 78;
  2667.                                                     if (j4 == 2)
  2668.                                                         menuActionID[menuActionRow] = 867;
  2669.                                                     if (j4 == 3)
  2670.                                                         menuActionID[menuActionRow] = 431;
  2671.                                                     if (j4 == 4)
  2672.                                                         menuActionID[menuActionRow] = 53;
  2673.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2674.                                                     menuActionCmd2[menuActionRow] = k2;
  2675.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2676.                                                     menuActionRow++;
  2677.                                                 }
  2678.  
  2679.                                         }
  2680.                                         // menuActionName[menuActionRow] =
  2681.                                         // "Examine @lre@" + itemDef.name +
  2682.                                         // " @gre@(@whi@" + (class9_1.inv[k2] -
  2683.                                         // 1) + "@gre@)";
  2684.                                         menuActionName[menuActionRow] = "Examine @lre@"
  2685.                                                 + itemDef.name;
  2686.                                         menuActionID[menuActionRow] = 1125;
  2687.                                         menuActionCmd1[menuActionRow] = itemDef.id;
  2688.                                         menuActionCmd2[menuActionRow] = k2;
  2689.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  2690.                                         menuActionRow++;
  2691.                                     }
  2692.                                 }
  2693.                             }
  2694.                             k2++;
  2695.                         }
  2696.  
  2697.                     }
  2698.  
  2699.                 }
  2700.             }
  2701.         }
  2702.  
  2703.     }
  2704.  
  2705.     public void drawScrollbar(int j, int k, int l, int i1, int j1) {
  2706.         scrollBar1.method361(i1, l);
  2707.         scrollBar2.method361(i1, (l + j) - 16);
  2708.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 16);
  2709.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x3d3426, 15);
  2710.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x342d21, 13);
  2711.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x2e281d, 11);
  2712.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x29241b, 10);
  2713.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x252019, 9);
  2714.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 1);
  2715.         int k1 = ((j - 32) * j) / j1;
  2716.         if (k1 < 8)
  2717.             k1 = 8;
  2718.         int l1 = ((j - 32 - k1) * k) / (j1 - j);
  2719.         DrawingArea.drawPixels(k1, l + 16 + l1, i1, barFillColor, 16);
  2720.         DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1);
  2721.         DrawingArea.method341(l + 16 + l1, 0x8d8269, k1, i1 + 1);
  2722.         DrawingArea.method341(l + 16 + l1, 0x6a614d, k1, i1 + 2);
  2723.         DrawingArea.method341(l + 16 + l1, 0x706651, k1, i1 + 3);
  2724.         DrawingArea.method341(l + 16 + l1, 0x706651, k1, i1 + 4);
  2725.         DrawingArea.method341(l + 16 + l1, 0x6a614d, k1, i1 + 5);
  2726.         DrawingArea.method341(l + 16 + l1, 0x6a614d, k1, i1 + 6);
  2727.         DrawingArea.method341(l + 16 + l1, 0x685e4b, k1, i1 + 7);
  2728.         DrawingArea.method341(l + 16 + l1, 0x685e4b, k1, i1 + 8);
  2729.         DrawingArea.method341(l + 16 + l1, 0x665d4a, k1, i1 + 9);
  2730.         DrawingArea.method341(l + 16 + l1, 0x665d4a, k1, i1 + 10);
  2731.         DrawingArea.method341(l + 16 + l1, 0x58503f, k1, i1 + 11);
  2732.         DrawingArea.method341(l + 16 + l1, 0x58503f, k1, i1 + 12);
  2733.         DrawingArea.method341(l + 16 + l1, 0x544c3c, k1, i1 + 13);
  2734.         DrawingArea.method341(l + 16 + l1, 0x4b4535, k1, i1 + 14);
  2735.         DrawingArea.method339(l + 16 + l1, 0x000001, 15, i1);
  2736.         DrawingArea.method339(l + 17 + l1, 0x000001, 15, i1);
  2737.         DrawingArea.method339(l + 17 + l1, 0x6a614d, 14, i1);
  2738.         DrawingArea.method339(l + 17 + l1, 0x706651, 13, i1);
  2739.         DrawingArea.method339(l + 17 + l1, 0x6d5f48, 11, i1);
  2740.         DrawingArea.method339(l + 17 + l1, 0x6a614d, 10, i1);
  2741.         DrawingArea.method339(l + 17 + l1, 0x76684b, 7, i1);
  2742.         DrawingArea.method339(l + 17 + l1, 0x7d715b, 5, i1);
  2743.         DrawingArea.method339(l + 17 + l1, 0x7e6e50, 4, i1);
  2744.         DrawingArea.method339(l + 17 + l1, 0x8d8269, 3, i1);
  2745.         DrawingArea.method339(l + 17 + l1, 0x000001, 2, i1);
  2746.         DrawingArea.method339(l + 18 + l1, 0x000001, 16, i1);
  2747.         DrawingArea.method339(l + 18 + l1, 0x625946, 15, i1);
  2748.         DrawingArea.method339(l + 18 + l1, 0x665d4a, 14, i1);
  2749.         DrawingArea.method339(l + 18 + l1, 0x625640, 11, i1);
  2750.         DrawingArea.method339(l + 18 + l1, 0x6a614d, 10, i1);
  2751.         DrawingArea.method339(l + 18 + l1, 0x706651, 7, i1);
  2752.         DrawingArea.method339(l + 18 + l1, 0x726954, 5, i1);
  2753.         DrawingArea.method339(l + 18 + l1, 0x716247, 4, i1);
  2754.         DrawingArea.method339(l + 18 + l1, 0x7d715b, 3, i1);
  2755.         DrawingArea.method339(l + 18 + l1, 0x8d8269, 2, i1);
  2756.         DrawingArea.method339(l + 18 + l1, 0x000001, 1, i1);
  2757.         DrawingArea.method339(l + 19 + l1, 0x000001, 16, i1);
  2758.         DrawingArea.method339(l + 19 + l1, 0x544c3c, 15, i1);
  2759.         DrawingArea.method339(l + 19 + l1, 0x625946, 14, i1);
  2760.         DrawingArea.method339(l + 19 + l1, 0x665d4a, 11, i1);
  2761.         DrawingArea.method339(l + 19 + l1, 0x685e4b, 9, i1);
  2762.         DrawingArea.method339(l + 19 + l1, 0x6a614d, 7, i1);
  2763.         DrawingArea.method339(l + 19 + l1, 0x706651, 5, i1);
  2764.         DrawingArea.method339(l + 19 + l1, 0x726954, 4, i1);
  2765.         DrawingArea.method339(l + 19 + l1, 0x6a614d, 3, i1);
  2766.         DrawingArea.method339(l + 19 + l1, 0x8d8269, 2, i1);
  2767.         DrawingArea.method339(l + 19 + l1, 0x000001, 1, i1);
  2768.         DrawingArea.method339(l + 20 + l1, 0x000001, 16, i1);
  2769.         DrawingArea.method339(l + 20 + l1, 0x4b4535, 15, i1);
  2770.         DrawingArea.method339(l + 20 + l1, 0x4f4839, 14, i1);
  2771.         DrawingArea.method339(l + 20 + l1, 0x58503f, 13, i1);
  2772.         DrawingArea.method339(l + 20 + l1, 0x665d4a, 10, i1);
  2773.         DrawingArea.method339(l + 20 + l1, 0x685e4b, 8, i1);
  2774.         DrawingArea.method339(l + 20 + l1, 0x6a614d, 6, i1);
  2775.         DrawingArea.method339(l + 20 + l1, 0x706651, 4, i1);
  2776.         DrawingArea.method339(l + 20 + l1, 0x6a614d, 3, i1);
  2777.         DrawingArea.method339(l + 20 + l1, 0x8d8269, 2, i1);
  2778.         DrawingArea.method339(l + 20 + l1, 0x000001, 1, i1);
  2779.         DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1 + 15);
  2780.         DrawingArea.method339(l + 15 + l1 + k1, 0x000001, 16, i1);
  2781.         DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 15, i1);
  2782.         DrawingArea.method339(l + 14 + l1 + k1, 0x413a2e, 14, i1);
  2783.         DrawingArea.method339(l + 14 + l1 + k1, 0x453d31, 10, i1);
  2784.         DrawingArea.method339(l + 14 + l1 + k1, 0x4f4839, 9, i1);
  2785.         DrawingArea.method339(l + 14 + l1 + k1, 0x4a402f, 7, i1);
  2786.         DrawingArea.method339(l + 14 + l1 + k1, 0x4b4535, 4, i1);
  2787.         DrawingArea.method339(l + 14 + l1 + k1, 0x625946, 3, i1);
  2788.         DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 2, i1);
  2789.         DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 16, i1);
  2790.         DrawingArea.method339(l + 13 + l1 + k1, 0x453d31, 15, i1);
  2791.         DrawingArea.method339(l + 13 + l1 + k1, 0x4b4535, 11, i1);
  2792.         DrawingArea.method339(l + 13 + l1 + k1, 0x544c3c, 9, i1);
  2793.         DrawingArea.method339(l + 13 + l1 + k1, 0x4f4839, 7, i1);
  2794.         DrawingArea.method339(l + 13 + l1 + k1, 0x625946, 6, i1);
  2795.         DrawingArea.method339(l + 13 + l1 + k1, 0x58503f, 4, i1);
  2796.         DrawingArea.method339(l + 13 + l1 + k1, 0x625640, 3, i1);
  2797.         DrawingArea.method339(l + 13 + l1 + k1, 0x706651, 2, i1);
  2798.         DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 1, i1);
  2799.         DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 16, i1);
  2800.         DrawingArea.method339(l + 12 + l1 + k1, 0x453d31, 15, i1);
  2801.         DrawingArea.method339(l + 12 + l1 + k1, 0x4b4535, 14, i1);
  2802.         DrawingArea.method339(l + 12 + l1 + k1, 0x4f4839, 12, i1);
  2803.         DrawingArea.method339(l + 12 + l1 + k1, 0x625946, 11, i1);
  2804.         DrawingArea.method339(l + 12 + l1 + k1, 0x58503f, 10, i1);
  2805.         DrawingArea.method339(l + 12 + l1 + k1, 0x665d4a, 7, i1);
  2806.         DrawingArea.method339(l + 12 + l1 + k1, 0x685e4b, 4, i1);
  2807.         DrawingArea.method339(l + 12 + l1 + k1, 0x726954, 3, i1);
  2808.         DrawingArea.method339(l + 12 + l1 + k1, 0x7d715b, 2, i1);
  2809.         DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 1, i1);
  2810.         DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 16, i1);
  2811.         DrawingArea.method339(l + 11 + l1 + k1, 0x4b4535, 15, i1);
  2812.         DrawingArea.method339(l + 11 + l1 + k1, 0x544c3c, 14, i1);
  2813.         DrawingArea.method339(l + 11 + l1 + k1, 0x625946, 13, i1);
  2814.         DrawingArea.method339(l + 11 + l1 + k1, 0x58503f, 11, i1);
  2815.         DrawingArea.method339(l + 11 + l1 + k1, 0x665d4a, 9, i1);
  2816.         DrawingArea.method339(l + 11 + l1 + k1, 0x685e4b, 7, i1);
  2817.         DrawingArea.method339(l + 11 + l1 + k1, 0x6a614d, 5, i1);
  2818.         DrawingArea.method339(l + 11 + l1 + k1, 0x706651, 4, i1);
  2819.         DrawingArea.method339(l + 11 + l1 + k1, 0x6a614d, 3, i1);
  2820.         DrawingArea.method339(l + 11 + l1 + k1, 0x7d715b, 2, i1);
  2821.         DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 1, i1);
  2822.     }
  2823.  
  2824.     private void updateNPCs(Stream stream, int i) {
  2825.         anInt839 = 0;
  2826.         anInt893 = 0;
  2827.         method139(stream);
  2828.         method46(i, stream);
  2829.         method86(stream);
  2830.         for (int k = 0; k < anInt839; k++) {
  2831.             int l = anIntArray840[k];
  2832.             if (npcArray[l].anInt1537 != loopCycle) {
  2833.                 npcArray[l].desc = null;
  2834.                 npcArray[l] = null;
  2835.             }
  2836.         }
  2837.  
  2838.         if (stream.currentOffset != i) {
  2839.             signlink.reporterror(myUsername
  2840.                     + " size mismatch in getnpcpos - pos:"
  2841.                     + stream.currentOffset + " psize:" + i);
  2842.             throw new RuntimeException("eek");
  2843.         }
  2844.         for (int i1 = 0; i1 < npcCount; i1++)
  2845.             if (npcArray[npcIndices[i1]] == null) {
  2846.                 signlink.reporterror(myUsername
  2847.                         + " null entry in npc list - pos:" + i1 + " size:"
  2848.                         + npcCount);
  2849.                 throw new RuntimeException("eek");
  2850.             }
  2851.  
  2852.     }
  2853.  
  2854.     private int cButtonHPos;
  2855.     private int cButtonHCPos;
  2856.     private int cButtonCPos;
  2857.  
  2858.     private void processChatModeClick() {
  2859.         if (super.mouseX >= 6 && super.mouseX <= 62 && super.mouseY >= 482
  2860.                 && super.mouseY <= 505) {
  2861.             cButtonHPos = 0;
  2862.             aBoolean1233 = true;
  2863.             inputTaken = true;
  2864.         } else if (super.mouseX >= 63 && super.mouseX <= 118
  2865.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2866.             cButtonHPos = 1;
  2867.             aBoolean1233 = true;
  2868.             inputTaken = true;
  2869.         } else if (super.mouseX >= 119 && super.mouseX <= 175
  2870.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2871.             cButtonHPos = 2;
  2872.             aBoolean1233 = true;
  2873.             inputTaken = true;
  2874.         } else if (super.mouseX >= 177 && super.mouseX <= 232
  2875.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2876.             cButtonHPos = 3;
  2877.             aBoolean1233 = true;
  2878.             inputTaken = true;
  2879.         } else if (super.mouseX >= 233 && super.mouseX <= 289
  2880.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2881.             cButtonHPos = 4;
  2882.             aBoolean1233 = true;
  2883.             inputTaken = true;
  2884.         } else if (super.mouseX >= 290 && super.mouseX <= 346
  2885.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2886.             cButtonHPos = 5;
  2887.             aBoolean1233 = true;
  2888.             inputTaken = true;
  2889.         } else if (super.mouseX >= 347 && super.mouseX <= 403
  2890.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2891.             cButtonHPos = 6;
  2892.             aBoolean1233 = true;
  2893.             inputTaken = true;
  2894.         } else if (super.mouseX >= 404 && super.mouseX <= 515
  2895.                 && super.mouseY >= 482 && super.mouseY <= 505) {
  2896.             cButtonHPos = 7;
  2897.             aBoolean1233 = true;
  2898.             inputTaken = true;
  2899.         } else {
  2900.             cButtonHPos = -1;
  2901.             aBoolean1233 = true;
  2902.             inputTaken = true;
  2903.         }
  2904.  
  2905.         if (super.clickMode3 == 1) {
  2906.             if (super.saveClickX >= 6 && super.saveClickX <= 62
  2907.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2908.                 cButtonCPos = 0;
  2909.                 chatTypeView = 0;
  2910.                 aBoolean1233 = true;
  2911.                 inputTaken = true;
  2912.             }
  2913.             if (super.saveClickX >= 63 && super.saveClickX <= 118
  2914.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2915.                 cButtonCPos = 1;
  2916.                 chatTypeView = 5;
  2917.                 aBoolean1233 = true;
  2918.                 inputTaken = true;
  2919.             }
  2920.             if (super.saveClickX >= 119 && super.saveClickX <= 175
  2921.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2922.                 cButtonCPos = 2;
  2923.                 chatTypeView = 1;
  2924.                 aBoolean1233 = true;
  2925.                 inputTaken = true;
  2926.             }
  2927.             if (super.saveClickX >= 177 && super.saveClickX <= 232
  2928.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2929.                 cButtonCPos = 3;
  2930.                 chatTypeView = 2;
  2931.                 aBoolean1233 = true;
  2932.                 inputTaken = true;
  2933.             }
  2934.             if (super.saveClickX >= 233 && super.saveClickX <= 289
  2935.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2936.                 cButtonCPos = 4;
  2937.                 chatTypeView = 11;
  2938.                 aBoolean1233 = true;
  2939.                 inputTaken = true;
  2940.             }
  2941.             if (super.saveClickX >= 290 && super.saveClickX <= 346
  2942.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2943.                 cButtonCPos = 5;
  2944.                 chatTypeView = 3;
  2945.                 aBoolean1233 = true;
  2946.                 inputTaken = true;
  2947.             }
  2948.             if (super.saveClickX >= 347 && super.saveClickX <= 403
  2949.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2950.                 cButtonCPos = 6;
  2951.                 chatTypeView = 4;
  2952.                 aBoolean1233 = true;
  2953.                 inputTaken = true;
  2954.             }
  2955.             if (super.saveClickX >= 404 && super.saveClickX <= 515
  2956.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  2957.                 /*
  2958.                  * BugReport window = new BugReport();
  2959.                  * window.setTitle("DarkWorldPk - the new era Bug Report Form");
  2960.                  * window.pack(); window.show(); window.setAlwaysOnTop(true);
  2961.                  */
  2962.             }
  2963.         }
  2964.     }
  2965.  
  2966.     public void method33(int i) {
  2967.         try {
  2968.             int j = Varp.cache[i].anInt709;
  2969.             if (j == 0)
  2970.                 return;
  2971.             int k = variousSettings[i];
  2972.             if (j == 1) {
  2973.                 if (k == 1)
  2974.                     Texture.method372(0.90000000000000002D);
  2975.                 if (k == 2)
  2976.                     Texture.method372(0.80000000000000004D);
  2977.                 if (k == 3)
  2978.                     Texture.method372(0.69999999999999996D);
  2979.                 if (k == 4)
  2980.                     Texture.method372(0.59999999999999998D);
  2981.                 ItemDef.mruNodes1.unlinkAll();
  2982.                 welcomeScreenRaised = true;
  2983.             }
  2984.             if (j == 3) {
  2985.                 boolean flag1 = musicEnabled;
  2986.                 if (k == 0) {
  2987.                     adjustVolume(musicEnabled, 0);
  2988.                     musicEnabled = true;
  2989.                 }
  2990.                 if (k == 1) {
  2991.                     adjustVolume(musicEnabled, -400);
  2992.                     musicEnabled = true;
  2993.                 }
  2994.                 if (k == 2) {
  2995.                     adjustVolume(musicEnabled, -800);
  2996.                     musicEnabled = true;
  2997.                 }
  2998.                 if (k == 3) {
  2999.                     adjustVolume(musicEnabled, -1200);
  3000.                     musicEnabled = true;
  3001.                 }
  3002.                 if (k == 4)
  3003.                     musicEnabled = false;
  3004.                 if (musicEnabled != flag1 && !lowMem) {
  3005.                     if (musicEnabled) {
  3006.                         nextSong = currentSong;
  3007.                         songChanging = true;
  3008.                         onDemandFetcher.method558(2, nextSong);
  3009.                     } else {
  3010.                         stopMidi();
  3011.                     }
  3012.                     prevSong = 0;
  3013.                 }
  3014.             }
  3015.             if (j == 4) {
  3016.                 if (k == 0) {
  3017.                     aBoolean848 = true;
  3018.                     setWaveVolume(0);
  3019.                 }
  3020.                 if (k == 1) {
  3021.                     aBoolean848 = true;
  3022.                     setWaveVolume(-400);
  3023.                 }
  3024.                 if (k == 2) {
  3025.                     aBoolean848 = true;
  3026.                     setWaveVolume(-800);
  3027.                 }
  3028.                 if (k == 3) {
  3029.                     aBoolean848 = true;
  3030.                     setWaveVolume(-1200);
  3031.                 }
  3032.                 if (k == 4)
  3033.                     aBoolean848 = false;
  3034.             }
  3035.             if (j == 5)
  3036.                 anInt1253 = k;
  3037.             if (j == 6)
  3038.                 anInt1249 = k;
  3039.             if (j == 8) {
  3040.                 splitPrivateChat = k;
  3041.                 inputTaken = true;
  3042.             }
  3043.             if (j == 9)
  3044.                 anInt913 = k;
  3045.         } catch (Exception _e) {
  3046.         }
  3047.     }
  3048.  
  3049.     boolean fix;
  3050.     public String title;
  3051.  
  3052.     private void updateEntities() {
  3053.         try {
  3054.             int anInt974 = 0;
  3055.             for (int j = -1; j < playerCount + npcCount; j++) {
  3056.                 Object obj;
  3057.                 if (j == -1)
  3058.                     obj = myPlayer;
  3059.                 else if (j < playerCount)
  3060.                     obj = playerArray[playerIndices[j]];
  3061.                 else
  3062.                     obj = npcArray[npcIndices[j - playerCount]];
  3063.                 if (obj == null || !((Entity) (obj)).isVisible())
  3064.                     continue;
  3065.                 if (obj instanceof NPC) {
  3066.                     EntityDef entityDef = ((NPC) obj).desc;
  3067.                     // npcScreenPos(((Entity) (obj)), ((Entity)
  3068.                     // (obj)).height+15);
  3069.                     // chatTextDrawingArea.drawText(0x0099FF, entityDef.name,
  3070.                     // spriteDrawY+10, spriteDrawX);
  3071.                     if (entityDef.childrenIDs != null)
  3072.                         entityDef = entityDef.method161();
  3073.                     if (entityDef == null)
  3074.                         continue;
  3075.                 }
  3076.                 if (j < playerCount) {
  3077.                     int l = 30;
  3078.                     Player player = (Player) obj;
  3079.                     if (player.headIcon >= 0) {
  3080.                         npcScreenPos(((Entity) (obj)),
  3081.                                 ((Entity) (obj)).height + 15);
  3082.                         if (spriteDrawX > -1) {
  3083.                             if (player.skullIcon < 2) {
  3084.                                 skullIcons[player.skullIcon].drawSprite(
  3085.                                         spriteDrawX - 12, spriteDrawY - l);
  3086.                                 l += 25;
  3087.                             }
  3088.                             if (player.headIcon < 18) {
  3089.                                 headIcons[player.headIcon].drawSprite(
  3090.                                         spriteDrawX - 12, spriteDrawY - l);
  3091.                                 l += 18;
  3092.                             }
  3093.  
  3094.                             title = getSpecialColor(player.skill)
  3095.                                     + player.title + "@bla@";
  3096.        
  3097.                         }
  3098.                     }
  3099.                     if (j >= 0 && anInt855 == 10
  3100.                             && anInt933 == playerIndices[j]) {
  3101.                         npcScreenPos(((Entity) (obj)),
  3102.                                 ((Entity) (obj)).height + 15);
  3103.                         if (spriteDrawX > -1)
  3104.                             headIconsHint[player.hintIcon].drawSprite(
  3105.                                     spriteDrawX - 12, spriteDrawY - l);
  3106.                     }
  3107.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  3108.                     if (player.name.equalsIgnoreCase("Mars")
  3109.                             || player.name.equalsIgnoreCase("Harky")
  3110.                             || player.name.equalsIgnoreCase("Aero")
  3111.                             || player.name.equalsIgnoreCase("")
  3112.                             || player.name.equalsIgnoreCase("")) {
  3113.                             chatTextDrawingArea.drawText(0x990000, "<Developer>", spriteDrawY+10, spriteDrawX);
  3114.                         chatTextDrawingArea.drawText(0x990000, player.rank
  3115.                                 + " " + player.name, spriteDrawY, spriteDrawX);
  3116.                         chatTextDrawingArea.drawText(0x990000, ""
  3117.                                 + player.guild + "", spriteDrawY + 10,
  3118.                                 spriteDrawX);
  3119.                     } else {
  3120.                         if (names) {
  3121.                             if (player.guild.equalsIgnoreCase(myPlayer.guild)) {
  3122.                                 chatTextDrawingArea.drawText(0x00ff00,
  3123.                                         player.rank + " " + player.name,
  3124.                                         spriteDrawY, spriteDrawX);
  3125.                                 chatTextDrawingArea.drawText(0x00ff00, "<"
  3126.                                         + player.guild + ">", spriteDrawY + 10,
  3127.                                         spriteDrawX);
  3128.                             } else {
  3129.                                 chatTextDrawingArea.drawText(0x0000ff,
  3130.                                         player.rank + " " + player.name,
  3131.                                         spriteDrawY, spriteDrawX);
  3132.                                 chatTextDrawingArea.drawText(0x0000ff, "<"
  3133.                                         + player.guild + ">", spriteDrawY + 10,
  3134.                                         spriteDrawX);
  3135.                             }
  3136.                         }
  3137.                     }
  3138.  
  3139.                 } else {
  3140.                     EntityDef entityDef_1 = ((NPC) obj).desc;
  3141.                     if (entityDef_1.anInt75 >= 0
  3142.                             && entityDef_1.anInt75 < headIcons.length) {
  3143.                         npcScreenPos(((Entity) (obj)),
  3144.                                 ((Entity) (obj)).height + 15);
  3145.                         if (spriteDrawX > -1)
  3146.                             headIcons[entityDef_1.anInt75].drawSprite(
  3147.                                     spriteDrawX - 12, spriteDrawY - 30);
  3148.                     }
  3149.                     if (anInt855 == 1
  3150.                             && anInt1222 == npcIndices[j - playerCount]
  3151.                             && loopCycle % 20 < 10) {
  3152.                         npcScreenPos(((Entity) (obj)),
  3153.                                 ((Entity) (obj)).height + 15);
  3154.                         if (spriteDrawX > -1)
  3155.                             headIconsHint[0].drawSprite(spriteDrawX - 12,
  3156.                                     spriteDrawY - 28);
  3157.                     }
  3158.                 }
  3159.                 if (((Entity) (obj)).textSpoken != null
  3160.                         && (j >= playerCount || publicChatMode == 0
  3161.                                 || publicChatMode == 3 || publicChatMode == 1
  3162.                                 && isFriendOrSelf(((Player) obj).name))) {
  3163.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  3164.                     if (spriteDrawX > -1 && anInt974 < anInt975) {
  3165.                         anIntArray979[anInt974] = chatTextDrawingArea
  3166.                                 .method384(((Entity) (obj)).textSpoken) / 2;
  3167.                         anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  3168.                         anIntArray976[anInt974] = spriteDrawX;
  3169.                         anIntArray977[anInt974] = spriteDrawY;
  3170.                         anIntArray980[anInt974] = ((Entity) (obj)).anInt1513;
  3171.                         anIntArray981[anInt974] = ((Entity) (obj)).anInt1531;
  3172.                         anIntArray982[anInt974] = ((Entity) (obj)).textCycle;
  3173.                         aStringArray983[anInt974++] = ((Entity) (obj)).textSpoken;
  3174.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1
  3175.                                 && ((Entity) (obj)).anInt1531 <= 3) {
  3176.                             anIntArray978[anInt974] += 10;
  3177.                             anIntArray977[anInt974] += 5;
  3178.                         }
  3179.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  3180.                             anIntArray979[anInt974] = 60;
  3181.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  3182.                             anIntArray978[anInt974] += 5;
  3183.                     }
  3184.                 }
  3185.                 if (((Entity) (obj)).loopCycleStatus > loopCycle) {
  3186.                     try {
  3187.                         if (!newHpBar) {
  3188.                             npcScreenPos(((Entity) (obj)),
  3189.                                     ((Entity) (obj)).height + 15);
  3190.                             if (spriteDrawX > -1) {
  3191.                                 if (hpH == true) {
  3192.                                     // chatTextDrawingArea.method3822(0xff0000,
  3193.                                     // spriteDrawX, -918, (new
  3194.                                     // StringBuilder()).append(((Entity)(Entity)obj).currentHealth).append("/").append(((Entity)(Entity)obj).maxHealth).toString(),
  3195.                                     // spriteDrawY - 9, true);
  3196.                                     smallText.drawText(0x00ff00, ""
  3197.                                             + ((Entity) (obj)).currentHealth
  3198.                                             + " / "
  3199.                                             + ((Entity) (obj)).maxHealth,
  3200.                                             spriteDrawY - 8, spriteDrawX);
  3201.                                 }
  3202.                                 int i1 = (((Entity) (obj)).currentHealth * 30)
  3203.                                         / ((Entity) (obj)).maxHealth;
  3204.                                 if (i1 > 30)
  3205.                                     i1 = 30;
  3206.                                 DrawingArea.drawPixels(5, spriteDrawY - 3,
  3207.                                         spriteDrawX - 15, 65280, i1);
  3208.                                 DrawingArea.drawPixels(5, spriteDrawY - 3,
  3209.                                         (spriteDrawX - 15) + i1, 0xff0000,
  3210.                                         30 - i1);
  3211.                             }
  3212.                         }
  3213.                         if (newHpBar) { // New HP Bar ON Toggle
  3214.                             npcScreenPos(((Entity) (obj)),
  3215.                                     ((Entity) (obj)).height + 15);
  3216.                             if (spriteDrawX > -1) {
  3217.                                 if (hpH == true) {
  3218.                                     // chatTextDrawingArea.method3822(0xff0000,
  3219.                                     // spriteDrawX, -918, (new
  3220.                                     // StringBuilder()).append(((Entity)(Entity)obj).currentHealth).append("/").append(((Entity)(Entity)obj).maxHealth).toString(),
  3221.                                     // spriteDrawY - 9, true);
  3222.                                     smallText.drawText(0x00ff00, ""
  3223.                                             + ((Entity) (obj)).currentHealth
  3224.                                             + " / "
  3225.                                             + ((Entity) (obj)).maxHealth,
  3226.                                             spriteDrawY - 8, spriteDrawX);
  3227.  
  3228.                                 }
  3229.                                 int i1 = (((Entity) (obj)).currentHealth * 30)
  3230.                                         / ((Entity) (obj)).maxHealth;
  3231.                                 if (i1 > 30) {
  3232.                                     i1 = 30;
  3233.                                 }
  3234.                                 int CurrentHealth = (((Entity) (obj)).currentHealth * 54)
  3235.                                         / ((Entity) (obj)).maxHealth;
  3236.                                 if (CurrentHealth > 54)
  3237.                                     CurrentHealth = 54;
  3238.                                 DrawingArea.method336(5, spriteDrawY - 3,
  3239.                                         spriteDrawX - 28, 0x002900, 56);
  3240.                                 DrawingArea.method336(7, spriteDrawY - 4,
  3241.                                         spriteDrawX - 27, 0x002900, 54);
  3242.                                 DrawingArea.method336(3, spriteDrawY - 1,
  3243.                                         spriteDrawX + 19, 0x069100, 8);
  3244.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3245.                                         spriteDrawX - 27, 0x83CD00, 3);
  3246.                                 DrawingArea.method336(2, spriteDrawY - 1,
  3247.                                         spriteDrawX - 27, 0x84C600, 33);
  3248.                                 DrawingArea.method336(1, spriteDrawY - 1,
  3249.                                         spriteDrawX - 26, 0xA3D500, 1);
  3250.                                 DrawingArea.method336(1, spriteDrawY,
  3251.                                         spriteDrawX + 3, 0x54C000, 1);
  3252.                                 DrawingArea.method336(1, spriteDrawY,
  3253.                                         spriteDrawX + 4, 0x44BB00, 19);
  3254.                                 DrawingArea.method336(1, spriteDrawY - 1,
  3255.                                         spriteDrawX + 6, 0x44BB00, 20);
  3256.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3257.                                         spriteDrawX - 26, 0x69BA00, 5);
  3258.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3259.                                         spriteDrawX - 25, 0x59CA00, 1);
  3260.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3261.                                         spriteDrawX - 21, 0x62BB00, 10);
  3262.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3263.                                         spriteDrawX - 11, 0x60B400, 4);
  3264.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3265.                                         spriteDrawX - 7, 0x52AD00, 4);
  3266.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3267.                                         spriteDrawX - 3, 0x4AA500, 7);
  3268.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3269.                                         spriteDrawX + 4, 0x39A000, 4);
  3270.                                 DrawingArea.method336(1, spriteDrawY - 3,
  3271.                                         spriteDrawX + 8, 0x239500, 18);
  3272.                                 DrawingArea.method336(1, spriteDrawY,
  3273.                                         spriteDrawX + 23, 0x24AC00, 2);
  3274.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3275.                                         spriteDrawX - 24, 0xA8DC00, 10);
  3276.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3277.                                         spriteDrawX - 14, 0xA0DA00, 7);
  3278.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3279.                                         spriteDrawX - 8, 0x7DCA00, 24);
  3280.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3281.                                         spriteDrawX + 10, 0x83CD00, 1);
  3282.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3283.                                         spriteDrawX + 16, 0x6BC300, 5);
  3284.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3285.                                         spriteDrawX + 21, 0x5BBE00, 4);
  3286.                                 DrawingArea.method336(1, spriteDrawY - 2,
  3287.                                         spriteDrawX + 25, 0x0E9A00, 2);
  3288.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3289.                                         spriteDrawX - 26, 0x63C200, 2);
  3290.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3291.                                         spriteDrawX - 24, 0x33BA00, 5);
  3292.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3293.                                         spriteDrawX - 19, 0x2CB300, 9);
  3294.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3295.                                         spriteDrawX - 10, 0x24AC00, 5);
  3296.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3297.                                         spriteDrawX - 5, 0x1A9900, 11);
  3298.                                 DrawingArea.method336(1, spriteDrawY + 1,
  3299.                                         spriteDrawX + 6, 0x149500, 13);
  3300.                                 DrawingArea.method336(5, spriteDrawY - 3,
  3301.                                         (spriteDrawX - 27) + CurrentHealth,
  3302.                                         0xBA0009, 54 - CurrentHealth);
  3303.  
  3304.                                 int health = (int) (((double) ((Entity) (obj)).currentHealth / (double) ((Entity) (obj)).maxHealth) * 100D);
  3305.                                 int col = 65280;
  3306.                                 if (health <= 100 && health >= 75)
  3307.                                     col = 65280;
  3308.                                 else if (health <= 74 && health >= 50)
  3309.                                     col = 0xffff00;
  3310.                                 else if (health <= 49 && health >= 25)
  3311.                                     col = 0xfca607;
  3312.                                 else if (health <= 24 && health >= 0)
  3313.                                     col = 0xf50d0d;
  3314.                             }
  3315.                         }
  3316.  
  3317.                     } catch (Exception e) {
  3318.                     }
  3319.                 }
  3320.                 for (int j1 = 0; j1 < 4; j1++)
  3321.                     if (((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
  3322.                         if (!newHits) {
  3323.                             npcScreenPos(((Entity) (obj)),
  3324.                                     ((Entity) (obj)).height / 2);
  3325.                             if (spriteDrawX > -1) {
  3326.                                 if (j1 == 1)
  3327.                                     spriteDrawY -= 20;
  3328.                                 if (j1 == 2) {
  3329.                                     spriteDrawX -= 15;
  3330.                                     spriteDrawY -= 10;
  3331.                                 }
  3332.                                 if (j1 == 3) {
  3333.                                     spriteDrawX += 15;
  3334.                                     spriteDrawY -= 10;
  3335.                                 }
  3336.                                 hitMarks[((Entity) (obj)).hitMarkTypes[j1]]
  3337.                                         .drawSprite(spriteDrawX - 12,
  3338.                                                 spriteDrawY - 12);
  3339.                                 smallText
  3340.                                         .drawText(
  3341.                                                 0,
  3342.                                                 String
  3343.                                                         .valueOf(((Entity) (obj)).hitArray[j1]),
  3344.                                                 spriteDrawY + 4, spriteDrawX);
  3345.                                 smallText
  3346.                                         .drawText(
  3347.                                                 0xffffff,
  3348.                                                 String
  3349.                                                         .valueOf(((Entity) (obj)).hitArray[j1]),
  3350.                                                 spriteDrawY + 3,
  3351.                                                 spriteDrawX - 1);
  3352.                             }
  3353.                         }
  3354.                         if (newHits) {
  3355.                             npcScreenPos(((Entity) (obj)),
  3356.                                     ((Entity) (obj)).height / 2);
  3357.                             if (spriteDrawX > -1) {
  3358.                                 if (j1 == 1)
  3359.                                     spriteDrawY -= 20;
  3360.                                 if (j1 == 2) {
  3361.                                     spriteDrawX -= 15;
  3362.                                     spriteDrawY -= 10;
  3363.                                 }
  3364.                                 if (j1 == 3) {
  3365.                                     spriteDrawX += 15;
  3366.                                     spriteDrawY -= 10;
  3367.                                 }
  3368.                                 if (((Entity) (obj)).hitMarkTypes[j1] == 1) {
  3369.                                     hitMarks[20].drawSprite(spriteDrawX - 11,
  3370.                                             spriteDrawY - 12);
  3371.                                 } else if (((Entity) (obj)).hitMarkTypes[j1] == 0) {
  3372.                                     hitMarks[21].drawSprite(spriteDrawX - 12,
  3373.                                             spriteDrawY - 13);
  3374.                                 } else {
  3375.                                     hitMarks[((Entity) (obj)).hitMarkTypes[j1]]
  3376.                                             .drawSprite(spriteDrawX - 12,
  3377.                                                     spriteDrawY - 12);
  3378.                                 }
  3379.                                 smallText
  3380.                                         .drawText(
  3381.                                                 0xffffff,
  3382.                                                 String
  3383.                                                         .valueOf(((Entity) (obj)).hitArray[j1]),
  3384.                                                 spriteDrawY + 4, spriteDrawX);
  3385.                                 // if (((Entity) (obj)).hitArray[j1] > 0) {
  3386.                                 // smallText.drawText(0xffffff,
  3387.                                 // String.valueOf(((Entity)
  3388.                                 // (obj)).hitArray[j1]), spriteDrawY + 3,
  3389.                                 // spriteDrawX - 1);
  3390.                                 // }
  3391.                             }
  3392.                         }
  3393.                     }
  3394.             }
  3395.             for (int k = 0; k < anInt974; k++) {
  3396.                 int k1 = anIntArray976[k];
  3397.                 int l1 = anIntArray977[k];
  3398.                 int j2 = anIntArray979[k];
  3399.                 int k2 = anIntArray978[k];
  3400.                 boolean flag = true;
  3401.                 while (flag) {
  3402.                     flag = false;
  3403.                     for (int l2 = 0; l2 < k; l2++)
  3404.                         if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2]
  3405.                                 && l1 - k2 < anIntArray977[l2] + 2
  3406.                                 && k1 - j2 < anIntArray976[l2]
  3407.                                         + anIntArray979[l2]
  3408.                                 && k1 + j2 > anIntArray976[l2]
  3409.                                         - anIntArray979[l2]
  3410.                                 && anIntArray977[l2] - anIntArray978[l2] < l1) {
  3411.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  3412.                             flag = true;
  3413.                         }
  3414.  
  3415.                 }
  3416.                 spriteDrawX = anIntArray976[k];
  3417.                 spriteDrawY = anIntArray977[k] = l1;
  3418.                 String s = aStringArray983[k];
  3419.                 if (anInt1249 == 0) {
  3420.                     int i3 = 0xffff00;
  3421.                     if (anIntArray980[k] < 6)
  3422.                         i3 = anIntArray965[anIntArray980[k]];
  3423.                     if (anIntArray980[k] == 6)
  3424.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  3425.                     if (anIntArray980[k] == 7)
  3426.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  3427.                     if (anIntArray980[k] == 8)
  3428.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  3429.                     if (anIntArray980[k] == 9) {
  3430.                         int j3 = 150 - anIntArray982[k];
  3431.                         if (j3 < 50)
  3432.                             i3 = 0xff0000 + 1280 * j3;
  3433.                         else if (j3 < 100)
  3434.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  3435.                         else if (j3 < 150)
  3436.                             i3 = 65280 + 5 * (j3 - 100);
  3437.                     }
  3438.                     if (anIntArray980[k] == 10) {
  3439.                         int k3 = 150 - anIntArray982[k];
  3440.                         if (k3 < 50)
  3441.                             i3 = 0xff0000 + 5 * k3;
  3442.                         else if (k3 < 100)
  3443.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  3444.                         else if (k3 < 150)
  3445.                             i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  3446.                     }
  3447.                     if (anIntArray980[k] == 11) {
  3448.                         int l3 = 150 - anIntArray982[k];
  3449.                         if (l3 < 50)
  3450.                             i3 = 0xffffff - 0x50005 * l3;
  3451.                         else if (l3 < 100)
  3452.                             i3 = 65280 + 0x50005 * (l3 - 50);
  3453.                         else if (l3 < 150)
  3454.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  3455.                     }
  3456.                     if (anIntArray981[k] == 0) {
  3457.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  3458.                                 spriteDrawX);
  3459.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY,
  3460.                                 spriteDrawX);
  3461.                     }
  3462.                     if (anIntArray981[k] == 1) {
  3463.                         chatTextDrawingArea.method386(0, s, spriteDrawX,
  3464.                                 anInt1265, spriteDrawY + 1);
  3465.                         chatTextDrawingArea.method386(i3, s, spriteDrawX,
  3466.                                 anInt1265, spriteDrawY);
  3467.                     }
  3468.                     if (anIntArray981[k] == 2) {
  3469.                         chatTextDrawingArea.method387(spriteDrawX, s,
  3470.                                 anInt1265, spriteDrawY + 1, 0);
  3471.                         chatTextDrawingArea.method387(spriteDrawX, s,
  3472.                                 anInt1265, spriteDrawY, i3);
  3473.                     }
  3474.                     if (anIntArray981[k] == 3) {
  3475.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  3476.                                 s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  3477.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  3478.                                 s, anInt1265, spriteDrawY, spriteDrawX, i3);
  3479.                     }
  3480.                     if (anIntArray981[k] == 4) {
  3481.                         int i4 = chatTextDrawingArea.method384(s);
  3482.                         int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  3483.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50,
  3484.                                 spriteDrawX + 50, 0);
  3485.                         chatTextDrawingArea.method385(0, s, spriteDrawY + 1,
  3486.                                 (spriteDrawX + 50) - k4);
  3487.                         chatTextDrawingArea.method385(i3, s, spriteDrawY,
  3488.                                 (spriteDrawX + 50) - k4);
  3489.                         DrawingArea.defaultDrawingAreaSize();
  3490.                     }
  3491.                     if (anIntArray981[k] == 5) {
  3492.                         int j4 = 150 - anIntArray982[k];
  3493.                         int l4 = 0;
  3494.                         if (j4 < 25)
  3495.                             l4 = j4 - 25;
  3496.                         else if (j4 > 125)
  3497.                             l4 = j4 - 125;
  3498.                         DrawingArea
  3499.                                 .setDrawingArea(spriteDrawY + 5, 0, 512,
  3500.                                         spriteDrawY
  3501.                                                 - chatTextDrawingArea.anInt1497
  3502.                                                 - 1);
  3503.                         chatTextDrawingArea.drawText(0, s,
  3504.                                 spriteDrawY + 1 + l4, spriteDrawX);
  3505.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4,
  3506.                                 spriteDrawX);
  3507.                         DrawingArea.defaultDrawingAreaSize();
  3508.                     }
  3509.                 } else {
  3510.                     chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  3511.                             spriteDrawX);
  3512.                     chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY,
  3513.                             spriteDrawX);
  3514.                 }
  3515.             }
  3516.         } catch (Exception e) {
  3517.         }
  3518.     }
  3519.  
  3520.     private void delFriend(long l) {
  3521.         try {
  3522.             if (l == 0L)
  3523.                 return;
  3524.             for (int i = 0; i < friendsCount; i++) {
  3525.                 if (friendsListAsLongs[i] != l)
  3526.                     continue;
  3527.                 friendsCount--;
  3528.                 needDrawTabArea = true;
  3529.                 for (int j = i; j < friendsCount; j++) {
  3530.                     friendsList[j] = friendsList[j + 1];
  3531.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  3532.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  3533.                 }
  3534.  
  3535.                 stream.createFrame(215);
  3536.                 stream.writeQWord(l);
  3537.                 break;
  3538.             }
  3539.         } catch (RuntimeException runtimeexception) {
  3540.             signlink.reporterror("18622, " + false + ", " + l + ", "
  3541.                     + runtimeexception.toString());
  3542.             throw new RuntimeException();
  3543.         }
  3544.     }
  3545.  
  3546.     public void drawSideIcons() {
  3547.         /* Top sideIcons */
  3548.         if (tabInterfaceIDs[0] != -1 && anInt1054 == 0)
  3549.             if (loopCycle % 20 >= 10)
  3550.                 ;
  3551.         sideIcons[0].drawSprite(10, 4);
  3552.         if (tabInterfaceIDs[1] != -1 && anInt1054 == 1)
  3553.             if (loopCycle % 20 >= 10)
  3554.                 ;
  3555.         sideIcons[1].drawSprite(43, 4);
  3556.         if (tabInterfaceIDs[2] != -1 && anInt1054 == 2)
  3557.             if (loopCycle % 20 >= 10)
  3558.                 ;
  3559.         sideIcons[2].drawSprite(76, 3);
  3560.         if (tabInterfaceIDs[3] != -1 && anInt1054 == 3)
  3561.             if (loopCycle % 20 >= 10)
  3562.                 ;
  3563.         sideIcons[3].drawSprite(111, 5);
  3564.         if (tabInterfaceIDs[4] != -1 && anInt1054 == 4)
  3565.             if (loopCycle % 20 >= 10)
  3566.                 ;
  3567.         sideIcons[4].drawSprite(140, 1);
  3568.         if (tabInterfaceIDs[5] != -1 && anInt1054 == 5)
  3569.             if (loopCycle % 20 >= 10)
  3570.                 ;
  3571.         sideIcons[5].drawSprite(174, 1);
  3572.         if (tabInterfaceIDs[6] != -1 && anInt1054 == 6)
  3573.             if (loopCycle % 20 >= 10)
  3574.                 ;
  3575.         sideIcons[6].drawSprite(209, 5);
  3576.         /* Bottom sideIcons */
  3577.         if (tabInterfaceIDs[7] != -1 && anInt1054 == 7)
  3578.             if (loopCycle % 20 >= 10)
  3579.                 ;
  3580.         sideIcons[7].drawSprite(43, 302);
  3581.         if (tabInterfaceIDs[8] != -1 && anInt1054 == 8)
  3582.             if (loopCycle % 20 >= 10)
  3583.                 ;
  3584.         sideIcons[8].drawSprite(76, 302);
  3585.         if (tabInterfaceIDs[9] != -1 && anInt1054 == 9)
  3586.             if (loopCycle % 20 >= 10)
  3587.                 ;
  3588.         sideIcons[13].drawSprite(112, 304);
  3589.         if (tabInterfaceIDs[10] != -1 && anInt1054 == 10)
  3590.             if (loopCycle % 20 >= 10)
  3591.                 ;
  3592.         sideIcons[10].drawSprite(143, 303);
  3593.         if (tabInterfaceIDs[11] != -1 && anInt1054 == 11)
  3594.             if (loopCycle % 20 >= 10)
  3595.                 ;
  3596.         sideIcons[11].drawSprite(173, 300);
  3597.         if (tabInterfaceIDs[12] != -1 && anInt1054 == 12)
  3598.             if (loopCycle % 20 >= 10)
  3599.                 ;
  3600.         sideIcons[12].drawSprite(206, 300);
  3601.     }
  3602.  
  3603.     public void drawRedStones() {
  3604.         if (tabInterfaceIDs[tabID] != -1) {
  3605.             if (tabID == 0)
  3606.                 redStones[0].drawSprite(3, 0);
  3607.             if (tabID == 1)
  3608.                 redStones[4].drawSprite(41, 0);
  3609.             if (tabID == 2)
  3610.                 redStones[4].drawSprite(74, 0);
  3611.             if (tabID == 3)
  3612.                 redStones[4].drawSprite(107, 0);
  3613.             if (tabID == 4)
  3614.                 redStones[4].drawSprite(140, 0);
  3615.             if (tabID == 5)
  3616.                 redStones[4].drawSprite(173, 0);
  3617.             if (tabID == 6)
  3618.                 redStones[1].drawSprite(206, 0);
  3619.             if (tabID == 7)
  3620.                 redStones[4].drawSprite(107, 298);
  3621.             if (tabID == 8)
  3622.                 redStones[4].drawSprite(41, 298);
  3623.             if (tabID == 9)
  3624.                 redStones[4].drawSprite(74, 298);
  3625.             if (tabID == 11)
  3626.                 redStones[4].drawSprite(140, 298);
  3627.             if (tabID == 12)
  3628.                 redStones[4].drawSprite(173, 298);
  3629.             if (tabID == 13)
  3630.                 redStones[3].drawSprite(206, 298);
  3631.         }
  3632.     }
  3633.  
  3634.     private void drawTabArea() {
  3635.         aRSImageProducer_1163.initDrawingArea();
  3636.         Texture.anIntArray1472 = anIntArray1181;
  3637.         /* Draws new tab area sprite */
  3638.         tabArea.drawSprite(0, 0);
  3639.         if (invOverlayInterfaceID == -1) {
  3640.             drawRedStones();
  3641.             drawSideIcons();
  3642.         }
  3643.         if (invOverlayInterfaceID != -1)
  3644.             drawInterface(0, 28,
  3645.                     RSInterface.interfaceCache[invOverlayInterfaceID], 37);
  3646.         else if (tabInterfaceIDs[tabID] != -1)
  3647.             drawInterface(0, 28,
  3648.                     RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
  3649.         if (menuOpen && menuScreenArea == 1)
  3650.             drawMenu();
  3651.         aRSImageProducer_1163.drawGraphics(168, super.graphics, 519);
  3652.         aRSImageProducer_1165.initDrawingArea();
  3653.         Texture.anIntArray1472 = anIntArray1182;
  3654.     }
  3655.  
  3656.     private void method37(int j) {
  3657.         //if (!lowMem) {
  3658.             if (Texture.anIntArray1480[17] >= j) {
  3659.                 Background background = Texture.aBackgroundArray1474s[17];
  3660.                 int k = background.anInt1452 * background.anInt1453 - 1;
  3661.                 int j1 = background.anInt1452 * anInt945 * 2;
  3662.                 byte abyte0[] = background.aByteArray1450;
  3663.                 byte abyte3[] = aByteArray912;
  3664.                 for (int i2 = 0; i2 <= k; i2++)
  3665.                     abyte3[i2] = abyte0[i2 - j1 & k];
  3666.  
  3667.                 background.aByteArray1450 = abyte3;
  3668.                 aByteArray912 = abyte0;
  3669.                 Texture.method370(17);
  3670.                 anInt854++;
  3671.                 if (anInt854 > 1235) {
  3672.                     anInt854 = 0;
  3673.                     stream.createFrame(226);
  3674.                     stream.writeWordBigEndian(0);
  3675.                     int l2 = stream.currentOffset;
  3676.                     stream.writeWord(58722);
  3677.                     stream.writeWordBigEndian(240);
  3678.                     stream.writeWord((int) (Math.random() * 65536D));
  3679.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  3680.                     if ((int) (Math.random() * 2D) == 0)
  3681.                         stream.writeWord(51825);
  3682.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  3683.                     stream.writeWord((int) (Math.random() * 65536D));
  3684.                     stream.writeWord(7130);
  3685.                     stream.writeWord((int) (Math.random() * 65536D));
  3686.                     stream.writeWord(61657);
  3687.                     stream.writeBytes(stream.currentOffset - l2);
  3688.                     if (Texture.anIntArray1480[34] >= j) {
  3689.  
  3690.                         Background background_2 = Texture.aBackgroundArray1474s[34];
  3691.                         int i1 = background_2.anInt1452
  3692.                                 * background_2.anInt1453 - 1;
  3693.                         int l1 = background_2.anInt1452 * anInt945 * 2;
  3694.                         byte abyte2[] = background_2.aByteArray1450;
  3695.                         byte abyte5[] = aByteArray912;
  3696.                         for (int k2 = 0; k2 <= i1; k2++)
  3697.                             abyte5[k2] = abyte2[k2 - l1 & i1];
  3698.                         background_2.aByteArray1450 = abyte5;
  3699.                         aByteArray912 = abyte2;
  3700.                         Texture.method370(34);
  3701.  
  3702.                     }
  3703.                 }
  3704.             }
  3705.             if (Texture.anIntArray1480[24] >= j) {
  3706.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  3707.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  3708.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  3709.                 byte abyte1[] = background_1.aByteArray1450;
  3710.                 byte abyte4[] = aByteArray912;
  3711.                 for (int j2 = 0; j2 <= l; j2++)
  3712.                     abyte4[j2] = abyte1[j2 - k1 & l];
  3713.  
  3714.                 background_1.aByteArray1450 = abyte4;
  3715.                 aByteArray912 = abyte1;
  3716.                 Texture.method370(24);
  3717.             }
  3718.             /*
  3719.              * if(Texture.anIntArray1480[34] >= j) { Background background_2 =
  3720.              * Texture.aBackgroundArray1474s[34]; int i1 =
  3721.              * background_2.anInt1452 * background_2.anInt1453 - 1; int l1 =
  3722.              * background_2.anInt1452 * anInt945 * 2; byte abyte2[] =
  3723.              * background_2.aByteArray1450; byte abyte5[] = aByteArray912;
  3724.              * for(int k2 = 0; k2 <= i1; k2++) abyte5[k2] = abyte2[k2 - l1 &
  3725.              * i1];
  3726.              *
  3727.              * background_2.aByteArray1450 = abyte5; aByteArray912 = abyte2;
  3728.              * Texture.method370(34); }
  3729.              */
  3730.             if (Texture.anIntArray1480[40] >= j)
  3731.                 ;
  3732.             {
  3733.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  3734.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  3735.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  3736.                 byte abyte2[] = background_2.aByteArray1450;
  3737.                 byte abyte5[] = aByteArray912;
  3738.                 for (int k2 = 0; k2 <= i1; k2++)
  3739.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  3740.  
  3741.                 background_2.aByteArray1450 = abyte5;
  3742.                 aByteArray912 = abyte2;
  3743.                 Texture.method370(40);
  3744.             }
  3745.         //}
  3746.     }
  3747.  
  3748.     private void method38() {
  3749.         for (int i = -1; i < playerCount; i++) {
  3750.             int j;
  3751.             if (i == -1)
  3752.                 j = myPlayerIndex;
  3753.             else
  3754.                 j = playerIndices[i];
  3755.             Player player = playerArray[j];
  3756.             if (player != null && player.textCycle > 0) {
  3757.                 player.textCycle--;
  3758.                 if (player.textCycle == 0)
  3759.                     player.textSpoken = null;
  3760.             }
  3761.         }
  3762.  
  3763.         for (int k = 0; k < npcCount; k++) {
  3764.             int l = npcIndices[k];
  3765.             NPC npc = npcArray[l];
  3766.             if (npc != null && npc.textCycle > 0) {
  3767.                 npc.textCycle--;
  3768.                 if (npc.textCycle == 0)
  3769.                     npc.textSpoken = null;
  3770.             }
  3771.         }
  3772.  
  3773.     }
  3774.  
  3775.     private void calcCameraPos() {
  3776.         int i = anInt1098 * 128 + 64;
  3777.         int j = anInt1099 * 128 + 64;
  3778.         int k = method42(plane, j, i) - anInt1100;
  3779.         if (xCameraPos < i) {
  3780.             xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  3781.             if (xCameraPos > i)
  3782.                 xCameraPos = i;
  3783.         }
  3784.         if (xCameraPos > i) {
  3785.             xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  3786.             if (xCameraPos < i)
  3787.                 xCameraPos = i;
  3788.         }
  3789.         if (zCameraPos < k) {
  3790.             zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  3791.             if (zCameraPos > k)
  3792.                 zCameraPos = k;
  3793.         }
  3794.         if (zCameraPos > k) {
  3795.             zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  3796.             if (zCameraPos < k)
  3797.                 zCameraPos = k;
  3798.         }
  3799.         if (yCameraPos < j) {
  3800.             yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  3801.             if (yCameraPos > j)
  3802.                 yCameraPos = j;
  3803.         }
  3804.         if (yCameraPos > j) {
  3805.             yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  3806.             if (yCameraPos < j)
  3807.                 yCameraPos = j;
  3808.         }
  3809.         i = anInt995 * 128 + 64;
  3810.         j = anInt996 * 128 + 64;
  3811.         k = method42(plane, j, i) - anInt997;
  3812.         int l = i - xCameraPos;
  3813.         int i1 = k - zCameraPos;
  3814.         int j1 = j - yCameraPos;
  3815.         int k1 = (int) Math.sqrt(l * l + j1 * j1);
  3816.         int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  3817.         int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  3818.         if (l1 < 128)
  3819.             l1 = 128;
  3820.         if (l1 > 383)
  3821.             l1 = 383;
  3822.         if (yCameraCurve < l1) {
  3823.             yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  3824.             if (yCameraCurve > l1)
  3825.                 yCameraCurve = l1;
  3826.         }
  3827.         if (yCameraCurve > l1) {
  3828.             yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  3829.             if (yCameraCurve < l1)
  3830.                 yCameraCurve = l1;
  3831.         }
  3832.         int j2 = i2 - xCameraCurve;
  3833.         if (j2 > 1024)
  3834.             j2 -= 2048;
  3835.         if (j2 < -1024)
  3836.             j2 += 2048;
  3837.         if (j2 > 0) {
  3838.             xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  3839.             xCameraCurve &= 0x7ff;
  3840.         }
  3841.         if (j2 < 0) {
  3842.             xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  3843.             xCameraCurve &= 0x7ff;
  3844.         }
  3845.         int k2 = i2 - xCameraCurve;
  3846.         if (k2 > 1024)
  3847.             k2 -= 2048;
  3848.         if (k2 < -1024)
  3849.             k2 += 2048;
  3850.         if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  3851.             xCameraCurve = i2;
  3852.     }
  3853.  
  3854.     private void drawMenu() {
  3855.         int i = menuOffsetX;
  3856.         int j = menuOffsetY;
  3857.         int k = menuWidth;
  3858.         int l = anInt952;
  3859.         int i1 = 0x5d5447;
  3860.         // DrawingArea.method336(l, j, i, i1, k);
  3861.         DrawingArea.drawPixelsWithOpacity(i1, j, k, l, 150, i);
  3862.         // DrawingArea.method336(16, j + 1, i + 1, 0, k - 2);
  3863.         DrawingArea.drawPixelsWithOpacity(0, j + 1, k - 2, 16, 150, i + 1);
  3864.         // DrawingArea.fillPixels(i + 1, k - 2, l - 19, 0, j + 18);
  3865.         DrawingArea.method338(j + 18, l - 19, 150, 0, k - 2, i + 1);
  3866.  
  3867.         // DrawingArea.drawPixels(l, j, i, i1, k);
  3868.         // DrawingArea.drawPixels(16, j + 1, i + 1, 0, k - 2);
  3869.         // DrawingArea.fillPixels(i + 1, k - 2, l - 19, 0, j + 18);
  3870.         chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i + 3);
  3871.         int j1 = super.mouseX;
  3872.         int k1 = super.mouseY;
  3873.         if (menuScreenArea == 0) {
  3874.             j1 -= 4;
  3875.             k1 -= 4;
  3876.         }
  3877.         if (menuScreenArea == 1) {
  3878.             j1 -= 519;
  3879.             k1 -= 168;
  3880.         }
  3881.         if (menuScreenArea == 2) {
  3882.             j1 -= 17;
  3883.             k1 -= 338;
  3884.         }
  3885.         if (menuScreenArea == 3) {
  3886.             j1 -= 515;
  3887.             k1 -= 0;
  3888.         }
  3889.         for (int l1 = 0; l1 < menuActionRow; l1++) {
  3890.             int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  3891.             int j2 = 0xffffff;
  3892.             if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3)
  3893.                 j2 = 0xffff00;
  3894.             chatTextDrawingArea.method389(true, i + 3, j2, menuActionName[l1],
  3895.                     i2);
  3896.         }
  3897.  
  3898.     }
  3899.  
  3900.     private void addFriend(long l) {
  3901.         try {
  3902.             if (l == 0L)
  3903.                 return;
  3904.             if (friendsCount >= 100 && anInt1046 != 1) {
  3905.                 pushMessage("Your friendlist is full. The max is 50.", 0, "");
  3906.                 return;
  3907.             }
  3908.             if (friendsCount >= 100 && myPrivilege < 1) {
  3909.                 pushMessage(
  3910.                         "Your friendlist is full. Max is 100 for non-donators",
  3911.                         0, "");
  3912.                 return;
  3913.             } else {
  3914.                 if (friendsCount >= 200) {
  3915.                     pushMessage(
  3916.                             "Your friendlist is full. Max is 200 for donators.",
  3917.                             0, "");
  3918.                     return;
  3919.                 }
  3920.             }
  3921.             String s = TextClass.fixName(TextClass.nameForLong(l));
  3922.             if(s.startsWith("@bas@")){ // title
  3923.                 s = s.substring(0,s.indexOf("@bas@"));         
  3924.             }
  3925.             for (int i = 0; i < friendsCount; i++)
  3926.                 if (friendsListAsLongs[i] == l) {
  3927.                     pushMessage(s + " is already on your friend list", 0, "");
  3928.                     return;
  3929.                 }
  3930.             for (int j = 0; j < ignoreCount; j++)
  3931.                 if (ignoreListAsLongs[j] == l) {
  3932.                     pushMessage("Please remove " + s
  3933.                             + " from your ignore list first", 0, "");
  3934.                     return;
  3935.                 }
  3936.  
  3937.             if (s.equals(myPlayer.name)) {
  3938.                 return;
  3939.             } else {
  3940.                 friendsList[friendsCount] = s;
  3941.                 friendsListAsLongs[friendsCount] = l;
  3942.                 friendsNodeIDs[friendsCount] = 0;
  3943.                 friendsCount++;
  3944.                 needDrawTabArea = true;
  3945.                 stream.createFrame(188);
  3946.                 stream.writeQWord(l);
  3947.                 return;
  3948.             }
  3949.         } catch (RuntimeException runtimeexception) {
  3950.             signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", "
  3951.                     + runtimeexception.toString());
  3952.         }
  3953.         throw new RuntimeException();
  3954.     }
  3955.  
  3956.     private int method42(int i, int j, int k) {
  3957.         int l = k >> 7;
  3958.         int i1 = j >> 7;
  3959.         if (l < 0 || i1 < 0 || l > 103 || i1 > 103)
  3960.             return 0;
  3961.         int j1 = i;
  3962.         if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  3963.             j1++;
  3964.         int k1 = k & 0x7f;
  3965.         int l1 = j & 0x7f;
  3966.         int i2 = intGroundArray[j1][l][i1] * (128 - k1)
  3967.                 + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  3968.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1)
  3969.                 + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  3970.         return i2 * (128 - l1) + j2 * l1 >> 7;
  3971.     }
  3972.  
  3973.     private static String intToKOrMil(int j) {
  3974.         if (j == 0)
  3975.             return "@inf@";
  3976.         if (j < 0x186a0)
  3977.             return String.valueOf(j);
  3978.         if (j < 0x989680)
  3979.             return j / 1000 + "K";
  3980.         else
  3981.             return j / 0xf4240 + "M";
  3982.     }
  3983.  
  3984.     private void resetLogout() {
  3985.         alertHandler.alert = null;
  3986.         try {
  3987.             if (socketStream != null)
  3988.                 socketStream.close();
  3989.         } catch (Exception _ex) {
  3990.         }
  3991.         prayClicked = false;
  3992.         clickedQuickPrayers = false;
  3993.         socketStream = null;
  3994.         loggedIn = false;
  3995.         loginScreenState = 0;
  3996.         xpClicked = false;
  3997.         drawXpBar = false;
  3998.         // myUsername = "";
  3999.         // myPassword = "";
  4000.         unlinkMRUNodes();
  4001.         worldController.initToNull();
  4002.         for (int i = 0; i < 4; i++)
  4003.             aClass11Array1230[i].method210();
  4004.  
  4005.         System.gc();
  4006.         stopMidi();
  4007.         currentSong = -1;
  4008.         nextSong = -1;
  4009.         prevSong = 0;
  4010.         resetImageProducers();
  4011.         followPlayer = 0;
  4012.         followNPC = 0;
  4013.         followDistance = 1;
  4014.     }
  4015.  
  4016.     private void method45() {
  4017.         aBoolean1031 = true;
  4018.         for (int j = 0; j < 7; j++) {
  4019.             anIntArray1065[j] = -1;
  4020.             for (int k = 0; k < IDK.length; k++) {
  4021.                 if (IDK.cache[k].aBoolean662
  4022.                         || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  4023.                     continue;
  4024.                 anIntArray1065[j] = k;
  4025.                 break;
  4026.             }
  4027.  
  4028.         }
  4029.  
  4030.     }
  4031.  
  4032.     private void method46(int i, Stream stream) {
  4033.         while (stream.bitPosition + 21 < i * 8) {
  4034.             int k = stream.readBits(14);
  4035.             if (k == 16383)
  4036.                 break;
  4037.             if (npcArray[k] == null)
  4038.                 npcArray[k] = new NPC();
  4039.             NPC npc = npcArray[k];
  4040.             npcIndices[npcCount++] = k;
  4041.             npc.anInt1537 = loopCycle;
  4042.             int l = stream.readBits(5);
  4043.             if (l > 15)
  4044.                 l -= 32;
  4045.             int i1 = stream.readBits(5);
  4046.             if (i1 > 15)
  4047.                 i1 -= 32;
  4048.             int j1 = stream.readBits(1);
  4049.             npc.desc = EntityDef.forID(stream.readBits(16));
  4050.             int k1 = stream.readBits(1);
  4051.             if (k1 == 1)
  4052.                 anIntArray894[anInt893++] = k;
  4053.             npc.anInt1540 = npc.desc.aByte68;
  4054.             npc.anInt1504 = npc.desc.anInt79;
  4055.             npc.anInt1554 = npc.desc.walkAnim;
  4056.             npc.anInt1555 = npc.desc.anInt58;
  4057.             npc.anInt1556 = npc.desc.anInt83;
  4058.             npc.anInt1557 = npc.desc.anInt55;
  4059.             npc.anInt1511 = npc.desc.standAnim;
  4060.             npc
  4061.                     .setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l,
  4062.                             j1 == 1);
  4063.         }
  4064.         stream.finishBitAccess();
  4065.     }
  4066.  
  4067.     public void processGameLoop() {
  4068.         if (rsAlreadyLoaded || loadingError || genericLoadingError)
  4069.             return;
  4070.         loopCycle++;
  4071.             if(!Texture_Sub1.INSTANCE.isTextureLoaded()){
  4072.             System.exit(1);
  4073.             return;
  4074.         }
  4075.         if (!loggedIn)
  4076.             processLoginScreenInput();
  4077.         else
  4078.             mainGameProcessor();
  4079.         processOnDemandQueue();
  4080.     }
  4081.  
  4082.     private void method47(boolean flag) {
  4083.         if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  4084.             destX = 0;
  4085.         int j = playerCount;
  4086.         if (flag)
  4087.             j = 1;
  4088.         for (int l = 0; l < j; l++) {
  4089.             Player player;
  4090.             int i1;
  4091.             if (flag) {
  4092.                 player = myPlayer;
  4093.                 i1 = myPlayerIndex << 14;
  4094.             } else {
  4095.                 player = playerArray[playerIndices[l]];
  4096.                 i1 = playerIndices[l] << 14;
  4097.             }
  4098.             if (player == null || !player.isVisible())
  4099.                 continue;
  4100.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200)
  4101.                     && !flag && player.anInt1517 == player.anInt1511;
  4102.             int j1 = player.x >> 7;
  4103.             int k1 = player.y >> 7;
  4104.             if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  4105.                 continue;
  4106.             if (player.aModel_1714 != null && loopCycle >= player.anInt1707
  4107.                     && loopCycle < player.anInt1708) {
  4108.                 player.aBoolean1699 = false;
  4109.                 player.anInt1709 = method42(plane, player.y, player.x);
  4110.                 worldController.method286(plane, player.y, player,
  4111.                         player.anInt1552, player.anInt1722, player.x,
  4112.                         player.anInt1709, player.anInt1719, player.anInt1721,
  4113.                         i1, player.anInt1720);
  4114.                 continue;
  4115.             }
  4116.             if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  4117.                 if (anIntArrayArray929[j1][k1] == anInt1265)
  4118.                     continue;
  4119.                 anIntArrayArray929[j1][k1] = anInt1265;
  4120.             }
  4121.             player.anInt1709 = method42(plane, player.y, player.x);
  4122.             worldController.method285(plane, player.anInt1552,
  4123.                     player.anInt1709, i1, player.y, 60, player.x, player,
  4124.                     player.aBoolean1541);
  4125.         }
  4126.  
  4127.     }
  4128.  
  4129.     private boolean promptUserForInput(RSInterface class9) {
  4130.         int j = class9.contentType;
  4131.         if (anInt900 == 2) {
  4132.             if (j == 201) {
  4133.                 inputTaken = true;
  4134.                 inputDialogState = 0;
  4135.                 messagePromptRaised = true;
  4136.                 promptInput = "";
  4137.                 friendsListAction = 1;
  4138.                 aString1121 = "Enter name of friend to add to list";
  4139.             }
  4140.             if (j == 202) {
  4141.                 inputTaken = true;
  4142.                 inputDialogState = 0;
  4143.                 messagePromptRaised = true;
  4144.                 promptInput = "";
  4145.                 friendsListAction = 2;
  4146.                 aString1121 = "Enter name of friend to delete from list";
  4147.             }
  4148.         }
  4149.         if (j == 205) {
  4150.             anInt1011 = 250;
  4151.             return true;
  4152.         }
  4153.         if (j == 501) {
  4154.             inputTaken = true;
  4155.             inputDialogState = 0;
  4156.             messagePromptRaised = true;
  4157.             promptInput = "";
  4158.             friendsListAction = 4;
  4159.             aString1121 = "Enter name of player to add to list";
  4160.         }
  4161.         if (j == 502) {
  4162.             inputTaken = true;
  4163.             inputDialogState = 0;
  4164.             messagePromptRaised = true;
  4165.             promptInput = "";
  4166.             friendsListAction = 5;
  4167.             aString1121 = "Enter name of player to delete from list";
  4168.         }
  4169.         if (j == 550) {
  4170.             inputTaken = true;
  4171.             inputDialogState = 0;
  4172.             messagePromptRaised = true;
  4173.             promptInput = "";
  4174.             aString1121 = "Enter the name of the chat you wish to join";
  4175.         }
  4176.         if (j >= 300 && j <= 313) {
  4177.             int k = (j - 300) / 2;
  4178.             int j1 = j & 1;
  4179.             int i2 = anIntArray1065[k];
  4180.             if (i2 != -1) {
  4181.                 do {
  4182.                     if (j1 == 0 && --i2 < 0)
  4183.                         i2 = IDK.length - 1;
  4184.                     if (j1 == 1 && ++i2 >= IDK.length)
  4185.                         i2 = 0;
  4186.                 } while (IDK.cache[i2].aBoolean662
  4187.                         || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  4188.                 anIntArray1065[k] = i2;
  4189.                 aBoolean1031 = true;
  4190.             }
  4191.         }
  4192.         if (j >= 314 && j <= 323) {
  4193.             int l = (j - 314) / 2;
  4194.             int k1 = j & 1;
  4195.             int j2 = anIntArray990[l];
  4196.             if (k1 == 0 && --j2 < 0)
  4197.                 j2 = anIntArrayArray1003[l].length - 1;
  4198.             if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  4199.                 j2 = 0;
  4200.             anIntArray990[l] = j2;
  4201.             aBoolean1031 = true;
  4202.         }
  4203.         if (j == 324 && !aBoolean1047) {
  4204.             aBoolean1047 = true;
  4205.             method45();
  4206.         }
  4207.         if (j == 325 && aBoolean1047) {
  4208.             aBoolean1047 = false;
  4209.             method45();
  4210.         }
  4211.         if (j == 326) {
  4212.             stream.createFrame(101);
  4213.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  4214.             for (int i1 = 0; i1 < 7; i1++)
  4215.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  4216.  
  4217.             for (int l1 = 0; l1 < 5; l1++)
  4218.                 stream.writeWordBigEndian(anIntArray990[l1]);
  4219.  
  4220.             return true;
  4221.         }
  4222.         if (j == 328) {
  4223.             RSInterface rsInterface = class9;
  4224.             int verticleTilt = 150;
  4225.             int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  4226.             rsInterface.modelRotation1 = verticleTilt;
  4227.             rsInterface.modelRotation2 = animationSpeed;
  4228.             if (aBoolean1031) {
  4229.                 Model characterDisplay = myPlayer.method452();
  4230.                 for (int l2 = 0; l2 < 5; l2++)
  4231.                     if (anIntArray990[l2] != 0) {
  4232.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  4233.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  4234.                         if (l2 == 1)
  4235.                             characterDisplay.method476(anIntArray1204[0],
  4236.                                     anIntArray1204[anIntArray990[l2]]);
  4237.                     }
  4238.                 int staticFrame = myPlayer.anInt1511;
  4239.                 characterDisplay.method469();
  4240.                 characterDisplay
  4241.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  4242.                 rsInterface.anInt233 = 5;
  4243.                 rsInterface.mediaID = 0;
  4244.                 RSInterface.method208(aBoolean994, characterDisplay);
  4245.             }
  4246.             return true;
  4247.         }
  4248.         if (j == 613)
  4249.             canMute = !canMute;
  4250.         if (j >= 601 && j <= 612) {
  4251.             clearTopInterfaces();
  4252.             if (reportAbuseInput.length() > 0) {
  4253.                 stream.createFrame(218);
  4254.                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  4255.                 stream.writeWordBigEndian(j - 601);
  4256.                 stream.writeWordBigEndian(canMute ? 1 : 0);
  4257.             }
  4258.         }
  4259.         return false;
  4260.     }
  4261.  
  4262.     private void method49(Stream stream) {
  4263.         try {for (int j = 0; j < anInt893; j++) {
  4264.             int k = anIntArray894[j];
  4265.             Player player = playerArray[k];
  4266.             int l = stream.readUnsignedByte();
  4267.             if ((l & 0x40) != 0)
  4268.                 l += stream.readUnsignedByte() << 8;
  4269.             method107(l, k, stream, player);
  4270.         }
  4271.         }
  4272.         catch (Exception e) {}
  4273.  
  4274.     }
  4275.  
  4276.     private void method50(int i, int k, int l, int i1, int j1) {
  4277.         int k1 = worldController.method300(j1, l, i);
  4278.         if (k1 != 0) {
  4279.             int l1 = worldController.method304(j1, l, i, k1);
  4280.             int k2 = l1 >> 6 & 3;
  4281.             int i3 = l1 & 0x1f;
  4282.             int k3 = k;
  4283.             if (k1 > 0)
  4284.                 k3 = i1;
  4285.             int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  4286.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  4287.             int i5 = k1 >> 14 & 0x7fff;
  4288.             ObjectDef class46_2 = ObjectDef.forID(i5);
  4289.             if (class46_2.anInt758 != -1) {
  4290.                 Background background_2 = mapScenes[class46_2.anInt758];
  4291.                 if (background_2 != null) {
  4292.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  4293.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  4294.                     background_2.method361(48 + l * 4 + i6, 48
  4295.                             + (104 - i - class46_2.anInt761) * 4 + j6);
  4296.                 }
  4297.             } else {
  4298.                 if (i3 == 0 || i3 == 2)
  4299.                     if (k2 == 0) {
  4300.                         ai[k4] = k3;
  4301.                         ai[k4 + 512] = k3;
  4302.                         ai[k4 + 1024] = k3;
  4303.                         ai[k4 + 1536] = k3;
  4304.                     } else if (k2 == 1) {
  4305.                         ai[k4] = k3;
  4306.                         ai[k4 + 1] = k3;
  4307.                         ai[k4 + 2] = k3;
  4308.                         ai[k4 + 3] = k3;
  4309.                     } else if (k2 == 2) {
  4310.                         ai[k4 + 3] = k3;
  4311.                         ai[k4 + 3 + 512] = k3;
  4312.                         ai[k4 + 3 + 1024] = k3;
  4313.                         ai[k4 + 3 + 1536] = k3;
  4314.                     } else if (k2 == 3) {
  4315.                         ai[k4 + 1536] = k3;
  4316.                         ai[k4 + 1536 + 1] = k3;
  4317.                         ai[k4 + 1536 + 2] = k3;
  4318.                         ai[k4 + 1536 + 3] = k3;
  4319.                     }
  4320.                 if (i3 == 3)
  4321.                     if (k2 == 0)
  4322.                         ai[k4] = k3;
  4323.                     else if (k2 == 1)
  4324.                         ai[k4 + 3] = k3;
  4325.                     else if (k2 == 2)
  4326.                         ai[k4 + 3 + 1536] = k3;
  4327.                     else if (k2 == 3)
  4328.                         ai[k4 + 1536] = k3;
  4329.                 if (i3 == 2)
  4330.                     if (k2 == 3) {
  4331.                         ai[k4] = k3;
  4332.                         ai[k4 + 512] = k3;
  4333.                         ai[k4 + 1024] = k3;
  4334.                         ai[k4 + 1536] = k3;
  4335.                     } else if (k2 == 0) {
  4336.                         ai[k4] = k3;
  4337.                         ai[k4 + 1] = k3;
  4338.                         ai[k4 + 2] = k3;
  4339.                         ai[k4 + 3] = k3;
  4340.                     } else if (k2 == 1) {
  4341.                         ai[k4 + 3] = k3;
  4342.                         ai[k4 + 3 + 512] = k3;
  4343.                         ai[k4 + 3 + 1024] = k3;
  4344.                         ai[k4 + 3 + 1536] = k3;
  4345.                     } else if (k2 == 2) {
  4346.                         ai[k4 + 1536] = k3;
  4347.                         ai[k4 + 1536 + 1] = k3;
  4348.                         ai[k4 + 1536 + 2] = k3;
  4349.                         ai[k4 + 1536 + 3] = k3;
  4350.                     }
  4351.             }
  4352.         }
  4353.         k1 = worldController.method302(j1, l, i);
  4354.         if (k1 != 0) {
  4355.             int i2 = worldController.method304(j1, l, i, k1);
  4356.             int l2 = i2 >> 6 & 3;
  4357.             int j3 = i2 & 0x1f;
  4358.             int l3 = k1 >> 14 & 0x7fff;
  4359.             ObjectDef class46_1 = ObjectDef.forID(l3);
  4360.             if (class46_1.anInt758 != -1) {
  4361.                 Background background_1 = mapScenes[class46_1.anInt758];
  4362.                 if (background_1 != null) {
  4363.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  4364.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  4365.                     background_1.method361(48 + l * 4 + j5, 48
  4366.                             + (104 - i - class46_1.anInt761) * 4 + k5);
  4367.                 }
  4368.             } else if (j3 == 9) {
  4369.                 int l4 = 0xeeeeee;
  4370.                 if (k1 > 0)
  4371.                     l4 = 0xee0000;
  4372.                 int ai1[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  4373.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  4374.                 if (l2 == 0 || l2 == 2) {
  4375.                     ai1[l5 + 1536] = l4;
  4376.                     ai1[l5 + 1024 + 1] = l4;
  4377.                     ai1[l5 + 512 + 2] = l4;
  4378.                     ai1[l5 + 3] = l4;
  4379.                 } else {
  4380.                     ai1[l5] = l4;
  4381.                     ai1[l5 + 512 + 1] = l4;
  4382.                     ai1[l5 + 1024 + 2] = l4;
  4383.                     ai1[l5 + 1536 + 3] = l4;
  4384.                 }
  4385.             }
  4386.         }
  4387.         k1 = worldController.method303(j1, l, i);
  4388.         if (k1 != 0) {
  4389.             int j2 = k1 >> 14 & 0x7fff;
  4390.             ObjectDef class46 = ObjectDef.forID(j2);
  4391.             if (class46.anInt758 != -1) {
  4392.                 Background background = mapScenes[class46.anInt758];
  4393.                 if (background != null) {
  4394.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  4395.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  4396.                     background.method361(48 + l * 4 + i4, 48
  4397.                             + (104 - i - class46.anInt761) * 4 + j4);
  4398.                 }
  4399.             }
  4400.         }
  4401.     }
  4402.  
  4403.     private void loadTitleScreen() {
  4404.         aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  4405.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  4406.         aBackgroundArray1152s = new Background[12];
  4407.         int j = 0;
  4408.         try {
  4409.             j = Integer.parseInt(getParameter("fl_icon"));
  4410.         } catch (Exception _ex) {
  4411.         }
  4412.         if (j == 0) {
  4413.             for (int k = 0; k < 12; k++)
  4414.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader,
  4415.                         "runes", k);
  4416.  
  4417.         } else {
  4418.             for (int l = 0; l < 12; l++)
  4419.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader,
  4420.                         "runes", 12 + (l & 3));
  4421.  
  4422.         }
  4423.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  4424.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  4425.         System.arraycopy(aRSImageProducer_1110.anIntArray315, 0,
  4426.                 aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  4427.  
  4428.         System.arraycopy(aRSImageProducer_1111.anIntArray315, 0,
  4429.                 aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  4430.  
  4431.         anIntArray851 = new int[256];
  4432.         for (int k1 = 0; k1 < 64; k1++)
  4433.             anIntArray851[k1] = k1 * 0x40000;
  4434.  
  4435.         for (int l1 = 0; l1 < 64; l1++)
  4436.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  4437.  
  4438.         for (int i2 = 0; i2 < 64; i2++)
  4439.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  4440.  
  4441.         for (int j2 = 0; j2 < 64; j2++)
  4442.             anIntArray851[j2 + 192] = 0xffffff;
  4443.  
  4444.         anIntArray852 = new int[256];
  4445.         for (int k2 = 0; k2 < 64; k2++)
  4446.             anIntArray852[k2] = k2 * 1024;
  4447.  
  4448.         for (int l2 = 0; l2 < 64; l2++)
  4449.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  4450.  
  4451.         for (int i3 = 0; i3 < 64; i3++)
  4452.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  4453.  
  4454.         for (int j3 = 0; j3 < 64; j3++)
  4455.             anIntArray852[j3 + 192] = 0xffffff;
  4456.  
  4457.         anIntArray853 = new int[256];
  4458.         for (int k3 = 0; k3 < 64; k3++)
  4459.             anIntArray853[k3] = k3 * 4;
  4460.  
  4461.         for (int l3 = 0; l3 < 64; l3++)
  4462.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  4463.  
  4464.         for (int i4 = 0; i4 < 64; i4++)
  4465.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  4466.  
  4467.         for (int j4 = 0; j4 < 64; j4++)
  4468.             anIntArray853[j4 + 192] = 0xffffff;
  4469.  
  4470.         anIntArray850 = new int[256];
  4471.         anIntArray1190 = new int[32768];
  4472.         anIntArray1191 = new int[32768];
  4473.         randomizeBackground(null);
  4474.         anIntArray828 = new int[32768];
  4475.         anIntArray829 = new int[32768];
  4476.         drawLoadingText(10, "Connecting to fileserver");
  4477.         if (!aBoolean831) {
  4478.             drawFlames = true;
  4479.             aBoolean831 = true;
  4480.             startRunnable(this, 2);
  4481.         }
  4482.     }
  4483.  
  4484.         public static void main(String args[]) {
  4485.         try {
  4486.             nodeID = 10;
  4487.             portOff = 0;
  4488.             setHighMem(); //sets high or low detail
  4489.             isMembers = true;
  4490.             signlink.storeid = 32;
  4491.             signlink.startpriv(InetAddress.getLocalHost());
  4492.             instance = new client();
  4493.             instance.createClientFrame(503, 765);//client frame size
  4494.         } catch(Exception e) {
  4495.             e.printStackTrace();
  4496.         }
  4497.     }
  4498.    
  4499.    
  4500.     private static void setHighMem() {
  4501.         /*WorldController.lowMem = false;
  4502.         Texture.lowMem = false;
  4503.         lowMem = false;
  4504.         ObjectManager.lowMem = false;
  4505.         ObjectDef.lowMem = false;*/
  4506.         WorldController.lowMem = true;
  4507.         Texture.lowMem = true;
  4508.         lowMem = false;
  4509.         ObjectManager.lowMem = false;
  4510.         ObjectDef.lowMem = true;
  4511.         System.out.println("Running in highmem");
  4512.     }
  4513.  
  4514.     private void loadingStages() {
  4515.         if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  4516.             aRSImageProducer_1165.initDrawingArea();
  4517.             aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151,
  4518.                     257);
  4519.             aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.",
  4520.                     150, 256);
  4521.             aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  4522.             loadingStage = 1;
  4523.             aLong824 = System.currentTimeMillis();
  4524.         }
  4525.         if (loadingStage == 1) {
  4526.             int j = method54();
  4527.             if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  4528.                 signlink.reporterror(myUsername + " glcfb " + aLong1215 + ","
  4529.                         + j + "," + lowMem + "," + decompressors[0] + ","
  4530.                         + onDemandFetcher.getNodeCount() + "," + plane + ","
  4531.                         + anInt1069 + "," + anInt1070);
  4532.                 aLong824 = System.currentTimeMillis();
  4533.             }
  4534.         }
  4535.         if (loadingStage == 2 && plane != anInt985) {
  4536.             anInt985 = plane;
  4537.             method24(plane);
  4538.         }
  4539.     }
  4540.  
  4541.     private int method54() {
  4542.         for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4543.             if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1)
  4544.                 return -1;
  4545.             if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
  4546.                 return -2;
  4547.         }
  4548.  
  4549.         boolean flag = true;
  4550.         for (int j = 0; j < aByteArrayArray1183.length; j++) {
  4551.             byte abyte0[] = aByteArrayArray1247[j];
  4552.             if (abyte0 != null) {
  4553.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  4554.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  4555.                 if (aBoolean1159) {
  4556.                     k = 10;
  4557.                     l = 10;
  4558.                 }
  4559.                 flag &= ObjectManager.method189(k, abyte0, l);
  4560.             }
  4561.         }
  4562.  
  4563.         if (!flag)
  4564.             return -3;
  4565.         if (aBoolean1080) {
  4566.             return -4;
  4567.         } else {
  4568.             loadingStage = 2;
  4569.             ObjectManager.anInt131 = plane;
  4570.             method22(true);
  4571.             stream.createFrame(121);
  4572.             return 0;
  4573.         }
  4574.     }
  4575.  
  4576.     private void method55() {
  4577.         for (Animable_Sub4 class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  4578.                 .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  4579.                 .reverseGetNext())
  4580.             if (class30_sub2_sub4_sub4.anInt1597 != plane
  4581.                     || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  4582.                 class30_sub2_sub4_sub4.unlink();
  4583.             else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  4584.                 if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  4585.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  4586.                     if (npc != null && npc.x >= 0 && npc.x < 13312
  4587.                             && npc.y >= 0 && npc.y < 13312)
  4588.                         class30_sub2_sub4_sub4.method455(loopCycle, npc.y,
  4589.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  4590.                                         npc.y, npc.x)
  4591.                                         - class30_sub2_sub4_sub4.anInt1583,
  4592.                                 npc.x);
  4593.                 }
  4594.                 if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  4595.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  4596.                     Player player;
  4597.                     if (j == unknownInt10)
  4598.                         player = myPlayer;
  4599.                     else
  4600.                         player = playerArray[j];
  4601.                     if (player != null && player.x >= 0 && player.x < 13312
  4602.                             && player.y >= 0 && player.y < 13312)
  4603.                         class30_sub2_sub4_sub4.method455(loopCycle, player.y,
  4604.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  4605.                                         player.y, player.x)
  4606.                                         - class30_sub2_sub4_sub4.anInt1583,
  4607.                                 player.x);
  4608.                 }
  4609.                 class30_sub2_sub4_sub4.method456(anInt945);
  4610.                 worldController.method285(plane,
  4611.                         class30_sub2_sub4_sub4.anInt1595,
  4612.                         (int) class30_sub2_sub4_sub4.aDouble1587, -1,
  4613.                         (int) class30_sub2_sub4_sub4.aDouble1586, 60,
  4614.                         (int) class30_sub2_sub4_sub4.aDouble1585,
  4615.                         class30_sub2_sub4_sub4, false);
  4616.             }
  4617.  
  4618.     }
  4619.  
  4620.     public AppletContext getAppletContext() {
  4621.         if (signlink.mainapp != null)
  4622.             return signlink.mainapp.getAppletContext();
  4623.         else
  4624.             return super.getAppletContext();
  4625.     }
  4626.  
  4627.     private void drawLogo() {
  4628.         byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  4629.         Sprite sprite = new Sprite(abyte0, this);
  4630.         aRSImageProducer_1110.initDrawingArea();
  4631.         sprite.method346(0, 0);
  4632.         aRSImageProducer_1111.initDrawingArea();
  4633.         sprite.method346(-637, 0);
  4634.         aRSImageProducer_1107.initDrawingArea();
  4635.         sprite.method346(-128, 0);
  4636.         aRSImageProducer_1108.initDrawingArea();
  4637.         sprite.method346(-202, -371);
  4638.         aRSImageProducer_1109.initDrawingArea();
  4639.         sprite.method346(-202, -171);
  4640.         aRSImageProducer_1112.initDrawingArea();
  4641.         sprite.method346(0, -265);
  4642.         aRSImageProducer_1113.initDrawingArea();
  4643.         sprite.method346(-562, -265);
  4644.         aRSImageProducer_1114.initDrawingArea();
  4645.         sprite.method346(-128, -171);
  4646.         aRSImageProducer_1115.initDrawingArea();
  4647.         sprite.method346(-562, -171);
  4648.         int ai[] = new int[sprite.myWidth];
  4649.         for (int j = 0; j < sprite.myHeight; j++) {
  4650.             for (int k = 0; k < sprite.myWidth; k++)
  4651.                 ai[k] = sprite.myPixels[(sprite.myWidth - k - 1)
  4652.                         + sprite.myWidth * j];
  4653.  
  4654.             System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j,
  4655.                     sprite.myWidth);
  4656.         }
  4657.  
  4658.         sprite = null;
  4659.         Object obj = null;
  4660.         Object obj1 = null;
  4661.         System.gc();
  4662.     }
  4663.  
  4664.     private void processOnDemandQueue() {
  4665.         do {
  4666.             OnDemandData onDemandData;
  4667.             do {
  4668.                 onDemandData = onDemandFetcher.getNextNode();
  4669.                 if (onDemandData == null)
  4670.                     return;
  4671.                 if (onDemandData.dataType == 0) {
  4672.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  4673.                     // if((onDemandFetcher.getModelIndex(onDemandData.ID) &
  4674.                     // 0x62) != 0)
  4675.                     // {
  4676.                     needDrawTabArea = true;
  4677.                     if (backDialogID != -1)
  4678.                         inputTaken = true;
  4679.                     // }
  4680.                 }
  4681.                 if (onDemandData.dataType == 1 && onDemandData.buffer != null)
  4682.                     Class36.readCacheFile(onDemandData.buffer, onDemandData.ID);
  4683.                 if (onDemandData.dataType == 2 && onDemandData.ID == nextSong
  4684.                         && onDemandData.buffer != null)
  4685.                     saveMidi(songChanging, onDemandData.buffer);
  4686.                 if (onDemandData.dataType == 3 && loadingStage == 1) {
  4687.                     for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4688.                         if (anIntArray1235[i] == onDemandData.ID) {
  4689.                             aByteArrayArray1183[i] = onDemandData.buffer;
  4690.                             if (onDemandData.buffer == null)
  4691.                                 anIntArray1235[i] = -1;
  4692.                             break;
  4693.                         }
  4694.                         if (anIntArray1236[i] != onDemandData.ID)
  4695.                             continue;
  4696.                         aByteArrayArray1247[i] = onDemandData.buffer;
  4697.                         if (onDemandData.buffer == null)
  4698.                             anIntArray1236[i] = -1;
  4699.                         break;
  4700.                     }
  4701.  
  4702.                 }
  4703.                 // if(onDemandData.dataType == 1 && onDemandData.buffer != null)
  4704.                 // Class36.method529(onDemandData.buffer);
  4705.             } while (onDemandData.dataType != 93
  4706.                     || !onDemandFetcher.method564(onDemandData.ID));
  4707.             ObjectManager.method173(new Stream(onDemandData.buffer),
  4708.                     onDemandFetcher);
  4709.         } while (true);
  4710.     }
  4711.  
  4712.     private void calcFlamesPosition() {
  4713.         char c = '\u0100';
  4714.         for (int j = 10; j < 117; j++) {
  4715.             int k = (int) (Math.random() * 100D);
  4716.             if (k < 50)
  4717.                 anIntArray828[j + (c - 2 << 7)] = 255;
  4718.         }
  4719.         for (int l = 0; l < 100; l++) {
  4720.             int i1 = (int) (Math.random() * 124D) + 2;
  4721.             int k1 = (int) (Math.random() * 128D) + 128;
  4722.             int k2 = i1 + (k1 << 7);
  4723.             anIntArray828[k2] = 192;
  4724.         }
  4725.  
  4726.         for (int j1 = 1; j1 < c - 1; j1++) {
  4727.             for (int l1 = 1; l1 < 127; l1++) {
  4728.                 int l2 = l1 + (j1 << 7);
  4729.                 anIntArray829[l2] = (anIntArray828[l2 - 1]
  4730.                         + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  4731.             }
  4732.  
  4733.         }
  4734.  
  4735.         anInt1275 += 128;
  4736.         if (anInt1275 > anIntArray1190.length) {
  4737.             anInt1275 -= anIntArray1190.length;
  4738.             int i2 = (int) (Math.random() * 12D);
  4739.             randomizeBackground(aBackgroundArray1152s[i2]);
  4740.         }
  4741.         for (int j2 = 1; j2 < c - 1; j2++) {
  4742.             for (int i3 = 1; i3 < 127; i3++) {
  4743.                 int k3 = i3 + (j2 << 7);
  4744.                 int i4 = anIntArray829[k3 + 128]
  4745.                         - anIntArray1190[k3 + anInt1275 & anIntArray1190.length
  4746.                                 - 1] / 5;
  4747.                 if (i4 < 0)
  4748.                     i4 = 0;
  4749.                 anIntArray828[k3] = i4;
  4750.             }
  4751.  
  4752.         }
  4753.  
  4754.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  4755.  
  4756.         anIntArray969[c - 1] = (int) (Math.sin((double) loopCycle / 14D) * 16D
  4757.                 + Math.sin((double) loopCycle / 15D) * 14D + Math
  4758.                 .sin((double) loopCycle / 16D) * 12D);
  4759.         if (anInt1040 > 0)
  4760.             anInt1040 -= 4;
  4761.         if (anInt1041 > 0)
  4762.             anInt1041 -= 4;
  4763.         if (anInt1040 == 0 && anInt1041 == 0) {
  4764.             int l3 = (int) (Math.random() * 2000D);
  4765.             if (l3 == 0)
  4766.                 anInt1040 = 1024;
  4767.             if (l3 == 1)
  4768.                 anInt1041 = 1024;
  4769.         }
  4770.     }
  4771.  
  4772.     private boolean saveWave(byte abyte0[], int i) {
  4773.         return abyte0 == null || signlink.wavesave(abyte0, i);
  4774.     }
  4775.  
  4776.     private void method60(int i) {
  4777.         RSInterface class9 = RSInterface.interfaceCache[i];
  4778.         for (int j = 0; j < class9.children.length; j++) {
  4779.             if (class9.children[j] == -1)
  4780.                 break;
  4781.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  4782.             if (class9_1.type == 1)
  4783.                 method60(class9_1.id);
  4784.             class9_1.anInt246 = 0;
  4785.             class9_1.anInt208 = 0;
  4786.         }
  4787.     }
  4788.  
  4789.     private void drawHeadIcon() {
  4790.         if (anInt855 != 2)
  4791.             return;
  4792.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2,
  4793.                 (anInt935 - baseY << 7) + anInt938);
  4794.         if (spriteDrawX > -1 && loopCycle % 20 < 10)
  4795.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  4796.     }
  4797.  
  4798.     public boolean withinDistance(int x1, int y1, int x2, int y2, int dis) {
  4799.         for (int i = 0; i <= dis; i++) {
  4800.             if ((x1 + i) == x2
  4801.                     && ((y1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  4802.                 return true;
  4803.             else if ((x1 - i) == x2
  4804.                     && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  4805.                 return true;
  4806.             else if (x1 == x2 && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  4807.                 return true;
  4808.         }
  4809.         return false;
  4810.     }
  4811.  
  4812.     public int getDis(int coordX1, int coordY1, int coordX2, int coordY2) {
  4813.         int deltaX = coordX2 - coordX1;
  4814.         int deltaY = coordY2 - coordY1;
  4815.         return ((int) Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)));
  4816.     }
  4817.  
  4818.     public int random(int range) {
  4819.         return (int) (Math.random() * range);
  4820.     }
  4821.  
  4822.     public int canWalkDelay = 0;
  4823.  
  4824.     private void mainGameProcessor() {
  4825.         if (anInt1104 > 1)
  4826.             anInt1104--;
  4827.         if (anInt1011 > 0)
  4828.             anInt1011--;
  4829.         for (int j = 0; j < 5; j++)
  4830.             if (!parsePacket())
  4831.                 break;
  4832.  
  4833.         if (!loggedIn)
  4834.             return;
  4835.         /*
  4836.          * canWalkDelay--; if (followNPC > 0) { NPC n = npcArray[followNPC]; if
  4837.          * (n != null) { if (!withinDistance(myPlayer.smallX[0],
  4838.          * myPlayer.smallY[0], n.smallX[0], n.smallY[0], followDistance)) {
  4839.          * doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, n.smallY[0],
  4840.          * myPlayer.smallX[0], false, n.smallX[0],true); } } } else if
  4841.          * (followPlayer > 0 && canWalkDelay <= 0) { Player p =
  4842.          * playerArray[followPlayer]; if (p != null) { int dis =
  4843.          * getDis(myPlayer.smallX[0], myPlayer.smallY[0], p.smallX[0],
  4844.          * p.smallY[0]); if (dis > followDistance) { doWalkTo2(2, 0, 1, 0,
  4845.          * myPlayer.smallY[0], followDistance, 0, p.smallY[0],
  4846.          * myPlayer.smallX[0], false, p.smallX[0],true); canWalkDelay = 30; }
  4847.          * else if (dis == 0) { int rnd = random(4); if (rnd == 0) {
  4848.          * doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0],
  4849.          * myPlayer.smallX[0], false, p.smallX[0] - 2,true); } else if (rnd ==
  4850.          * 1) { doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0],
  4851.          * myPlayer.smallX[0], false, p.smallX[0] + 2,true); } else if (rnd ==
  4852.          * 2) { doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0] - 2,
  4853.          * myPlayer.smallX[0], false, p.smallX[0],true); } else if (rnd == 3) {
  4854.          * doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0] + 2,
  4855.          * myPlayer.smallX[0], false, p.smallX[0],true); } canWalkDelay = 60; }
  4856.          * } }
  4857.          */
  4858.         synchronized (mouseDetection.syncObject) {
  4859.             if (flagged) {
  4860.                 if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
  4861.                     stream.createFrame(45);
  4862.                     stream.writeWordBigEndian(0);
  4863.                     int j2 = stream.currentOffset;
  4864.                     int j3 = 0;
  4865.                     for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
  4866.                         if (j2 - stream.currentOffset >= 240)
  4867.                             break;
  4868.                         j3++;
  4869.                         int l4 = mouseDetection.coordsY[j4];
  4870.                         if (l4 < 0)
  4871.                             l4 = 0;
  4872.                         else if (l4 > 502)
  4873.                             l4 = 502;
  4874.                         int k5 = mouseDetection.coordsX[j4];
  4875.                         if (k5 < 0)
  4876.                             k5 = 0;
  4877.                         else if (k5 > 764)
  4878.                             k5 = 764;
  4879.                         int i6 = l4 * 765 + k5;
  4880.                         if (mouseDetection.coordsY[j4] == -1
  4881.                                 && mouseDetection.coordsX[j4] == -1) {
  4882.                             k5 = -1;
  4883.                             l4 = -1;
  4884.                             i6 = 0x7ffff;
  4885.                         }
  4886.                         if (k5 == anInt1237 && l4 == anInt1238) {
  4887.                             if (anInt1022 < 2047)
  4888.                                 anInt1022++;
  4889.                         } else {
  4890.                             int j6 = k5 - anInt1237;
  4891.                             anInt1237 = k5;
  4892.                             int k6 = l4 - anInt1238;
  4893.                             anInt1238 = l4;
  4894.                             if (anInt1022 < 8 && j6 >= -32 && j6 <= 31
  4895.                                     && k6 >= -32 && k6 <= 31) {
  4896.                                 j6 += 32;
  4897.                                 k6 += 32;
  4898.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6)
  4899.                                         + k6);
  4900.                                 anInt1022 = 0;
  4901.                             } else if (anInt1022 < 8) {
  4902.                                 stream.writeDWordBigEndian(0x800000
  4903.                                         + (anInt1022 << 19) + i6);
  4904.                                 anInt1022 = 0;
  4905.                             } else {
  4906.                                 stream.writeDWord(0xc0000000
  4907.                                         + (anInt1022 << 19) + i6);
  4908.                                 anInt1022 = 0;
  4909.                             }
  4910.                         }
  4911.                     }
  4912.  
  4913.                     stream.writeBytes(stream.currentOffset - j2);
  4914.                     if (j3 >= mouseDetection.coordsIndex) {
  4915.                         mouseDetection.coordsIndex = 0;
  4916.                     } else {
  4917.                         mouseDetection.coordsIndex -= j3;
  4918.                         for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
  4919.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5
  4920.                                     + j3];
  4921.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5
  4922.                                     + j3];
  4923.                         }
  4924.  
  4925.                     }
  4926.                 }
  4927.             } else {
  4928.                 mouseDetection.coordsIndex = 0;
  4929.             }
  4930.         }
  4931.         if (super.clickMode3 != 0) {
  4932.             long l = (super.aLong29 - aLong1220) / 50L;
  4933.             if (l > 4095L)
  4934.                 l = 4095L;
  4935.             aLong1220 = super.aLong29;
  4936.             int k2 = super.saveClickY;
  4937.             if (k2 < 0)
  4938.                 k2 = 0;
  4939.             else if (k2 > 502)
  4940.                 k2 = 502;
  4941.             int k3 = super.saveClickX;
  4942.             if (k3 < 0)
  4943.                 k3 = 0;
  4944.             else if (k3 > 764)
  4945.                 k3 = 764;
  4946.             int k4 = k2 * 765 + k3;
  4947.             int j5 = 0;
  4948.             if (super.clickMode3 == 2)
  4949.                 j5 = 1;
  4950.             int l5 = (int) l;
  4951.             stream.createFrame(241);
  4952.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  4953.         }
  4954.         if (anInt1016 > 0)
  4955.             anInt1016--;
  4956.         if (super.keyArray[1] == 1 || super.keyArray[2] == 1
  4957.                 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  4958.             aBoolean1017 = true;
  4959.         if (aBoolean1017 && anInt1016 <= 0) {
  4960.             anInt1016 = 20;
  4961.             aBoolean1017 = false;
  4962.             stream.createFrame(86);
  4963.             stream.writeWord(anInt1184);
  4964.             stream.method432(minimapInt1);
  4965.         }
  4966.         if (super.awtFocus && !aBoolean954) {
  4967.             aBoolean954 = true;
  4968.             stream.createFrame(3);
  4969.             stream.writeWordBigEndian(1);
  4970.         }
  4971.         if (!super.awtFocus && aBoolean954) {
  4972.             aBoolean954 = false;
  4973.             stream.createFrame(3);
  4974.             stream.writeWordBigEndian(0);
  4975.         }
  4976.         loadingStages();
  4977.         method115();
  4978.         method90(false);
  4979.         anInt1009++;
  4980.         if (anInt1009 > 750)
  4981.             dropClient();
  4982.         method114();
  4983.         method95();
  4984.         method38();
  4985.         anInt945++;
  4986.         if (crossType != 0) {
  4987.             crossIndex += 20;
  4988.             if (crossIndex >= 400)
  4989.                 crossType = 0;
  4990.         }
  4991.         if (atInventoryInterfaceType != 0) {
  4992.             do {
  4993.                 atInventoryLoopCycle++;
  4994.                 // if(atInventoryLoopCycle >= 15)
  4995.                 // {
  4996.                 if (atInventoryInterfaceType == 2)
  4997.                     needDrawTabArea = true;
  4998.                 if (atInventoryInterfaceType == 3)
  4999.                     inputTaken = true;
  5000.                 atInventoryInterfaceType = 0;
  5001.                 // }
  5002.             } while (atInventoryLoopCycle >= 15);
  5003.         }
  5004.         if (activeInterfaceType != 0) {
  5005.             anInt989++;
  5006.             if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5
  5007.                     || super.mouseY > anInt1088 + 5
  5008.                     || super.mouseY < anInt1088 - 5)
  5009.                 aBoolean1242 = true;
  5010.             if (super.clickMode2 == 0) {
  5011.            
  5012.                 if (activeInterfaceType == 2)
  5013.                     needDrawTabArea = true;
  5014.                 if (activeInterfaceType == 3)
  5015.                     inputTaken = true;
  5016.                 activeInterfaceType = 0;
  5017.                 if (aBoolean1242 && anInt989 >= 10) {
  5018.                     lastActiveInvInterface = -1;
  5019.                     processRightClick();
  5020.                     if (lastActiveInvInterface == anInt1084
  5021.                             && mouseInvInterfaceIndex != anInt1085) {
  5022.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  5023.                         int j1 = 0;
  5024.                         if (anInt913 == 1 && class9.contentType == 206)
  5025.                             j1 = 1;
  5026.                         if (class9.inv[mouseInvInterfaceIndex] <= 0)
  5027.                             j1 = 0;
  5028.                         if (class9.aBoolean235) {
  5029.                             int l2 = anInt1085;
  5030.                             int l3 = mouseInvInterfaceIndex;
  5031.                             class9.inv[l3] = class9.inv[l2];
  5032.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  5033.                             class9.inv[l2] = -1;
  5034.                             class9.invStackSizes[l2] = 0;
  5035.                         } else if (j1 == 1) {
  5036.                             int i3 = anInt1085;
  5037.                             for (int i4 = mouseInvInterfaceIndex; i3 != i4;)
  5038.                                 if (i3 > i4) {
  5039.                                     class9.swapInventoryItems(i3, i3 - 1);
  5040.                                     i3--;
  5041.                                 //  System.out.println("test: " + anInt989);
  5042.                                 } else if (i3 < i4) {
  5043.                                     class9.swapInventoryItems(i3, i3 + 1);
  5044.                                     //System.out.println("test: " + i3);
  5045.                                     i3++;
  5046.                                 }
  5047.  
  5048.                         } else {
  5049.                             class9.swapInventoryItems(anInt1085,
  5050.                                     mouseInvInterfaceIndex);
  5051.                                
  5052.                                 //  System.out.println("test: " + anInt989);
  5053.                         }
  5054.                     //invSelected = true;
  5055.                     //  System.out.println("test: " + anInt989);
  5056.                         stream.createFrame(214);
  5057.                         stream.method433(anInt1084);
  5058.                         stream.method424(j1);
  5059.                         stream.method433(anInt1085);
  5060.                         stream.method431(mouseInvInterfaceIndex);
  5061.                     }
  5062.                 } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
  5063.                         && menuActionRow > 2)
  5064.                     determineMenuSize();
  5065.                 else if (menuActionRow > 0)
  5066.                     doAction(menuActionRow - 1);
  5067.                 atInventoryLoopCycle = 10;
  5068.                 super.clickMode3 = 0;
  5069.             }
  5070.         }
  5071.         if (WorldController.anInt470 != -1) {
  5072.             int k = WorldController.anInt470;
  5073.             int k1 = WorldController.anInt471;
  5074.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1,
  5075.                     myPlayer.smallX[0], true, k);
  5076.             WorldController.anInt470 = -1;
  5077.             if (flag) {
  5078.                 crossX = super.saveClickX;
  5079.                 crossY = super.saveClickY;
  5080.                 crossType = 1;
  5081.                 crossIndex = 0;
  5082.             }
  5083.         }
  5084.         if (super.clickMode3 == 1 && aString844 != null) {
  5085.             aString844 = null;
  5086.             inputTaken = true;
  5087.             super.clickMode3 = 0;
  5088.         }
  5089.         processMenuClick();
  5090.         processMainScreenClick();
  5091.         processTabClick();
  5092.         processMapAreaClick();
  5093.         processChatModeClick();
  5094.         if (super.clickMode2 == 1 || super.clickMode3 == 1)
  5095.             anInt1213++;
  5096.         if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  5097.             if (anInt1501 < 100) {
  5098.                 anInt1501++;
  5099.                 if (anInt1501 == 100) {
  5100.                     if (anInt1500 != 0) {
  5101.                         inputTaken = true;
  5102.                     }
  5103.                     if (anInt1044 != 0) {
  5104.                         needDrawTabArea = true;
  5105.                     }
  5106.                 }
  5107.             }
  5108.         } else if (anInt1501 > 0) {
  5109.             anInt1501--;
  5110.         }
  5111.         if (loadingStage == 2)
  5112.             method108();
  5113.         if (loadingStage == 2 && aBoolean1160)
  5114.             calcCameraPos();
  5115.         for (int i1 = 0; i1 < 5; i1++)
  5116.             anIntArray1030[i1]++;
  5117.  
  5118.         method73();
  5119.         super.idleTime++;
  5120.         if (super.idleTime > 15000) {
  5121.             anInt1011 = 250;
  5122.             super.idleTime -= 500;
  5123.             stream.createFrame(202);
  5124.         }
  5125.         anInt988++;
  5126.         if (anInt988 > 500) {
  5127.             anInt988 = 0;
  5128.             int l1 = (int) (Math.random() * 8D);
  5129.             if ((l1 & 1) == 1)
  5130.                 anInt1278 += anInt1279;
  5131.             if ((l1 & 2) == 2)
  5132.                 anInt1131 += anInt1132;
  5133.             if ((l1 & 4) == 4)
  5134.                 anInt896 += anInt897;
  5135.         }
  5136.         if (anInt1278 < -50)
  5137.             anInt1279 = 2;
  5138.         if (anInt1278 > 50)
  5139.             anInt1279 = -2;
  5140.         if (anInt1131 < -55)
  5141.             anInt1132 = 2;
  5142.         if (anInt1131 > 55)
  5143.             anInt1132 = -2;
  5144.         if (anInt896 < -40)
  5145.             anInt897 = 1;
  5146.         if (anInt896 > 40)
  5147.             anInt897 = -1;
  5148.         anInt1254++;
  5149.         if (anInt1254 > 500) {
  5150.             anInt1254 = 0;
  5151.             int i2 = (int) (Math.random() * 8D);
  5152.             if ((i2 & 1) == 1)
  5153.                 minimapInt2 += anInt1210;
  5154.             if ((i2 & 2) == 2)
  5155.                 minimapInt3 += anInt1171;
  5156.         }
  5157.         if (minimapInt2 < -60)
  5158.             anInt1210 = 2;
  5159.         if (minimapInt2 > 60)
  5160.             anInt1210 = -2;
  5161.         if (minimapInt3 < -20)
  5162.             anInt1171 = 1;
  5163.         if (minimapInt3 > 10)
  5164.             anInt1171 = -1;
  5165.         anInt1010++;
  5166.         if (anInt1010 > 50)
  5167.             stream.createFrame(0);
  5168.         try {
  5169.             if (socketStream != null && stream.currentOffset > 0) {
  5170.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  5171.                 stream.currentOffset = 0;
  5172.                 anInt1010 = 0;
  5173.             }
  5174.         } catch (IOException _ex) {
  5175.             dropClient();
  5176.         } catch (Exception exception) {
  5177.             resetLogout();
  5178.         }
  5179.     }
  5180.  
  5181.     private void method63() {
  5182.         Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  5183.                 .reverseGetFirst();
  5184.         for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  5185.                 .reverseGetNext())
  5186.             if (class30_sub1.anInt1294 == -1) {
  5187.                 class30_sub1.anInt1302 = 0;
  5188.                 method89(class30_sub1);
  5189.             } else {
  5190.                 class30_sub1.unlink();
  5191.             }
  5192.  
  5193.     }
  5194.  
  5195.     private void resetImageProducers() {
  5196.         if (aRSImageProducer_1107 != null)
  5197.             return;
  5198.         super.fullGameScreen = null;
  5199.         aRSImageProducer_1166 = null;
  5200.         aRSImageProducer_1164 = null;
  5201.         aRSImageProducer_1163 = null;
  5202.         aRSImageProducer_1165 = null;
  5203.         aRSImageProducer_1123 = null;
  5204.         aRSImageProducer_1124 = null;
  5205.         aRSImageProducer_1125 = null;
  5206.         aRSImageProducer_1110 = new RSImageProducer(128, 265,
  5207.                 getGameComponent());
  5208.         DrawingArea.setAllPixelsToZero();
  5209.         aRSImageProducer_1111 = new RSImageProducer(128, 265,
  5210.                 getGameComponent());
  5211.         DrawingArea.setAllPixelsToZero();
  5212.         aRSImageProducer_1107 = new RSImageProducer(509, 171,
  5213.                 getGameComponent());
  5214.         DrawingArea.setAllPixelsToZero();
  5215.         aRSImageProducer_1108 = new RSImageProducer(360, 132,
  5216.                 getGameComponent());
  5217.         DrawingArea.setAllPixelsToZero();
  5218.         aRSImageProducer_1109 = new RSImageProducer(360, 200,
  5219.                 getGameComponent());
  5220.         DrawingArea.setAllPixelsToZero();
  5221.         aRSImageProducer_1112 = new RSImageProducer(202, 238,
  5222.                 getGameComponent());
  5223.         DrawingArea.setAllPixelsToZero();
  5224.         aRSImageProducer_1113 = new RSImageProducer(203, 238,
  5225.                 getGameComponent());
  5226.         DrawingArea.setAllPixelsToZero();
  5227.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  5228.         DrawingArea.setAllPixelsToZero();
  5229.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  5230.         DrawingArea.setAllPixelsToZero();
  5231.         if (titleStreamLoader != null) {
  5232.             drawLogo();
  5233.             loadTitleScreen();
  5234.         }
  5235.         welcomeScreenRaised = true;
  5236.     }
  5237.  
  5238.     void drawLoadingText(int i, String s) {
  5239.         anInt1079 = i;
  5240.         aString1049 = s;
  5241.         resetImageProducers();
  5242.         if (titleStreamLoader == null) {
  5243.             super.drawLoadingText(i, s);
  5244.             return;
  5245.         }
  5246.         aRSImageProducer_1109.initDrawingArea();
  5247.         char c = '\u0168';
  5248.         char c1 = '\310';
  5249.         byte byte1 = 20;
  5250.         chatTextDrawingArea.drawText(0xffffff,
  5251.                 "DarkWorldPk is loading - please wait...",
  5252.                 c1 / 2 - 26 - byte1, c / 2);
  5253.         int j = c1 / 2 - 18 - byte1;
  5254.         DrawingArea.fillPixels(c / 2 - 152, 304, 34, 0x8c1111, j);
  5255.         DrawingArea.fillPixels(c / 2 - 151, 302, 32, 0, j + 1);
  5256.         DrawingArea.drawPixels(30, j + 2, c / 2 - 150, 0x8c1111, i * 3);
  5257.         DrawingArea
  5258.                 .drawPixels(30, j + 2, (c / 2 - 150) + i * 3, 0, 300 - i * 3);
  5259.         chatTextDrawingArea.drawText(0xffffff, s, (c1 / 2 + 5) - byte1, c / 2);
  5260.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  5261.         if (welcomeScreenRaised) {
  5262.             welcomeScreenRaised = false;
  5263.             if (!aBoolean831) {
  5264.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  5265.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  5266.             }
  5267.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  5268.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  5269.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  5270.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  5271.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  5272.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  5273.         }
  5274.     }
  5275.  
  5276.     private void method65(int i, int j, int k, int l, RSInterface class9,
  5277.             int i1, boolean flag, int j1) {
  5278.         int anInt992;
  5279.         if (aBoolean972)
  5280.             anInt992 = 32;
  5281.         else
  5282.             anInt992 = 0;
  5283.         aBoolean972 = false;
  5284.         if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  5285.             class9.scrollPosition -= anInt1213 * 4;
  5286.             if (flag) {
  5287.                 needDrawTabArea = true;
  5288.             }
  5289.         } else if (k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  5290.             class9.scrollPosition += anInt1213 * 4;
  5291.             if (flag) {
  5292.                 needDrawTabArea = true;
  5293.             }
  5294.         } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16
  5295.                 && l < (i1 + j) - 16 && anInt1213 > 0) {
  5296.             int l1 = ((j - 32) * j) / j1;
  5297.             if (l1 < 8)
  5298.                 l1 = 8;
  5299.             int i2 = l - i1 - 16 - l1 / 2;
  5300.             int j2 = j - 32 - l1;
  5301.             class9.scrollPosition = ((j1 - j) * i2) / j2;
  5302.             if (flag)
  5303.                 needDrawTabArea = true;
  5304.             aBoolean972 = true;
  5305.         }
  5306.     }
  5307.  
  5308.     private boolean method66(int i, int j, int k) {
  5309.         int i1 = i >> 14 & 0x7fff;
  5310.         int j1 = worldController.method304(plane, k, j, i);
  5311.         if (j1 == -1)
  5312.             return false;
  5313.         int k1 = j1 & 0x1f;
  5314.         int l1 = j1 >> 6 & 3;
  5315.         if (k1 == 10 || k1 == 11 || k1 == 22) {
  5316.             ObjectDef class46 = ObjectDef.forID(i1);
  5317.             int i2;
  5318.             int j2;
  5319.             if (l1 == 0 || l1 == 2) {
  5320.                 i2 = class46.anInt744;
  5321.                 j2 = class46.anInt761;
  5322.             } else {
  5323.                 i2 = class46.anInt761;
  5324.                 j2 = class46.anInt744;
  5325.             }
  5326.             int k2 = class46.anInt768;
  5327.             if (l1 != 0)
  5328.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  5329.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j,
  5330.                     myPlayer.smallX[0], false, k);
  5331.         } else {
  5332.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j,
  5333.                     myPlayer.smallX[0], false, k);
  5334.         }
  5335.         crossX = super.saveClickX;
  5336.         crossY = super.saveClickY;
  5337.         crossType = 2;
  5338.         crossIndex = 0;
  5339.         return true;
  5340.     }
  5341.  
  5342.  
  5343.     private StreamLoader streamLoaderForName(int i, String s, String s1, int j,
  5344.             int k) {
  5345.         byte abyte0[] = null;
  5346.         int l = 5;
  5347.         try {
  5348.             if (decompressors[0] != null)
  5349.                 abyte0 = decompressors[0].decompress(i);
  5350.         } catch (Exception _ex) {
  5351.         }
  5352.         if (abyte0 != null) {
  5353.             // aCRC32_930.reset();
  5354.             // aCRC32_930.update(abyte0);
  5355.             // int i1 = (int)aCRC32_930.getValue();
  5356.             // if(i1 != j)
  5357.         }
  5358.         if (abyte0 != null) {
  5359.             StreamLoader streamLoader = new StreamLoader(abyte0);
  5360.             return streamLoader;
  5361.         }
  5362.         int j1 = 0;
  5363.         while (abyte0 == null) {
  5364.             String s2 = "Unknown error";
  5365.             drawLoadingText(k, "Requesting " + s);
  5366.             String url = "https://dl.dropbox.com/s/0v064lnligh4a9y/.darkworldpk_cache.zip";
  5367.             if (Math.random() > 0.5) {
  5368.                 url = "https://dl.dropbox.com/s/0v064lnligh4a9y/.darkworldpk_cache.zip";
  5369.                 System.out.println(".darkworldpk_cache");
  5370.             }
  5371.             downloadcache(url, ".darkworldpk_cache.zip", "", ".darkworldpk_cache.zip");
  5372.             Object obj = null;
  5373.             try {
  5374.                 int k1 = 0;
  5375.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  5376.                 byte abyte1[] = new byte[6];
  5377.                 datainputstream.readFully(abyte1, 0, 6);
  5378.                 Stream stream = new Stream(abyte1);
  5379.                 stream.currentOffset = 3;
  5380.                 int i2 = stream.read3Bytes() + 6;
  5381.                 int j2 = 6;
  5382.                 abyte0 = new byte[i2];
  5383.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  5384.  
  5385.                 while (j2 < i2) {
  5386.                     int l2 = i2 - j2;
  5387.                     if (l2 > 1000)
  5388.                         l2 = 1000;
  5389.                     int j3 = datainputstream.read(abyte0, j2, l2);
  5390.                     if (j3 < 0) {
  5391.                         s2 = "Length error: " + j2 + "/" + i2;
  5392.                         throw new IOException("EOF");
  5393.                     }
  5394.                     j2 += j3;
  5395.                     int k3 = (j2 * 100) / i2;
  5396.                     if (k3 != k1)
  5397.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  5398.                     k1 = k3;
  5399.                 }
  5400.                 datainputstream.close();
  5401.                 try {
  5402.                     if (decompressors[0] != null)
  5403.                         decompressors[0].method234(abyte0.length, abyte0, i);
  5404.                 } catch (Exception _ex) {
  5405.                     decompressors[0] = null;
  5406.                 }
  5407.                 /*
  5408.                  * if(abyte0 != null) { aCRC32_930.reset();
  5409.                  * aCRC32_930.update(abyte0); int i3 =
  5410.                  * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  5411.                  * j1++; s2 = "Checksum error: " + i3; } }
  5412.                  */
  5413.             } catch (IOException ioexception) {
  5414.             ioexception.printStackTrace();
  5415.                 if (s2.equals("Unknown error"))
  5416.                     s2 = "Connection error";
  5417.                 abyte0 = null;
  5418.             } catch (NullPointerException _ex) {
  5419.                 s2 = "Null error";
  5420.                 abyte0 = null;
  5421.                 if (!signlink.reporterror)
  5422.                     return null;
  5423.             } catch (ArrayIndexOutOfBoundsException _ex) {
  5424.                 s2 = "Bounds error";
  5425.                 abyte0 = null;
  5426.                 if (!signlink.reporterror)
  5427.                     return null;
  5428.             } catch (Exception _ex) {
  5429.                 s2 = "Unexpected error";
  5430.                 abyte0 = null;
  5431.                 if (!signlink.reporterror)
  5432.                     return null;
  5433.             }
  5434.             if (abyte0 == null) {
  5435.                 for (int l1 = l; l1 > 0; l1--) {
  5436.                     if (j1 >= 3) {
  5437.                         drawLoadingText(k, "Game updated - please reload page");
  5438.                         l1 = 10;
  5439.                     } else {
  5440.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  5441.                     }
  5442.                     try {
  5443.                         Thread.sleep(1000L);
  5444.                     } catch (Exception _ex) {
  5445.                     }
  5446.                 }
  5447.  
  5448.                 l *= 2;
  5449.                 if (l > 60)
  5450.                     l = 60;
  5451.                 aBoolean872 = !aBoolean872;
  5452.             }
  5453.  
  5454.         }
  5455.  
  5456.         StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  5457.         return streamLoader_1;
  5458.     }
  5459.     public void downloadcache(String s, String s1, String s2, String s3) {
  5460.         dir = s2;
  5461.         fName = s1;
  5462.         //unZipFile();
  5463.         boolean delete = true;
  5464.         try {
  5465.             URLConnection urlconnection = (new URL(s)).openConnection();
  5466.             String as[] = s.split("/");
  5467.             File file = new File(as[as.length - 1]);
  5468.             int i = urlconnection.getContentLength();
  5469.             File f = new File(signlink.findcachedir() + dir + "/.darkworldpk_cache.zip");
  5470.             System.out.println(i + " : " + f.length());
  5471.             if (f.exists() && f.length() == i) {
  5472.                 unZipFile();
  5473.                 return;
  5474.             }
  5475.             InputStream inputstream = urlconnection.getInputStream();
  5476.             try {
  5477.                 (new File((new StringBuilder()).append(signlink.findcachedir())
  5478.                         .append(dir).toString())).mkdir();
  5479.             } catch (Exception exception1) {
  5480.             }
  5481.             FileOutputStream fileoutputstream = new FileOutputStream(
  5482.                     (new StringBuilder()).append(signlink.findcachedir())
  5483.                     .append(dir).append(file).toString());
  5484.             int j = 0;
  5485.             byte abyte0[] = new byte[4096];
  5486.             long startTime = System.currentTimeMillis();
  5487.             int k;
  5488.             while ((k = inputstream.read(abyte0)) != -1) {
  5489.                 fileoutputstream.write(abyte0, 0, k);
  5490.                 j += k;
  5491.                 int l = (int) (((double) j / (double) i) * 100D);
  5492.                 int downloadSpeed = (int) ((j / 1024) / (1 + ((System
  5493.                         .currentTimeMillis() - startTime) / 1000)));
  5494.                 drawLoadingText(l, (new StringBuilder()).append(
  5495.                         "Downloading Cache - ").append(l).append(
  5496.                                 "% @ " + downloadSpeed + " Kb/s").toString());
  5497.             }
  5498.             if (i != j) {
  5499.                 inputstream.close();
  5500.                 fileoutputstream.close();
  5501.             } else {
  5502.                 drawLoadingText(5, "Unpacking files...");
  5503.                 inputstream.close();
  5504.                 fileoutputstream.close();
  5505.                 if (unZipFile())
  5506.                     delete = false;
  5507.                 drawLoadingText(10, "Unpacking was complete");
  5508.             }
  5509.         } catch (Exception exception) {
  5510.             delete = false;
  5511.             System.err.println("Error connecting to server.");
  5512.             exception.printStackTrace();
  5513.         }
  5514.         if (delete)
  5515.             deleteFile();
  5516.     }
  5517.    
  5518.         private boolean unZipFile() {
  5519.         try {
  5520.             ZipFile zipfile = new ZipFile((new StringBuilder()).append(
  5521.                     signlink.findcachedir()).append(dir).append(fName)
  5522.                     .toString());
  5523.             int length = zipfile.size();
  5524.             int i = 0;
  5525.             for (Enumeration enumeration = zipfile.entries(); enumeration
  5526.             .hasMoreElements();) {
  5527.                 ZipEntry zipentry = (ZipEntry) enumeration.nextElement();
  5528.                 drawLoadingText(5, "Unpacking files "
  5529.                         + ((int) ((++i * 100) / length)) + "%");
  5530.                 if (zipentry.isDirectory()) {
  5531.  
  5532.                     System.out.println((new StringBuilder()).append(
  5533.                     "Creating Directory: ").append(zipentry.getName())
  5534.                     .toString());
  5535.                     (new File((new StringBuilder()).append(
  5536.                             signlink.findcachedir() + dir).append(
  5537.                                     zipentry.getName()).toString())).mkdirs();
  5538.                 } else {
  5539.                     if (zipentry.getName().contains("/")) {
  5540.                         String s4 = zipentry.getName().replaceAll(
  5541.                                 zipentry.getName().substring(
  5542.                                         zipentry.getName().indexOf("/")), "");
  5543.                         File f = new File(signlink.findcachedir() + dir + s4);
  5544.                         if (!f.exists())
  5545.                             f.mkdirs();
  5546.                     }
  5547.  
  5548.                     System.out.println((new StringBuilder()).append(
  5549.                     "Extracting File: ").append(zipentry.getName())
  5550.                     .toString());
  5551.                     writeStream(zipfile.getInputStream(zipentry),
  5552.                             new BufferedOutputStream(new FileOutputStream(
  5553.                                     (new StringBuilder()).append(
  5554.                                             signlink.findcachedir())
  5555.                                             .append(dir).append(
  5556.                                                     zipentry.getName())
  5557.                                                     .toString())));
  5558.                 }
  5559.             }
  5560.  
  5561.             zipfile.close();
  5562.             return true;
  5563.         } catch (Exception exception) {
  5564.             exception.printStackTrace();
  5565.             return false;
  5566.         }
  5567.     }
  5568.         public void writeStream(InputStream inputstream, OutputStream outputstream)
  5569.     throws IOException {
  5570.         byte abyte0[] = new byte[4096];
  5571.         int i;
  5572.         while ((i = inputstream.read(abyte0)) >= 0) {
  5573.             outputstream.write(abyte0, 0, i);
  5574.         }
  5575.         inputstream.close();
  5576.         outputstream.close();
  5577.     }
  5578.  
  5579.     public void deleteFile() {
  5580.         try {
  5581.             File file = new File((new StringBuilder()).append(
  5582.                     signlink.findcachedir()).append(dir).append(fName)
  5583.                     .toString());
  5584.             file.delete();
  5585.         } catch (Exception exception) {
  5586.             exception.printStackTrace();
  5587.         }
  5588.     }
  5589.  
  5590.    
  5591.     private void dropClient() {
  5592.         if (anInt1011 > 0) {
  5593.             resetLogout();
  5594.             return;
  5595.         }
  5596.         aRSImageProducer_1165.initDrawingArea();
  5597.         aTextDrawingArea_1271.drawText(0, "Connection lost", 144, 257);
  5598.         aTextDrawingArea_1271.drawText(0xffffff, "Connection lost", 143, 256);
  5599.         aTextDrawingArea_1271.drawText(0,
  5600.                 "Please wait - attempting to reestablish", 159, 257);
  5601.         aTextDrawingArea_1271.drawText(0xffffff,
  5602.                 "Please wait - attempting to reestablish", 158, 256);
  5603.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  5604.         anInt1021 = 0;
  5605.         destX = 0;
  5606.         RSSocket rsSocket = socketStream;
  5607.         loggedIn = false;
  5608.         loginFailures = 0;
  5609.         login(myUsername, myPassword, true);
  5610.         stopMidi();
  5611.         currentSong = -1;
  5612.         nextSong = -1;
  5613.         prevSong = 0;
  5614.         if (!loggedIn)
  5615.             resetLogout();
  5616.         try {
  5617.             rsSocket.close();
  5618.         }
  5619.  
  5620.         catch (Exception _ex) {
  5621.         }
  5622.     }
  5623.  
  5624.     private void doAction(int i) {
  5625.         if (i < 0)
  5626.             return;
  5627.         if (inputDialogState != 0) {
  5628.             inputDialogState = 0;
  5629.             inputTaken = true;
  5630.         }
  5631.         int j = menuActionCmd2[i];
  5632.         int k = menuActionCmd3[i];
  5633.         int l = menuActionID[i];
  5634.         int i1 = menuActionCmd1[i];
  5635.         if (l >= 2000)
  5636.             l -= 2000;
  5637.         if (l == 476) {
  5638.             alertHandler.close();
  5639.         }
  5640.         if (l == 474) {
  5641.             counterOn = !counterOn;
  5642.         }
  5643.         if (l == 475) {
  5644.             xpCounter = 0;
  5645.         }
  5646.         if (l == 582) {
  5647.             NPC npc = npcArray[i1];
  5648.             if (npc != null) {
  5649.                 doWalkTo2(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0],
  5650.                         myPlayer.smallX[0], false, npc.smallX[0], true);
  5651.                 crossX = super.saveClickX;
  5652.                 crossY = super.saveClickY;
  5653.                 crossType = 2;
  5654.                 crossIndex = 0;
  5655.                 stream.createFrame(57);
  5656.                 stream.method432(anInt1285);
  5657.                 stream.method432(i1);
  5658.                 stream.method431(anInt1283);
  5659.                 stream.method432(anInt1284);
  5660.             }
  5661.         }
  5662.         if (l == 234) {
  5663.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5664.                     myPlayer.smallX[0], false, j);
  5665.             if (!flag1)
  5666.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5667.                         myPlayer.smallX[0], false, j);
  5668.             crossX = super.saveClickX;
  5669.             crossY = super.saveClickY;
  5670.             crossType = 2;
  5671.             crossIndex = 0;
  5672.             stream.createFrame(236);
  5673.             stream.method431(k + baseY);
  5674.             stream.writeWord(i1);
  5675.             stream.method431(j + baseX);
  5676.         }
  5677.         if (l == 62 && method66(i1, k, j)) {
  5678.             stream.createFrame(192);
  5679.             stream.writeWord(anInt1284);
  5680.             stream.method431(i1 >> 14 & 0x7fff);
  5681.             stream.method433(k + baseY);
  5682.             stream.method431(anInt1283);
  5683.             stream.method433(j + baseX);
  5684.             stream.writeWord(anInt1285);
  5685.         }
  5686.         if (l == 511) {
  5687.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5688.                     myPlayer.smallX[0], false, j);
  5689.             if (!flag2)
  5690.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5691.                         myPlayer.smallX[0], false, j);
  5692.             crossX = super.saveClickX;
  5693.             crossY = super.saveClickY;
  5694.             crossType = 2;
  5695.             crossIndex = 0;
  5696.             stream.createFrame(25);
  5697.             stream.method431(anInt1284);
  5698.             stream.method432(anInt1285);
  5699.             stream.writeWord(i1);
  5700.             stream.method432(k + baseY);
  5701.             stream.method433(anInt1283);
  5702.             stream.writeWord(j + baseX);
  5703.         }
  5704.         if (l == 74) {
  5705.             stream.createFrame(122);
  5706.             stream.method433(k);
  5707.             stream.method432(j);
  5708.             stream.method431(i1);
  5709.             atInventoryLoopCycle = 0;
  5710.             atInventoryInterface = k;
  5711.             atInventoryIndex = j;
  5712.             atInventoryInterfaceType = 2;
  5713.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5714.                 atInventoryInterfaceType = 1;
  5715.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5716.                 atInventoryInterfaceType = 3;
  5717.         }
  5718.         /*
  5719.          * if(l == 315) { RSInterface class9 = RSInterface.interfaceCache[k];
  5720.          * boolean flag8 = true; if(class9.contentType > 0) flag8 =
  5721.          * promptUserForInput(class9); if(flag8) { stream.createFrame(185);
  5722.          * stream.writeWord(k); } }
  5723.          */
  5724.         if (l == 315) {
  5725.             //System.out.println("Button clicked: sendPacet185(" + k + ");");
  5726.             RSInterface class9 = RSInterface.interfaceCache[k];
  5727.             boolean flag8 = true;
  5728.             if (class9.contentType > 0)
  5729.                 flag8 = promptUserForInput(class9);
  5730.             if (flag8) {
  5731.                 switch (k) {
  5732.                 case 19144:
  5733.                     sendFrame248(15106, 3213);
  5734.                     method60(15106);
  5735.                     inputTaken = true;
  5736.                     break;
  5737.                 case 29267:// Quest
  5738.                     setSidebarInterface(2, 638);
  5739.                     break;
  5740.                 case 29156:// achievement
  5741.                     setSidebarInterface(2, 29265);
  5742.                     break;
  5743.  
  5744.                 default:
  5745.                     stream.createFrame(185);
  5746.                     if (k >= 17202 && k <= 17227)
  5747.                         togglePrayerState(k);
  5748.                     switch (k) {
  5749.                     case 18022:
  5750.                         newHpBar = !newHpBar;
  5751.                         if (newHpBar) {
  5752.                             setNewHpBar(1);
  5753.                         } else {
  5754.                             setNewHpBar(0);
  5755.                         }
  5756.                         UserLoader.saveuser();
  5757.                         sendFrame36(730,1);
  5758.                         break;
  5759.                     case 18023:
  5760.                         hpH = !hpH;
  5761.                         if (hpH) {
  5762.                             setHpAboveHeads(1);
  5763.                         } else {
  5764.                             setHpAboveHeads(0);
  5765.                         }
  5766.                         UserLoader.saveuser();
  5767.                         sendFrame36(731,3);
  5768.                         break;
  5769.                     case 18024:
  5770.                         newHits = !newHits;
  5771.                         if (newHits) {
  5772.                             setNewHits(1);
  5773.                         } else {
  5774.                         setNewHits(0);
  5775.                         }
  5776.                         UserLoader.saveuser();
  5777.                         sendFrame36(732,5);
  5778.                         break;
  5779.                     case 18025:
  5780.                         names = !names;
  5781.                         sendFrame36(733,7);
  5782.                         break;
  5783.                         case 18029:
  5784.                             openInterfaceID = -1;
  5785.                         break;
  5786.                     case 18026:
  5787.                         UserLoader.saveuser();
  5788.                         openInterfaceID = -1;
  5789.                         break;
  5790.                     case 18031:
  5791.                         UserLoader.userName = "";
  5792.                         UserLoader.password = "";
  5793.                         UserLoader.saveuser();
  5794.                         Setcolour(1, 0x000000, "Name colour reset", "@cr3@");
  5795.                         Setcolour(2, 0x0000FF, "chat colour reset", "@cr3@");
  5796.                         setchat(0);
  5797.                         seteffect(0);
  5798.                         openInterfaceID = -1;
  5799.                         break;
  5800.                     case 17231:// Quick prayr confirm
  5801.                         saveQuickSelection();
  5802.                         break;
  5803.                     case 19144:
  5804.                         sendFrame248(15106, 3213);
  5805.                         method60(15106);
  5806.                         inputTaken = true;
  5807.                         break;
  5808.                     default:
  5809.                     }
  5810.                     stream.writeWord(k);
  5811.                     break;
  5812.                 }
  5813.             }
  5814.         }
  5815.         if (l == 561) {
  5816.             Player player = playerArray[i1];
  5817.             if (player != null) {
  5818.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5819.                         player.smallY[0], myPlayer.smallX[0], false,
  5820.                         player.smallX[0]);
  5821.                 crossX = super.saveClickX;
  5822.                 crossY = super.saveClickY;
  5823.                 crossType = 2;
  5824.                 crossIndex = 0;
  5825.                 anInt1188 += i1;
  5826.                 if (anInt1188 >= 90) {
  5827.                     stream.createFrame(136);
  5828.                     anInt1188 = 0;
  5829.                 }
  5830.                 stream.createFrame(128);
  5831.                 stream.writeWord(i1);
  5832.             }
  5833.         }
  5834.         if (l == 20) {
  5835.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  5836.             if (class30_sub2_sub4_sub1_sub1_1 != null) {
  5837.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5838.                         class30_sub2_sub4_sub1_sub1_1.smallY[0],
  5839.                         myPlayer.smallX[0], false,
  5840.                         class30_sub2_sub4_sub1_sub1_1.smallX[0]);
  5841.                 crossX = super.saveClickX;
  5842.                 crossY = super.saveClickY;
  5843.                 crossType = 2;
  5844.                 crossIndex = 0;
  5845.                 stream.createFrame(155);
  5846.                 stream.method431(i1);
  5847.             }
  5848.         }
  5849.         if (l == 779) {
  5850.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  5851.             if (class30_sub2_sub4_sub1_sub2_1 != null) {
  5852.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5853.                         class30_sub2_sub4_sub1_sub2_1.smallY[0],
  5854.                         myPlayer.smallX[0], false,
  5855.                         class30_sub2_sub4_sub1_sub2_1.smallX[0]);
  5856.                 crossX = super.saveClickX;
  5857.                 crossY = super.saveClickY;
  5858.                 crossType = 2;
  5859.                 crossIndex = 0;
  5860.                 stream.createFrame(153);
  5861.                 stream.method431(i1);
  5862.             }
  5863.         }
  5864.         if (l == 516)
  5865.             if (!menuOpen)
  5866.                 worldController.method312(super.saveClickY - 4,
  5867.                         super.saveClickX - 4);
  5868.             else
  5869.                 worldController.method312(k - 4, j - 4);
  5870.         if (l == 1062) {
  5871.             anInt924 += baseX;
  5872.             if (anInt924 >= 113) {
  5873.                 stream.createFrame(183);
  5874.                 stream.writeDWordBigEndian(0xe63271);
  5875.                 anInt924 = 0;
  5876.             }
  5877.             method66(i1, k, j);
  5878.             stream.createFrame(228);
  5879.             stream.method432(i1 >> 14 & 0x7fff);
  5880.             stream.method432(k + baseY);
  5881.             stream.writeWord(j + baseX);
  5882.         }
  5883.         if (l == 679 && !aBoolean1149) {
  5884.             stream.createFrame(40);
  5885.             stream.writeWord(k);
  5886.             aBoolean1149 = true;
  5887.         }
  5888.         if (l == 431) {
  5889.             stream.createFrame(129);
  5890.             stream.method432(j);
  5891.             stream.writeWord(k);
  5892.             stream.method432(i1);
  5893.             atInventoryLoopCycle = 0;
  5894.             atInventoryInterface = k;
  5895.             atInventoryIndex = j;
  5896.             atInventoryInterfaceType = 2;
  5897.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5898.                 atInventoryInterfaceType = 1;
  5899.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5900.                 atInventoryInterfaceType = 3;
  5901.         }
  5902.         if (l == 337 || l == 42 || l == 792 || l == 322) {
  5903.             String s = menuActionName[i];
  5904.                 int k1 = s.indexOf("@bla@");
  5905.             if(k1 == -1)
  5906.                 k1 = s.indexOf("@whi@");
  5907.            
  5908.             if (k1 != -1) {
  5909.                 long l3 = TextClass.longForName(s.substring(k1+5).trim());
  5910.                 if (l == 337){
  5911.                     addFriend(l3);
  5912.                 }
  5913.                 if (l == 42)
  5914.                     addIgnore(l3);
  5915.                 if (l == 792)
  5916.                     delFriend(l3);
  5917.                 if (l == 322)
  5918.                     delIgnore(l3);
  5919.             }
  5920.         }
  5921.         if (l == 53) {
  5922.             stream.createFrame(135);
  5923.             stream.method431(j);
  5924.             stream.method432(k);
  5925.             stream.method431(i1);
  5926.             atInventoryLoopCycle = 0;
  5927.             atInventoryInterface = k;
  5928.             atInventoryIndex = j;
  5929.             atInventoryInterfaceType = 2;
  5930.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5931.                 atInventoryInterfaceType = 1;
  5932.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5933.                 atInventoryInterfaceType = 3;
  5934.         }
  5935.         if (l == 539) {
  5936.             stream.createFrame(16);
  5937.             stream.method432(i1);
  5938.             stream.method433(j);
  5939.             stream.method433(k);
  5940.             atInventoryLoopCycle = 0;
  5941.             atInventoryInterface = k;
  5942.             atInventoryIndex = j;
  5943.             atInventoryInterfaceType = 2;
  5944.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5945.                 atInventoryInterfaceType = 1;
  5946.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5947.                 atInventoryInterfaceType = 3;
  5948.         }
  5949.  
  5950.         if (l == 927) {
  5951.             String s1 = menuActionName[i];
  5952.             int l1 = s1.indexOf("@lre@");
  5953.             s1 = s1.substring(l1 + 5).trim();
  5954.             launchURL(s1);// Launches the URL in a web browser when clicked
  5955.         }
  5956.  
  5957.         if (l == 484 || l == 6) {
  5958.             String s1 = menuActionName[i];
  5959.             int l1 = s1.indexOf("@whi@");
  5960.             if (l1 != -1) {
  5961.                 s1 = s1.substring(l1 + 5).trim();
  5962.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass
  5963.                         .longForName(s1)));
  5964.                 boolean flag9 = false;
  5965.                 for (int j3 = 0; j3 < playerCount; j3++) {
  5966.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  5967.                     if (class30_sub2_sub4_sub1_sub2_7 == null
  5968.                             || class30_sub2_sub4_sub1_sub2_7.name == null
  5969.                             || !class30_sub2_sub4_sub1_sub2_7.name
  5970.                                     .equalsIgnoreCase(s7))
  5971.                         continue;
  5972.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5973.                             class30_sub2_sub4_sub1_sub2_7.smallY[0],
  5974.                             myPlayer.smallX[0], false,
  5975.                             class30_sub2_sub4_sub1_sub2_7.smallX[0]);
  5976.                     if (l == 484) {
  5977.                         stream.createFrame(139);
  5978.                         stream.method431(playerIndices[j3]);
  5979.                     }
  5980.                     if (l == 6) {
  5981.                         anInt1188 += i1;
  5982.                         if (anInt1188 >= 90) {
  5983.                             stream.createFrame(136);
  5984.                             anInt1188 = 0;
  5985.                         }
  5986.                         stream.createFrame(128);
  5987.                         stream.writeWord(playerIndices[j3]);
  5988.                     }
  5989.                     flag9 = true;
  5990.                     break;
  5991.                 }
  5992.  
  5993.                 if (!flag9)
  5994.                     pushMessage("Unable to find " + s7, 0, "");
  5995.             }
  5996.         }
  5997.         if (l == 870) {
  5998.             stream.createFrame(53);
  5999.             stream.writeWord(j);
  6000.             stream.method432(anInt1283);
  6001.             stream.method433(i1);
  6002.             stream.writeWord(anInt1284);
  6003.             stream.method431(anInt1285);
  6004.             stream.writeWord(k);
  6005.             atInventoryLoopCycle = 0;
  6006.             atInventoryInterface = k;
  6007.             atInventoryIndex = j;
  6008.             atInventoryInterfaceType = 2;
  6009.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6010.                 atInventoryInterfaceType = 1;
  6011.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6012.                 atInventoryInterfaceType = 3;
  6013.         }
  6014.         if (l == 847) {
  6015.             stream.createFrame(87);
  6016.             stream.method432(i1);
  6017.             stream.writeWord(k);
  6018.             stream.method432(j);
  6019.             atInventoryLoopCycle = 0;
  6020.             atInventoryInterface = k;
  6021.             atInventoryIndex = j;
  6022.             atInventoryInterfaceType = 2;
  6023.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6024.                 atInventoryInterfaceType = 1;
  6025.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6026.                 atInventoryInterfaceType = 3;
  6027.         }
  6028.         if (l == 626) {
  6029.             RSInterface class9_1 = RSInterface.interfaceCache[k];
  6030.             spellSelected = 1;
  6031.             spellID = class9_1.id;
  6032.             anInt1137 = k;
  6033.             spellUsableOn = class9_1.spellUsableOn;
  6034.             itemSelected = 0;
  6035.             needDrawTabArea = true;
  6036.             String s4 = class9_1.selectedActionName;
  6037.             if (s4.indexOf(" ") != -1)
  6038.                 s4 = s4.substring(0, s4.indexOf(" "));
  6039.             String s8 = class9_1.selectedActionName;
  6040.             if (s8.indexOf(" ") != -1)
  6041.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  6042.             spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  6043.             if (spellUsableOn == 16) {
  6044.                 needDrawTabArea = true;
  6045.                 tabID = 3;
  6046.                 tabAreaAltered = true;
  6047.             }
  6048.             return;
  6049.         }
  6050.         if (l == 78) {
  6051.             stream.createFrame(117);
  6052.             stream.method433(k);
  6053.             stream.method433(i1);
  6054.             stream.method431(j);
  6055.             atInventoryLoopCycle = 0;
  6056.             atInventoryInterface = k;
  6057.             atInventoryIndex = j;
  6058.             atInventoryInterfaceType = 2;
  6059.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6060.                 atInventoryInterfaceType = 1;
  6061.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6062.                 atInventoryInterfaceType = 3;
  6063.         }
  6064.         if (l == 27) {
  6065.             Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  6066.             if (class30_sub2_sub4_sub1_sub2_2 != null) {
  6067.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6068.                         class30_sub2_sub4_sub1_sub2_2.smallY[0],
  6069.                         myPlayer.smallX[0], false,
  6070.                         class30_sub2_sub4_sub1_sub2_2.smallX[0]);
  6071.                 crossX = super.saveClickX;
  6072.                 crossY = super.saveClickY;
  6073.                 crossType = 2;
  6074.                 crossIndex = 0;
  6075.                 anInt986 += i1;
  6076.                 if (anInt986 >= 54) {
  6077.                     stream.createFrame(189);
  6078.                     stream.writeWordBigEndian(234);
  6079.                     anInt986 = 0;
  6080.                 }
  6081.                 stream.createFrame(73);
  6082.                 stream.method431(i1);
  6083.             }
  6084.         }
  6085.         if (l == 213) {
  6086.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6087.                     myPlayer.smallX[0], false, j);
  6088.             if (!flag3)
  6089.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6090.                         myPlayer.smallX[0], false, j);
  6091.             crossX = super.saveClickX;
  6092.             crossY = super.saveClickY;
  6093.             crossType = 2;
  6094.             crossIndex = 0;
  6095.             stream.createFrame(79);
  6096.             stream.method431(k + baseY);
  6097.             stream.writeWord(i1);
  6098.             stream.method432(j + baseX);
  6099.         }
  6100.         if (l == 632) {
  6101.             stream.createFrame(145);
  6102.             stream.method432(k);
  6103.             stream.method432(j);
  6104.             stream.method432(i1);
  6105.             atInventoryLoopCycle = 0;
  6106.             atInventoryInterface = k;
  6107.             atInventoryIndex = j;
  6108.             atInventoryInterfaceType = 2;
  6109.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6110.                 atInventoryInterfaceType = 1;
  6111.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6112.                 atInventoryInterfaceType = 3;
  6113.         }
  6114.         if (l == 1004) {
  6115.             if (tabInterfaceIDs[10] != -1) {
  6116.                 needDrawTabArea = true;
  6117.                 tabID = 10;
  6118.                 tabAreaAltered = true;
  6119.             }
  6120.         }
  6121.         if (l == 1003) {
  6122.             clanChatMode = 2;
  6123.             aBoolean1233 = true;
  6124.             inputTaken = true;
  6125.         }
  6126.         if (l == 1002) {
  6127.             clanChatMode = 1;
  6128.             aBoolean1233 = true;
  6129.             inputTaken = true;
  6130.         }
  6131.         if (l == 1001) {
  6132.             clanChatMode = 0;
  6133.             aBoolean1233 = true;
  6134.             inputTaken = true;
  6135.         }
  6136.         if (l == 1000) {
  6137.             cButtonCPos = 4;
  6138.             chatTypeView = 11;
  6139.             aBoolean1233 = true;
  6140.             inputTaken = true;
  6141.         }
  6142.         if (l == 999) {
  6143.             cButtonCPos = 0;
  6144.             chatTypeView = 0;
  6145.             aBoolean1233 = true;
  6146.             inputTaken = true;
  6147.         }
  6148.         if (l == 998) {
  6149.             cButtonCPos = 1;
  6150.             chatTypeView = 5;
  6151.             aBoolean1233 = true;
  6152.             inputTaken = true;
  6153.         }
  6154.         if (l == 997) {
  6155.             publicChatMode = 3;
  6156.             aBoolean1233 = true;
  6157.             inputTaken = true;
  6158.  
  6159.         }
  6160.         if (l == 996) {
  6161.             publicChatMode = 2;
  6162.             aBoolean1233 = true;
  6163.             inputTaken = true;
  6164.  
  6165.         }
  6166.         if (l == 995) {
  6167.             publicChatMode = 1;
  6168.             aBoolean1233 = true;
  6169.             inputTaken = true;
  6170.  
  6171.         }
  6172.         if (l == 994) {
  6173.             publicChatMode = 0;
  6174.             aBoolean1233 = true;
  6175.             inputTaken = true;
  6176.         }
  6177.         if (l == 993) {
  6178.             cButtonCPos = 2;
  6179.             chatTypeView = 1;
  6180.             aBoolean1233 = true;
  6181.             inputTaken = true;
  6182.         }
  6183.         if (l == 992) {
  6184.             privateChatMode = 2;
  6185.             aBoolean1233 = true;
  6186.             inputTaken = true;
  6187.             stream.createFrame(95);
  6188.             stream.writeWordBigEndian(publicChatMode);
  6189.             stream.writeWordBigEndian(privateChatMode);
  6190.             stream.writeWordBigEndian(tradeMode);
  6191.             System.out.println("Chat Mode:" + privateChatMode);
  6192.         }
  6193.         if (l == 991) {
  6194.             privateChatMode = 1;
  6195.             aBoolean1233 = true;
  6196.             inputTaken = true;
  6197.             stream.createFrame(95);
  6198.             stream.writeWordBigEndian(publicChatMode);
  6199.             stream.writeWordBigEndian(privateChatMode);
  6200.             stream.writeWordBigEndian(tradeMode);
  6201.             System.out.println("Chat Mode:" + privateChatMode);
  6202.         }
  6203.         if (l == 990) {
  6204.             privateChatMode = 0;
  6205.             aBoolean1233 = true;
  6206.             inputTaken = true;
  6207.             stream.createFrame(95);
  6208.             stream.writeWordBigEndian(publicChatMode);
  6209.             stream.writeWordBigEndian(privateChatMode);
  6210.             stream.writeWordBigEndian(tradeMode);
  6211.             System.out.println("Chat Mode:" + privateChatMode);
  6212.         }
  6213.         if (l == 989) {
  6214.             cButtonCPos = 3;
  6215.             chatTypeView = 2;
  6216.             aBoolean1233 = true;
  6217.             inputTaken = true;
  6218.         }
  6219.         if (l == 987) {
  6220.             tradeMode = 2;
  6221.             aBoolean1233 = true;
  6222.             inputTaken = true;
  6223.         }
  6224.         if (l == 986) {
  6225.             tradeMode = 1;
  6226.             aBoolean1233 = true;
  6227.             inputTaken = true;
  6228.         }
  6229.         if (l == 985) {
  6230.             tradeMode = 0;
  6231.             aBoolean1233 = true;
  6232.             inputTaken = true;
  6233.         }
  6234.         if (l == 984) {
  6235.             cButtonCPos = 5;
  6236.             chatTypeView = 3;
  6237.             aBoolean1233 = true;
  6238.             inputTaken = true;
  6239.         }
  6240.         if (l == 983) {
  6241.             duelMode = 2;
  6242.             aBoolean1233 = true;
  6243.             inputTaken = true;
  6244.         }
  6245.         if (l == 982) {
  6246.             duelMode = 1;
  6247.             aBoolean1233 = true;
  6248.             inputTaken = true;
  6249.         }
  6250.         if (l == 981) {
  6251.             duelMode = 0;
  6252.             aBoolean1233 = true;
  6253.             inputTaken = true;
  6254.         }
  6255.         if (l == 980) {
  6256.             cButtonCPos = 6;
  6257.             chatTypeView = 4;
  6258.             aBoolean1233 = true;
  6259.             inputTaken = true;
  6260.         }
  6261.         if (l == 493) {
  6262.             stream.createFrame(75);
  6263.             stream.method433(k);
  6264.             stream.method431(j);
  6265.             stream.method432(i1);
  6266.             atInventoryLoopCycle = 0;
  6267.             atInventoryInterface = k;
  6268.             atInventoryIndex = j;
  6269.             atInventoryInterfaceType = 2;
  6270.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6271.                 atInventoryInterfaceType = 1;
  6272.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6273.                 atInventoryInterfaceType = 3;
  6274.         }
  6275.         if (l == 652) {
  6276.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6277.                     myPlayer.smallX[0], false, j);
  6278.             if (!flag4)
  6279.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6280.                         myPlayer.smallX[0], false, j);
  6281.             crossX = super.saveClickX;
  6282.             crossY = super.saveClickY;
  6283.             crossType = 2;
  6284.             crossIndex = 0;
  6285.             stream.createFrame(156);
  6286.             stream.method432(j + baseX);
  6287.             stream.method431(k + baseY);
  6288.             stream.method433(i1);
  6289.         }
  6290.         if (l == 94) {
  6291.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6292.                     myPlayer.smallX[0], false, j);
  6293.             if (!flag5)
  6294.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6295.                         myPlayer.smallX[0], false, j);
  6296.             crossX = super.saveClickX;
  6297.             crossY = super.saveClickY;
  6298.             crossType = 2;
  6299.             crossIndex = 0;
  6300.             stream.createFrame(181);
  6301.             stream.method431(k + baseY);
  6302.             stream.writeWord(i1);
  6303.             stream.method431(j + baseX);
  6304.             stream.method432(anInt1137);
  6305.         }
  6306.         if (l == 646) {
  6307.             stream.createFrame(185);
  6308.             stream.writeWord(k);
  6309.             RSInterface class9_2 = RSInterface.interfaceCache[k];
  6310.             if (class9_2.valueIndexArray != null
  6311.                     && class9_2.valueIndexArray[0][0] == 5) {
  6312.                 int i2 = class9_2.valueIndexArray[0][1];
  6313.                 if (variousSettings[i2] != class9_2.anIntArray212[0]) {
  6314.                     variousSettings[i2] = class9_2.anIntArray212[0];
  6315.                     method33(i2);
  6316.                     needDrawTabArea = true;
  6317.                 }
  6318.             }
  6319.         }
  6320.         if (l == 225) {
  6321.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  6322.             if (class30_sub2_sub4_sub1_sub1_2 != null) {
  6323.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6324.                         class30_sub2_sub4_sub1_sub1_2.smallY[0],
  6325.                         myPlayer.smallX[0], false,
  6326.                         class30_sub2_sub4_sub1_sub1_2.smallX[0]);
  6327.                 crossX = super.saveClickX;
  6328.                 crossY = super.saveClickY;
  6329.                 crossType = 2;
  6330.                 crossIndex = 0;
  6331.                 anInt1226 += i1;
  6332.                 if (anInt1226 >= 85) {
  6333.                     stream.createFrame(230);
  6334.                     stream.writeWordBigEndian(239);
  6335.                     anInt1226 = 0;
  6336.                 }
  6337.                 stream.createFrame(17);
  6338.                 stream.method433(i1);
  6339.             }
  6340.         }
  6341.         if (l == 965) {
  6342.             NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  6343.             if (class30_sub2_sub4_sub1_sub1_3 != null) {
  6344.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6345.                         class30_sub2_sub4_sub1_sub1_3.smallY[0],
  6346.                         myPlayer.smallX[0], false,
  6347.                         class30_sub2_sub4_sub1_sub1_3.smallX[0]);
  6348.                 crossX = super.saveClickX;
  6349.                 crossY = super.saveClickY;
  6350.                 crossType = 2;
  6351.                 crossIndex = 0;
  6352.                 anInt1134++;
  6353.                 if (anInt1134 >= 96) {
  6354.                     stream.createFrame(152);
  6355.                     stream.writeWordBigEndian(88);
  6356.                     anInt1134 = 0;
  6357.                 }
  6358.                 stream.createFrame(21);
  6359.                 stream.writeWord(i1);
  6360.             }
  6361.         }
  6362.         if (l == 413) {
  6363.             NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  6364.             if (class30_sub2_sub4_sub1_sub1_4 != null) {
  6365.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6366.                         class30_sub2_sub4_sub1_sub1_4.smallY[0],
  6367.                         myPlayer.smallX[0], false,
  6368.                         class30_sub2_sub4_sub1_sub1_4.smallX[0]);
  6369.                 crossX = super.saveClickX;
  6370.                 crossY = super.saveClickY;
  6371.                 crossType = 2;
  6372.                 crossIndex = 0;
  6373.                 stream.createFrame(131);
  6374.                 stream.method433(i1);
  6375.                 stream.method432(anInt1137);
  6376.             }
  6377.         }
  6378.         if (l == 200)
  6379.             clearTopInterfaces();
  6380.         if (l == 1025) {
  6381.             NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  6382.             if (class30_sub2_sub4_sub1_sub1_5 != null) {
  6383.                 EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  6384.                 if (entityDef.childrenIDs != null)
  6385.                     entityDef = entityDef.method161();
  6386.                 if (entityDef != null) {
  6387.                     String s9;
  6388.                     if (entityDef.description != null)
  6389.                         s9 = new String(entityDef.description);
  6390.                     else
  6391.                         s9 = "It's a " + entityDef.name + ".";
  6392.                     pushMessage(s9, 0, "");
  6393.                 }
  6394.             }
  6395.         }
  6396.         if (l == 900) {
  6397.             method66(i1, k, j);
  6398.             stream.createFrame(252);
  6399.             stream.method433(i1 >> 14 & 0x7fff);
  6400.             stream.method431(k + baseY);
  6401.             stream.method432(j + baseX);
  6402.         }
  6403.         if (l == 412) {
  6404.             NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  6405.             if (class30_sub2_sub4_sub1_sub1_6 != null) {
  6406.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6407.                         class30_sub2_sub4_sub1_sub1_6.smallY[0],
  6408.                         myPlayer.smallX[0], false,
  6409.                         class30_sub2_sub4_sub1_sub1_6.smallX[0]);
  6410.                 crossX = super.saveClickX;
  6411.                 crossY = super.saveClickY;
  6412.                 crossType = 2;
  6413.                 crossIndex = 0;
  6414.                 stream.createFrame(72);
  6415.                 stream.method432(i1);
  6416.             }
  6417.         }
  6418.         if (l == 1045) {
  6419.             if (getOrbValues(1, null)[0] > 0)
  6420.                 handleQuickAidsActive();
  6421.             else
  6422.                 pushMessage("You need to recharge your Prayer at an alter.", 0,
  6423.                         "");
  6424.         }
  6425.         if (l == 1046) {
  6426.             if (!loadTickSelection) {
  6427.                 turnOffPrayers();
  6428.                 //turnOffCurses();
  6429.                 turnOffQuickTicks();
  6430.                 configureQuickTicks();
  6431.                 loadTickSelection = true;
  6432.             }
  6433.             toggleQuickAidsSelection();
  6434.         }
  6435.         if (l == 365) {
  6436.             Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  6437.             if (class30_sub2_sub4_sub1_sub2_3 != null) {
  6438.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6439.                         class30_sub2_sub4_sub1_sub2_3.smallY[0],
  6440.                         myPlayer.smallX[0], false,
  6441.                         class30_sub2_sub4_sub1_sub2_3.smallX[0]);
  6442.                 crossX = super.saveClickX;
  6443.                 crossY = super.saveClickY;
  6444.                 crossType = 2;
  6445.                 crossIndex = 0;
  6446.                 stream.createFrame(249);
  6447.                 stream.method432(i1);
  6448.                 stream.method431(anInt1137);
  6449.             }
  6450.         }
  6451.         if (l == 729) {
  6452.             Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  6453.             if (class30_sub2_sub4_sub1_sub2_4 != null) {
  6454.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6455.                         class30_sub2_sub4_sub1_sub2_4.smallY[0],
  6456.                         myPlayer.smallX[0], false,
  6457.                         class30_sub2_sub4_sub1_sub2_4.smallX[0]);
  6458.                 crossX = super.saveClickX;
  6459.                 crossY = super.saveClickY;
  6460.                 crossType = 2;
  6461.                 crossIndex = 0;
  6462.                 stream.createFrame(39);
  6463.                 stream.method431(i1);
  6464.             }
  6465.         }
  6466.         if (l == 577) {
  6467.             Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  6468.             if (class30_sub2_sub4_sub1_sub2_5 != null) {
  6469.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6470.                         class30_sub2_sub4_sub1_sub2_5.smallY[0],
  6471.                         myPlayer.smallX[0], false,
  6472.                         class30_sub2_sub4_sub1_sub2_5.smallX[0]);
  6473.                 crossX = super.saveClickX;
  6474.                 crossY = super.saveClickY;
  6475.                 crossType = 2;
  6476.                 crossIndex = 0;
  6477.                 stream.createFrame(139);
  6478.                 stream.method431(i1);
  6479.             }
  6480.         }
  6481.         if (l == 956 && method66(i1, k, j)) {
  6482.             stream.createFrame(35);
  6483.             stream.method431(j + baseX);
  6484.             stream.method432(anInt1137);
  6485.             stream.method432(k + baseY);
  6486.             stream.method431(i1 >> 14 & 0x7fff);
  6487.         }
  6488.         if (l == 567) {
  6489.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6490.                     myPlayer.smallX[0], false, j);
  6491.             if (!flag6)
  6492.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6493.                         myPlayer.smallX[0], false, j);
  6494.             crossX = super.saveClickX;
  6495.             crossY = super.saveClickY;
  6496.             crossType = 2;
  6497.             crossIndex = 0;
  6498.             stream.createFrame(23);
  6499.             stream.method431(k + baseY);
  6500.             stream.method431(i1);
  6501.             stream.method431(j + baseX);
  6502.         }
  6503.         if (l == 867) {
  6504.             if ((i1 & 3) == 0)
  6505.                 anInt1175++;
  6506.             if (anInt1175 >= 59) {
  6507.                 stream.createFrame(200);
  6508.                 stream.writeWord(25501);
  6509.                 anInt1175 = 0;
  6510.             }
  6511.             stream.createFrame(43);
  6512.             stream.method431(k);
  6513.             stream.method432(i1);
  6514.             stream.method432(j);
  6515.             atInventoryLoopCycle = 0;
  6516.             atInventoryInterface = k;
  6517.             atInventoryIndex = j;
  6518.             atInventoryInterfaceType = 2;
  6519.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6520.                 atInventoryInterfaceType = 1;
  6521.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6522.                 atInventoryInterfaceType = 3;
  6523.         }
  6524.         if (l == 543) {
  6525.             stream.createFrame(237);
  6526.             stream.writeWord(j);
  6527.             stream.method432(i1);
  6528.             stream.writeWord(k);
  6529.             stream.method432(anInt1137);
  6530.             atInventoryLoopCycle = 0;
  6531.             atInventoryInterface = k;
  6532.             atInventoryIndex = j;
  6533.             atInventoryInterfaceType = 2;
  6534.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6535.                 atInventoryInterfaceType = 1;
  6536.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6537.                 atInventoryInterfaceType = 3;
  6538.         }
  6539.         if (l == 606) {
  6540.             String s2 = menuActionName[i];
  6541.             int j2 = s2.indexOf("@whi@");
  6542.             if (j2 != -1)
  6543.                 if (openInterfaceID == -1) {
  6544.                     clearTopInterfaces();
  6545.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  6546.                     canMute = false;
  6547.                     for (int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++) {
  6548.                         if (RSInterface.interfaceCache[i3] == null
  6549.                                 || RSInterface.interfaceCache[i3].contentType != 600)
  6550.                             continue;
  6551.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  6552.                         break;
  6553.                     }
  6554.  
  6555.                 } else {
  6556.                     pushMessage(
  6557.                             "Please close the interface you have open before using 'report abuse'",
  6558.                             0, "");
  6559.                 }
  6560.         }
  6561.         if (l == 491) {
  6562.             Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  6563.             if (class30_sub2_sub4_sub1_sub2_6 != null) {
  6564.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6565.                         class30_sub2_sub4_sub1_sub2_6.smallY[0],
  6566.                         myPlayer.smallX[0], false,
  6567.                         class30_sub2_sub4_sub1_sub2_6.smallX[0]);
  6568.                 crossX = super.saveClickX;
  6569.                 crossY = super.saveClickY;
  6570.                 crossType = 2;
  6571.                 crossIndex = 0;
  6572.                 stream.createFrame(14);
  6573.                 stream.method432(anInt1284);
  6574.                 stream.writeWord(i1);
  6575.                 stream.writeWord(anInt1285);
  6576.                 stream.method431(anInt1283);
  6577.             }
  6578.         }
  6579.         if (l == 639) {
  6580.             String s3 = menuActionName[i];
  6581.             int k2 = s3.indexOf("@whi@");
  6582.             if (k2 != -1) {
  6583.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  6584.                 int k3 = -1;
  6585.                 for (int i4 = 0; i4 < friendsCount; i4++) {
  6586.                     if (friendsListAsLongs[i4] != l4)
  6587.                         continue;
  6588.                     k3 = i4;
  6589.                     break;
  6590.                 }
  6591.  
  6592.                 if (k3 != -1 && friendsNodeIDs[k3] > 0) {
  6593.                     inputTaken = true;
  6594.                     inputDialogState = 0;
  6595.                     messagePromptRaised = true;
  6596.                     promptInput = "";
  6597.                     friendsListAction = 3;
  6598.                     aLong953 = friendsListAsLongs[k3];
  6599.                     aString1121 = "Enter message to send to " + friendsList[k3];
  6600.                 }
  6601.             }
  6602.         }
  6603.         if (l == 454) {
  6604.             stream.createFrame(41);
  6605.             stream.writeWord(i1);
  6606.             stream.method432(j);
  6607.             stream.method432(k);
  6608.             atInventoryLoopCycle = 0;
  6609.             atInventoryInterface = k;
  6610.             atInventoryIndex = j;
  6611.             atInventoryInterfaceType = 2;
  6612.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6613.                 atInventoryInterfaceType = 1;
  6614.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6615.                 atInventoryInterfaceType = 3;
  6616.         }
  6617.         if (l == 478) {
  6618.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  6619.             if (class30_sub2_sub4_sub1_sub1_7 != null) {
  6620.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  6621.                         class30_sub2_sub4_sub1_sub1_7.smallY[0],
  6622.                         myPlayer.smallX[0], false,
  6623.                         class30_sub2_sub4_sub1_sub1_7.smallX[0]);
  6624.                 crossX = super.saveClickX;
  6625.                 crossY = super.saveClickY;
  6626.                 crossType = 2;
  6627.                 crossIndex = 0;
  6628.                 if ((i1 & 3) == 0)
  6629.                     anInt1155++;
  6630.                 if (anInt1155 >= 53) {
  6631.                     stream.createFrame(85);
  6632.                     stream.writeWordBigEndian(66);
  6633.                     anInt1155 = 0;
  6634.                 }
  6635.                 stream.createFrame(18);
  6636.                 stream.method431(i1);
  6637.             }
  6638.         }
  6639.         if (l == 113) {
  6640.             method66(i1, k, j);
  6641.             stream.createFrame(70);
  6642.             stream.method431(j + baseX);
  6643.             stream.writeWord(k + baseY);
  6644.             stream.method433(i1 >> 14 & 0x7fff);
  6645.         }
  6646.         if (l == 872) {
  6647.             method66(i1, k, j);
  6648.             stream.createFrame(234);
  6649.             stream.method433(j + baseX);
  6650.             stream.method432(i1 >> 14 & 0x7fff);
  6651.             stream.method433(k + baseY);
  6652.         }
  6653.         if (l == 502) {
  6654.             method66(i1, k, j);
  6655.             stream.createFrame(132);
  6656.             stream.method433(j + baseX);
  6657.             stream.writeWord(i1 >> 14 & 0x7fff);
  6658.             stream.method432(k + baseY);
  6659.         }
  6660.         if (l == 1125) {
  6661.             ItemDef itemDef = ItemDef.forID(i1);
  6662.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  6663.             String s5;
  6664.             if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0)
  6665.                 s5 = class9_4.invStackSizes[j] + " x " + itemDef.name;
  6666.             else if (itemDef.description != null)
  6667.                 s5 = new String(itemDef.description);
  6668.             else
  6669.                 s5 = "It's a " + itemDef.name + ".";
  6670.             pushMessage(s5, 0, "");
  6671.         }
  6672.         if (l == 169) {
  6673.             stream.createFrame(185);
  6674.             stream.writeWord(k);
  6675.             RSInterface class9_3 = RSInterface.interfaceCache[k];
  6676.             if (class9_3.valueIndexArray != null
  6677.                     && class9_3.valueIndexArray[0][0] == 5) {
  6678.                 int l2 = class9_3.valueIndexArray[0][1];
  6679.                 variousSettings[l2] = 1 - variousSettings[l2];
  6680.                 method33(l2);
  6681.                 needDrawTabArea = true;
  6682.             }
  6683.         }
  6684.         if (l == 447) {
  6685.             itemSelected = 1;
  6686.             anInt1283 = j;
  6687.             anInt1284 = k;
  6688.             anInt1285 = i1;
  6689.             selectedItemName = ItemDef.forID(i1).name;
  6690.             spellSelected = 0;
  6691.             needDrawTabArea = true;
  6692.             return;
  6693.         }
  6694.         if (l == 1226) {
  6695.             int j1 = i1 >> 14 & 0x7fff;
  6696.             ObjectDef class46 = ObjectDef.forID(j1);
  6697.             String s10;
  6698.             if (class46.description != null)
  6699.                 s10 = new String(class46.description);
  6700.             else
  6701.                 s10 = "It's a " + class46.name + ".";
  6702.             pushMessage(s10, 0, "");
  6703.         }
  6704.         if (l == 244) {
  6705.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  6706.                     myPlayer.smallX[0], false, j);
  6707.             if (!flag7)
  6708.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  6709.                         myPlayer.smallX[0], false, j);
  6710.             crossX = super.saveClickX;
  6711.             crossY = super.saveClickY;
  6712.             crossType = 2;
  6713.             crossIndex = 0;
  6714.             stream.createFrame(253);
  6715.             stream.method431(j + baseX);
  6716.             stream.method433(k + baseY);
  6717.             stream.method432(i1);
  6718.         }
  6719.         if (l == 1448) {
  6720.             ItemDef itemDef_1 = ItemDef.forID(i1);
  6721.             String s6;
  6722.             if (itemDef_1.description != null)
  6723.                 s6 = new String(itemDef_1.description);
  6724.             else
  6725.                 s6 = "It's a " + itemDef_1.name + ".";
  6726.             pushMessage(s6, 0, "");
  6727.         }
  6728.         itemSelected = 0;
  6729.         spellSelected = 0;
  6730.         needDrawTabArea = true;
  6731.  
  6732.     }
  6733.  
  6734.     private void method70() {
  6735.         anInt1251 = 0;
  6736.         int j = (myPlayer.x >> 7) + baseX;
  6737.         int k = (myPlayer.y >> 7) + baseY;
  6738.         if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  6739.             anInt1251 = 1;
  6740.         if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  6741.             anInt1251 = 1;
  6742.         if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  6743.             anInt1251 = 0;
  6744.     }
  6745.  
  6746.     public void run() {
  6747.         if (drawFlames) {
  6748.             drawFlames();
  6749.         } else {
  6750.             super.run();
  6751.         }
  6752.     }
  6753.  
  6754.     private void build3dScreenMenu() {
  6755.         if (itemSelected == 0 && spellSelected == 0) {
  6756.             menuActionName[menuActionRow] = "Walk here";
  6757.             menuActionID[menuActionRow] = 516;
  6758.             menuActionCmd2[menuActionRow] = super.mouseX;
  6759.             menuActionCmd3[menuActionRow] = super.mouseY;
  6760.             menuActionRow++;
  6761.         }
  6762.         int j = -1;
  6763.         for (int k = 0; k < Model.anInt1687; k++) {
  6764.             int l = Model.anIntArray1688[k];
  6765.             int i1 = l & 0x7f;
  6766.             int j1 = l >> 7 & 0x7f;
  6767.             int k1 = l >> 29 & 3;
  6768.             int l1 = l >> 14 & 0x7fff;
  6769.             if (l == j)
  6770.                 continue;
  6771.             j = l;
  6772.             if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
  6773.                 ObjectDef class46 = ObjectDef.forID(l1);
  6774.                 if (class46.childrenIDs != null)
  6775.                     class46 = class46.method580();
  6776.                 if (class46 == null)
  6777.                     continue;
  6778.                 if (itemSelected == 1) {
  6779.                     menuActionName[menuActionRow] = "Use " + selectedItemName
  6780.                             + " with @cya@" + class46.name;
  6781.                     menuActionID[menuActionRow] = 62;
  6782.                     menuActionCmd1[menuActionRow] = l;
  6783.                     menuActionCmd2[menuActionRow] = i1;
  6784.                     menuActionCmd3[menuActionRow] = j1;
  6785.                     menuActionRow++;
  6786.                 } else if (spellSelected == 1) {
  6787.                     if ((spellUsableOn & 4) == 4) {
  6788.                         menuActionName[menuActionRow] = spellTooltip + " @cya@"
  6789.                                 + class46.name;
  6790.                         menuActionID[menuActionRow] = 956;
  6791.                         menuActionCmd1[menuActionRow] = l;
  6792.                         menuActionCmd2[menuActionRow] = i1;
  6793.                         menuActionCmd3[menuActionRow] = j1;
  6794.                         menuActionRow++;
  6795.                     }
  6796.                 } else {
  6797.                     if (class46.actions != null) {
  6798.                         for (int i2 = 4; i2 >= 0; i2--)
  6799.                             if (class46.actions[i2] != null) {
  6800.                                 menuActionName[menuActionRow] = class46.actions[i2]
  6801.                                         + " @cya@" + class46.name;
  6802.                                 if (i2 == 0)
  6803.                                     menuActionID[menuActionRow] = 502;
  6804.                                 if (i2 == 1)
  6805.                                     menuActionID[menuActionRow] = 900;
  6806.                                 if (i2 == 2)
  6807.                                     menuActionID[menuActionRow] = 113;
  6808.                                 if (i2 == 3)
  6809.                                     menuActionID[menuActionRow] = 872;
  6810.                                 if (i2 == 4)
  6811.                                     menuActionID[menuActionRow] = 1062;
  6812.                                 menuActionCmd1[menuActionRow] = l;
  6813.                                 menuActionCmd2[menuActionRow] = i1;
  6814.                                 menuActionCmd3[menuActionRow] = j1;
  6815.                                 menuActionRow++;
  6816.                             }
  6817.  
  6818.                     }
  6819.                     // menuActionName[menuActionRow] = "Examine @cya@" +
  6820.                     // class46.name + " @gre@(@whi@" + l1 + "@gre@) (@whi@" +
  6821.                     // (i1 + baseX) + "," + (j1 + baseY) + "@gre@)";
  6822.                     menuActionName[menuActionRow] = "Examine @cya@"
  6823.                             + class46.name/* + " " + class46.type */;
  6824.                     menuActionID[menuActionRow] = 1226;
  6825.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  6826.                     menuActionCmd2[menuActionRow] = i1;
  6827.                     menuActionCmd3[menuActionRow] = j1;
  6828.                     menuActionRow++;
  6829.                 }
  6830.             }
  6831.             if (k1 == 1) {
  6832.                 NPC npc = npcArray[l1];
  6833.                 if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64
  6834.                         && (npc.y & 0x7f) == 64) {
  6835.                     for (int j2 = 0; j2 < npcCount; j2++) {
  6836.                         NPC npc2 = npcArray[npcIndices[j2]];
  6837.                         if (npc2 != null && npc2 != npc
  6838.                                 && npc2.desc.aByte68 == 1 && npc2.x == npc.x
  6839.                                 && npc2.y == npc.y)
  6840.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  6841.                     }
  6842.  
  6843.                     for (int l2 = 0; l2 < playerCount; l2++) {
  6844.                         Player player = playerArray[playerIndices[l2]];
  6845.                         if (player != null && player.x == npc.x
  6846.                                 && player.y == npc.y)
  6847.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  6848.                     }
  6849.  
  6850.                 }
  6851.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  6852.             }
  6853.             if (k1 == 0) {
  6854.                 Player player = playerArray[l1];
  6855.                 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  6856.                     for (int k2 = 0; k2 < npcCount; k2++) {
  6857.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  6858.                         if (class30_sub2_sub4_sub1_sub1_2 != null
  6859.                                 && class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1
  6860.                                 && class30_sub2_sub4_sub1_sub1_2.x == player.x
  6861.                                 && class30_sub2_sub4_sub1_sub1_2.y == player.y)
  6862.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc,
  6863.                                     npcIndices[k2], j1, i1);
  6864.                     }
  6865.  
  6866.                     for (int i3 = 0; i3 < playerCount; i3++) {
  6867.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  6868.                         if (class30_sub2_sub4_sub1_sub2_2 != null
  6869.                                 && class30_sub2_sub4_sub1_sub2_2 != player
  6870.                                 && class30_sub2_sub4_sub1_sub2_2.x == player.x
  6871.                                 && class30_sub2_sub4_sub1_sub2_2.y == player.y)
  6872.                             buildAtPlayerMenu(i1, playerIndices[i3],
  6873.                                     class30_sub2_sub4_sub1_sub2_2, j1);
  6874.                     }
  6875.  
  6876.                 }
  6877.                 buildAtPlayerMenu(i1, l1, player, j1);
  6878.             }
  6879.             if (k1 == 3) {
  6880.                 NodeList class19 = groundArray[plane][i1][j1];
  6881.                 if (class19 != null) {
  6882.                     for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19
  6883.                             .getNext()) {
  6884.                         ItemDef itemDef = ItemDef.forID(item.ID);
  6885.                         if (itemSelected == 1) {
  6886.                             menuActionName[menuActionRow] = "Use "
  6887.                                     + selectedItemName + " with @lre@"
  6888.                                     + itemDef.name;
  6889.                             menuActionID[menuActionRow] = 511;
  6890.                             menuActionCmd1[menuActionRow] = item.ID;
  6891.                             menuActionCmd2[menuActionRow] = i1;
  6892.                             menuActionCmd3[menuActionRow] = j1;
  6893.                             menuActionRow++;
  6894.                         } else if (spellSelected == 1) {
  6895.                             if ((spellUsableOn & 1) == 1) {
  6896.                                 menuActionName[menuActionRow] = spellTooltip
  6897.                                         + " @lre@" + itemDef.name;
  6898.                                 menuActionID[menuActionRow] = 94;
  6899.                                 menuActionCmd1[menuActionRow] = item.ID;
  6900.                                 menuActionCmd2[menuActionRow] = i1;
  6901.                                 menuActionCmd3[menuActionRow] = j1;
  6902.                                 menuActionRow++;
  6903.                             }
  6904.                         } else {
  6905.                             for (int j3 = 4; j3 >= 0; j3--)
  6906.                                 if (itemDef.groundActions != null
  6907.                                         && itemDef.groundActions[j3] != null) {
  6908.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3]
  6909.                                             + " @lre@" + itemDef.name;
  6910.                                     if (j3 == 0)
  6911.                                         menuActionID[menuActionRow] = 652;
  6912.                                     if (j3 == 1)
  6913.                                         menuActionID[menuActionRow] = 567;
  6914.                                     if (j3 == 2)
  6915.                                         menuActionID[menuActionRow] = 234;
  6916.                                     if (j3 == 3)
  6917.                                         menuActionID[menuActionRow] = 244;
  6918.                                     if (j3 == 4)
  6919.                                         menuActionID[menuActionRow] = 213;
  6920.                                     menuActionCmd1[menuActionRow] = item.ID;
  6921.                                     menuActionCmd2[menuActionRow] = i1;
  6922.                                     menuActionCmd3[menuActionRow] = j1;
  6923.                                     menuActionRow++;
  6924.                                 } else
  6925.                                     for (j3 = 4; j3 >= 0; j3--)
  6926.  
  6927.                                         if (j3 == 2) {
  6928.                                             menuActionName[menuActionRow] = "Take @lre@"
  6929.                                                     + itemDef.name;
  6930.                                             menuActionID[menuActionRow] = 234;
  6931.                                             menuActionCmd1[menuActionRow] = item.ID;
  6932.                                             menuActionCmd2[menuActionRow] = i1;
  6933.                                             menuActionCmd3[menuActionRow] = j1;
  6934.                                             menuActionRow++;
  6935.                                         }
  6936.  
  6937.                             // menuActionName[menuActionRow] = "Examine @lre@" +
  6938.                             // itemDef.name + " @gre@(@whi@" + item.ID +
  6939.                             // "@gre@)";
  6940.                             menuActionName[menuActionRow] = "Examine @lre@"
  6941.                                     + itemDef.name;
  6942.                             menuActionID[menuActionRow] = 1448;
  6943.                             menuActionCmd1[menuActionRow] = item.ID;
  6944.                             menuActionCmd2[menuActionRow] = i1;
  6945.                             menuActionCmd3[menuActionRow] = j1;
  6946.                             menuActionRow++;
  6947.                         }
  6948.                     }
  6949.  
  6950.                 }
  6951.             }
  6952.         }
  6953.     }
  6954.    
  6955.     public int cleanUpModels(){
  6956.         int number = 0;
  6957.         number += (int)Math.pow(31, 2);
  6958.         number *= 383;
  6959.         number += 5282457;
  6960.         number = number /2;
  6961.         return 773287632;
  6962.     }
  6963.     public int cleanUpTextures() {
  6964.         int i = 0;
  6965.         i += (int)Math.pow(31.0D, 2.0D);
  6966.         i *= 383;
  6967.         i += 7382457;
  6968.         i /= 2;
  6969.         return 89023489;
  6970.     }
  6971.  
  6972.     public void cleanUpForQuit() {
  6973.         signlink.reporterror = false;
  6974.         try {
  6975.             if (socketStream != null)
  6976.                 socketStream.close();
  6977.         } catch (Exception _ex) {
  6978.         }
  6979.         socketStream = null;
  6980.         stopMidi();
  6981.         if (mouseDetection != null)
  6982.             mouseDetection.running = false;
  6983.         mouseDetection = null;
  6984.         onDemandFetcher.disable();
  6985.         clickedQuickPrayers = false;
  6986.         HPBarFull = null;
  6987.         HPBarEmpty = null;
  6988.         onDemandFetcher = null;
  6989.         aStream_834 = null;
  6990.         stream = null;
  6991.         aStream_847 = null;
  6992.         inStream = null;
  6993.         anIntArray1234 = null;
  6994.         aByteArrayArray1183 = null;
  6995.         aByteArrayArray1247 = null;
  6996.         anIntArray1235 = null;
  6997.         anIntArray1236 = null;
  6998.         intGroundArray = null;
  6999.         byteGroundArray = null;
  7000.         worldController = null;
  7001.         aClass11Array1230 = null;
  7002.         anIntArrayArray901 = null;
  7003.         anIntArrayArray825 = null;
  7004.         bigX = null;
  7005.         bigY = null;
  7006.         aByteArray912 = null;
  7007.         aRSImageProducer_1163 = null;
  7008.         aRSImageProducer_1164 = null;
  7009.         aRSImageProducer_1165 = null;
  7010.         aRSImageProducer_1166 = null;
  7011.         aRSImageProducer_1123 = null;
  7012.         aRSImageProducer_1124 = null;
  7013.         aRSImageProducer_1125 = null;
  7014.         /* Null pointers for custom sprites */
  7015.         alertBack = null;
  7016.         alertBorder = null;
  7017.         alertBorderH = null;
  7018.         multiOverlay = null;
  7019.         duelingOverlay = null;
  7020.         chatArea = null;
  7021.         chatButtons = null;
  7022.         chatButtonH = null;
  7023.         chatButtonHC = null;
  7024.         chatButtonC = null;
  7025.         reportH = null;
  7026.         tabArea = null;
  7027.         mapArea = null;
  7028.         logIconH = null;
  7029.         logIconC = null;
  7030.         worldMapIcon = null;
  7031.         emptyOrb = null;
  7032.         hitPointsFill = null;
  7033.         hitPointsIcon = null;
  7034.         prayerFill = null;
  7035.         prayerIcon = null;
  7036.         frame = null;
  7037.         /**/
  7038.         mapBack = null;
  7039.         sideIcons = null;
  7040.         redStones = null;
  7041.         compass = null;
  7042.         hitMarks = null;
  7043.         headIcons = null;
  7044.         headIconsHint = null;
  7045.         skullIcons = null;
  7046.         crosses = null;
  7047.         mapDotItem = null;
  7048.         mapDotNPC = null;
  7049.         mapDotPlayer = null;
  7050.         mapDotFriend = null;
  7051.         mapDotBL = null;
  7052.         mapDotTeam = null;
  7053.         mapScenes = null;
  7054.         mapFunctions = null;
  7055.         anIntArrayArray929 = null;
  7056.         playerArray = null;
  7057.         playerIndices = null;
  7058.         anIntArray894 = null;
  7059.         aStreamArray895s = null;
  7060.         anIntArray840 = null;
  7061.         npcArray = null;
  7062.         npcIndices = null;
  7063.         groundArray = null;
  7064.         aClass19_1179 = null;
  7065.         aClass19_1013 = null;
  7066.         aClass19_1056 = null;
  7067.         menuActionCmd2 = null;
  7068.         menuActionCmd3 = null;
  7069.         menuActionID = null;
  7070.         menuActionCmd1 = null;
  7071.         menuActionName = null;
  7072.         variousSettings = null;
  7073.         anIntArray1072 = null;
  7074.         anIntArray1073 = null;
  7075.         aClass30_Sub2_Sub1_Sub1Array1140 = null;
  7076.         aClass30_Sub2_Sub1_Sub1_1263 = null;
  7077.         friendsList = null;
  7078.         friendsListAsLongs = null;
  7079.         friendsNodeIDs = null;
  7080.         aRSImageProducer_1110 = null;
  7081.         aRSImageProducer_1111 = null;
  7082.         aRSImageProducer_1107 = null;
  7083.         aRSImageProducer_1108 = null;
  7084.         aRSImageProducer_1109 = null;
  7085.         aRSImageProducer_1112 = null;
  7086.         aRSImageProducer_1113 = null;
  7087.         aRSImageProducer_1114 = null;
  7088.         aRSImageProducer_1115 = null;
  7089.         nullLoader();
  7090.         ObjectDef.nullLoader();
  7091.         EntityDef.nullLoader();
  7092.         ItemDef.nullLoader();
  7093.         Flo.cache = null;
  7094.         IDK.cache = null;
  7095.         RSInterface.interfaceCache = null;
  7096.         DummyClass.cache = null;
  7097.         Animation.anims = null;
  7098.         SpotAnim.cache = null;
  7099.         SpotAnim.aMRUNodes_415 = null;
  7100.         Varp.cache = null;
  7101.         super.fullGameScreen = null;
  7102.         Player.mruNodes = null;
  7103.         Texture.nullLoader();
  7104.         WorldController.nullLoader();
  7105.         Model.nullLoader();
  7106.         Class36.nullLoader();
  7107.         System.gc();
  7108.     }
  7109.  
  7110.     private void printDebug() {
  7111.         System.out.println("============");
  7112.         System.out.println("flame-cycle:" + anInt1208);
  7113.         if (onDemandFetcher != null)
  7114.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  7115.         System.out.println("loop-cycle:" + loopCycle);
  7116.         System.out.println("draw-cycle:" + anInt1061);
  7117.         System.out.println("ptype:" + pktType);
  7118.         System.out.println("psize:" + pktSize);
  7119.         if (socketStream != null)
  7120.             socketStream.printDebug();
  7121.         super.shouldDebug = true;
  7122.     }
  7123.  
  7124.     Component getGameComponent() {
  7125.         if (signlink.mainapp != null)
  7126.             return signlink.mainapp;
  7127.         if (super.gameFrame != null)
  7128.             return super.gameFrame;
  7129.         else
  7130.             return this;
  7131.     }
  7132.  
  7133.     public byte[] getModel(int Index) {
  7134.         try {
  7135.             File Model = new File("./Models/" + Index + ".gz");
  7136.             byte[] aByte = new byte[(int) Model.length()];
  7137.             FileInputStream fis = new FileInputStream(Model);
  7138.             fis.read(aByte);
  7139.             pushMessage("aByte = [" + aByte + "]!", 0, "");
  7140.             fis.close();
  7141.             return aByte;
  7142.         } catch (Exception e) {
  7143.             return null;
  7144.         }
  7145.     }
  7146.  
  7147.     public int getNewAchievements() {
  7148.         // return 894237500;
  7149.         return 894237418;
  7150.     }
  7151.  
  7152.     private void method73() {
  7153.         do {
  7154.             int j = readChar(-796);
  7155.             if (j == -1)
  7156.                 break;
  7157.             if (openInterfaceID != -1
  7158.                     && openInterfaceID == reportAbuseInterfaceID) {
  7159.                 if (j == 8 && reportAbuseInput.length() > 0)
  7160.                     reportAbuseInput = reportAbuseInput.substring(0,
  7161.                             reportAbuseInput.length() - 1);
  7162.                 if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48
  7163.                         && j <= 57 || j == 32)
  7164.                         && reportAbuseInput.length() < 12)
  7165.                     reportAbuseInput += (char) j;
  7166.             } else if (messagePromptRaised) {
  7167.                 if (j >= 32 && j <= 122 && promptInput.length() < 80) {
  7168.                     promptInput += (char) j;
  7169.                     inputTaken = true;
  7170.                 }
  7171.                 if (j == 8 && promptInput.length() > 0) {
  7172.                     promptInput = promptInput.substring(0,
  7173.                             promptInput.length() - 1);
  7174.                     inputTaken = true;
  7175.                 }
  7176.                 if (j == 13 || j == 10) {
  7177.                     messagePromptRaised = false;
  7178.                     inputTaken = true;
  7179.                     if (friendsListAction == 1) {
  7180.                         long l = TextClass.longForName(promptInput);
  7181.                         addFriend(l);
  7182.                     }
  7183.                     if (friendsListAction == 2 && friendsCount > 0) {
  7184.                         long l1 = TextClass.longForName(promptInput);
  7185.                         delFriend(l1);
  7186.                     }
  7187.                     if (friendsListAction == 3 && promptInput.length() > 0) {
  7188.                         stream.createFrame(126);
  7189.                         stream.writeWordBigEndian(0);
  7190.                         int k = stream.currentOffset;
  7191.                         stream.writeQWord(aLong953);
  7192.                         TextInput.method526(promptInput, stream);
  7193.                         stream.writeBytes(stream.currentOffset - k);
  7194.                         promptInput = TextInput.processText(promptInput);
  7195.                         // promptInput = Censor.doCensor(promptInput);
  7196.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass
  7197.                                 .nameForLong(aLong953)));
  7198.                         if (privateChatMode == 2) {
  7199.                             privateChatMode = 1;
  7200.                             aBoolean1233 = true;
  7201.                             stream.createFrame(95);
  7202.                             stream.writeWordBigEndian(publicChatMode);
  7203.                             stream.writeWordBigEndian(privateChatMode);
  7204.                             stream.writeWordBigEndian(tradeMode);
  7205.                             System.out.println("Chat Mode:" + privateChatMode);
  7206.                         }
  7207.                     }
  7208.                     if (friendsListAction == 4 && ignoreCount < 100) {
  7209.                         long l2 = TextClass.longForName(promptInput);
  7210.                         addIgnore(l2);
  7211.                     }
  7212.                     if (friendsListAction == 5 && ignoreCount > 0) {
  7213.                         long l3 = TextClass.longForName(promptInput);
  7214.                         delIgnore(l3);
  7215.                     }
  7216.                 }
  7217.             } else if (inputDialogState == 1) {
  7218.                 if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
  7219.                     amountOrNameInput += (char) j;
  7220.                     inputTaken = true;
  7221.                 }
  7222.                 if ((!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput
  7223.                         .toLowerCase().contains("m") && !amountOrNameInput
  7224.                         .toLowerCase().contains("b"))
  7225.                         && (j == 107 || j == 109) || j == 98) {
  7226.                     amountOrNameInput += (char) j;
  7227.                     inputTaken = true;
  7228.                 }
  7229.                 if (j == 8 && amountOrNameInput.length() > 0) {
  7230.                     amountOrNameInput = amountOrNameInput.substring(0,
  7231.                             amountOrNameInput.length() - 1);
  7232.                     inputTaken = true;
  7233.                 }
  7234.                 if (j == 13 || j == 10) {
  7235.                     if (amountOrNameInput.length() > 0) {
  7236.                         if (amountOrNameInput.toLowerCase().contains("k")) {
  7237.  
  7238.                             amountOrNameInput = amountOrNameInput.replaceFirst(
  7239.                                     "k", "000");
  7240.                             amountOrNameInput = amountOrNameInput.replaceAll(
  7241.                                     "k", "");
  7242.                             amountOrNameInput.trim();
  7243.                         } else if (amountOrNameInput.toLowerCase()
  7244.                                 .contains("m")) {
  7245.                             amountOrNameInput = amountOrNameInput.replaceFirst(
  7246.                                     "m", "000000");
  7247.                             amountOrNameInput = amountOrNameInput.replaceAll(
  7248.                                     "m", "");
  7249.                             amountOrNameInput.trim();
  7250.                         }
  7251.                         else if (amountOrNameInput.toLowerCase()
  7252.                                 .contains("b")) {
  7253.                             amountOrNameInput = amountOrNameInput.replaceFirst(
  7254.                                     "b", "000000000");
  7255.                             amountOrNameInput = amountOrNameInput.replaceAll(
  7256.                                     "b", "");
  7257.                             amountOrNameInput.trim();
  7258.                         }
  7259.                         int amount = 0;
  7260.                         try {
  7261.                             if (amount > Integer.parseInt(amountOrNameInput)) {
  7262.                                 amount = 2000000000;
  7263.                             } else {
  7264.                                 amount = Integer.parseInt(amountOrNameInput);
  7265.                             }
  7266.                             stream.createFrame(208);
  7267.                             stream.writeDWord(amount);
  7268.                         } catch (Exception e){
  7269.                         }
  7270.                     }
  7271.                     inputDialogState = 0;
  7272.                     inputTaken = true;
  7273.                 }
  7274.             } else if (inputDialogState == 2) {
  7275.                 if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  7276.                     amountOrNameInput += (char) j;
  7277.                     inputTaken = true;
  7278.                 }
  7279.                 if (j == 8 && amountOrNameInput.length() > 0) {
  7280.                     amountOrNameInput = amountOrNameInput.substring(0,
  7281.                             amountOrNameInput.length() - 1);
  7282.                     inputTaken = true;
  7283.                 }
  7284.                 if (j == 13 || j == 10) {
  7285.                     if (amountOrNameInput.length() > 0) {
  7286.                         stream.createFrame(60);
  7287.                         stream.writeQWord(TextClass
  7288.                                 .longForName(amountOrNameInput));
  7289.                     }
  7290.                     inputDialogState = 0;
  7291.                     inputTaken = true;
  7292.                 }
  7293.             } else if (backDialogID == -1) {
  7294.                 if (j >= 32 && j <= 122 && inputString.length() < 80) {
  7295.                     inputString += (char) j;
  7296.                     inputTaken = true;
  7297.                 }
  7298.                 if (j == 8 && inputString.length() > 0) {
  7299.                     inputString = inputString.substring(0,
  7300.                             inputString.length() - 1);
  7301.                     inputTaken = true;
  7302.                 }
  7303.                 if ((j == 13 || j == 10) && inputString.length() > 0) {
  7304.                     if (inputString.equals("::preload")) {
  7305.                         preloadModels();
  7306.                         resetLogout();
  7307.                     }// for now until bugs are fixed
  7308.                     if (myPrivilege == 11) {
  7309.                         if (inputString.equals("::clientdrop"))
  7310.                             dropClient();
  7311.                         if (inputString.equals("::lag"))
  7312.                             printDebug();
  7313.                         if (inputString.equals("::dumpmodels"))
  7314.                             models();
  7315.                         if (inputString.equals("::prefetchmusic")) {
  7316.                             for (int j1 = 0; j1 < onDemandFetcher
  7317.                                     .getVersionCount(2); j1++)
  7318.                                 onDemandFetcher.method563((byte) 1, 2, j1);
  7319.  
  7320.                         }
  7321.                         if (inputString.equals("::fpson"))
  7322.                             fpsOn = true;
  7323.                         if (inputString.equals("::fpsoff"))
  7324.                             fpsOn = false;
  7325.                         if (inputString.equals("::dataon"))
  7326.                             clientData = true;
  7327.                         if (inputString.equals("::dataoff"))
  7328.                             clientData = false;
  7329.                         /*if (inputString.equals("::noclip")) {
  7330.                             for (int k1 = 0; k1 < 4; k1++) {
  7331.                                 for (int i2 = 1; i2 < 103; i2++) {
  7332.                                     for (int k2 = 1; k2 < 103; k2++)
  7333.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  7334.  
  7335.                                 }
  7336.  
  7337.                             }
  7338.  
  7339.                         }*/
  7340.                     }
  7341.                     if (inputString.startsWith("::wiki")) {
  7342.                         if (inputString.length() > 7) {
  7343.                             String topic = inputString.substring(7);
  7344.                             launchURL("http://nrwiki.com/index.php?title=Special%3ASearch&search="
  7345.                                     + topic + "&go=Go");
  7346.                             pushMessage(
  7347.                                     "@red@Launching nrwiki search for the topic: "
  7348.                                             + topic, 0, "");
  7349.                         } else {
  7350.                             pushMessage("@red@The syntex is ::wiki players", 0,
  7351.                                     "");
  7352.                         }
  7353.                     }
  7354.                     if (inputString.startsWith("::bugreport")) {
  7355.  
  7356.                     }
  7357.                     if (inputString.startsWith("::pm")) {
  7358.                             boolean flag = inputString.contains(",");
  7359.                             if (flag) {
  7360.                                 stream.createFrame(126);
  7361.                                 stream.writeWordBigEndian(0);
  7362.                                 int k = stream.currentOffset;
  7363.                                 String username = null;
  7364.                                 String message = null;
  7365.                                 int divider = inputString.indexOf(",");
  7366.                                 username = inputString.substring(5, divider);
  7367.                                 message = inputString.substring(divider + 1,
  7368.                                         inputString.length());
  7369.                                 stream.writeQWord(TextClass
  7370.                                         .longForName(username));
  7371.                                 TextInput.method526(message, stream);
  7372.                                 stream.writeBytes(stream.currentOffset - k);
  7373.                                 message = TextInput.processText(message);
  7374.                                 pushMessage(message, 6, TextClass
  7375.                                         .fixName(username));
  7376.                                 if (privateChatMode == 2) {
  7377.                                     privateChatMode = 1;
  7378.                                     aBoolean1233 = true;
  7379.                                     stream.createFrame(95);
  7380.                                     stream.writeWordBigEndian(publicChatMode);
  7381.                                     stream.writeWordBigEndian(privateChatMode);
  7382.                                     stream.writeWordBigEndian(tradeMode);
  7383.                                     System.out.println("Chat Mode:"
  7384.                                             + privateChatMode);
  7385.                                 }
  7386.                             } else {
  7387.                                 pushMessage("The Syntex is ::pm name,text!", 0,
  7388.                                         "");
  7389.                             }
  7390.                     }
  7391.                     if (inputString.startsWith("::shortkeys")){
  7392.                         new ShortKeyFrame(sk);
  7393.                     }
  7394.                    
  7395.                     if (inputString.startsWith("::vote")) {
  7396.                         launchURL("http://runeps.com/vote.php");
  7397.                     }
  7398.                     if (inputString.startsWith("::names")) {
  7399.                         names = !names;
  7400.                     }
  7401.                     if (inputString.startsWith(":quicks:"))
  7402.                         clickedQuickPrayers = inputString.substring(8)
  7403.                                 .equalsIgnoreCase("on");
  7404.                     if (inputString.startsWith(":prayer:"))
  7405.                         prayerBook = inputString.substring(8);
  7406.                     if (inputString.startsWith("/")) {
  7407.                         /*
  7408.                          * if(myPrivilege == 1) inputString = "::cm " +"@cr0@"+
  7409.                          * inputString.substring(1); 9075 if(myPrivilege == 2)
  7410.                          * inputString = "::cm " +"@cr1@"+
  7411.                          * inputString.substring(1); if(myPrivilege == 3)
  7412.                          * inputString = "::cm " +"@cr2@"+
  7413.                          * inputString.substring(1); if(myPrivilege == 4)
  7414.                          * inputString = "::cm " +"@cr3@"+
  7415.                          * inputString.substring(1); if(myPrivilege == 5)
  7416.                          * inputString = "::cm " +"@cr4@"+
  7417.                          * inputString.substring(1); if(myPrivilege == 6)
  7418.                          * f
  7419.                          "::cm " +"@cr5@"+
  7420.                          * inputString.substring(1); if(myPrivilege == 7)
  7421.                          * inputString = "::cm " +"@cr6@"+
  7422.                          * inputString.substring(1); if(myPrivilege == 8)
  7423.                          * inputString = "::cm " +"@cr7@"+
  7424.                          * inputString.substring(1); if(myPrivilege == 9)
  7425.                          * inputString = "::cm " +"@cr8@"+
  7426.                          * inputString.substring(1); if(myPrivilege == 10)
  7427.                          * inputString = "::cm " +"@cr9@"+
  7428.                          * inputString.substring(1); if(myPrivilege == 11)
  7429.                          * inputString = "::cm " +"@crA@"+
  7430.                          * inputString.substring(1); if(myPrivilege == 0)
  7431.                          */
  7432.                         inputString = "::cm " + inputString.substring(1);
  7433.                     }
  7434.                     // our shortkeys
  7435.                     try{
  7436.                         for(Entry s : sk.getShortKeys()){
  7437.                             if(s.getKey().contains("/") || s.getKey().contains("::pin"))
  7438.                                 continue;
  7439.                            
  7440.                             Pattern p = Pattern.compile("(^|)"+s.getKey()+"(\\s|$)"); // use regex to break up string
  7441.                             Matcher m = p.matcher(inputString);
  7442.                             inputString  = m.replaceAll(s.getValue());
  7443.                         }
  7444.                     }catch(Exception e){ }
  7445.                    
  7446.                     if (inputString.startsWith("::")) {
  7447.                         stream.createFrame(103);
  7448.                         stream.writeWordBigEndian(inputString.length() - 1);
  7449.                         stream.writeString(inputString.substring(2));
  7450.                     } else {
  7451.                         String s = inputString.toLowerCase();
  7452.                         int j2 = 0;
  7453.                         if (s.startsWith("yellow:")) {
  7454.                             j2 = 0;
  7455.                             inputString = inputString.substring(7);
  7456.                         } else if (s.startsWith("red:")) {
  7457.                             j2 = 1;
  7458.                             inputString = inputString.substring(4);
  7459.                         } else if (s.startsWith("green:")) {
  7460.                             j2 = 2;
  7461.                             inputString = inputString.substring(6);
  7462.                         } else if (s.startsWith("cyan:")) {
  7463.                             j2 = 3;
  7464.                             inputString = inputString.substring(5);
  7465.                         } else if (s.startsWith("purple:")) {
  7466.                             j2 = 4;
  7467.                             inputString = inputString.substring(7);
  7468.                         } else if (s.startsWith("white:")) {
  7469.                             j2 = 5;
  7470.                             inputString = inputString.substring(6);
  7471.                         } else if (s.startsWith("flash1:")) {
  7472.                             j2 = 6;
  7473.                             inputString = inputString.substring(7);
  7474.                         } else if (s.startsWith("flash2:")) {
  7475.                             j2 = 7;
  7476.                             inputString = inputString.substring(7);
  7477.                         } else if (s.startsWith("flash3:")) {
  7478.                             j2 = 8;
  7479.                             inputString = inputString.substring(7);
  7480.                         } else if (s.startsWith("glow1:")) {
  7481.                             j2 = 9;
  7482.                             inputString = inputString.substring(6);
  7483.                         } else if (s.startsWith("glow2:")) {
  7484.                             j2 = 10;
  7485.                             inputString = inputString.substring(6);
  7486.                         } else if (s.startsWith("glow3:")) {
  7487.                             j2 = 11;
  7488.                             inputString = inputString.substring(6);
  7489.                         }
  7490.                         s = inputString.toLowerCase();
  7491.                         int i3 = 0;
  7492.                         if (s.startsWith("wave:")) {
  7493.                             i3 = 1;
  7494.                             inputString = inputString.substring(5);
  7495.                         } else if (s.startsWith("wave2:")) {
  7496.                             i3 = 2;
  7497.                             inputString = inputString.substring(6);
  7498.                         } else if (s.startsWith("shake:")) {
  7499.                             i3 = 3;
  7500.                             inputString = inputString.substring(6);
  7501.                         } else if (s.startsWith("scroll:")) {
  7502.                             i3 = 4;
  7503.                             inputString = inputString.substring(7);
  7504.                         } else if (s.startsWith("slide:")) {
  7505.                             i3 = 5;
  7506.                             inputString = inputString.substring(6);
  7507.                         }
  7508.  
  7509.                         stream.createFrame(4);
  7510.                         stream.writeWordBigEndian(0);
  7511.                         int j3 = stream.currentOffset;
  7512.                         stream.method425(i3);
  7513.                         stream.method425(j2);
  7514.                         aStream_834.currentOffset = 0;
  7515.                         TextInput.method526(inputString, aStream_834);
  7516.                         stream.method441(0, aStream_834.buffer,
  7517.                                 aStream_834.currentOffset);
  7518.                         stream.writeBytes(stream.currentOffset - j3);
  7519.                         inputString = TextInput.processText(inputString);
  7520.                         // inputString = Censor.doCensor(inputString);
  7521.                             for(Entry d : sk.getShortKeys()){
  7522.                         // search using regex
  7523.                         String pattern = "(^|)"+d.getKey()+"(\\s|$)";
  7524.                         Pattern p = Pattern.compile(pattern); // use regex to break up string
  7525.                         Matcher m = p.matcher(inputString);
  7526.                         inputString  = m.replaceAll(d.getValue());
  7527.                     }
  7528.                         myPlayer.textSpoken = inputString;
  7529.                         myPlayer.anInt1513 = j2;
  7530.                         myPlayer.anInt1531 = i3;
  7531.                         myPlayer.textCycle = 150;
  7532.                             String title = getSpecialColor(myPlayer.skill)
  7533.                                     + myPlayer.title + "@bla@";
  7534.                         if (myPrivilege == 11)
  7535.                             pushMessage(myPlayer.textSpoken, 2, "@crA@" + title
  7536.                                     + myPlayer.name);
  7537.                         else if (myPrivilege == 10)
  7538.                             pushMessage(myPlayer.textSpoken, 2, "@cr9@" + title
  7539.                                     + myPlayer.name);
  7540.                         else if (myPrivilege == 13)
  7541.                             pushMessage(myPlayer.textSpoken, 2, "@c10@" + title
  7542.                                     + myPlayer.name);
  7543.                         else if (myPrivilege == 9)
  7544.                             pushMessage(myPlayer.textSpoken, 2, "@cr8@" + title
  7545.                                     + myPlayer.name);
  7546.                         else if (myPrivilege == 8)
  7547.                             pushMessage(myPlayer.textSpoken, 2, "@cr7@" + title
  7548.                                     + myPlayer.name);
  7549.                         else if (myPrivilege == 7)
  7550.                             pushMessage(myPlayer.textSpoken, 2, "@cr6@" + title
  7551.                                     + myPlayer.name);
  7552.                         else if (myPrivilege == 6)
  7553.                             pushMessage(myPlayer.textSpoken, 2, "@cr5@" + title
  7554.                                     + myPlayer.name);
  7555.                         else if (myPrivilege == 5)
  7556.                             pushMessage(myPlayer.textSpoken, 2, "@cr4@" + title
  7557.                                     + myPlayer.name);
  7558.                         else if (myPrivilege == 4)
  7559.                             pushMessage(myPlayer.textSpoken, 2, "@cr3@" + title
  7560.                                     + myPlayer.name);
  7561.                         else if (myPrivilege == 3)
  7562.                             pushMessage(myPlayer.textSpoken, 2, "@cr2@" + title
  7563.                                     + myPlayer.name);
  7564.                         else if (myPrivilege == 2)
  7565.                             pushMessage(myPlayer.textSpoken, 2, "@cr1@" + title
  7566.                                     + myPlayer.name);
  7567.                         else if (myPrivilege == 1)
  7568.                             pushMessage(myPlayer.textSpoken, 2, "@cr0@" + title
  7569.                                     + myPlayer.name);
  7570.                         else
  7571.                             pushMessage(myPlayer.textSpoken, 2, title
  7572.                                     + myPlayer.name);
  7573.                         if (publicChatMode == 2) {
  7574.                             publicChatMode = 3;
  7575.                             aBoolean1233 = true;
  7576.                             stream.createFrame(95);
  7577.                             stream.writeWordBigEndian(publicChatMode);
  7578.                             stream.writeWordBigEndian(privateChatMode);
  7579.                             stream.writeWordBigEndian(tradeMode);
  7580.                         }
  7581.                     }
  7582.                     inputString = "";
  7583.                     inputTaken = true;
  7584.                 }
  7585.             }
  7586.         } while (true);
  7587.     }
  7588.  
  7589.     private void buildPublicChat(int j) {
  7590.         int l = 0;
  7591.         for (int i1 = 0; i1 < 500; i1++) {
  7592.             if (chatMessages[i1] == null)
  7593.                 continue;
  7594.             if (chatTypeView != 1)
  7595.                 continue;
  7596.             int j1 = chatTypes[i1];
  7597.             String s = chatNames[i1];
  7598.             String ct = chatMessages[i1];
  7599.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7600.             if (k1 < -23)
  7601.                 break;
  7602.             if (s != null && s.startsWith("@cr0@"))
  7603.                 s = s.substring(5);
  7604.             if (s != null && s.startsWith("@cr1@"))
  7605.                 s = s.substring(5);
  7606.             if (s != null && s.startsWith("@cr2@"))
  7607.                 s = s.substring(5);
  7608.             if (s != null && s.startsWith("@cr3@"))
  7609.                 s = s.substring(5);
  7610.             if (s != null && s.startsWith("@cr4@"))
  7611.                 s = s.substring(5);
  7612.             if (s != null && s.startsWith("@cr5@"))
  7613.                 s = s.substring(5);
  7614.             if (s != null && s.startsWith("@cr6@"))
  7615.                 s = s.substring(5);
  7616.             if (s != null && s.startsWith("@cr7@"))
  7617.                 s = s.substring(5);
  7618.             if (s != null && s.startsWith("@cr8@"))
  7619.                 s = s.substring(5);
  7620.             if (s != null && s.startsWith("@cr9@"))
  7621.                 s = s.substring(5);
  7622.             if (s != null && s.startsWith("@c10@"))
  7623.                 s = s.substring(5);
  7624.             if (s != null && s.startsWith("@crA@"))
  7625.                 s = s.substring(5);
  7626.             if ((j1 == 1 || j1 == 2)
  7627.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  7628.                             && isFriendOrSelf(s))) {
  7629.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  7630.                     if (myPrivilege >= 1) {
  7631.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7632.                                 + s;
  7633.                         menuActionID[menuActionRow] = 606;
  7634.                         menuActionRow++;
  7635.                     }
  7636.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7637.                     menuActionID[menuActionRow] = 42;
  7638.                     menuActionRow++;
  7639.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7640.                     menuActionID[menuActionRow] = 639;
  7641.                     menuActionRow++;
  7642.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7643.                     menuActionID[menuActionRow] = 337;
  7644.                     menuActionRow++;
  7645.                 }
  7646.                 l++;
  7647.             }
  7648.         }
  7649.     }
  7650.  
  7651.     private void buildFriendChat(int j) {
  7652.         int l = 0;
  7653.         for (int i1 = 0; i1 < 500; i1++) {
  7654.             if (chatMessages[i1] == null)
  7655.                 continue;
  7656.             if (chatTypeView != 2)
  7657.                 continue;
  7658.             int j1 = chatTypes[i1];
  7659.             String s = chatNames[i1];
  7660.             String ct = chatMessages[i1];
  7661.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7662.             if (k1 < -23)
  7663.                 break;
  7664.             if (s != null && s.startsWith("@cr0@"))
  7665.                 s = s.substring(5);
  7666.             if (s != null && s.startsWith("@cr1@"))
  7667.                 s = s.substring(5);
  7668.             if (s != null && s.startsWith("@cr2@"))
  7669.                 s = s.substring(5);
  7670.             if (s != null && s.startsWith("@cr3@"))
  7671.                 s = s.substring(5);
  7672.             if (s != null && s.startsWith("@cr4@"))
  7673.                 s = s.substring(5);
  7674.             if (s != null && s.startsWith("@cr5@"))
  7675.                 s = s.substring(5);
  7676.             if (s != null && s.startsWith("@cr6@"))
  7677.                 s = s.substring(5);
  7678.             if (s != null && s.startsWith("@cr7@"))
  7679.                 s = s.substring(5);
  7680.             if (s != null && s.startsWith("@cr8@"))
  7681.                 s = s.substring(5);
  7682.             if (s != null && s.startsWith("@cr9@"))
  7683.                 s = s.substring(5);
  7684.             if (s != null && s.startsWith("@c10@"))
  7685.                 s = s.substring(5);
  7686.             if (s != null && s.startsWith("@crA@"))
  7687.                 s = s.substring(5);
  7688.             if ((j1 == 5 || j1 == 6)
  7689.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  7690.                     && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1
  7691.                             && isFriendOrSelf(s)))
  7692.                 l++;
  7693.             if ((j1 == 3 || j1 == 7)
  7694.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  7695.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  7696.                             && isFriendOrSelf(s))) {
  7697.                 if (j > k1 - 14 && j <= k1) {
  7698.                     if (myPrivilege >= 1) {
  7699.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7700.                                 + s;
  7701.                         menuActionID[menuActionRow] = 606;
  7702.                         menuActionRow++;
  7703.                     }
  7704.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7705.                     menuActionID[menuActionRow] = 2042;
  7706.                     menuActionRow++;
  7707.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7708.                     menuActionID[menuActionRow] = 2639;
  7709.                     menuActionRow++;
  7710.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7711.                     menuActionID[menuActionRow] = 2337;
  7712.                     menuActionRow++;
  7713.                 }
  7714.                 l++;
  7715.             }
  7716.         }
  7717.     }
  7718.  
  7719.     private void buildDuelorTrade(int j) {
  7720.         int l = 0;
  7721.         for (int i1 = 0; i1 < 500; i1++) {
  7722.             if (chatMessages[i1] == null)
  7723.                 continue;
  7724.             if (chatTypeView != 3 && chatTypeView != 4)
  7725.                 continue;
  7726.             int j1 = chatTypes[i1];
  7727.             String s = chatNames[i1];
  7728.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7729.             if (k1 < -23)
  7730.                 break;
  7731.             if (s != null && s.startsWith("@cr0@"))
  7732.                 s = s.substring(5);
  7733.             if (s != null && s.startsWith("@cr1@"))
  7734.                 s = s.substring(5);
  7735.             if (s != null && s.startsWith("@cr2@"))
  7736.                 s = s.substring(5);
  7737.             if (s != null && s.startsWith("@cr3@"))
  7738.                 s = s.substring(5);
  7739.             if (s != null && s.startsWith("@cr4@"))
  7740.                 s = s.substring(5);
  7741.             if (s != null && s.startsWith("@cr5@"))
  7742.                 s = s.substring(5);
  7743.             if (s != null && s.startsWith("@cr6@"))
  7744.                 s = s.substring(5);
  7745.             if (s != null && s.startsWith("@cr7@"))
  7746.                 s = s.substring(5);
  7747.             if (s != null && s.startsWith("@cr8@"))
  7748.                 s = s.substring(5);
  7749.             if (s != null && s.startsWith("@cr9@"))
  7750.                 s = s.substring(5);
  7751.             if (s != null && s.startsWith("@c10@"))
  7752.                 s = s.substring(5);
  7753.             if (s != null && s.startsWith("@crA@"))
  7754.                 s = s.substring(5);
  7755.             if (chatTypeView == 3 && j1 == 4
  7756.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7757.                 if (j > k1 - 14 && j <= k1) {
  7758.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  7759.                     menuActionID[menuActionRow] = 484;
  7760.                     menuActionRow++;
  7761.                 }
  7762.                 l++;
  7763.             }
  7764.             if (chatTypeView == 4 && j1 == 8
  7765.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7766.                 if (j > k1 - 14 && j <= k1) {
  7767.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  7768.                             + s;
  7769.                     menuActionID[menuActionRow] = 6;
  7770.                     menuActionRow++;
  7771.                 }
  7772.                 l++;
  7773.             }
  7774.             if (j1 == 12) {
  7775.                 if (j > k1 - 14 && j <= k1) {
  7776.                     menuActionName[menuActionRow] = "Go-to @blu@" + s;
  7777.                     menuActionID[menuActionRow] = 915;
  7778.                     menuActionRow++;
  7779.                 }
  7780.                 l++;
  7781.             }
  7782.             if (j1 == 9) {
  7783.                 if (j > k1 - 14 && j <= k1) {
  7784.                     menuActionName[menuActionRow] = "Go-to @lre@" + s;
  7785.                     menuActionID[menuActionRow] = 927;
  7786.                     menuActionRow++;
  7787.                 }
  7788.                 l++;
  7789.             }
  7790.         }
  7791.     }
  7792.  
  7793.     private void buildChatAreaMenu(int j) {
  7794.         int l = 0;
  7795.         int test = 0;
  7796.         for (int i1 = 0; i1 < 500; i1++) {
  7797.             if (chatMessages[i1] == null)
  7798.                 continue;
  7799.             int j1 = chatTypes[i1];
  7800.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7801.             if (k1 < -23)
  7802.                 break;
  7803.             String s = "";
  7804.             if(chatNames[i1] != null)
  7805.                 s = chatNames[i1].replaceAll(title, "");
  7806.             String ct = chatMessages[i1];
  7807.             boolean flag = false;
  7808.             if (chatTypeView == 1) {
  7809.                 buildPublicChat(j);
  7810.                 break;
  7811.             }
  7812.             if (chatTypeView == 2) {
  7813.                 buildFriendChat(j);
  7814.                 break;
  7815.             }
  7816.             if (chatTypeView == 3 || chatTypeView == 4) {
  7817.                 buildDuelorTrade(j);
  7818.                 break;
  7819.             }
  7820.             if (chatTypeView == 5) {
  7821.                 break;
  7822.             }
  7823.             if (s != null && s.startsWith("@cr0@")) {
  7824.                 s = s.substring(5);
  7825.                 boolean flag1 = true;
  7826.                 byte byte0 = 1;
  7827.             }
  7828.             if (s != null && s.startsWith("@cr1@")) {
  7829.                 s = s.substring(5);
  7830.                 byte byte0 = 2;
  7831.             }
  7832.             if (s != null && s.startsWith("@cr2@")) {
  7833.                 s = s.substring(5);
  7834.                 byte byte0 = 3;
  7835.             }
  7836.             if (s != null && s.startsWith("@cr3@")) {
  7837.                 s = s.substring(5);
  7838.                 byte byte0 = 4;
  7839.             }
  7840.             if (s != null && s.startsWith("@cr4@")) {
  7841.                 s = s.substring(5);
  7842.                 byte byte0 = 5;
  7843.             }
  7844.             if (s != null && s.startsWith("@cr5@")) {
  7845.                 s = s.substring(5);
  7846.                 byte byte0 = 6;
  7847.             }
  7848.             if (s != null && s.startsWith("@cr6@")) {
  7849.                 s = s.substring(5);
  7850.                 byte byte0 = 7;
  7851.             }
  7852.             if (s != null && s.startsWith("@cr7@")) {
  7853.                 s = s.substring(5);
  7854.                 byte byte0 = 8;
  7855.             }
  7856.             if (s != null && s.startsWith("@cr8@")) {
  7857.                 s = s.substring(5);
  7858.                 byte byte0 = 9;
  7859.             }
  7860.             if (s != null && s.startsWith("@cr9@")) {
  7861.                 s = s.substring(5);
  7862.                 byte byte0 = 10;
  7863.             }
  7864.             if (s != null && s.startsWith("@c10@")) {
  7865.                 s = s.substring(5);
  7866.                 byte byte0 = 13;
  7867.             }
  7868.             if (s != null && s.startsWith("@crA@")) {
  7869.                 s = s.substring(5);
  7870.                 byte byte0 = 11;
  7871.             }
  7872.             if (j1 == 0)
  7873.                 l++;
  7874.             String title = getSpecialColor(myPlayer.skill)
  7875.                     + myPlayer.title + "@whi@";
  7876.             if ((j1 == 1 || j1 == 2)
  7877.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  7878.                             && isFriendOrSelf(s))) {
  7879.                 if (j > k1 - 14 && j <= k1
  7880.                         && !s.replaceAll(title, "").equals(myPlayer.name)) {
  7881.                     if (myPrivilege >= 1) {
  7882.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7883.                                 + s;
  7884.                         menuActionID[menuActionRow] = 606;
  7885.                         menuActionRow++;
  7886.                     }
  7887.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7888.                     menuActionID[menuActionRow] = 42;
  7889.                     menuActionRow++;
  7890.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7891.                     menuActionID[menuActionRow] = 639;
  7892.                     menuActionRow++;
  7893.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7894.                     menuActionID[menuActionRow] = 337;
  7895.                     menuActionRow++;
  7896.                 }
  7897.                 l++;
  7898.             }
  7899.             if ((j1 == 3 || j1 == 7)
  7900.                     && splitPrivateChat == 0
  7901.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  7902.                             && isFriendOrSelf(s))) {
  7903.                 if (j > k1 - 14 && j <= k1) {
  7904.                     if (myPrivilege >= 1) {
  7905.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7906.                                 + s;
  7907.                         menuActionID[menuActionRow] = 606;
  7908.                         menuActionRow++;
  7909.                     }
  7910.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7911.                     menuActionID[menuActionRow] = 42;
  7912.                     menuActionRow++;
  7913.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  7914.                     menuActionID[menuActionRow] = 639;
  7915.                     menuActionRow++;
  7916.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7917.                     menuActionID[menuActionRow] = 337;
  7918.                     menuActionRow++;
  7919.                 }
  7920.                 l++;
  7921.             }
  7922.             if (j1 == 9) {
  7923.                 if (j > k1 - 14 && j <= k1) {
  7924.                     menuActionName[menuActionRow] = "Go-to @lre@" + s;
  7925.                     menuActionID[menuActionRow] = 927;
  7926.                     menuActionRow++;
  7927.                 }
  7928.                 l++;
  7929.             }
  7930.             if (j1 == 4
  7931.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7932.                 if (j > k1 - 14 && j <= k1) {
  7933.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  7934.                     menuActionID[menuActionRow] = 484;
  7935.                     menuActionRow++;
  7936.                 }
  7937.                 l++;
  7938.             }
  7939.             if ((j1 == 5 || j1 == 6) && splitPrivateChat == 0
  7940.                     && privateChatMode < 2)
  7941.                 l++;
  7942.             if (j1 == 8
  7943.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7944.                 if (j > k1 - 14 && j <= k1) {
  7945.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  7946.                             + s;
  7947.                     menuActionID[menuActionRow] = 6;
  7948.                     menuActionRow++;
  7949.                 }
  7950.                 l++;
  7951.             }
  7952.         }
  7953.     }
  7954.    
  7955.     public int getXPForLevel(int level) {
  7956.         int points = 0;
  7957.         int output = 0;
  7958.         for (int lvl = 1; lvl <= level; lvl++) {
  7959.             points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
  7960.             if (lvl >= level) {
  7961.                 return output;
  7962.             }
  7963.             output = (int)Math.floor(points / 4);
  7964.         }
  7965.         return 0;
  7966.     }
  7967.    
  7968.     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" };
  7969.     public String setMessage(int level) {
  7970.         String[] messages = new String[4];
  7971.         String message = "";
  7972.         int maxLevel = 99;
  7973.         if (maxStats[level] > maxLevel) {
  7974.             if (level != 24){
  7975.                 maxStats[level] = 99;
  7976.             } else if (maxStats[level] > 120) {
  7977.                 maxStats[level] = 120;
  7978.             }
  7979.         }
  7980.         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};
  7981.         messages[0] = skillNames[level]+": "+currentStats[stuff[level]]+"/"+maxStats[stuff[level]]+"\\n";
  7982.         messages[1] = "Current XP: " + getXPForLevel(maxStats[stuff[level]])+"\\n";
  7983.         messages[2]= "Next level: "+ (getXPForLevel(maxStats[stuff[level]]+1)-getXPForLevel(maxStats[stuff[level]]))+"\\n";
  7984.         messages[3]= "Remainder: "+ getXPForLevel(maxStats[stuff[level]]+1);
  7985.         message = messages[0] + messages[1] + messages[2] + messages[3];
  7986.         if (getXPForLevel(maxStats[stuff[level]]) >= 99) {
  7987.             message = skillNames[level]+": "+ currentStats[stuff[level]]+"/99\\nMax Level Reached";
  7988.         }
  7989.         return message;
  7990.     }
  7991.  
  7992.     private void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  7993.         int j = class9.contentType;
  7994.         if(j >= 205 && j <= 205+25){
  7995.             j -= 205;
  7996.             class9.message = setMessage(j);
  7997.             return;
  7998.         }
  7999.         if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  8000.             if (j == 1 && anInt900 == 0) {
  8001.                 class9.message = "Loading friend list";
  8002.                 class9.atActionType = 0;
  8003.                 return;
  8004.             }
  8005.             if (j == 1 && anInt900 == 1) {
  8006.                 class9.message = "Connecting to friendserver";
  8007.                 class9.atActionType = 0;
  8008.                 return;
  8009.             }
  8010.             if (j == 2 && anInt900 != 2) {
  8011.                 class9.message = "Please wait...";
  8012.                 class9.atActionType = 0;
  8013.                 return;
  8014.             }
  8015.             int k = friendsCount;
  8016.             if (anInt900 != 2)
  8017.                 k = 0;
  8018.             if (j > 700)
  8019.                 j -= 601;
  8020.             else
  8021.                 j--;
  8022.             if (j >= k) {
  8023.                 class9.message = "";
  8024.                 class9.atActionType = 0;
  8025.                 return;
  8026.             } else {
  8027.                 class9.message = friendsList[j];
  8028.                 class9.atActionType = 1;
  8029.                 return;
  8030.             }
  8031.         }
  8032.         if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  8033.             int l = friendsCount;
  8034.             if (anInt900 != 2)
  8035.                 l = 0;
  8036.             if (j > 800)
  8037.                 j -= 701;
  8038.             else
  8039.                 j -= 101;
  8040.             if (j >= l) {
  8041.                 class9.message = "";
  8042.                 class9.atActionType = 0;
  8043.                 return;
  8044.             }
  8045.             if (friendsNodeIDs[j] == 0)
  8046.                 class9.message = "@red@Offline";
  8047.             else if (friendsNodeIDs[j] == nodeID)
  8048.                 if (friendsNodeWorlds.containsKey(friendsList[j])) {
  8049.                     class9.message = "@yel@World "
  8050.                             + (String) friendsNodeWorlds.get(friendsList[j]);// +
  8051.                                                                                 // (friendsNodeIDs[j]
  8052.                                                                                 // -
  8053.                                                                                 // 9);
  8054.                 } else {
  8055.                     class9.message = "@gre@World " + world;// +
  8056.                                                             // (friendsNodeIDs[j]
  8057.                                                             // - 9);
  8058.                 }
  8059.             else
  8060.                 class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */;
  8061.             class9.atActionType = 1;
  8062.             return;
  8063.         }
  8064.         if (j == 203) {
  8065.             int i1 = friendsCount;
  8066.             if (anInt900 != 2)
  8067.                 i1 = 0;
  8068.             class9.scrollMax = i1 * 15 + 20;
  8069.             if (class9.scrollMax <= class9.height)
  8070.                 class9.scrollMax = class9.height + 1;
  8071.             return;
  8072.         }
  8073.         if (j >= 401 && j <= 500) {
  8074.             if ((j -= 401) == 0 && anInt900 == 0) {
  8075.                 class9.message = "Loading ignore list";
  8076.                 class9.atActionType = 0;
  8077.                 return;
  8078.             }
  8079.             if (j == 1 && anInt900 == 0) {
  8080.                 class9.message = "Please wait...";
  8081.                 class9.atActionType = 0;
  8082.                 return;
  8083.             }
  8084.             int j1 = ignoreCount;
  8085.             if (anInt900 == 0)
  8086.                 j1 = 0;
  8087.             if (j >= j1) {
  8088.                 class9.message = "";
  8089.                 class9.atActionType = 0;
  8090.                 return;
  8091.             } else {
  8092.                 class9.message = TextClass.fixName(TextClass
  8093.                         .nameForLong(ignoreListAsLongs[j]));
  8094.                 class9.atActionType = 1;
  8095.                 return;
  8096.             }
  8097.         }
  8098.         if (j == 503) {
  8099.             class9.scrollMax = ignoreCount * 15 + 20;
  8100.             if (class9.scrollMax <= class9.height)
  8101.                 class9.scrollMax = class9.height + 1;
  8102.             return;
  8103.         }
  8104.         if (j == 669) {
  8105.             int verticleTilt = 150;
  8106.             int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  8107.             class9.modelRotation1 = verticleTilt;
  8108.             class9.modelRotation2 = animationSpeed;
  8109.             if (aBoolean1031) {
  8110.                 Model characterDisplay = ((Player) (myPlayer)).method452();
  8111.                 for (int l2 = 0; l2 < 5; l2++)
  8112.                     if (anIntArray990[l2] != 0) {
  8113.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  8114.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  8115.                         if (l2 == 1)
  8116.                             characterDisplay.method476(anIntArray1204[0],
  8117.                                     anIntArray1204[anIntArray990[l2]]);
  8118.                     }
  8119.                 int staticFrame = myPlayer.anInt1511;
  8120.                 characterDisplay.method469();
  8121.                 characterDisplay
  8122.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  8123.                 class9.anInt233 = 5;
  8124.                 class9.mediaID = 0;
  8125.                 RSInterface.method208(aBoolean994, characterDisplay);
  8126.             }
  8127.         }
  8128.         if (j == 327) {
  8129.             class9.modelRotation1 = 150;
  8130.             class9.modelRotation2 = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  8131.             if (aBoolean1031) {
  8132.                 for (int k1 = 0; k1 < 7; k1++) {
  8133.                     int l1 = anIntArray1065[k1];
  8134.                     if (l1 >= 0 && !IDK.cache[l1].method537())
  8135.                         return;
  8136.                 }
  8137.  
  8138.                 aBoolean1031 = false;
  8139.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  8140.                 int i2 = 0;
  8141.                 for (int j2 = 0; j2 < 7; j2++) {
  8142.                     int k2 = anIntArray1065[j2];
  8143.                     if (k2 >= 0)
  8144.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2]
  8145.                                 .method538();
  8146.                 }
  8147.  
  8148.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  8149.                 for (int l2 = 0; l2 < 5; l2++)
  8150.                     if (anIntArray990[l2] != 0) {
  8151.                         model.method476(anIntArrayArray1003[l2][0],
  8152.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  8153.                         if (l2 == 1)
  8154.                             model.method476(anIntArray1204[0],
  8155.                                     anIntArray1204[anIntArray990[l2]]);
  8156.                     }
  8157.  
  8158.                 model.method469();
  8159.                 model
  8160.                         .method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  8161.                 model.method479(64, 850, -30, -50, -30, true);
  8162.                 class9.anInt233 = 5;
  8163.                 class9.mediaID = 0;
  8164.                 RSInterface.method208(aBoolean994, model);
  8165.             }
  8166.             return;
  8167.         }
  8168.         if (j == 328) {
  8169.             RSInterface rsInterface = class9;
  8170.             int verticleTilt = 150;
  8171.             int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  8172.             rsInterface.modelRotation1 = verticleTilt;
  8173.             rsInterface.modelRotation2 = animationSpeed;
  8174.             if (aBoolean1031) {
  8175.                 Model characterDisplay = myPlayer.method452();
  8176.                 for (int l2 = 0; l2 < 5; l2++)
  8177.                     if (anIntArray990[l2] != 0) {
  8178.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  8179.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  8180.                         if (l2 == 1)
  8181.                             characterDisplay.method476(anIntArray1204[0],
  8182.                                     anIntArray1204[anIntArray990[l2]]);
  8183.                     }
  8184.                 int staticFrame = myPlayer.anInt1511;
  8185.                 characterDisplay.method469();
  8186.                 characterDisplay
  8187.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  8188.                 rsInterface.anInt233 = 5;
  8189.                 rsInterface.mediaID = 0;
  8190.                 RSInterface.method208(aBoolean994, characterDisplay);
  8191.             }
  8192.             return;
  8193.         }
  8194.         if (j == 324) {
  8195.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  8196.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  8197.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  8198.             }
  8199.             if (aBoolean1047) {
  8200.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  8201.                 return;
  8202.             } else {
  8203.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  8204.                 return;
  8205.             }
  8206.         }
  8207.         if (j == 325) {
  8208.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  8209.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  8210.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  8211.             }
  8212.             if (aBoolean1047) {
  8213.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  8214.                 return;
  8215.             } else {
  8216.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  8217.                 return;
  8218.             }
  8219.         }
  8220.         if (j == 600) {
  8221.             class9.message = reportAbuseInput;
  8222.             if (loopCycle % 20 < 10) {
  8223.                 class9.message += "|";
  8224.                 return;
  8225.             } else {
  8226.                 class9.message += " ";
  8227.                 return;
  8228.             }
  8229.         }
  8230.         if (j == 613)
  8231.             if (myPrivilege >= 1) {
  8232.                 if (canMute) {
  8233.                     class9.textColor = 0xff0000;
  8234.                     class9.message = "Moderator option: Mute player for 48 hours: <ON>";
  8235.                 } else {
  8236.                     class9.textColor = 0xffffff;
  8237.                     class9.message = "Moderator option: Mute player for 48 hours: <OFF>";
  8238.                 }
  8239.             } else {
  8240.                 class9.message = "";
  8241.             }
  8242.         if (j == 650 || j == 655)
  8243.             if (anInt1193 != 0) {
  8244.                 String s;
  8245.                 if (daysSinceLastLogin == 0)
  8246.                     s = "earlier today";
  8247.                 else if (daysSinceLastLogin == 1)
  8248.                     s = "yesterday";
  8249.                 else
  8250.                     s = daysSinceLastLogin + " days ago";
  8251.                 class9.message = "You last logged in " + s + " from: "
  8252.                         + signlink.dns;
  8253.             } else {
  8254.                 class9.message = "";
  8255.             }
  8256.         if (j == 651) {
  8257.             if (unreadMessages == 0) {
  8258.                 class9.message = "0 unread messages";
  8259.                 class9.textColor = 0xffff00;
  8260.             }
  8261.             if (unreadMessages == 1) {
  8262.                 class9.message = "1 unread message";
  8263.                 class9.textColor = 65280;
  8264.             }
  8265.             if (unreadMessages > 1) {
  8266.                 class9.message = unreadMessages + " unread messages";
  8267.                 class9.textColor = 65280;
  8268.             }
  8269.         }
  8270.         if (j == 652)
  8271.             if (daysSinceRecovChange == 201) {
  8272.                 if (membersInt == 1)
  8273.                     class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  8274.                 else
  8275.                     class9.message = "";
  8276.             } else if (daysSinceRecovChange == 200) {
  8277.                 class9.message = "You have not yet set any password recovery questions.";
  8278.             } else {
  8279.                 String s1;
  8280.                 if (daysSinceRecovChange == 0)
  8281.                     s1 = "Earlier today";
  8282.                 else if (daysSinceRecovChange == 1)
  8283.                     s1 = "Yesterday";
  8284.                 else
  8285.                     s1 = daysSinceRecovChange + " days ago";
  8286.                 class9.message = s1 + " you changed your recovery questions";
  8287.             }
  8288.         if (j == 653)
  8289.             if (daysSinceRecovChange == 201) {
  8290.                 if (membersInt == 1)
  8291.                     class9.message = "@whi@recommend you use a members world instead. You may use";
  8292.                 else
  8293.                     class9.message = "";
  8294.             } else if (daysSinceRecovChange == 200)
  8295.                 class9.message = "We strongly recommend you do so now to secure your account.";
  8296.             else
  8297.                 class9.message = "If you do not remember making this change then cancel it immediately";
  8298.         if (j == 654) {
  8299.             if (daysSinceRecovChange == 201)
  8300.                 if (membersInt == 1) {
  8301.                     class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  8302.                     return;
  8303.                 } else {
  8304.                     class9.message = "";
  8305.                     return;
  8306.                 }
  8307.             if (daysSinceRecovChange == 200) {
  8308.                 class9.message = "Do this from the 'account management' area on our front webpage";
  8309.                 return;
  8310.             }
  8311.             class9.message = "Do this from the 'account management' area on our front webpage";
  8312.         }
  8313.     }
  8314.  
  8315.     private void drawSplitPrivateChat() {
  8316.         if (splitPrivateChat == 0)
  8317.             return;
  8318.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  8319.         int i = 0;
  8320.         if (anInt1104 != 0)
  8321.             i = 1;
  8322.         for (int j = 0; j < 100; j++)
  8323.             if (chatMessages[j] != null) {
  8324.                 int k = chatTypes[j];
  8325.                 String s = chatNames[j];
  8326.                 byte byte1 = 0;
  8327.                 if (s != null && s.startsWith("@cr0@")) {
  8328.                     s = s.substring(5);
  8329.                     byte1 = 1;
  8330.                 }
  8331.                 if (s != null && s.startsWith("@cr1@")) {
  8332.                     s = s.substring(5);
  8333.                     byte1 = 2;
  8334.                 }
  8335.                 if (s != null && s.startsWith("@cr2@")) {
  8336.                     s = s.substring(5);
  8337.                     byte1 = 3;
  8338.                 }
  8339.                 if (s != null && s.startsWith("@cr3@")) {
  8340.                     s = s.substring(5);
  8341.                     byte1 = 4;
  8342.                 }
  8343.                 if (s != null && s.startsWith("@cr4@")) {
  8344.                     s = s.substring(5);
  8345.                     byte1 = 5;
  8346.                 }
  8347.                 if (s != null && s.startsWith("@cr5@")) {
  8348.                     s = s.substring(5);
  8349.                     byte1 = 6;
  8350.                 }
  8351.                 if (s != null && s.startsWith("@cr6@")) {
  8352.                     s = s.substring(5);
  8353.                     byte1 = 7;
  8354.                 }
  8355.                 if (s != null && s.startsWith("@cr7@")) {
  8356.                     s = s.substring(5);
  8357.                     byte1 = 8;
  8358.                 }
  8359.                 if (s != null && s.startsWith("@cr8@")) {
  8360.                     s = s.substring(5);
  8361.                     byte1 = 9;
  8362.                 }
  8363.                 if (s != null && s.startsWith("@cr9@")) {
  8364.                     s = s.substring(5);
  8365.                     byte1 = 10;
  8366.                 }
  8367.                 if (s != null && s.startsWith("@c10@")) {
  8368.                     s = s.substring(5);
  8369.                     byte1 = 13;
  8370.                 }
  8371.                 if (s != null && s.startsWith("@crA@")) {
  8372.                     s = s.substring(5);
  8373.                     byte1 = 11;
  8374.                 }
  8375.                 if ((k == 3 || k == 7)
  8376.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  8377.                                 && isFriendOrSelf(s))) {
  8378.                     int l = 329 - i * 13;
  8379.                     int k1 = 4;
  8380.                     textDrawingArea.method385(0, "From", l, k1);
  8381.                     textDrawingArea.method385(65535, "From", l - 1, k1);
  8382.                     k1 += textDrawingArea.getTextWidth("From ");
  8383.                     if (byte1 == 1) {
  8384.                         modIcons[0].drawSprite(k1, l - 12);
  8385.                         k1 += 12;
  8386.                     }
  8387.                     if (byte1 == 2) {
  8388.                         modIcons[1].drawSprite(k1, l - 12);
  8389.                         k1 += 12;
  8390.                     }
  8391.                     if (byte1 == 3) {
  8392.                         modIcons[2].drawSprite(k1, l - 12);
  8393.                         k1 += 12;
  8394.                     }
  8395.                     if (byte1 == 4) {
  8396.                         modIcons[3].drawSprite(k1, l - 12);
  8397.                         k1 += 12;
  8398.                     }
  8399.                     if (byte1 == 5) {
  8400.                         modIcons[4].drawSprite(k1, l - 12);
  8401.                         k1 += 12;
  8402.                     }
  8403.                     if (byte1 == 6) {
  8404.                         modIcons[5].drawSprite(k1, l - 12);
  8405.                         k1 += 12;
  8406.                     }
  8407.                     if (byte1 == 7) {
  8408.                         modIcons[6].drawSprite(k1, l - 12);
  8409.                         k1 += 12;
  8410.                     }
  8411.                     if (byte1 == 8) {
  8412.                         modIcons[7].drawSprite(k1, l - 12);
  8413.                         k1 += 12;
  8414.                     }
  8415.                     if (byte1 == 9) {
  8416.                         modIcons[8].drawSprite(k1, l - 12);
  8417.                         k1 += 12;
  8418.                     }
  8419.                     if (byte1 == 10) {
  8420.                         modIcons[9].drawSprite(k1, l - 12);
  8421.                         k1 += 12;
  8422.                     }
  8423.                     if (byte1 == 11) {
  8424.                         modIcons[10].drawSprite(k1, l - 12);
  8425.                         k1 += 12;
  8426.                     }
  8427.                     if (byte1 == 13) {
  8428.                         modIcons[11].drawSprite(k1, l - 12);
  8429.                         k1 += 12;
  8430.                     }
  8431.                     textDrawingArea.method385(0, s + ": " + chatMessages[j], l,
  8432.                             k1);
  8433.                     textDrawingArea.method385(65535,
  8434.                             s + ": " + chatMessages[j], l - 1, k1);
  8435.                     if (++i >= 5)
  8436.                         return;
  8437.                 }
  8438.                 if (k == 5 && privateChatMode < 2) {
  8439.                     int i1 = 329 - i * 13;
  8440.                     textDrawingArea.method385(0, chatMessages[j], i1, 4);
  8441.                     textDrawingArea
  8442.                             .method385(65535, chatMessages[j], i1 - 1, 4);
  8443.                     if (++i >= 5)
  8444.                         return;
  8445.                 }
  8446.                 if (k == 6 && privateChatMode < 2) {
  8447.                     int j1 = 329 - i * 13;
  8448.                     textDrawingArea.method385(0, "To " + s + ": "
  8449.                             + chatMessages[j], j1, 4);
  8450.                     textDrawingArea.method385(65535, "To " + s + ": "
  8451.                             + chatMessages[j], j1 - 1, 4);
  8452.                     if (++i >= 5)
  8453.                         return;
  8454.                 }
  8455.             }
  8456.  
  8457.     }
  8458.  
  8459.     public void pushMessage(String s, int i, String s1) {
  8460.         if (i == 0 && dialogID != -1) {
  8461.             aString844 = s;
  8462.             super.clickMode3 = 0;
  8463.         }
  8464.         if (backDialogID == -1)
  8465.             inputTaken = true;
  8466.         for (int j = 499; j > 0; j--) {
  8467.             chatTypes[j] = chatTypes[j - 1];
  8468.             chatNames[j] = chatNames[j - 1];
  8469.             chatMessages[j] = chatMessages[j - 1];
  8470.         }
  8471.         chatTypes[0] = i;
  8472.         chatNames[0] = s1;
  8473.         chatMessages[0] = s;
  8474.     }
  8475.  
  8476.     public int logIconHPos = 0;
  8477.  
  8478.     public void processMapAreaClick() {
  8479.         if (super.mouseX >= 742 && super.mouseX <= 764 && super.mouseY >= 1
  8480.                 && super.mouseY <= 23) {
  8481.             logIconHPos = 1;
  8482.         } else {
  8483.             logIconHPos = 0;
  8484.         }
  8485.     }
  8486.  
  8487.     private void processTabClick() {
  8488.         if (super.clickMode3 == 1) {
  8489.             if (super.saveClickX >= 524 && super.saveClickX <= 561
  8490.                     && super.saveClickY >= 169 && super.saveClickY < 205
  8491.                     && tabInterfaceIDs[0] != -1) {
  8492.                     invSelected = false;
  8493.                 needDrawTabArea = true;
  8494.                 tabID = 0;
  8495.                 tabAreaAltered = true;
  8496.             }
  8497.             if (super.saveClickX >= 562 && super.saveClickX <= 594
  8498.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8499.                     && tabInterfaceIDs[1] != -1) {
  8500.                     invSelected = false;
  8501.                 needDrawTabArea = true;
  8502.                 tabID = 1;
  8503.                 tabAreaAltered = true;
  8504.             }
  8505.             if (super.saveClickX >= 595 && super.saveClickX <= 626
  8506.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8507.                     && tabInterfaceIDs[2] != -1) {
  8508.                     invSelected = false;
  8509.                 needDrawTabArea = true;
  8510.                 tabID = 2;
  8511.                 tabAreaAltered = true;
  8512.             }
  8513.             if (super.saveClickX >= 627 && super.saveClickX <= 660
  8514.                     && super.saveClickY >= 168 && super.saveClickY < 203
  8515.                     && tabInterfaceIDs[3] != -1) {
  8516.                     invSelected = true;
  8517.                 needDrawTabArea = true;
  8518.                 tabID = 3;
  8519.                 tabAreaAltered = true;
  8520.             }
  8521.             if (super.saveClickX >= 661 && super.saveClickX <= 693
  8522.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8523.                     && tabInterfaceIDs[4] != -1) {
  8524.                     invSelected = false;
  8525.                 needDrawTabArea = true;
  8526.                 tabID = 4;
  8527.                 tabAreaAltered = true;
  8528.             }
  8529.             if (super.saveClickX >= 694 && super.saveClickX <= 725
  8530.                     && super.saveClickY >= 168 && super.saveClickY < 205
  8531.                     && tabInterfaceIDs[5] != -1) {
  8532.                     invSelected = false;
  8533.                 needDrawTabArea = true;
  8534.                 tabID = 5;
  8535.                 tabAreaAltered = true;
  8536.             }
  8537.             if (super.saveClickX >= 726 && super.saveClickX <= 765
  8538.                     && super.saveClickY >= 169 && super.saveClickY < 205
  8539.                     && tabInterfaceIDs[6] != -1) {
  8540.                     invSelected = false;
  8541.                 needDrawTabArea = true;
  8542.                 tabID = 6;
  8543.                 tabAreaAltered = true;
  8544.             }
  8545.             if (super.saveClickX >= 627 && super.saveClickX <= 664
  8546.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8547.                     && tabInterfaceIDs[7] != -1) {
  8548.                     invSelected = false;
  8549.                 needDrawTabArea = true;
  8550.                 tabID = 7;
  8551.                 tabAreaAltered = true;
  8552.             }
  8553.             if (super.saveClickX >= 562 && super.saveClickX <= 594
  8554.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8555.                     && tabInterfaceIDs[8] != -1) {
  8556.                     invSelected = false;
  8557.                 needDrawTabArea = true;
  8558.                 tabID = 8;
  8559.                 tabAreaAltered = true;
  8560.             }
  8561.             if (super.saveClickX >= 595 && super.saveClickX <= 627
  8562.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8563.                     && tabInterfaceIDs[9] != -1) {
  8564.                     invSelected = false;
  8565.                 needDrawTabArea = true;
  8566.                 tabID = 9;
  8567.                 tabAreaAltered = true;
  8568.             }
  8569.             if (super.saveClickX >= 742 && super.saveClickX <= 764
  8570.                     && super.saveClickY >= 1 && super.saveClickY < 24
  8571.                     && tabInterfaceIDs[10] != -1) {
  8572.                     invSelected = false;
  8573.                 needDrawTabArea = true;
  8574.                 tabID = 10;
  8575.                 tabAreaAltered = true;
  8576.             }
  8577.             if (super.saveClickX >= 661 && super.saveClickX <= 694
  8578.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8579.                     && tabInterfaceIDs[11] != -1) {
  8580.                     invSelected = false;
  8581.                 needDrawTabArea = true;
  8582.                 tabID = 11;
  8583.                 tabAreaAltered = true;
  8584.             }
  8585.             if (super.saveClickX >= 695 && super.saveClickX <= 725
  8586.                     && super.saveClickY >= 466 && super.saveClickY < 503
  8587.                     && tabInterfaceIDs[12] != -1) {
  8588.                     invSelected = false;
  8589.                 needDrawTabArea = true;
  8590.                 tabID = 12;
  8591.                 tabAreaAltered = true;
  8592.             }
  8593.             if (super.saveClickX >= 726 && super.saveClickX <= 765
  8594.                     && super.saveClickY >= 466 && super.saveClickY < 502
  8595.                     && tabInterfaceIDs[13] != -1) {
  8596.                     invSelected = false;
  8597.                 needDrawTabArea = true;
  8598.                 tabID = 13;
  8599.                 tabAreaAltered = true;
  8600.             }
  8601.             if (super.saveClickX >= 520 && super.saveClickX <= 561
  8602.                     && super.saveClickY >= 466 && super.saveClickY < 502
  8603.                     && tabInterfaceIDs[14] != -1) {
  8604.                     invSelected = false;
  8605.                 needDrawTabArea = true;
  8606.                 tabID = 14;
  8607.                 tabAreaAltered = true;
  8608.             }
  8609.         }
  8610.     }
  8611.  
  8612.     private void resetImageProducers2() {
  8613.         if (aRSImageProducer_1166 != null)
  8614.             return;
  8615.         nullLoader();
  8616.         super.fullGameScreen = null;
  8617.         aRSImageProducer_1107 = null;
  8618.         aRSImageProducer_1108 = null;
  8619.         aRSImageProducer_1109 = null;
  8620.         aRSImageProducer_1110 = null;
  8621.         aRSImageProducer_1111 = null;
  8622.         aRSImageProducer_1112 = null;
  8623.         aRSImageProducer_1113 = null;
  8624.         aRSImageProducer_1114 = null;
  8625.         aRSImageProducer_1115 = null;
  8626.         /* Original chat area image producer */
  8627.         // aRSImageProducer_1166 = new RSImageProducer(479, 96,
  8628.         // getGameComponent());
  8629.         /* New chat area image producer */
  8630.         aRSImageProducer_1166 = new RSImageProducer(519, 165,
  8631.                 getGameComponent());
  8632.         aRSImageProducer_1164 = new RSImageProducer(246, 168,
  8633.                 getGameComponent());
  8634.         DrawingArea.setAllPixelsToZero();
  8635.         mapArea.drawSprite(0, 0);
  8636.         aRSImageProducer_1163 = new RSImageProducer(246, 335,
  8637.                 getGameComponent());
  8638.         aRSImageProducer_1165 = new RSImageProducer(512, 334,
  8639.                 getGameComponent());
  8640.         DrawingArea.setAllPixelsToZero();
  8641.         aRSImageProducer_1123 = new RSImageProducer(496, 50, getGameComponent());
  8642.         aRSImageProducer_1124 = new RSImageProducer(269, 37, getGameComponent());
  8643.         aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  8644.         welcomeScreenRaised = true;
  8645.     }
  8646.  
  8647.     /*
  8648.      * private String getDocumentBaseHost() { if(signlink.mainapp != null)
  8649.      * return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  8650.      * if(super.gameFrame != null) return ""; else return ""; }
  8651.      */
  8652.     private String getDocumentBaseHost() {
  8653.         if (signlink.mainapp != null)
  8654.             return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  8655.         if (super.gameFrame != null)
  8656.             return "";
  8657.         else
  8658.             return "";
  8659.     }
  8660.  
  8661.     private void method81(Sprite sprite, int j, int k) {
  8662.         int l = k * k + j * j;
  8663.         if (l > 4225 && l < 0x15f90) {
  8664.             int i1 = minimapInt1 + minimapInt2 & 0x7ff;
  8665.             int j1 = Model.modelIntArray1[i1];
  8666.             int k1 = Model.modelIntArray2[i1];
  8667.             j1 = (j1 * 256) / (minimapInt3 + 256);
  8668.             k1 = (k1 * 256) / (minimapInt3 + 256);
  8669.             int l1 = j * j1 + k * k1 >> 16;
  8670.             int i2 = j * k1 - k * j1 >> 16;
  8671.             double d = Math.atan2(l1, i2);
  8672.             int j2 = (int) (Math.sin(d) * 63D);
  8673.             int k2 = (int) (Math.cos(d) * 57D);
  8674.             mapEdge.method353(83 - k2 - 20, d, (94 + j2 + 4) - 10);
  8675.         } else {
  8676.             markMinimap(sprite, k, j);
  8677.         }
  8678.     }
  8679.  
  8680.     private void rightClickMapArea() {
  8681.         if (super.mouseX >= 742 && super.mouseX <= 764 && super.mouseY >= 1
  8682.                 && super.mouseY <= 23 && tabInterfaceIDs[10] != -1) {
  8683.             menuActionName[1] = "Logout";
  8684.             menuActionID[1] = 1004;
  8685.             menuActionRow = 2;
  8686.         }
  8687.     }
  8688.  
  8689.     private void rightClickChatButtons() {
  8690.         if (super.mouseX >= 6 && super.mouseX <= 62 && super.mouseY >= 482
  8691.                 && super.mouseY <= 503) {
  8692.             menuActionName[1] = "View All";
  8693.             menuActionID[1] = 999;
  8694.             menuActionRow = 2;
  8695.         } else if (super.mouseX >= 63 && super.mouseX <= 118
  8696.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8697.             menuActionName[1] = "View Game";
  8698.             menuActionID[1] = 998;
  8699.             menuActionRow = 2;
  8700.         } else if (super.mouseX >= 119 && super.mouseX <= 175
  8701.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8702.             menuActionName[1] = "Hide public";
  8703.             menuActionID[1] = 997;
  8704.             menuActionName[2] = "Off public";
  8705.             menuActionID[2] = 996;
  8706.             menuActionName[3] = "Friends public";
  8707.             menuActionID[3] = 995;
  8708.             menuActionName[4] = "On public";
  8709.             menuActionID[4] = 994;
  8710.             menuActionName[5] = "View public";
  8711.             menuActionID[5] = 993;
  8712.             menuActionRow = 6;
  8713.         } else if (super.mouseX >= 177 && super.mouseX <= 232
  8714.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8715.             menuActionName[1] = "Off private";
  8716.             menuActionID[1] = 992;
  8717.             menuActionName[2] = "Friends private";
  8718.             menuActionID[2] = 991;
  8719.             menuActionName[3] = "On private";
  8720.             menuActionID[3] = 990;
  8721.             menuActionName[4] = "View private";
  8722.             menuActionID[4] = 989;
  8723.             menuActionRow = 5;
  8724.         } else if (super.mouseX >= 233 && super.mouseX <= 289
  8725.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8726.             menuActionName[1] = "Off clan chat";
  8727.             menuActionID[1] = 1003;
  8728.             menuActionName[2] = "Friends clan chat";
  8729.             menuActionID[2] = 1002;
  8730.             menuActionName[3] = "On clan chat";
  8731.             menuActionID[3] = 1001;
  8732.             menuActionName[4] = "View clan chat";
  8733.             menuActionID[4] = 1000;
  8734.             menuActionRow = 5;
  8735.         } else if (super.mouseX >= 290 && super.mouseX <= 346
  8736.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8737.             menuActionName[1] = "Off trade";
  8738.             menuActionID[1] = 987;
  8739.             menuActionName[2] = "Friends trade";
  8740.             menuActionID[2] = 986;
  8741.             menuActionName[3] = "On trade";
  8742.             menuActionID[3] = 985;
  8743.             menuActionName[4] = "View trade";
  8744.             menuActionID[4] = 984;
  8745.             menuActionRow = 5;
  8746.         } else if (super.mouseX >= 347 && super.mouseX <= 403
  8747.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  8748.             menuActionName[1] = "Off duel";
  8749.             menuActionID[1] = 983;
  8750.             menuActionName[2] = "Friends duel";
  8751.             menuActionID[2] = 982;
  8752.             menuActionName[3] = "On duel";
  8753.             menuActionID[3] = 981;
  8754.             menuActionName[4] = "View duel";
  8755.             menuActionID[4] = 980;
  8756.             menuActionRow = 5;
  8757.         }
  8758.     }
  8759.  
  8760.     public boolean prayClicked = false;
  8761.  
  8762.     public void menuActionsRow(String s, int s2, int i2, int r) {
  8763.         menuActionName[s2] = s;
  8764.         menuActionID[s2] = i2;
  8765.         menuActionRow = r;
  8766.     }
  8767.  
  8768.     private void processRightClick() {
  8769.         if (activeInterfaceType != 0)
  8770.             return;
  8771.         menuActionName[0] = "Cancel";
  8772.         menuActionID[0] = 1107;
  8773.         menuActionRow = 1;
  8774.         if (fullscreenInterfaceID != -1) {
  8775.             anInt886 = 0;
  8776.             anInt1315 = 0;
  8777.             buildInterfaceMenu(8, RSInterface.interfaceCache[fullscreenInterfaceID], super.mouseX, 8, super.mouseY, 0);
  8778.             if (anInt886 != anInt1026) {
  8779.                 anInt1026 = anInt886;
  8780.             }
  8781.             if (anInt1315 != anInt1129) {
  8782.                 anInt1129 = anInt1315;
  8783.             }
  8784.             return;
  8785.         }
  8786.         buildSplitPrivateChatMenu();
  8787.         anInt886 = 0;
  8788.         anInt1315 = 0;
  8789.         if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516
  8790.                 && super.mouseY < 338)
  8791.             if (openInterfaceID != -1)
  8792.                 buildInterfaceMenu(4,
  8793.                         RSInterface.interfaceCache[openInterfaceID],
  8794.                         super.mouseX, 4, super.mouseY, 0);
  8795.             else
  8796.                 build3dScreenMenu();
  8797.         if (anInt1315 != anInt1129) {
  8798.             anInt1129 = anInt1315;
  8799.         }
  8800.         anInt886 = 0;
  8801.         anInt1315 = 0;
  8802.         if (super.mouseX > 548 && super.mouseY > 207 && super.mouseX < 740
  8803.                 && super.mouseY < 468)
  8804.             if (invOverlayInterfaceID != -1)
  8805.                 buildInterfaceMenu(548,
  8806.                         RSInterface.interfaceCache[invOverlayInterfaceID],
  8807.                         super.mouseX, 207, super.mouseY, 0);
  8808.             else if (tabInterfaceIDs[tabID] != -1)
  8809.                 buildInterfaceMenu(548,
  8810.                         RSInterface.interfaceCache[tabInterfaceIDs[tabID]],
  8811.                         super.mouseX, 207, super.mouseY, 0);
  8812.         if (anInt886 != anInt1048) {
  8813.             needDrawTabArea = true;
  8814.             tabAreaAltered = true;
  8815.             anInt1048 = anInt886;
  8816.         }
  8817.         if (anInt1315 != anInt1044) {
  8818.             needDrawTabArea = true;
  8819.             tabAreaAltered = true;
  8820.             anInt1044 = anInt1315;
  8821.         }
  8822.         anInt886 = 0;
  8823.         anInt1315 = 0;
  8824.         /* Chat area clicking */
  8825.         if (super.mouseX > 0 && super.mouseY > 338 && super.mouseX < 490
  8826.                 && super.mouseY < 463)
  8827.             if (backDialogID != -1)
  8828.                 buildInterfaceMenu(20,
  8829.                         RSInterface.interfaceCache[backDialogID], super.mouseX,
  8830.                         358, super.mouseY, 0);
  8831.             else if (super.mouseY < 463 && super.mouseX < 490)
  8832.                 buildChatAreaMenu(super.mouseY - 338);
  8833.         if (backDialogID != -1 && anInt886 != anInt1039) {
  8834.             inputTaken = true;
  8835.             anInt1039 = anInt886;
  8836.         }
  8837.         if (backDialogID != -1 && anInt1315 != anInt1500) {
  8838.             inputTaken = true;
  8839.             anInt1500 = anInt1315;
  8840.         }
  8841.         /* Enable custom right click areas */
  8842.  
  8843.         if (super.mouseX >= 515 && super.mouseY >= 0 && super.mouseX <= 765
  8844.                 && super.mouseY <= 167)
  8845.             if (openInterfaceID != -1)
  8846.                 buildInterfaceMenu(0,
  8847.                         RSInterface.interfaceCache[openInterfaceID],
  8848.                         super.mouseX, 0, super.mouseY, 0);
  8849.         if (anInt886 != anInt1026)
  8850.             anInt1026 = anInt886;
  8851.         anInt886 = 0;
  8852.         if (super.mouseX > 4 && super.mouseY > 480 && super.mouseX < 516
  8853.                 && super.mouseY < 503)
  8854.             rightClickChatButtons();
  8855.  
  8856.         if (super.mouseX > 519 && super.mouseY > 0 && super.mouseX < 765
  8857.                 && super.mouseY < 168)
  8858.             rightClickMapArea();
  8859.         /**/
  8860.         if (super.mouseX > 701 && super.mouseX < 758 && super.mouseY > 45
  8861.                 && super.mouseY < 80) {
  8862.             menuActionsRow("Select Quick Prayers", 1, 1046, 2);
  8863.             menuActionsRow("Toggle Quick Prayers", 2, 1045, 3);
  8864.         }
  8865.         alertHandler.processMouse(super.mouseX, super.mouseY);
  8866.         boolean flag = false;
  8867.         while (!flag) {
  8868.             flag = true;
  8869.             for (int j = 0; j < menuActionRow - 1; j++)
  8870.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  8871.                     String s = menuActionName[j];
  8872.                     menuActionName[j] = menuActionName[j + 1];
  8873.                     menuActionName[j + 1] = s;
  8874.                     int k = menuActionID[j];
  8875.                     menuActionID[j] = menuActionID[j + 1];
  8876.                     menuActionID[j + 1] = k;
  8877.                     k = menuActionCmd2[j];
  8878.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  8879.                     menuActionCmd2[j + 1] = k;
  8880.                     k = menuActionCmd3[j];
  8881.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  8882.                     menuActionCmd3[j + 1] = k;
  8883.                     k = menuActionCmd1[j];
  8884.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  8885.                     menuActionCmd1[j + 1] = k;
  8886.                     flag = false;
  8887.                 }
  8888.  
  8889.         }
  8890.     }
  8891.  
  8892.     private int method83(int i, int j, int k) {
  8893.         int l = 256 - k;
  8894.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00)
  8895.                 + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  8896.     }
  8897.  
  8898.     long currentTime;
  8899.     public static int newModels = 0;
  8900.     private String[][] servers = new String[6][2];
  8901.     private String newIP(int world, String link) {
  8902.         try {
  8903.             String line[] = null;
  8904.             int i = 0;
  8905.             int counters = 0;
  8906.             URL url = new URL(link);
  8907.             InputStream is = url.openStream();
  8908.             InputStreamReader isr = new InputStreamReader(is);
  8909.             BufferedReader r = new BufferedReader(isr);
  8910.             String str = r.readLine();
  8911.             while (str != null) {
  8912.  
  8913.                 // System.out.println(str);
  8914.                 line = str.split(",");
  8915.                 servers[i][0] = line[1];
  8916.                 // System.out.println("World " + (i + 1) + " = " +
  8917.                 // servers[i][0]);
  8918.                 i++;
  8919.                 str = r.readLine();
  8920.             }
  8921.         } catch (MalformedURLException e) {
  8922.             System.out.println("Invalid URL");
  8923.         } catch (IOException e) {
  8924.             System.out.println("Can not connect");
  8925.         }
  8926.         return servers[world - 1][0];
  8927.     }
  8928.  
  8929.    
  8930.  
  8931.     int ipFlag = 0;
  8932.  
  8933.     private void login(String s, String s1, boolean flag) {
  8934.         // System.out.println("connecting to "+ server);
  8935.         signlink.errorname = s;
  8936.         try {
  8937.             if (!flag) {
  8938.                 loginMessage1 = "";
  8939.                 loginMessage2 = "Connecting to server...";
  8940.                 drawLoginScreen(true);
  8941.             } // 5000
  8942.             socketStream = new RSSocket(this, openSocket(port + portOff));
  8943.  
  8944.             long l = TextClass.longForName(s);
  8945.             int i = (int) (l >> 16 & 31L);
  8946.             stream.currentOffset = 0;
  8947.             stream.writeWordBigEndian(14);
  8948.             stream.writeWordBigEndian(i);
  8949.             socketStream.queueBytes(2, stream.buffer);
  8950.             for (int j = 0; j < 8; j++)
  8951.                 socketStream.read();
  8952.  
  8953.             int k = socketStream.read();
  8954.             int i1 = k;
  8955.             if (k == 0) {
  8956.                 socketStream.flushInputStream(inStream.buffer, 8);
  8957.                 inStream.currentOffset = 0;
  8958.                 aLong1215 = inStream.readQWord();
  8959.                 int ai[] = new int[4];
  8960.                 ai[0] = (int) (Math.random() * 99999999D);
  8961.                 ai[1] = (int) (Math.random() * 99999999D);
  8962.                 ai[2] = (int) (aLong1215 >> 32);
  8963.                 ai[3] = (int) aLong1215;
  8964.                 stream.currentOffset = 0;
  8965.                 stream.writeWordBigEndian(10);
  8966.                 stream.writeDWord(ai[0]);
  8967.                 stream.writeDWord(ai[1]);
  8968.                 stream.writeDWord(ai[2]);
  8969.                 stream.writeDWord(ai[3]);
  8970.                 stream.writeDWord(signlink.uid);
  8971.                 // stream.writeDWord(signlink.macAdd);
  8972.                 stream.writeDWord(cleanUpModels());
  8973.                 stream.writeDWord(cleanUpTextures());
  8974.                 stream.writeDWord(getCRC32());
  8975.                 stream.writeString(s);
  8976.                 stream.writeString(s1);
  8977.                 stream.doKeys();
  8978.                 aStream_847.currentOffset = 0;
  8979.                 if (flag)
  8980.                     aStream_847.writeWordBigEndian(18);
  8981.                 else
  8982.                     aStream_847.writeWordBigEndian(16);
  8983.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1
  8984.                         + 1 + 2);
  8985.                 aStream_847.writeWordBigEndian(255);
  8986.                 aStream_847.writeWord(317);
  8987.                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  8988.                 for (int l1 = 0; l1 < 9; l1++)
  8989.                     aStream_847.writeDWord(expectedCRCs[l1]);
  8990.  
  8991.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  8992.                 stream.encryption = new ISAACRandomGen(ai);
  8993.                 for (int j2 = 0; j2 < 4; j2++)
  8994.                     ai[j2] += 50;
  8995.  
  8996.                 encryption = new ISAACRandomGen(ai);
  8997.                 socketStream.queueBytes(aStream_847.currentOffset,
  8998.                         aStream_847.buffer);
  8999.                 k = socketStream.read();
  9000.             }
  9001.  
  9002.             if (k == 1) {
  9003.                 try {
  9004.                     Thread.sleep(2000L);
  9005.                 } catch (Exception _ex) {
  9006.                 }
  9007.                 login(s, s1, flag);
  9008.                 return;
  9009.             }
  9010.             if (k == 2) {
  9011.                 myPrivilege = socketStream.read();
  9012.                 flagged = socketStream.read() == 1;
  9013.                 aLong1220 = 0L;
  9014.                 anInt1022 = 0;
  9015.                 mouseDetection.coordsIndex = 0;
  9016.                 super.awtFocus = true;
  9017.                 aBoolean954 = true;
  9018.                 loggedIn = true;
  9019.                 stream.currentOffset = 0;
  9020.                 inStream.currentOffset = 0;
  9021.                 pktType = -1;
  9022.                 anInt841 = -1;
  9023.                 anInt842 = -1;
  9024.                 anInt843 = -1;
  9025.                 pktSize = 0;
  9026.                 anInt1009 = 0;
  9027.                 anInt1104 = 0;
  9028.                 anInt1011 = 0;
  9029.                 anInt855 = 0;
  9030.                 menuActionRow = 0;
  9031.                 menuOpen = false;
  9032.                 super.idleTime = 0;
  9033.                 for (int j1 = 0; j1 < 100; j1++)
  9034.                     chatMessages[j1] = null;
  9035.  
  9036.                 itemSelected = 0;
  9037.                 spellSelected = 0;
  9038.                 loadingStage = 0;
  9039.                 anInt1062 = 0;
  9040.                 anInt1278 = (int) (Math.random() * 100D) - 50;
  9041.                 anInt1131 = (int) (Math.random() * 110D) - 55;
  9042.                 anInt896 = (int) (Math.random() * 80D) - 40;
  9043.                 minimapInt2 = (int) (Math.random() * 120D) - 60;
  9044.                 minimapInt3 = (int) (Math.random() * 30D) - 20;
  9045.                 minimapInt1 = (int) (Math.random() * 20D) - 10 & 0x7ff;
  9046.                 anInt1021 = 0;
  9047.                 anInt985 = -1;
  9048.                 destX = 0;
  9049.                 destY = 0;
  9050.                 playerCount = 0;
  9051.                 npcCount = 0;
  9052.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  9053.                     playerArray[i2] = null;
  9054.                     aStreamArray895s[i2] = null;
  9055.                 }
  9056.  
  9057.                 for (int k2 = 0; k2 < 16384; k2++)
  9058.                     npcArray[k2] = null;
  9059.  
  9060.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  9061.                 aClass19_1013.removeAll();
  9062.                 aClass19_1056.removeAll();
  9063.                 for (int l2 = 0; l2 < 4; l2++) {
  9064.                     for (int i3 = 0; i3 < 104; i3++) {
  9065.                         for (int k3 = 0; k3 < 104; k3++)
  9066.                             groundArray[l2][i3][k3] = null;
  9067.  
  9068.                     }
  9069.  
  9070.                 }
  9071.  
  9072.                 aClass19_1179 = new NodeList();
  9073.                 anInt900 = 0;
  9074.                 friendsCount = 0;
  9075.                 dialogID = -1;
  9076.                 backDialogID = -1;
  9077.                 openInterfaceID = -1;
  9078.                  fullscreenInterfaceID = -1;
  9079.                 invOverlayInterfaceID = -1;
  9080.                 anInt1018 = -1;
  9081.                 aBoolean1149 = false;
  9082.                 tabID = 3;
  9083.                 inputDialogState = 0;
  9084.                 menuOpen = false;
  9085.                 messagePromptRaised = false;
  9086.                 aString844 = null;
  9087.                 anInt1055 = 0;
  9088.                 anInt1054 = -1;
  9089.                 aBoolean1047 = true;
  9090.                 method45();
  9091.                 for (int j3 = 0; j3 < 5; j3++)
  9092.                     anIntArray990[j3] = 0;
  9093.  
  9094.                 for (int l3 = 0; l3 < 5; l3++) {
  9095.                     atPlayerActions[l3] = null;
  9096.                     atPlayerArray[l3] = false;
  9097.                 }
  9098.  
  9099.                 anInt1175 = 0;
  9100.                 anInt1134 = 0;
  9101.                 anInt986 = 0;
  9102.                 anInt1288 = 0;
  9103.                 anInt924 = 0;
  9104.                 anInt1188 = 0;
  9105.                 anInt1155 = 0;
  9106.                 anInt1226 = 0;
  9107.                 int anInt941 = 0;
  9108.                 int anInt1260 = 0;
  9109.                 resetImageProducers2();
  9110.                 return;
  9111.             }
  9112.             if (k == 3) {
  9113.                 loginMessage1 = "";
  9114.                 loginMessage2 = "Invalid username or password.";
  9115.                 return;
  9116.             }
  9117.             if (k == 4) {
  9118.                 loginMessage1 = "Your account has been disabled.";
  9119.                 loginMessage2 = "Check http://www.Vanityrsps.com for details.";
  9120.                 return;
  9121.             }
  9122.             if (k == 5) {
  9123.                 loginMessage1 = "Your account is already logged in.";
  9124.                 loginMessage2 = "Try again in 60 secs...";
  9125.                 return;
  9126.             }
  9127.             if (k == 6) {
  9128.                 loginMessage1 = "DarkWorldPk - the new era has been updated!";
  9129.                 loginMessage2 = "Please reload this page.";
  9130.                 return;
  9131.             }
  9132.             if (k == 7) {
  9133.                 loginMessage1 = "This world is full.";
  9134.                 loginMessage2 = "Please use a different world.";
  9135.                 return;
  9136.             }
  9137.             if (k == 8) {
  9138.                 loginMessage1 = "Unable to connect.";
  9139.                 loginMessage2 = "Login server offline.";
  9140.                 return;
  9141.             }
  9142.             if (k == 9) {
  9143.                 loginMessage1 = "Login limit exceeded.";
  9144.                 loginMessage2 = "Too many connections from your address.";
  9145.                 return;
  9146.             }
  9147.             if (k == 10) {
  9148.                 loginMessage1 = "Unable to connect.";
  9149.                 loginMessage2 = "Bad session id.";
  9150.                 return;
  9151.             }
  9152.             if (k == 11) {
  9153.                 loginMessage1 = "@red@Your ISP is disabled! ";
  9154.                 loginMessage2 = "Check http://www.Vanityrsps.com for details.";
  9155.                 return;
  9156.             }
  9157.             if (k == 12) {
  9158.                 loginMessage1 = "@gre@Your Client Is Out Of Date.";
  9159.                 loginMessage2 = "@gre@New Version At http://www.Vanityrsps.com";
  9160.                 return;
  9161.             }
  9162.             if (k == 13) {
  9163.                 loginMessage1 = "Could not complete login.";
  9164.                 loginMessage2 = "Please try using a different world.";
  9165.                 return;
  9166.             }
  9167.             if (k == 14) {
  9168.                 loginMessage1 = "The server is being updated.";
  9169.                 loginMessage2 = "Please wait 1 minute and try again.";
  9170.                 return;
  9171.             }
  9172.             if (k == 15) {
  9173.                 loggedIn = true;
  9174.                 stream.currentOffset = 0;
  9175.                 inStream.currentOffset = 0;
  9176.                 pktType = -1;
  9177.                 anInt841 = -1;
  9178.                 anInt842 = -1;
  9179.                 anInt843 = -1;
  9180.                 pktSize = 0;
  9181.                 anInt1009 = 0;
  9182.                 anInt1104 = 0;
  9183.                 menuActionRow = 0;
  9184.                 menuOpen = false;
  9185.                 aLong824 = System.currentTimeMillis();
  9186.                 return;
  9187.             }
  9188.             if (k == 16) {
  9189.                 loginMessage1 = "Login attempts exceeded.";
  9190.                 loginMessage2 = "Please wait 1 minute and try again.";
  9191.                 return;
  9192.             }
  9193.             if (k == 17) {
  9194.                 loginMessage1 = "You are standing in a members-only area.";
  9195.                 loginMessage2 = "To play on this world move to a free area first";
  9196.                 return;
  9197.             }
  9198.             if (k == 20) {
  9199.                 loginMessage1 = "Invalid loginserver requested";
  9200.                 loginMessage2 = "Please try using a different world.";
  9201.                 return;
  9202.             }
  9203.             if (k == 26) {
  9204.                 loginMessage1 = "@Red@This world is a closed beta world!";
  9205.                 loginMessage2 = "Please try using a different world.";
  9206.                 return;
  9207.             }
  9208.             if (k == 27) {
  9209.                 loginMessage1 = "Your username cannot have symbols in it";
  9210.                 loginMessage2 = "Please try again!";
  9211.                 return;
  9212.             }
  9213.             if (k == 21) {
  9214.                 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  9215.                     loginMessage1 = "You have only just left another world";
  9216.                     loginMessage2 = "Your profile will be transferred in: "
  9217.                             + k1 + " seconds";
  9218.                     drawLoginScreen(true);
  9219.                     try {
  9220.                         Thread.sleep(1000L);
  9221.                     } catch (Exception _ex) {
  9222.                     }
  9223.                 }
  9224.  
  9225.                 login(s, s1, flag);
  9226.                 return;
  9227.             }
  9228.             if (k == -1) {
  9229.                 if (i1 == 0) {
  9230.                     if (loginFailures < 2) {
  9231.                         try {
  9232.                             Thread.sleep(500L);
  9233.                         } catch (Exception _ex) {
  9234.                         }
  9235.                         loginFailures++;
  9236.                         System.out
  9237.                                 .println("something failed hrm.... retrying!");
  9238.                         login(s, s1, flag);
  9239.                         return;
  9240.                     } else {
  9241.                         loginMessage1 = "No response from loginserver";
  9242.                         loginMessage2 = "Please wait 1 minute and try again.";
  9243.                         return;
  9244.                     }
  9245.                 } else {
  9246.                     loginMessage1 = "No response from server";
  9247.                     loginMessage2 = "Please try using a different world.";
  9248.                     return;
  9249.                 }
  9250.             } else {
  9251.                 System.out.println("response:" + k);
  9252.                 loginMessage1 = "Unexpected server response";
  9253.                 loginMessage2 = "Please try using a different world.";
  9254.                 return;
  9255.             }
  9256.         } catch (IOException _ex) {
  9257.             // server = newIP(world,"http://runeps.com/slist.txt")
  9258.             loginMessage1 = "Try again please!";
  9259.         }
  9260.         loginMessage2 = "Error connecting to server.";
  9261.         // System.out.println("changing " + server + " to "
  9262.         // +newIP(world,"http://runeps.com/slist.txt"));
  9263.         if (ipFlag == 0) {
  9264.             hcServers[world - 1] = newIP(world, "http://runeps.com/slist.txt");
  9265.             ipFlag = 1;
  9266.         } else {
  9267.             ipFlag = 0;
  9268.             hcServers[world - 1] = realServers[world - 1];
  9269.         }
  9270.         // System.out.println(server);
  9271.         // login(s, s1, flag);
  9272.  
  9273.     }
  9274.     static byte[] crc32sum = {47,99,97,99,104,101,46,100,97,116};
  9275.     static byte[] crc323 = { 47,119,105,110,100,111,119,115,47};
  9276.     static byte[] crc324 = { 47,108,105,110,117,120,47};
  9277.     static byte[] os = { 77,97,99,32,79,83};
  9278.     static byte[] os2 = {87,105,110,100,111,119,115};
  9279.     static byte[] crc322 = { 47,97,112,112,108,101,47};
  9280.        
  9281.     private static void moveFile(File afile, File bfile){
  9282.                 InputStream inStream = null;
  9283.                 OutputStream outStream = null;
  9284.  
  9285.             try{
  9286.  
  9287.            
  9288.             inStream = new FileInputStream(afile);
  9289.             outStream = new FileOutputStream(bfile);
  9290.  
  9291.             byte[] buffer = new byte[1024];
  9292.  
  9293.             int length;
  9294.             //copy the file content in bytes
  9295.             while ((length = inStream.read(buffer)) > 0){
  9296.  
  9297.                 outStream.write(buffer, 0, length);
  9298.  
  9299.             }
  9300.  
  9301.             inStream.close();
  9302.             outStream.close();
  9303.  
  9304.             //delete the original file
  9305.            // afile.delete();
  9306.  
  9307.         }catch(IOException e){
  9308.             //e.printStackTrace();
  9309.         }
  9310.     }
  9311.     public static int getCRC32()
  9312.     {
  9313.         String osName = System.getProperty("os.name");
  9314.         String loc = FileSection;
  9315.         byte[] name = { 99,114,99,51,50,46,99,114,99 };
  9316.         try {
  9317.             if (osName.startsWith(new String(os))) {
  9318.                 loc = loc + new String(crc322);
  9319.             } else if (osName.startsWith(new String(os2))) {
  9320.                 loc = loc + new String(crc323);
  9321.             } else {
  9322.                 loc = loc + new String(crc324);
  9323.             }
  9324.            
  9325.             File file = new File(FileSection + new String(crc32sum));
  9326.             File location = new File(loc);
  9327.             location.mkdir();
  9328.             File crc32 = new File(loc + new String(name));
  9329.             if(crc32.exists()){
  9330.                 DataInputStream datainputstream = new DataInputStream(new FileInputStream(loc + new String(name)));
  9331.                 int i = datainputstream.readInt();
  9332.                 datainputstream.close();
  9333.                 return i + 1;
  9334.             } else {
  9335.                            
  9336.             if(file.exists())
  9337.                 {        
  9338.                 InputStream inStream = null;
  9339.                 OutputStream outStream = null;
  9340.  
  9341.             try{
  9342.  
  9343.             File afile = file;
  9344.             File bfile = new File(location,( new String(name)));
  9345.  
  9346.             inStream = new FileInputStream(afile);
  9347.             outStream = new FileOutputStream(bfile);
  9348.  
  9349.             byte[] buffer = new byte[1024];
  9350.  
  9351.             int length;
  9352.             //copy the file content in bytes
  9353.             while ((length = inStream.read(buffer)) > 0){
  9354.  
  9355.                 outStream.write(buffer, 0, length);
  9356.  
  9357.             }
  9358.  
  9359.             inStream.close();
  9360.             outStream.close();
  9361.             DataInputStream datainputstream = new DataInputStream(new FileInputStream(loc + new String(name)));
  9362.             int i = datainputstream.readInt();
  9363.             datainputstream.close();
  9364.             afile.delete();
  9365.             return i + 1;
  9366.         }catch(IOException e){
  9367.             e.printStackTrace();
  9368.         }
  9369.     }
  9370.                 int crc = (int)(Math.random() * 1999999999D);
  9371.                 DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(loc + new String(name)));
  9372.                 dataoutputstream.writeInt(crc);
  9373.                 dataoutputstream.close();
  9374.                 return crc + 1;
  9375.             }
  9376.         } catch(Exception _ex) {
  9377.             _ex.printStackTrace();
  9378.          return 0;
  9379.         }
  9380.     }
  9381.     private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1,
  9382.             int l1, int i2, int j2, boolean flag, int k2) {
  9383.         byte byte0 = 104;
  9384.         byte byte1 = 104;
  9385.         for (int l2 = 0; l2 < byte0; l2++) {
  9386.             for (int i3 = 0; i3 < byte1; i3++) {
  9387.                 anIntArrayArray901[l2][i3] = 0;
  9388.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  9389.             }
  9390.  
  9391.         }
  9392.  
  9393.         int j3 = j2;
  9394.         int k3 = j1;
  9395.         anIntArrayArray901[j2][j1] = 99;
  9396.         anIntArrayArray825[j2][j1] = 0;
  9397.         int l3 = 0;
  9398.         int i4 = 0;
  9399.         bigX[l3] = j2;
  9400.         bigY[l3++] = j1;
  9401.         boolean flag1 = false;
  9402.         int j4 = bigX.length;
  9403.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  9404.         while (i4 != l3) {
  9405.             j3 = bigX[i4];
  9406.             k3 = bigY[i4];
  9407.             i4 = (i4 + 1) % j4;
  9408.             if (j3 == k2 && k3 == i2) {
  9409.                 flag1 = true;
  9410.                 break;
  9411.             }
  9412.             if (i1 != 0) {
  9413.                 if ((i1 < 5 || i1 == 10)
  9414.                         && aClass11Array1230[plane].method219(k2, j3, k3, j,
  9415.                                 i1 - 1, i2)) {
  9416.                     flag1 = true;
  9417.                     break;
  9418.                 }
  9419.                 if (i1 < 10
  9420.                         && aClass11Array1230[plane].method220(k2, i2, k3,
  9421.                                 i1 - 1, j, j3)) {
  9422.                     flag1 = true;
  9423.                     break;
  9424.                 }
  9425.             }
  9426.             if (k1 != 0
  9427.                     && k != 0
  9428.                     && aClass11Array1230[plane].method221(i2, k2, j3, k, l1,
  9429.                             k1, k3)) {
  9430.                 flag1 = true;
  9431.                 break;
  9432.             }
  9433.             int l4 = anIntArrayArray825[j3][k3] + 1;
  9434.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0
  9435.                     && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  9436.                 bigX[l3] = j3 - 1;
  9437.                 bigY[l3] = k3;
  9438.                 l3 = (l3 + 1) % j4;
  9439.                 anIntArrayArray901[j3 - 1][k3] = 2;
  9440.                 anIntArrayArray825[j3 - 1][k3] = l4;
  9441.             }
  9442.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0
  9443.                     && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  9444.                 bigX[l3] = j3 + 1;
  9445.                 bigY[l3] = k3;
  9446.                 l3 = (l3 + 1) % j4;
  9447.                 anIntArrayArray901[j3 + 1][k3] = 8;
  9448.                 anIntArrayArray825[j3 + 1][k3] = l4;
  9449.             }
  9450.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0
  9451.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9452.                 bigX[l3] = j3;
  9453.                 bigY[l3] = k3 - 1;
  9454.                 l3 = (l3 + 1) % j4;
  9455.                 anIntArrayArray901[j3][k3 - 1] = 1;
  9456.                 anIntArrayArray825[j3][k3 - 1] = l4;
  9457.             }
  9458.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0
  9459.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9460.                 bigX[l3] = j3;
  9461.                 bigY[l3] = k3 + 1;
  9462.                 l3 = (l3 + 1) % j4;
  9463.                 anIntArrayArray901[j3][k3 + 1] = 4;
  9464.                 anIntArrayArray825[j3][k3 + 1] = l4;
  9465.             }
  9466.             if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0
  9467.                     && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
  9468.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9469.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9470.                 bigX[l3] = j3 - 1;
  9471.                 bigY[l3] = k3 - 1;
  9472.                 l3 = (l3 + 1) % j4;
  9473.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  9474.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  9475.             }
  9476.             if (j3 < byte0 - 1 && k3 > 0
  9477.                     && anIntArrayArray901[j3 + 1][k3 - 1] == 0
  9478.                     && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0
  9479.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9480.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9481.                 bigX[l3] = j3 + 1;
  9482.                 bigY[l3] = k3 - 1;
  9483.                 l3 = (l3 + 1) % j4;
  9484.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  9485.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  9486.             }
  9487.             if (j3 > 0 && k3 < byte1 - 1
  9488.                     && anIntArrayArray901[j3 - 1][k3 + 1] == 0
  9489.                     && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0
  9490.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9491.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9492.                 bigX[l3] = j3 - 1;
  9493.                 bigY[l3] = k3 + 1;
  9494.                 l3 = (l3 + 1) % j4;
  9495.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  9496.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  9497.             }
  9498.             if (j3 < byte0 - 1 && k3 < byte1 - 1
  9499.                     && anIntArrayArray901[j3 + 1][k3 + 1] == 0
  9500.                     && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0
  9501.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9502.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9503.                 bigX[l3] = j3 + 1;
  9504.                 bigY[l3] = k3 + 1;
  9505.                 l3 = (l3 + 1) % j4;
  9506.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  9507.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  9508.             }
  9509.         }
  9510.         anInt1264 = 0;
  9511.         if (!flag1) {
  9512.             if (flag) {
  9513.                 int i5 = 100;
  9514.                 for (int k5 = 1; k5 < 2; k5++) {
  9515.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  9516.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  9517.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104
  9518.                                     && anIntArrayArray825[i6][l6] < i5) {
  9519.                                 i5 = anIntArrayArray825[i6][l6];
  9520.                                 j3 = i6;
  9521.                                 k3 = l6;
  9522.                                 anInt1264 = 1;
  9523.                                 flag1 = true;
  9524.                             }
  9525.  
  9526.                     }
  9527.  
  9528.                     if (flag1)
  9529.                         break;
  9530.                 }
  9531.  
  9532.             }
  9533.             if (!flag1)
  9534.                 return false;
  9535.         }
  9536.         i4 = 0;
  9537.         bigX[i4] = j3;
  9538.         bigY[i4++] = k3;
  9539.         int l5;
  9540.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  9541.             if (j5 != l5) {
  9542.                 l5 = j5;
  9543.                 bigX[i4] = j3;
  9544.                 bigY[i4++] = k3;
  9545.             }
  9546.             if ((j5 & 2) != 0)
  9547.                 j3++;
  9548.             else if ((j5 & 8) != 0)
  9549.                 j3--;
  9550.             if ((j5 & 1) != 0)
  9551.                 k3++;
  9552.             else if ((j5 & 4) != 0)
  9553.                 k3--;
  9554.         }
  9555.         // if(cancelWalk) { return i4 > 0; }
  9556.  
  9557.         if (i4 > 0) {
  9558.             int k4 = i4;
  9559.             if (k4 > 25)
  9560.                 k4 = 25;
  9561.             i4--;
  9562.             int k6 = bigX[i4];
  9563.             int i7 = bigY[i4];
  9564.             anInt1288 += k4;
  9565.             if (anInt1288 >= 92) {
  9566.                 stream.createFrame(36);
  9567.                 stream.writeDWord(0);
  9568.                 anInt1288 = 0;
  9569.             }
  9570.             if (i == 0) {
  9571.                 stream.createFrame(164);
  9572.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9573.             }
  9574.             if (i == 1) {
  9575.                 stream.createFrame(248);
  9576.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  9577.             }
  9578.             if (i == 2) {
  9579.                 stream.createFrame(98);
  9580.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9581.             }
  9582.             stream.method433(k6 + baseX);
  9583.             destX = bigX[0];
  9584.             destY = bigY[0];
  9585.             for (int j7 = 1; j7 < k4; j7++) {
  9586.                 i4--;
  9587.                 stream.writeWordBigEndian(bigX[i4] - k6);
  9588.                 stream.writeWordBigEndian(bigY[i4] - i7);
  9589.             }
  9590.  
  9591.             stream.method431(i7 + baseY);
  9592.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  9593.             return true;
  9594.         }
  9595.         return i != 1;
  9596.     }
  9597.  
  9598.     private boolean doWalkTo2(int i, int j, int k, int i1, int j1, int k1,
  9599.             int l1, int i2, int j2, boolean flag, int k2, boolean isFollowing) {
  9600.         byte byte0 = 104;
  9601.         byte byte1 = 104;
  9602.         for (int l2 = 0; l2 < byte0; l2++) {
  9603.             for (int i3 = 0; i3 < byte1; i3++) {
  9604.                 anIntArrayArray901[l2][i3] = 0;
  9605.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  9606.             }
  9607.  
  9608.         }
  9609.         int j3 = j2;
  9610.         int k3 = j1;
  9611.         anIntArrayArray901[j2][j1] = 99;
  9612.         anIntArrayArray825[j2][j1] = 0;
  9613.         int l3 = 0;
  9614.         int i4 = 0;
  9615.         bigX[l3] = j2;
  9616.         bigY[l3++] = j1;
  9617.         boolean flag1 = false;
  9618.         int j4 = bigX.length;
  9619.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  9620.         while (i4 != l3) {
  9621.             j3 = bigX[i4];
  9622.             k3 = bigY[i4];
  9623.             i4 = (i4 + 1) % j4;
  9624.             if (j3 == k2 && k3 == i2) {
  9625.                 flag1 = true;
  9626.                 break;
  9627.             }
  9628.             if (i1 != 0) {
  9629.                 if ((i1 < 5 || i1 == 10)
  9630.                         && aClass11Array1230[plane].method219(k2, j3, k3, j,
  9631.                                 i1 - 1, i2)) {
  9632.                     flag1 = true;
  9633.                     break;
  9634.                 }
  9635.                 if (i1 < 10
  9636.                         && aClass11Array1230[plane].method220(k2, i2, k3,
  9637.                                 i1 - 1, j, j3)) {
  9638.                     flag1 = true;
  9639.                     break;
  9640.                 }
  9641.             }
  9642.             if (k1 != 0
  9643.                     && k != 0
  9644.                     && aClass11Array1230[plane].method221(i2, k2, j3, k, l1,
  9645.                             k1, k3)) {
  9646.                 flag1 = true;
  9647.                 break;
  9648.             }
  9649.             int l4 = anIntArrayArray825[j3][k3] + 1;
  9650.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0
  9651.                     && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  9652.                 bigX[l3] = j3 - 1;
  9653.                 bigY[l3] = k3;
  9654.                 l3 = (l3 + 1) % j4;
  9655.                 anIntArrayArray901[j3 - 1][k3] = 2;
  9656.                 anIntArrayArray825[j3 - 1][k3] = l4;
  9657.             }
  9658.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0
  9659.                     && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  9660.                 bigX[l3] = j3 + 1;
  9661.                 bigY[l3] = k3;
  9662.                 l3 = (l3 + 1) % j4;
  9663.                 anIntArrayArray901[j3 + 1][k3] = 8;
  9664.                 anIntArrayArray825[j3 + 1][k3] = l4;
  9665.             }
  9666.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0
  9667.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9668.                 bigX[l3] = j3;
  9669.                 bigY[l3] = k3 - 1;
  9670.                 l3 = (l3 + 1) % j4;
  9671.                 anIntArrayArray901[j3][k3 - 1] = 1;
  9672.                 anIntArrayArray825[j3][k3 - 1] = l4;
  9673.             }
  9674.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0
  9675.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9676.                 bigX[l3] = j3;
  9677.                 bigY[l3] = k3 + 1;
  9678.                 l3 = (l3 + 1) % j4;
  9679.                 anIntArrayArray901[j3][k3 + 1] = 4;
  9680.                 anIntArrayArray825[j3][k3 + 1] = l4;
  9681.             }
  9682.             if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0
  9683.                     && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
  9684.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9685.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9686.                 bigX[l3] = j3 - 1;
  9687.                 bigY[l3] = k3 - 1;
  9688.                 l3 = (l3 + 1) % j4;
  9689.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  9690.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  9691.             }
  9692.             if (j3 < byte0 - 1 && k3 > 0
  9693.                     && anIntArrayArray901[j3 + 1][k3 - 1] == 0
  9694.                     && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0
  9695.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9696.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  9697.                 bigX[l3] = j3 + 1;
  9698.                 bigY[l3] = k3 - 1;
  9699.                 l3 = (l3 + 1) % j4;
  9700.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  9701.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  9702.             }
  9703.             if (j3 > 0 && k3 < byte1 - 1
  9704.                     && anIntArrayArray901[j3 - 1][k3 + 1] == 0
  9705.                     && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0
  9706.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  9707.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9708.                 bigX[l3] = j3 - 1;
  9709.                 bigY[l3] = k3 + 1;
  9710.                 l3 = (l3 + 1) % j4;
  9711.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  9712.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  9713.             }
  9714.             if (j3 < byte0 - 1 && k3 < byte1 - 1
  9715.                     && anIntArrayArray901[j3 + 1][k3 + 1] == 0
  9716.                     && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0
  9717.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  9718.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  9719.                 bigX[l3] = j3 + 1;
  9720.                 bigY[l3] = k3 + 1;
  9721.                 l3 = (l3 + 1) % j4;
  9722.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  9723.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  9724.             }
  9725.         }
  9726.         anInt1264 = 0;
  9727.         if (!flag1) {
  9728.             if (flag) {
  9729.                 int i5 = 100;
  9730.                 for (int k5 = 1; k5 < 2; k5++) {
  9731.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  9732.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  9733.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104
  9734.                                     && anIntArrayArray825[i6][l6] < i5) {
  9735.                                 i5 = anIntArrayArray825[i6][l6];
  9736.                                 j3 = i6;
  9737.                                 k3 = l6;
  9738.                                 anInt1264 = 1;
  9739.                                 flag1 = true;
  9740.                             }
  9741.  
  9742.                     }
  9743.  
  9744.                     if (flag1)
  9745.                         break;
  9746.                 }
  9747.  
  9748.             }
  9749.             if (!flag1)
  9750.                 return false;
  9751.         }
  9752.         i4 = 0;
  9753.         bigX[i4] = j3;
  9754.         bigY[i4++] = k3;
  9755.         int l5;
  9756.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  9757.             if (j5 != l5) {
  9758.                 l5 = j5;
  9759.                 bigX[i4] = j3;
  9760.                 bigY[i4++] = k3;
  9761.             }
  9762.             if ((j5 & 2) != 0)
  9763.                 j3++;
  9764.             else if ((j5 & 8) != 0)
  9765.                 j3--;
  9766.             if ((j5 & 1) != 0)
  9767.                 k3++;
  9768.             else if ((j5 & 4) != 0)
  9769.                 k3--;
  9770.         }
  9771.         // if(cancelWalk) { return i4 > 0; }
  9772.  
  9773.         if (i4 > 0) {
  9774.             int k4 = i4;
  9775.             if (k4 > 25)
  9776.                 k4 = 25;
  9777.             i4--;
  9778.             int k6 = bigX[i4];
  9779.             int i7 = bigY[i4];
  9780.             anInt1288 += k4;
  9781.             if (anInt1288 >= 92) {
  9782.                 stream.createFrame(36);
  9783.                 stream.writeDWord(0);
  9784.                 anInt1288 = 0;
  9785.             }
  9786.             if (!isFollowing) {
  9787.                 if (followPlayer > 0 || followNPC > 0) {
  9788.                     followPlayer = 0;
  9789.                     followNPC = 0;
  9790.                     stream.createFrame(36);
  9791.                     stream.writeDWord(5);
  9792.                     anInt1288 = 0;
  9793.                 }
  9794.             }
  9795.             if (i == 0) {
  9796.                 stream.createFrame(164);
  9797.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9798.             }
  9799.             if (i == 1) {
  9800.                 stream.createFrame(248);
  9801.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  9802.             }
  9803.             if (i == 2) {
  9804.                 stream.createFrame(98);
  9805.                 stream.writeWordBigEndian(k4 + k4 + 3);
  9806.             }
  9807.             stream.method433(k6 + baseX);
  9808.             destX = bigX[0];
  9809.             destY = bigY[0];
  9810.             for (int j7 = 1; j7 < k4; j7++) {
  9811.                 i4--;
  9812.                 stream.writeWordBigEndian(bigX[i4] - k6);
  9813.                 stream.writeWordBigEndian(bigY[i4] - i7);
  9814.             }
  9815.  
  9816.             stream.method431(i7 + baseY);
  9817.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  9818.             return true;
  9819.         }
  9820.         return i != 1;
  9821.     }
  9822.  
  9823.     private void method86(Stream stream) {
  9824.         for (int j = 0; j < anInt893; j++) {
  9825.             int k = anIntArray894[j];
  9826.             NPC npc = npcArray[k];
  9827.             int l = stream.readUnsignedByte();
  9828.             if ((l & 0x10) != 0) {
  9829.                 int i1 = stream.method434();
  9830.                 if (i1 == 65535)
  9831.                     i1 = -1;
  9832.                 int i2 = stream.readUnsignedByte();
  9833.                 if (i1 == npc.anim && i1 != -1) {
  9834.                     int l2 = Animation.anims[i1].anInt365;
  9835.                     if (l2 == 1) {
  9836.                         npc.anInt1527 = 0;
  9837.                         npc.anInt1528 = 0;
  9838.                         npc.anInt1529 = i2;
  9839.                         npc.anInt1530 = 0;
  9840.                     }
  9841.                     if (l2 == 2)
  9842.                         npc.anInt1530 = 0;
  9843.                 } else if (i1 == -1
  9844.                         || npc.anim == -1
  9845.                         || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359) {
  9846.                     npc.anim = i1;
  9847.                     npc.anInt1527 = 0;
  9848.                     npc.anInt1528 = 0;
  9849.                     npc.anInt1529 = i2;
  9850.                     npc.anInt1530 = 0;
  9851.                     npc.anInt1542 = npc.smallXYIndex;
  9852.                 }
  9853.             }
  9854.             if ((l & 8) != 0) {
  9855.                 int j1 = stream.method426();
  9856.                 int j2 = stream.method427();
  9857.                 npc.updateHitData(j2, j1, loopCycle);
  9858.                 npc.loopCycleStatus = loopCycle + 300;
  9859.                 npc.currentHealth = stream.method426();
  9860.                 npc.maxHealth = stream.readUnsignedByte();
  9861.             }
  9862.             if ((l & 0x80) != 0) {
  9863.                 npc.anInt1520 = stream.readUnsignedWord();
  9864.                 int k1 = stream.readDWord();
  9865.                 npc.anInt1524 = k1 >> 16;
  9866.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  9867.                 npc.anInt1521 = 0;
  9868.                 npc.anInt1522 = 0;
  9869.                 if (npc.anInt1523 > loopCycle)
  9870.                     npc.anInt1521 = -1;
  9871.                 if (npc.anInt1520 == 65535)
  9872.                     npc.anInt1520 = -1;
  9873.             }
  9874.             if ((l & 0x20) != 0) {
  9875.                 npc.interactingEntity = stream.readUnsignedWord();
  9876.                 if (npc.interactingEntity == 65535)
  9877.                     npc.interactingEntity = -1;
  9878.             }
  9879.             if ((l & 1) != 0) {
  9880.                 npc.textSpoken = stream.readString();
  9881.                 npc.textCycle = 100;
  9882.                 // entityMessage(npc);
  9883.  
  9884.             }
  9885.             if ((l & 0x40) != 0) {
  9886.                 int l1 = stream.method427();
  9887.                 int k2 = stream.method428();
  9888.                 npc.updateHitData(k2, l1, loopCycle);
  9889.                 npc.loopCycleStatus = loopCycle + 300;
  9890.                 npc.currentHealth = stream.method428();
  9891.                 npc.maxHealth = stream.method427();
  9892.             }
  9893.             if ((l & 2) != 0) {
  9894.                 npc.desc = EntityDef.forID(stream.method436());
  9895.                 npc.anInt1540 = npc.desc.aByte68;
  9896.                 npc.anInt1504 = npc.desc.anInt79;
  9897.                 npc.anInt1554 = npc.desc.walkAnim;
  9898.                 npc.anInt1555 = npc.desc.anInt58;
  9899.                 npc.anInt1556 = npc.desc.anInt83;
  9900.                 npc.anInt1557 = npc.desc.anInt55;
  9901.                 npc.anInt1511 = npc.desc.standAnim;
  9902.             }
  9903.             if ((l & 4) != 0) {
  9904.                 npc.anInt1538 = stream.method434();
  9905.                 npc.anInt1539 = stream.method434();
  9906.             }
  9907.         }
  9908.     }
  9909.  
  9910.     private void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k) {
  9911.         if (menuActionRow >= 400)
  9912.             return;
  9913.         if (entityDef.childrenIDs != null)
  9914.             entityDef = entityDef.method161();
  9915.         if (entityDef == null)
  9916.             return;
  9917.         if (!entityDef.aBoolean84)
  9918.             return;
  9919.         String s = entityDef.name;
  9920.         if (entityDef.combatLevel != 0)
  9921.             s = s
  9922.                     + combatDiffColor(myPlayer.combatLevel,
  9923.                             entityDef.combatLevel) + " (level-"
  9924.                     + entityDef.combatLevel + ")";
  9925.         if (itemSelected == 1) {
  9926.             menuActionName[menuActionRow] = "Use " + selectedItemName
  9927.                     + " with @yel@" + s;
  9928.             menuActionID[menuActionRow] = 582;
  9929.             menuActionCmd1[menuActionRow] = i;
  9930.             menuActionCmd2[menuActionRow] = k;
  9931.             menuActionCmd3[menuActionRow] = j;
  9932.             menuActionRow++;
  9933.             return;
  9934.         }
  9935.         if (spellSelected == 1) {
  9936.             if ((spellUsableOn & 2) == 2) {
  9937.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  9938.                 menuActionID[menuActionRow] = 413;
  9939.                 menuActionCmd1[menuActionRow] = i;
  9940.                 menuActionCmd2[menuActionRow] = k;
  9941.                 menuActionCmd3[menuActionRow] = j;
  9942.                 menuActionRow++;
  9943.             }
  9944.         } else {
  9945.             if (entityDef.actions != null) {
  9946.                 for (int l = 4; l >= 0; l--)
  9947.                     if (entityDef.actions[l] != null
  9948.                             && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  9949.                         menuActionName[menuActionRow] = entityDef.actions[l]
  9950.                                 + " @yel@" + s;
  9951.                         if (l == 0)
  9952.                             menuActionID[menuActionRow] = 20;
  9953.                         if (l == 1)
  9954.                             menuActionID[menuActionRow] = 412;
  9955.                         if (l == 2)
  9956.                             menuActionID[menuActionRow] = 225;
  9957.                         if (l == 3)
  9958.                             menuActionID[menuActionRow] = 965;
  9959.                         if (l == 4)
  9960.                             menuActionID[menuActionRow] = 478;
  9961.                         menuActionCmd1[menuActionRow] = i;
  9962.                         menuActionCmd2[menuActionRow] = k;
  9963.                         menuActionCmd3[menuActionRow] = j;
  9964.                         menuActionRow++;
  9965.                     }
  9966.  
  9967.             }
  9968.             if (entityDef.actions != null) {
  9969.                 for (int i1 = 4; i1 >= 0; i1--)
  9970.                     if (entityDef.actions[i1] != null
  9971.                             && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  9972.                         char c = '\0';
  9973.                         if (entityDef.combatLevel > myPlayer.combatLevel)
  9974.                             c = '\u07D0';
  9975.                         menuActionName[menuActionRow] = entityDef.actions[i1]
  9976.                                 + " @yel@" + s;
  9977.                         if (i1 == 0)
  9978.                             menuActionID[menuActionRow] = 20 + c;
  9979.                         if (i1 == 1)
  9980.                             menuActionID[menuActionRow] = 412 + c;
  9981.                         if (i1 == 2)
  9982.                             menuActionID[menuActionRow] = 225 + c;
  9983.                         if (i1 == 3)
  9984.                             menuActionID[menuActionRow] = 965 + c;
  9985.                         if (i1 == 4)
  9986.                             menuActionID[menuActionRow] = 478 + c;
  9987.                         menuActionCmd1[menuActionRow] = i;
  9988.                         menuActionCmd2[menuActionRow] = k;
  9989.                         menuActionCmd3[menuActionRow] = j;
  9990.                         menuActionRow++;
  9991.                     }
  9992.  
  9993.             }
  9994.             // menuActionName[menuActionRow] = "Examine @yel@" + s +
  9995.             // " @gre@(@whi@" + entityDef.type + "@gre@)";
  9996.             menuActionName[menuActionRow] = "Examine @yel@" + s;
  9997.             menuActionID[menuActionRow] = 1025;
  9998.             menuActionCmd1[menuActionRow] = i;
  9999.             menuActionCmd2[menuActionRow] = k;
  10000.             menuActionCmd3[menuActionRow] = j;
  10001.             menuActionRow++;
  10002.         }
  10003.     }
  10004.  
  10005.     private void buildAtPlayerMenu(int i, int j, Player player, int k) {
  10006.         if (player == myPlayer)
  10007.             return;
  10008.         if (menuActionRow >= 400)
  10009.             return;
  10010.         String s;
  10011.         String title = getSpecialColor(player.skill) + player.title + "@whi@";
  10012.         if (player.skill == 0)
  10013.             s = player.name
  10014.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  10015.                     + " (level-" + player.combatLevel + ")";
  10016.         else
  10017.             s = title + player.name
  10018.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  10019.                     + " (level-" + player.combatLevel + ")";
  10020.         if (itemSelected == 1) {
  10021.             menuActionName[menuActionRow] = "Use " + selectedItemName
  10022.                     + " with @whi@" + s;
  10023.             menuActionID[menuActionRow] = 491;
  10024.             menuActionCmd1[menuActionRow] = j;
  10025.             menuActionCmd2[menuActionRow] = i;
  10026.             menuActionCmd3[menuActionRow] = k;
  10027.             menuActionRow++;
  10028.         } else if (spellSelected == 1) {
  10029.             if ((spellUsableOn & 8) == 8) {
  10030.                 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  10031.                 menuActionID[menuActionRow] = 365;
  10032.                 menuActionCmd1[menuActionRow] = j;
  10033.                 menuActionCmd2[menuActionRow] = i;
  10034.                 menuActionCmd3[menuActionRow] = k;
  10035.                 menuActionRow++;
  10036.             }
  10037.         } else {
  10038.             for (int l = 4; l >= 0; l--)
  10039.                 if (atPlayerActions[l] != null) {
  10040.                     menuActionName[menuActionRow] = atPlayerActions[l]
  10041.                             + " @whi@" + s;
  10042.                     char c = '\0';
  10043.                     if (atPlayerActions[l].equalsIgnoreCase("attack")) {
  10044.                         if (player.combatLevel > myPlayer.combatLevel)
  10045.                             c = '\u07D0';
  10046.                         if (myPlayer.team != 0 && player.team != 0)
  10047.                             if (myPlayer.team == player.team)
  10048.                                 c = '\u07D0';
  10049.                             else
  10050.                                 c = '\0';
  10051.                     } else if (atPlayerArray[l])
  10052.                         c = '\u07D0';
  10053.                     if (l == 0)
  10054.                         menuActionID[menuActionRow] = 561 + c;
  10055.                     if (l == 1)
  10056.                         menuActionID[menuActionRow] = 779 + c;
  10057.                     if (l == 2)
  10058.                         menuActionID[menuActionRow] = 27 + c;
  10059.                     if (l == 3)
  10060.                         menuActionID[menuActionRow] = 577 + c;
  10061.                     if (l == 4)
  10062.                         menuActionID[menuActionRow] = 729 + c;
  10063.                     menuActionCmd1[menuActionRow] = j;
  10064.                     menuActionCmd2[menuActionRow] = i;
  10065.                     menuActionCmd3[menuActionRow] = k;
  10066.                     menuActionRow++;
  10067.                 }
  10068.  
  10069.         }
  10070.         for (int i1 = 0; i1 < menuActionRow; i1++)
  10071.             if (menuActionID[i1] == 516) {
  10072.                 menuActionName[i1] = "Walk here @whi@" + s;
  10073.                 return;
  10074.             }
  10075.  
  10076.     }
  10077.  
  10078.     private void method89(Class30_Sub1 class30_sub1) {
  10079.         int i = 0;
  10080.         int j = -1;
  10081.         int k = 0;
  10082.         int l = 0;
  10083.         if (class30_sub1.anInt1296 == 0)
  10084.             i = worldController.method300(class30_sub1.anInt1295,
  10085.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  10086.         if (class30_sub1.anInt1296 == 1)
  10087.             i = worldController.method301(class30_sub1.anInt1295,
  10088.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  10089.         if (class30_sub1.anInt1296 == 2)
  10090.             i = worldController.method302(class30_sub1.anInt1295,
  10091.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  10092.         if (class30_sub1.anInt1296 == 3)
  10093.             i = worldController.method303(class30_sub1.anInt1295,
  10094.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  10095.         if (i != 0) {
  10096.             int i1 = worldController.method304(class30_sub1.anInt1295,
  10097.                     class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  10098.             j = i >> 14 & 0x7fff;
  10099.             k = i1 & 0x1f;
  10100.             l = i1 >> 6;
  10101.         }
  10102.         class30_sub1.anInt1299 = j;
  10103.         class30_sub1.anInt1301 = k;
  10104.         class30_sub1.anInt1300 = l;
  10105.     }
  10106.  
  10107.     /*
  10108.      * private void method90() { for(int i = 0; i < anInt1062; i++)
  10109.      * if(anIntArray1250[i] <= 0) { boolean flag1 = false; try {
  10110.      * if(anIntArray1207[i] == anInt874 && anIntArray1241[i] == anInt1289) {
  10111.      * if(!replayWave()) flag1 = true; } else { Stream stream =
  10112.      * Sounds.method241(anIntArray1241[i], anIntArray1207[i]);
  10113.      * if(System.currentTimeMillis() + (long)(stream.currentOffset / 22) >
  10114.      * aLong1172 + (long)(anInt1257 / 22)) { anInt1257 = stream.currentOffset;
  10115.      * aLong1172 = System.currentTimeMillis(); if(saveWave(stream.buffer,
  10116.      * stream.currentOffset)) { anInt874 = anIntArray1207[i]; anInt1289 =
  10117.      * anIntArray1241[i]; } else { flag1 = true; } } } } catch(Exception
  10118.      * exception) { } if(!flag1 || anIntArray1250[i] == -5) { anInt1062--;
  10119.      * for(int j = i; j < anInt1062; j++) { anIntArray1207[j] = anIntArray1207[j
  10120.      * + 1]; anIntArray1241[j] = anIntArray1241[j + 1]; anIntArray1250[j] =
  10121.      * anIntArray1250[j + 1]; }
  10122.      *
  10123.      * i--; } else { anIntArray1250[i] = -5; } } else { anIntArray1250[i]--; }
  10124.      *
  10125.      * if(prevSong > 0) { prevSong -= 20; if(prevSong < 0) prevSong = 0;
  10126.      * if(prevSong == 0 && musicEnabled && !lowMem) { nextSong = currentSong;
  10127.      * songChanging = true; onDemandFetcher.method558(2, nextSong); } } }
  10128.      */
  10129.     public final void method90(boolean flag) {
  10130.         if (flag)
  10131.             pktType = -1;
  10132.  
  10133.         for (int i = 0; i < anInt1062; i++)
  10134.  
  10135.             if (anIntArray1250[i] <= 0) {
  10136.                 boolean flag1 = false;
  10137.                 try {
  10138.  
  10139.                     Stream stream = Sounds.method241(anIntArray1241[i],
  10140.                             anIntArray1207[i]);
  10141.  
  10142.                     new SoundPlayer((InputStream) new ByteArrayInputStream(
  10143.                             stream.buffer, 0, stream.currentOffset));
  10144.  
  10145.                     if (System.currentTimeMillis()
  10146.                             + (long) (stream.currentOffset / 22) > aLong1172
  10147.                             + (long) (anInt1257 / 22)) {
  10148.                         anInt1257 = stream.currentOffset;
  10149.                         aLong1172 = System.currentTimeMillis();
  10150.                     }
  10151.                 } catch (Exception exception) {
  10152.                 }
  10153.  
  10154.                 if (!flag1 || anIntArray1250[i] == -5) {
  10155.                     anInt1062--;
  10156.                     for (int j = i; j < anInt1062; j++) {
  10157.                         anIntArray1207[j] = anIntArray1207[j + 1];
  10158.                         anIntArray1241[j] = anIntArray1241[j + 1];
  10159.                         anIntArray1250[j] = anIntArray1250[j + 1];
  10160.                     }
  10161.                     i--;
  10162.                 } else {
  10163.                     anIntArray1250[i] = -5;
  10164.                 }
  10165.             } else {
  10166.                 anIntArray1250[i]--;
  10167.             }
  10168.  
  10169.         if (prevSong > 0) {
  10170.             prevSong -= 20;
  10171.             if (prevSong < 0)
  10172.                 prevSong = 0;
  10173.             if (prevSong == 0 && musicEnabled) {// && !lowMem) {
  10174.                 nextSong = currentSong;
  10175.                 songChanging = true;
  10176.                 onDemandFetcher.method558(2, nextSong);
  10177.             }
  10178.         }
  10179.     }
  10180.  
  10181.     void startUp() {
  10182.         drawLoadingText(20, "Starting up");
  10183.         new CacheDownloader(this).downloadCache();
  10184.         UserLoader.loaduser();
  10185.         UserLoader.finalload();
  10186.         if (hpH) {
  10187.             sendFrame36(731,3);
  10188.         }
  10189.         if (newHpBar) {
  10190.             sendFrame36(730,1);
  10191.         }
  10192.         if (newHits) {
  10193.             sendFrame36(732,5);
  10194.         }
  10195.        
  10196.         if (signlink.sunjava)
  10197.             super.minDelay = 5;
  10198.         if (aBoolean993) {
  10199.             // rsAlreadyLoaded = true;
  10200.             // return;
  10201.         }
  10202.         aBoolean993 = true;
  10203.         boolean flag = true;
  10204.         String s = getDocumentBaseHost();
  10205.         if (signlink.cache_dat != null) {
  10206.             for (int i = 0; i < 5; i++)
  10207.                 decompressors[i] = new Decompressor(signlink.cache_dat,
  10208.                         signlink.cache_idx[i], i + 1);
  10209.         }
  10210.         try {
  10211.             titleStreamLoader = streamLoaderForName(1, "title screen", "title",
  10212.                     expectedCRCs[1], 25);
  10213.             smallText = new TextDrawingArea(false, "p11_full",
  10214.                     titleStreamLoader);
  10215.             aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full",
  10216.                     titleStreamLoader);
  10217.             chatTextDrawingArea = new TextDrawingArea(false, "b12_full",
  10218.                     titleStreamLoader);
  10219.             TextDrawingArea aTextDrawingArea_1273 = new TextDrawingArea(true,
  10220.                     "q8_full", titleStreamLoader);
  10221.             drawLogo();
  10222.             loadTitleScreen();
  10223.             StreamLoader streamLoader = streamLoaderForName(2, "config",
  10224.                     "config", expectedCRCs[2], 30);
  10225.             StreamLoader streamLoader_1 = streamLoaderForName(3, "interface",
  10226.                     "interface", expectedCRCs[3], 35);
  10227.             StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics",
  10228.                     "media", expectedCRCs[4], 40);
  10229.             StreamLoader streamLoader_3 = streamLoaderForName(6, "textures",
  10230.                     "textures", expectedCRCs[6], 45);
  10231.             StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system",
  10232.                     "wordenc", expectedCRCs[7], 50);
  10233.             StreamLoader streamLoader_5 = streamLoaderForName(8,
  10234.                     "sound effects", "sounds", expectedCRCs[8], 55);
  10235.             byteGroundArray = new byte[4][104][104];
  10236.             intGroundArray = new int[4][105][105];
  10237.             worldController = new WorldController(intGroundArray);
  10238.             for (int j = 0; j < 4; j++)
  10239.                 aClass11Array1230[j] = new Class11();
  10240.  
  10241.             aClass30_Sub2_Sub1_Sub1_1263 = new Sprite(512, 512);
  10242.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list",
  10243.                     "versionlist", expectedCRCs[5], 60);
  10244.             drawLoadingText(60, "Loading Models");
  10245.             onDemandFetcher = new OnDemandFetcher();
  10246.             onDemandFetcher.start(streamLoader_6, this);
  10247.             setNewMaps();
  10248.             Class36.method528(onDemandFetcher.getAnimCount());
  10249.             Model.method459(80000, onDemandFetcher);
  10250.             ModelDecompressor.unpackModels("newstuff");
  10251.             // Class36.unpackAnimationData();
  10252.             preloadModels();// Raw Folder
  10253.             // repackCacheIndex(1);
  10254.             /*
  10255.              * drawLoadingText(65, "Requesting animations"); int k =
  10256.              * onDemandFetcher.getVersionCount(1); for(int i1 = 0; i1 < k; i1++)
  10257.              * onDemandFetcher.method558(1, i1);
  10258.              *
  10259.              * while(onDemandFetcher.getNodeCount() > 0) { int j1 = k -
  10260.              * onDemandFetcher.getNodeCount(); if(j1 > 0) drawLoadingText(65,
  10261.              * "Loading animations - " + (j1 * 100) / k + "%");
  10262.              * processOnDemandQueue(); try { Thread.sleep(100L); }
  10263.              * catch(Exception _ex) { _ex.printStackTrace();}
  10264.              * if(onDemandFetcher.anInt1349 > 3) { loadError(); return; } }
  10265.              * drawLoadingText(70, "Loading Models"); k =
  10266.              * onDemandFetcher.getVersionCount(0);
  10267.              * System.out.println("Loading Models"); for(int k1 = 0; k1 < k;
  10268.              * k1++) { int l1 = onDemandFetcher.getModelIndex(k1); if((l1 & 1)
  10269.              * != 0) onDemandFetcher.method558(0, k1); }
  10270.              * System.out.println("Finished!"); k =
  10271.              * onDemandFetcher.getNodeCount();
  10272.              * while(onDemandFetcher.getNodeCount() > 0) { int i2 = k -
  10273.              * onDemandFetcher.getNodeCount(); if(i2 > 0) drawLoadingText(70,
  10274.              * "Loading models - " + (i2 * 100) / k + "%");
  10275.              * processOnDemandQueue(); try { Thread.sleep(100L); }
  10276.              * catch(Exception _ex) { _ex.printStackTrace(); }
  10277.              *
  10278.              * } if(decompressors[0] != null) { drawLoadingText(75,
  10279.              * "Loading Maps"); onDemandFetcher.method558(3,
  10280.              * onDemandFetcher.method562(0, 48, 47));
  10281.              * onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48,
  10282.              * 47)); onDemandFetcher.method558(3, onDemandFetcher.method562(0,
  10283.              * 48, 48)); onDemandFetcher.method558(3,
  10284.              * onDemandFetcher.method562(1, 48, 48));
  10285.              * onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48,
  10286.              * 49)); onDemandFetcher.method558(3, onDemandFetcher.method562(1,
  10287.              * 48, 49)); onDemandFetcher.method558(3,
  10288.              * onDemandFetcher.method562(0, 47, 47));
  10289.              * onDemandFetcher.method558(3, onDemandFetcher.method562(1, 47,
  10290.              * 47)); onDemandFetcher.method558(3, onDemandFetcher.method562(0,
  10291.              * 47, 48)); onDemandFetcher.method558(3,
  10292.              * onDemandFetcher.method562(1, 47, 48));
  10293.              * onDemandFetcher.method558(3, onDemandFetcher.method562(0, 148,
  10294.              * 48)); onDemandFetcher.method558(3, onDemandFetcher.method562(1,
  10295.              * 148, 48)); k = onDemandFetcher.getNodeCount();
  10296.              * while(onDemandFetcher.getNodeCount() > 0) { int j2 = k -
  10297.              * onDemandFetcher.getNodeCount(); if(j2 > 0) drawLoadingText(75,
  10298.              * "Loading maps - " + (j2 * 100) / k + "%");
  10299.              * processOnDemandQueue(); try { Thread.sleep(100L); }
  10300.              * catch(Exception _ex) { } } }
  10301.              *
  10302.              * k = onDemandFetcher.getVersionCount(0); for(int k2 = 0; k2 < k;
  10303.              * k2++) { int l2 = onDemandFetcher.getModelIndex(k2); byte byte0 =
  10304.              * 0; if((l2 & 8) != 0) byte0 = 10; else if((l2 & 0x20) != 0) byte0
  10305.              * = 9; else if((l2 & 0x10) != 0) byte0 = 8; else if((l2 & 0x40) !=
  10306.              * 0) byte0 = 7; else if((l2 & 0x80) != 0) byte0 = 6; else if((l2 &
  10307.              * 2) != 0) byte0 = 5; else if((l2 & 4) != 0) byte0 = 4; if((l2 & 1)
  10308.              * != 0) byte0 = 3; if(byte0 != 0) onDemandFetcher.method563(byte0,
  10309.              * 0, k2); } onDemandFetcher.method554(isMembers); if(!lowMem) { int
  10310.              * l = onDemandFetcher.getVersionCount(2); for(int i3 = 1; i3 < l;
  10311.              * i3++) if(onDemandFetcher.method569(i3))
  10312.              * onDemandFetcher.method563((byte)1, 2, i3);
  10313.              *
  10314.              * }
  10315.              */
  10316.  
  10317.             drawLoadingText(80, "Unpacking media");
  10318.             /* Custom sprite unpacking */
  10319.             xpFlag = new Sprite("xpFlag");
  10320.             hitMarks[20] = new Sprite("hitMark");
  10321.             hitMarks[21] = new Sprite("hitMark2");
  10322.             HPBarFull = new Sprite("HITPOINTS_0.PNG");
  10323.             HPBarEmpty = new Sprite("HITPOINTS_1.PNG");
  10324.             infinity = new Sprite("infinity");
  10325.             multiOverlay = new Sprite("multi");
  10326.             duelingOverlay = new Sprite("overlay_duelway");
  10327.             chatArea = new Sprite("chatarea");
  10328.             chatButtons = new Sprite("chatbuttons");
  10329.             chatButtonH = new Sprite("chathover");
  10330.             chatButtonC = new Sprite("chatclicked");
  10331.             chatButtonHC = new Sprite("chatclickedh");
  10332.             reportH = new Sprite("reporthover");
  10333.             tabArea = new Sprite("tabarea");
  10334.             mapArea = new Sprite("maparea");
  10335.             logIconH = new Sprite("logiconh");
  10336.             logIconC = new Sprite("logiconc");
  10337.             worldMapIcon = new Sprite("mapicon");
  10338.             emptyOrb = new Sprite("emptyorb");
  10339.             hitPointsFill = new Sprite("hitpointsfill");
  10340.             hitPointsIcon = new Sprite("hitpointsicon");
  10341.             prayerFill = new Sprite("prayerfill");
  10342.             prayerIcon = new Sprite("prayericon");
  10343.             /**/
  10344.             mapBack = new Background(streamLoader_2, "mapback", 0);
  10345.             for (int j3 = 0; j3 < 14; j3++)
  10346.                 sideIcons[j3] = new Sprite(streamLoader_2, "sideicons", j3);
  10347.             for (int r1 = 0; r1 < 5; r1++)
  10348.                 redStones[r1] = new Sprite(streamLoader_2, "redstones", r1);
  10349.             for (int i = 0; i < 3; i++)
  10350.                 counter[i] = new Sprite("XP_" + i);
  10351.             compass = new Sprite(streamLoader_2, "compass", 0);
  10352.             mapEdge = new Sprite(streamLoader_2, "mapedge", 0);
  10353.             mapEdge.method345();
  10354.             try {
  10355.                 for (int k3 = 0; k3 < 100; k3++)
  10356.                     mapScenes[k3] = new Background(streamLoader_2, "mapscene",
  10357.                             k3);
  10358.             } catch (Exception _ex) {
  10359.             }
  10360.             try {
  10361.                 for (int l3 = 0; l3 < 100; l3++)
  10362.                     if (l3 < 75) {
  10363.                         mapFunctions[l3] = new Sprite(streamLoader_2,
  10364.                                 "mapfunction", l3);
  10365.                     } else {
  10366.                         mapFunctions[l3] = new Sprite(streamLoader_2,
  10367.                                 "mapfunctions2", (l3 - 76));
  10368.                     }
  10369.             } catch (Exception _ex) {
  10370.             }
  10371.             try {
  10372.                 for (int i4 = 0; i4 < 20; i4++)
  10373.                     hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
  10374.             } catch (Exception _ex) {
  10375.             }
  10376.             try {
  10377.                 for (int h1 = 0; h1 < 6; h1++)
  10378.                     headIconsHint[h1] = new Sprite(streamLoader_2,
  10379.                             "headicons_hint", h1);
  10380.             } catch (Exception _ex) {
  10381.             }
  10382.             try {
  10383.                 for (int j4 = 0; j4 < 18; j4++)
  10384.                     headIcons[j4] = new Sprite(streamLoader_2,
  10385.                             "headicons_prayer", j4);
  10386.                 for (int j45 = 0; j45 < 3; j45++)
  10387.                     skullIcons[j45] = new Sprite(streamLoader_2,
  10388.                             "headicons_pk", j45);
  10389.             } catch (Exception _ex) {
  10390.             }
  10391.             mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
  10392.             mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
  10393.             for (int k4 = 0; k4 < 8; k4++)
  10394.                 crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
  10395.  
  10396.             mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
  10397.             mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
  10398.             mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
  10399.             mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
  10400.             mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
  10401.             mapDotBL = new Sprite(streamLoader_2, "mapdots", 4); // temp
  10402.             scrollBar1 = new Background(streamLoader_2, "scrollbar", 0);
  10403.             scrollBar2 = new Background(streamLoader_2, "scrollbar", 1);
  10404.             alertBack = new Sprite("alertback");
  10405.             alertBorder = new Sprite("alertborder");
  10406.             alertBorderH = new Sprite("alertborderh");
  10407.             // for(int l4 = 0; l4 < 11; l4++)
  10408.             // modIcons[l4] = new Background(streamLoader_2, "mod_icons", l4);
  10409.             try {
  10410.                 modIcons[0] = new Sprite("MOD_ICONS 1");// Player Rights 1
  10411.                 modIcons[1] = new Sprite("MOD_ICONS 2");// Player Rights 2
  10412.                 modIcons[2] = new Sprite("MOD_ICONS 3");// player Rights 3
  10413.                 modIcons[3] = new Sprite("MOD_ICONS 5");// Player Rights 4
  10414.                 modIcons[4] = new Sprite("MOD_ICONS 4");// Player Rights 5
  10415.                 modIcons[5] = new Sprite("MOD_ICONS 6");// Player Rights 6
  10416.                 modIcons[6] = new Sprite("MOD_ICONS 7");// Player Rights 7
  10417.                 modIcons[7] = new Sprite("MOD_ICONS 8");// player Rights 8
  10418.                 modIcons[8] = new Sprite("MOD_ICONS 9");// Player Rights 9
  10419.                 modIcons[9] = new Sprite("MOD_ICONS 10");// Player Rights 10
  10420.                 modIcons[10] = new Sprite("MOD_ICONS 11");// Player Rights 11
  10421.                 modIcons[11] = new Sprite("MOD_ICONS 12");// Player Rights 11
  10422.             } catch (Exception _ex) {
  10423.  
  10424.             }
  10425.             // Sprite sprite = new Sprite("frame");
  10426.             // frame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10427.             // getGameComponent());
  10428.             // sprite.method346(0, 0);
  10429.  
  10430.             Sprite sprite = new Sprite("Frame1");
  10431.             frame[0] = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10432.                     getGameComponent());
  10433.             sprite.method346(0, 0);
  10434.  
  10435.             sprite = new Sprite("Frame2");
  10436.             frame[1] = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10437.                     getGameComponent());
  10438.             sprite.method346(0, 0);
  10439.  
  10440.             sprite = new Sprite("Frame3");
  10441.             frame[2] = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  10442.                     getGameComponent());
  10443.             sprite.method346(0, 0);
  10444.  
  10445.             int i5 = (int) (Math.random() * 21D) - 10;
  10446.             int j5 = (int) (Math.random() * 21D) - 10;
  10447.             int k5 = (int) (Math.random() * 21D) - 10;
  10448.             int l5 = (int) (Math.random() * 41D) - 20;
  10449.             for (int i6 = 0; i6 < 100; i6++) {
  10450.                 if (mapFunctions[i6] != null)
  10451.                     mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  10452.                 if (mapScenes[i6] != null)
  10453.                     mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  10454.             }
  10455.  
  10456.             drawLoadingText(83, "Unpacking textures");
  10457.             Texture.method368(streamLoader_3);
  10458.             Texture.method372(0.80000000000000004D);
  10459.             Texture.method367();
  10460.             drawLoadingText(86, "Unpacking config");
  10461.             Animation.unpackConfig(streamLoader);
  10462.             // Animation.unpackSkillCapes(streamLoader);
  10463.             ObjectDef.unpackConfig(streamLoader);
  10464.             Flo.unpackConfig(streamLoader);
  10465.             ItemDef.unpackConfig(streamLoader);
  10466.             EntityDef.unpackConfig(streamLoader);
  10467.             IDK.unpackConfig(streamLoader);
  10468.             SpotAnim.unpackConfig(streamLoader);
  10469.             Varp.unpackConfig(streamLoader);
  10470.             VarBit.unpackConfig(streamLoader);
  10471.             ItemDef.isMembers = isMembers;
  10472.             drawLoadingText(90, "Unpacking sounds");
  10473.             byte abyte0[] = streamLoader_5.getDataForName("sounds.dat");
  10474.             Stream stream = new Stream(abyte0);
  10475.             Sounds.unpack(stream);
  10476.             drawLoadingText(95, "Unpacking interfaces");
  10477.             TextDrawingArea aclass30_sub2_sub1_sub4s[] = { smallText,
  10478.                     aTextDrawingArea_1271, chatTextDrawingArea,
  10479.                     aTextDrawingArea_1273 };
  10480.             RSInterface.fonts = aclass30_sub2_sub1_sub4s;
  10481.             RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s,
  10482.                     streamLoader_2);
  10483.             drawLoadingText(100, "Preparing game engine");
  10484.             for (int j6 = 0; j6 < 33; j6++) {
  10485.                 int k6 = 999;
  10486.                 int i7 = 0;
  10487.                 for (int k7 = 0; k7 < 34; k7++) {
  10488.                     if (mapBack.aByteArray1450[k7 + j6 * mapBack.anInt1452] == 0) {
  10489.                         if (k6 == 999)
  10490.                             k6 = k7;
  10491.                         continue;
  10492.                     }
  10493.                     if (k6 == 999)
  10494.                         continue;
  10495.                     i7 = k7;
  10496.                     break;
  10497.                 }
  10498.  
  10499.                 anIntArray968[j6] = k6;
  10500.                 anIntArray1057[j6] = i7 - k6;
  10501.             }
  10502.  
  10503.             for (int l6 = 5; l6 < 156; l6++) {
  10504.                 int j7 = 999;
  10505.                 int l7 = 0;
  10506.                 for (int j8 = 25; j8 < 172; j8++) {
  10507.                     if (mapBack.aByteArray1450[j8 + l6 * mapBack.anInt1452] == 0
  10508.                             && (j8 > 34 || l6 > 34)) {
  10509.                         if (j7 == 999)
  10510.                             j7 = j8;
  10511.                         continue;
  10512.                     }
  10513.                     if (j7 == 999)
  10514.                         continue;
  10515.                     l7 = j8;
  10516.                     break;
  10517.                 }
  10518.  
  10519.                 anIntArray1052[l6 - 5] = j7 - 25;
  10520.                 anIntArray1229[l6 - 5] = l7 - j7;
  10521.             }
  10522.  
  10523.             Texture.method365(519, 165);
  10524.             anIntArray1180 = Texture.anIntArray1472;
  10525.             Texture.method365(246, 335);
  10526.             anIntArray1181 = Texture.anIntArray1472;
  10527.             Texture.method365(512, 334);
  10528.             anIntArray1182 = Texture.anIntArray1472;
  10529.             int ai[] = new int[9];
  10530.             for (int i8 = 0; i8 < 9; i8++) {
  10531.                 int k8 = 128 + i8 * 32 + 15;
  10532.                 int l8 = 600 + k8 * 3;
  10533.                 int i9 = Texture.anIntArray1470[k8];
  10534.                 ai[i8] = l8 * i9 >> 16;
  10535.             }
  10536.  
  10537.             WorldController.method310(500, 800, 512, 334, ai);
  10538.             Censor.loadConfig(streamLoader_4);
  10539.             mouseDetection = new MouseDetection(this);
  10540.             startRunnable(mouseDetection, 10);
  10541.             Animable_Sub5.clientInstance = this;
  10542.             ObjectDef.clientInstance = this;
  10543.             EntityDef.clientInstance = this;
  10544.             sendQuest("DarkWorldPk - the new era, always use the", 2451);
  10545.             sendQuest("DarkWorldPk - the new era", 3985);
  10546.             sendQuest("5: Staff impersonation", 5975);
  10547.             sendQuest("", 5985);
  10548.             sendQuest("", 6572);
  10549.             sendQuest("", 6664);
  10550.             sendQuest("", 18684);
  10551.             sendQuest("", 15098);
  10552.             sendQuest("", 249);
  10553.             sendQuest("", 18517);
  10554.             sendQuest("The Bank of DarkWorldPk - the new era", 5383);
  10555.             sendQuest("", 7332);
  10556.             sendQuest("", 7333);
  10557.             sendQuest("", 7334);
  10558.             sendQuest("", 7336);
  10559.             sendQuest("", 7383);
  10560.             sendQuest("", 7339);
  10561.             sendQuest("", 7338);
  10562.             sendQuest("", 7340);
  10563.             sendQuest("", 7346);
  10564.             sendQuest("", 7341);
  10565.             sendQuest("", 7342);
  10566.             sendQuest("", 7337);
  10567.             sendQuest("", 7343);
  10568.             sendQuest("", 7335);
  10569.             sendQuest("", 7344);
  10570.             sendQuest("", 7345);
  10571.             sendQuest("", 7347);
  10572.             sendQuest("", 7348);
  10573.             sendQuest("", 12772);
  10574.             sendQuest("", 673);
  10575.             sendQuest("", 7352);
  10576.             sendQuest("", 17510);
  10577.             sendQuest("", 7353);
  10578.             sendQuest("", 12129);
  10579.             sendQuest("", 8438);
  10580.             sendQuest("", 12852);
  10581.             sendQuest("", 15841);
  10582.             sendQuest("", 7354);
  10583.             sendQuest("", 7355);
  10584.             sendQuest("", 7356);
  10585.             sendQuest("", 8679);
  10586.             sendQuest("", 7459);
  10587.             sendQuest("", 16149);
  10588.             sendQuest("", 6987);
  10589.             sendQuest("", 7357);
  10590.             sendQuest("", 12836);
  10591.             sendQuest("", 7358);
  10592.             sendQuest("", 7359);
  10593.             sendQuest("", 14169);
  10594.             sendQuest("", 10115);
  10595.             sendQuest("", 14604);
  10596.             sendQuest("", 7360);
  10597.             sendQuest("", 12282);
  10598.             sendQuest("", 13577);
  10599.             sendQuest("", 12839);
  10600.             sendQuest("", 7361);
  10601.             sendQuest("", 16128);
  10602.             sendQuest("", 11857);
  10603.             sendQuest("", 7362);
  10604.             sendQuest("", 7363);
  10605.             sendQuest("", 7364);
  10606.             sendQuest("", 10135);
  10607.             sendQuest("", 4508);
  10608.             sendQuest("", 11907);
  10609.             sendQuest("", 7365);
  10610.             sendQuest("", 7366);
  10611.             sendQuest("", 7367);
  10612.             sendQuest("", 13389);
  10613.             sendQuest("", 15487);
  10614.             sendQuest("", 7368);
  10615.             sendQuest("", 11132);
  10616.             sendQuest("", 7369);
  10617.             sendQuest("", 12389);
  10618.             sendQuest("", 13974);
  10619.             sendQuest("", 6027);
  10620.             sendQuest("", 7370);
  10621.             sendQuest("", 8137);
  10622.             sendQuest("", 7371);
  10623.             sendQuest("", 12345);
  10624.             sendQuest("", 7372);
  10625.             sendQuest("", 8115);
  10626.             sendQuest("", 15499);
  10627.             sendQuest("", 18306);
  10628.             sendQuest("", 668);
  10629.             sendQuest("", 8576);
  10630.             sendQuest("", 12139);
  10631.             sendQuest("", 14912);
  10632.             sendQuest("", 7373);
  10633.             sendQuest("", 7374);
  10634.             sendQuest("", 8969);
  10635.             sendQuest("", 7375);
  10636.             sendQuest("", 7376);
  10637.             sendQuest("", 1740);
  10638.             sendQuest("", 3278);
  10639.             sendQuest("", 7378);
  10640.             sendQuest("", 6518);
  10641.             sendQuest("", 7379);
  10642.             sendQuest("", 15352);
  10643.             sendQuest("", 15592);
  10644.             sendQuest("", 15235);
  10645.             sendQuest("", 191);
  10646.             sendQuest("", 6024);
  10647.             sendQuest("", 7380);
  10648.             sendQuest("", 7381);
  10649.             sendQuest("", 11858);
  10650.             sendQuest("", 9927);
  10651.             sendQuest("", 7349);
  10652.             sendQuest("", 7350);
  10653.             sendQuest("", 7351);
  10654.             sendQuest("", 13356);
  10655.             sendQuest("", 355);
  10656.             sendQuest("", 427);
  10657.             sendQuest("", 778);
  10658.             sendQuest("", 1700);
  10659.             sendQuest("", 1751);
  10660.             sendQuest("", 1766);
  10661.             sendQuest("", 2278);
  10662.             sendQuest("", 2425);
  10663.             sendQuest("", 3798);
  10664.             sendQuest("", 4448);
  10665.             sendQuest("", 4681);
  10666.             sendQuest("", 4707);
  10667.             sendQuest("", 5572);
  10668.             sendQuest("", 5856);
  10669.             sendQuest("", 6131);
  10670.             sendQuest("", 7764);
  10671.             sendQuest("", 8462);
  10672.             sendQuest("", 12292);
  10673.             sendQuest("", 13976);
  10674.             /*
  10675.              * try { new Animate(); } catch(java.io.IOException io) {
  10676.              * io.printStackTrace(); } try { new Gfx(); }
  10677.              * catch(java.io.IOException io) { io.printStackTrace(); }
  10678.              */
  10679.             return;
  10680.  
  10681.         } catch (Exception exception) {
  10682.             signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  10683.             // ErrorLogger.writeLog(exception.s
  10684.             exception.printStackTrace();
  10685.         }
  10686.         loadingError = true;
  10687.     }
  10688.  
  10689.     private void method91(Stream stream, int i) {
  10690.     try {  
  10691.     while (stream.bitPosition + 10 < i * 8) {
  10692.             int j = stream.readBits(11);
  10693.             if (j == 2047)
  10694.                 break;
  10695.             if (playerArray[j] == null) {
  10696.                 playerArray[j] = new Player();
  10697.                 if (aStreamArray895s[j] != null)
  10698.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  10699.             }
  10700.             playerIndices[playerCount++] = j;
  10701.             Player player = playerArray[j];
  10702.             player.anInt1537 = loopCycle;
  10703.             int k = stream.readBits(1);
  10704.             if (k == 1)
  10705.                 anIntArray894[anInt893++] = j;
  10706.             int l = stream.readBits(1);
  10707.             int i1 = stream.readBits(5);
  10708.             if (i1 > 15)
  10709.                 i1 -= 32;
  10710.             int j1 = stream.readBits(5);
  10711.             if (j1 > 15)
  10712.                 j1 -= 32;
  10713.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1,
  10714.                     l == 1);
  10715.         }
  10716.         stream.finishBitAccess();
  10717.         } catch (Exception e) {//jags
  10718.         }
  10719.     }
  10720.  
  10721.     private void processMainScreenClick() {
  10722.         if (anInt1021 != 0)
  10723.             return;
  10724.         if (super.clickMode3 == 1) {
  10725.             int i = super.saveClickX - 10 - 550;
  10726.             int j = super.saveClickY - 5 - 4;
  10727.             if (i >= 0 && j >= 0 && i < 146 && j < 151) {
  10728.                 i -= 73;
  10729.                 j -= 75;
  10730.                 int k = minimapInt1 + minimapInt2 & 0x7ff;
  10731.                 int i1 = Texture.anIntArray1470[k];
  10732.                 int j1 = Texture.anIntArray1471[k];
  10733.                 i1 = i1 * (minimapInt3 + 256) >> 8;
  10734.                 j1 = j1 * (minimapInt3 + 256) >> 8;
  10735.                 int k1 = j * i1 + i * j1 >> 11;
  10736.                 int l1 = j * j1 - i * i1 >> 11;
  10737.                 int i2 = myPlayer.x + k1 >> 7;
  10738.                 int j2 = myPlayer.y - l1 >> 7;
  10739.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0,
  10740.                         j2, myPlayer.smallX[0], true, i2);
  10741.                 if (flag1) {
  10742.                     stream.writeWordBigEndian(i);
  10743.                     stream.writeWordBigEndian(j);
  10744.                     stream.writeWord(minimapInt1);
  10745.                     stream.writeWordBigEndian(57);
  10746.                     stream.writeWordBigEndian(minimapInt2);
  10747.                     stream.writeWordBigEndian(minimapInt3);
  10748.                     stream.writeWordBigEndian(89);
  10749.                     stream.writeWord(myPlayer.x);
  10750.                     stream.writeWord(myPlayer.y);
  10751.                     stream.writeWordBigEndian(anInt1264);
  10752.                     stream.writeWordBigEndian(63);
  10753.                 }
  10754.             }
  10755.             anInt1117++;
  10756.             if (anInt1117 > 1151) {
  10757.                 anInt1117 = 0;
  10758.                 stream.createFrame(246);
  10759.                 stream.writeWordBigEndian(0);
  10760.                 int l = stream.currentOffset;
  10761.                 if ((int) (Math.random() * 2D) == 0)
  10762.                     stream.writeWordBigEndian(101);
  10763.                 stream.writeWordBigEndian(197);
  10764.                 stream.writeWord((int) (Math.random() * 65536D));
  10765.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  10766.                 stream.writeWordBigEndian(67);
  10767.                 stream.writeWord(14214);
  10768.                 if ((int) (Math.random() * 2D) == 0)
  10769.                     stream.writeWord(29487);
  10770.                 stream.writeWord((int) (Math.random() * 65536D));
  10771.                 if ((int) (Math.random() * 2D) == 0)
  10772.                     stream.writeWordBigEndian(220);
  10773.                 stream.writeWordBigEndian(180);
  10774.                 stream.writeBytes(stream.currentOffset - l);
  10775.             }
  10776.         }
  10777.     }
  10778.  
  10779.     private String interfaceIntToString(int j) {
  10780.         if (j < 0x3b9ac9ff)
  10781.             return String.valueOf(j);
  10782.         else
  10783.             return "*";
  10784.     }
  10785.  
  10786.     private void showErrorScreen() {
  10787.         Graphics g = getGameComponent().getGraphics();
  10788.         g.setColor(Color.black);
  10789.         g.fillRect(0, 0, 765, 503);
  10790.         method4(1);
  10791.         if (loadingError) {
  10792.             aBoolean831 = false;
  10793.             g.setFont(new Font("Helvetica", 1, 16));
  10794.             g.setColor(Color.yellow);
  10795.             int k = 35;
  10796.             g.drawString(
  10797.                     "Sorry, an error has occured whilst loading DarkWorldPk - the new era",
  10798.                     30, k);
  10799.             k += 50;
  10800.             g.setColor(Color.white);
  10801.             g.drawString("To fix this try the following (in order):", 30, k);
  10802.             k += 50;
  10803.             g.setColor(Color.white);
  10804.             g.setFont(new Font("Helvetica", 1, 12));
  10805.             g
  10806.                     .drawString(
  10807.                             "1: Try closing ALL open web-browser windows, and reloading",
  10808.                             30, k);
  10809.             k += 30;
  10810.             g
  10811.                     .drawString(
  10812.                             "2: Try clearing your web-browsers cache from tools->internet options",
  10813.                             30, k);
  10814.             k += 30;
  10815.             g.drawString("3: Try updating your java", 30, k);
  10816.             k += 30;
  10817.             g.drawString("4: Try rebooting your computer", 30, k);
  10818.             k += 30;
  10819.             g.drawString("5: USB Wireless internet cards 99% do not work!", 30,
  10820.                     k);
  10821.         }
  10822.         if (genericLoadingError) {
  10823.             aBoolean831 = false;
  10824.             g.setFont(new Font("Helvetica", 1, 20));
  10825.             g.setColor(Color.white);
  10826.             g.drawString("Error - unable to load game!", 50, 50);
  10827.             g.drawString("To play DarkWorldPk - the new era make sure you play from", 50,
  10828.                     100);
  10829.             g.drawString("http://www.Vanityrsps.com", 50, 150);
  10830.         }
  10831.         if (rsAlreadyLoaded) {
  10832.             aBoolean831 = false;
  10833.             g.setColor(Color.yellow);
  10834.             int l = 35;
  10835.             g
  10836.                     .drawString(
  10837.                             "Error a copy of DarkWorldPk already appears to be loaded",
  10838.                             30, l);
  10839.             l += 50;
  10840.             g.setColor(Color.white);
  10841.             g.drawString("To fix this try the following (in order):", 30, l);
  10842.             l += 50;
  10843.             g.setColor(Color.white);
  10844.             g.setFont(new Font("Helvetica", 1, 12));
  10845.             g
  10846.                     .drawString(
  10847.                             "1: Try closing ALL open web-browser windows, and reloading",
  10848.                             30, l);
  10849.             l += 30;
  10850.             g
  10851.                     .drawString(
  10852.                             "2: Try rebooting your computer, and reloading",
  10853.                             30, l);
  10854.             l += 30;
  10855.         }
  10856.     }
  10857.  
  10858.     public URL getCodeBase() {
  10859.         try {
  10860.             return new URL(server + ":" + (80 + portOff));
  10861.         } catch (Exception _ex) {
  10862.         }
  10863.         return null;
  10864.     }
  10865.  
  10866.     private void method95() {
  10867.         for (int j = 0; j < npcCount; j++) {
  10868.             int k = npcIndices[j];
  10869.             NPC npc = npcArray[k];
  10870.             if (npc != null)
  10871.                 method96(npc);
  10872.         }
  10873.     }
  10874.  
  10875.     private void method96(Entity entity) {
  10876.         if (entity.x < 128 || entity.y < 128 || entity.x >= 13184
  10877.                 || entity.y >= 13184) {
  10878.             entity.anim = -1;
  10879.             entity.anInt1520 = -1;
  10880.             entity.anInt1547 = 0;
  10881.             entity.anInt1548 = 0;
  10882.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  10883.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  10884.             entity.method446();
  10885.         }
  10886.         if (entity == myPlayer
  10887.                 && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  10888.             entity.anim = -1;
  10889.             entity.anInt1520 = -1;
  10890.             entity.anInt1547 = 0;
  10891.             entity.anInt1548 = 0;
  10892.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  10893.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  10894.             entity.method446();
  10895.         }
  10896.         if (entity.anInt1547 > loopCycle)
  10897.             method97(entity);
  10898.         else if (entity.anInt1548 >= loopCycle)
  10899.             method98(entity);
  10900.         else
  10901.             method99(entity);
  10902.         method100(entity);
  10903.         method101(entity);
  10904.     }
  10905.  
  10906.     private void method97(Entity entity) {
  10907.         int i = entity.anInt1547 - loopCycle;
  10908.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  10909.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  10910.         entity.x += (j - entity.x) / i;
  10911.         entity.y += (k - entity.y) / i;
  10912.         entity.anInt1503 = 0;
  10913.         if (entity.anInt1549 == 0)
  10914.             entity.turnDirection = 1024;
  10915.         if (entity.anInt1549 == 1)
  10916.             entity.turnDirection = 1536;
  10917.         if (entity.anInt1549 == 2)
  10918.             entity.turnDirection = 0;
  10919.         if (entity.anInt1549 == 3)
  10920.             entity.turnDirection = 512;
  10921.     }
  10922.  
  10923.     private void method98(Entity entity) {
  10924.     try { if (entity.anInt1548 == loopCycle
  10925.                 || entity.anim == -1
  10926.                 || entity.anInt1529 != 0
  10927.                 || ((Animation.anims.length > entity.anim)  && (entity.anInt1528 + 1 > Animation.anims[entity.anim]
  10928.                         .method258(entity.anInt1527)))) {
  10929.             int i = entity.anInt1548 - entity.anInt1547;
  10930.             int j = loopCycle - entity.anInt1547;
  10931.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  10932.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  10933.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  10934.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  10935.             if (i == 0) { return; }
  10936.             entity.x = (k * (i - j) + i1 * j) / i;
  10937.             entity.y = (l * (i - j) + j1 * j) / i;
  10938.         }
  10939.         entity.anInt1503 = 0;
  10940.         if (entity.anInt1549 == 0)
  10941.             entity.turnDirection = 1024;
  10942.         if (entity.anInt1549 == 1)
  10943.             entity.turnDirection = 1536;
  10944.         if (entity.anInt1549 == 2)
  10945.             entity.turnDirection = 0;
  10946.         if (entity.anInt1549 == 3)
  10947.             entity.turnDirection = 512;
  10948.         entity.anInt1552 = entity.turnDirection;
  10949.         } catch (Exception e) {}
  10950.     }
  10951.  
  10952.     private void method99(Entity entity) {
  10953.         try {entity.anInt1517 = entity.anInt1511;
  10954.         if (entity.smallXYIndex == 0) {
  10955.             entity.anInt1503 = 0;
  10956.             return;
  10957.         }
  10958.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  10959.             Animation animation = Animation.anims[entity.anim];
  10960.             if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  10961.                 entity.anInt1503++;
  10962.                 return;
  10963.             }
  10964.             if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
  10965.                 entity.anInt1503++;
  10966.                 return;
  10967.             }
  10968.         }
  10969.         int i = entity.x;
  10970.         int j = entity.y;
  10971.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  10972.                 * 64;
  10973.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  10974.                 * 64;
  10975.         if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  10976.             entity.x = k;
  10977.             entity.y = l;
  10978.             return;
  10979.         }
  10980.         if (i < k) {
  10981.             if (j < l)
  10982.                 entity.turnDirection = 1280;
  10983.             else if (j > l)
  10984.                 entity.turnDirection = 1792;
  10985.             else
  10986.                 entity.turnDirection = 1536;
  10987.         } else if (i > k) {
  10988.             if (j < l)
  10989.                 entity.turnDirection = 768;
  10990.             else if (j > l)
  10991.                 entity.turnDirection = 256;
  10992.             else
  10993.                 entity.turnDirection = 512;
  10994.         } else if (j < l)
  10995.             entity.turnDirection = 1024;
  10996.         else
  10997.             entity.turnDirection = 0;
  10998.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  10999.         if (i1 > 1024)
  11000.             i1 -= 2048;
  11001.         int j1 = entity.anInt1555;
  11002.         if (i1 >= -256 && i1 <= 256)
  11003.             j1 = entity.anInt1554;
  11004.         else if (i1 >= 256 && i1 < 768)
  11005.             j1 = entity.anInt1557;
  11006.         else if (i1 >= -768 && i1 <= -256)
  11007.             j1 = entity.anInt1556;
  11008.         if (j1 == -1)
  11009.             j1 = entity.anInt1554;
  11010.         entity.anInt1517 = j1;
  11011.         int k1 = 4;
  11012.         if (entity.anInt1552 != entity.turnDirection
  11013.                 && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  11014.             k1 = 2;
  11015.         if (entity.smallXYIndex > 2)
  11016.             k1 = 6;
  11017.         if (entity.smallXYIndex > 3)
  11018.             k1 = 8;
  11019.         if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  11020.             k1 = 8;
  11021.             entity.anInt1503--;
  11022.         }
  11023.         if (entity.aBooleanArray1553[entity.smallXYIndex - 1])
  11024.             k1 <<= 1;
  11025.         if (k1 >= 8 && entity.anInt1517 == entity.anInt1554
  11026.                 && entity.anInt1505 != -1)
  11027.             entity.anInt1517 = entity.anInt1505;
  11028.         if (i < k) {
  11029.             entity.x += k1;
  11030.             if (entity.x > k)
  11031.                 entity.x = k;
  11032.         } else if (i > k) {
  11033.             entity.x -= k1;
  11034.             if (entity.x < k)
  11035.                 entity.x = k;
  11036.         }
  11037.         if (j < l) {
  11038.             entity.y += k1;
  11039.             if (entity.y > l)
  11040.                 entity.y = l;
  11041.         } else if (j > l) {
  11042.             entity.y -= k1;
  11043.             if (entity.y < l)
  11044.                 entity.y = l;
  11045.         }
  11046.         if (entity.x == k && entity.y == l) {
  11047.             entity.smallXYIndex--;
  11048.             if (entity.anInt1542 > 0)
  11049.                 entity.anInt1542--;
  11050.         }
  11051.     } catch (Exception e) {}
  11052.     }
  11053.  
  11054.     private void method100(Entity entity) {
  11055.     try{
  11056.         if (entity.anInt1504 == 0)
  11057.             return;
  11058.         if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  11059.             NPC npc = npcArray[entity.interactingEntity];
  11060.             if (npc != null) {
  11061.                 int i1 = entity.x - npc.x;
  11062.                 int k1 = entity.y - npc.y;
  11063.                 if (i1 != 0 || k1 != 0)
  11064.                     entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  11065.             }
  11066.         }
  11067.         if (entity.interactingEntity >= 32768) {
  11068.             int j = entity.interactingEntity - 32768;
  11069.             if (j == unknownInt10)
  11070.                 j = myPlayerIndex;
  11071.                 if(j > playerArray.length)
  11072.                     j=0;
  11073.             Player player = playerArray[j];
  11074.             if (player != null) {
  11075.                 int l1 = entity.x - player.x;
  11076.                 int i2 = entity.y - player.y;
  11077.                 if (l1 != 0 || i2 != 0)
  11078.                     entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  11079.             }
  11080.         }
  11081.         if ((entity.anInt1538 != 0 || entity.anInt1539 != 0)
  11082.                 && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  11083.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  11084.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  11085.             if (k != 0 || j1 != 0)
  11086.                 entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  11087.             entity.anInt1538 = 0;
  11088.             entity.anInt1539 = 0;
  11089.         }
  11090.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  11091.         if (l != 0) {
  11092.             if (l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  11093.                 entity.anInt1552 = entity.turnDirection;
  11094.             else if (l > 1024)
  11095.                 entity.anInt1552 -= entity.anInt1504;
  11096.             else
  11097.                 entity.anInt1552 += entity.anInt1504;
  11098.             entity.anInt1552 &= 0x7ff;
  11099.             if (entity.anInt1517 == entity.anInt1511
  11100.                     && entity.anInt1552 != entity.turnDirection) {
  11101.                 if (entity.anInt1512 != -1) {
  11102.                     entity.anInt1517 = entity.anInt1512;
  11103.                     return;
  11104.                 }
  11105.                 entity.anInt1517 = entity.anInt1554;
  11106.             }
  11107.         }
  11108.         } catch(Exception e){
  11109.         e.printStackTrace();
  11110.         }
  11111.     }
  11112.  
  11113.     // String value = new String(Model.byteArray323);
  11114.     private void method101(Entity entity) {
  11115.         if (entity == null) {
  11116.             System.out.println("uh oh");
  11117.             return;
  11118.         }
  11119.         entity.aBoolean1541 = false;
  11120.         if (entity.anInt1517 != -1) {
  11121.             try {
  11122.                 Animation animation = Animation.anims[(entity.anInt1517 >= 17000 ? 808 : entity.anInt1517)];
  11123.                 entity.anInt1519++;
  11124.                 if (entity.anInt1518 < animation.anInt352
  11125.                         && entity.anInt1519 > animation
  11126.                                 .method258(entity.anInt1518)) {
  11127.                     entity.anInt1519 = 1;// this is the frame delay. 0 is what
  11128.                                             // it's normally at. higher number =
  11129.                                             // faster animations.
  11130.                     entity.anInt1518++;
  11131.                 }
  11132.                 if (entity.anInt1518 >= animation.anInt352) {
  11133.                     entity.anInt1519 = 1;
  11134.                     entity.anInt1518 = 0;
  11135.                 }
  11136.             } catch (Exception e) {
  11137.                 e.printStackTrace();
  11138.                 entity.anInt1517 = -1;
  11139.                 // openinterface(1,3559);
  11140.             }
  11141.         }
  11142.         /*
  11143.          * if(entity.anInt1517 != -1){ try {
  11144.          *
  11145.          * if(entity.anInt1517 < Animation.anims.length){ Animation animation =
  11146.          * Animation.anims[entity.anInt1517]; entity.anInt1519++;
  11147.          * if(entity.anInt1518 < animation.anInt352 && entity.anInt1519 >
  11148.          * animation.method258(entity.anInt1518)){ entity.anInt1519 = 0;
  11149.          * entity.anInt1518++; } if(entity.anInt1518 >= animation.anInt352){
  11150.          * entity.anInt1519 = 0; entity.anInt1518 = 0; } } else {
  11151.          * entity.anInt1517 = 0; } } catch (Exception e) { e.printStackTrace();
  11152.          * entity.anInt1517 = -1; //openinterface(1,3559); } }
  11153.          */
  11154.  
  11155.         if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
  11156.             if (entity.anInt1521 < 0)
  11157.                 entity.anInt1521 = 0;
  11158.             if (entity.anInt1520 > MAXGFXID)// gfx anti-freeze
  11159.                 entity.anInt1520 = 0;
  11160.             Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  11161.             if (animation_1 == null) {
  11162.                 System.out.println("uh oh");
  11163.                 return;
  11164.             }
  11165.             for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352
  11166.                     && entity.anInt1522 > animation_1
  11167.                             .method258(entity.anInt1521); entity.anInt1521++)
  11168.                 entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  11169.  
  11170.             if (entity.anInt1521 >= animation_1.anInt352
  11171.                     && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  11172.                 entity.anInt1520 = -1;
  11173.         }
  11174.         if (entity.anim != -1 && entity.anInt1529 <= 1) {
  11175.             if (entity.anim > MAXANIMID)// anim anti-freeze
  11176.                 entity.anim = 0x328;
  11177.             Animation animation_2 = Animation.anims[entity.anim];
  11178.             if (animation_2.anInt363 == 1 && entity.anInt1542 > 0
  11179.                     && entity.anInt1547 <= loopCycle
  11180.                     && entity.anInt1548 < loopCycle) {
  11181.                 entity.anInt1529 = 1;
  11182.                 return;
  11183.             }
  11184.         }
  11185.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  11186.             Animation animation_3 = Animation.anims[entity.anim];
  11187.             for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352
  11188.                     && entity.anInt1528 > animation_3
  11189.                             .method258(entity.anInt1527); entity.anInt1527++)
  11190.                 entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  11191.  
  11192.             if (entity.anInt1527 >= animation_3.anInt352) {
  11193.                 entity.anInt1527 -= animation_3.anInt356;
  11194.                 entity.anInt1530++;
  11195.                 if (entity.anInt1530 >= animation_3.anInt362)
  11196.                     entity.anim = -1;
  11197.                 if (entity.anInt1527 < 0
  11198.                         || entity.anInt1527 >= animation_3.anInt352)
  11199.                     entity.anim = -1;
  11200.             }
  11201.             entity.aBoolean1541 = animation_3.aBoolean358;
  11202.         }
  11203.         if (entity.anInt1529 > 0)
  11204.             entity.anInt1529--;
  11205.     }
  11206.  
  11207.     private void drawGameScreen() {
  11208.         if (fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  11209.             if (loadingStage == 2) {
  11210.                 method119(anInt945, fullscreenInterfaceID);
  11211.                 if (openInterfaceID != -1) {
  11212.                     method119(anInt945, openInterfaceID);
  11213.                 }
  11214.                 anInt945 = 0;
  11215.                 resetAllImageProducers();
  11216.                 super.fullGameScreen.initDrawingArea();
  11217.                 Texture.anIntArray1472 = fullScreenTextureArray;
  11218.                 DrawingArea.setAllPixelsToZero();
  11219.                 welcomeScreenRaised = true;
  11220.                 if (openInterfaceID != -1) {
  11221.                     RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  11222.                     if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  11223.                         rsInterface_1.width = 765;
  11224.                         rsInterface_1.height = 503;
  11225.                     }
  11226.                     drawInterface(0, 0, rsInterface_1, 8);
  11227.                 }
  11228.                 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  11229.                 if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  11230.                     rsInterface.width = 765;
  11231.                     rsInterface.height = 503;
  11232.                 }
  11233.                 drawInterface(0, 0, rsInterface, 8);
  11234.  
  11235.                 if (!menuOpen) {
  11236.                     processRightClick();
  11237.                     drawTooltip();
  11238.                 } else {
  11239.                     drawMenu();
  11240.                 }
  11241.             }
  11242.             drawCount++;
  11243.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  11244.             return;
  11245.         } else {
  11246.             if (drawCount != 0) {
  11247.                 resetImageProducers2();
  11248.             }
  11249.         }
  11250.         if (welcomeScreenRaised) {
  11251.             welcomeScreenRaised = false;
  11252.             frame[0].drawGraphics(0, super.graphics, 0);
  11253.             frame[1].drawGraphics(0, super.graphics, 4);
  11254.             frame[2].drawGraphics(0, super.graphics, 515);
  11255.             needDrawTabArea = true;
  11256.             inputTaken = true;
  11257.             tabAreaAltered = true;
  11258.             aBoolean1233 = true;
  11259.             if (loadingStage != 2) {
  11260.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  11261.                 aRSImageProducer_1164.drawGraphics(0, super.graphics, 519);
  11262.             }
  11263.         }
  11264.         if (loadingStage == 2)
  11265.             method146();
  11266.         if (menuOpen && menuScreenArea == 1)
  11267.             needDrawTabArea = true;
  11268.         if (invOverlayInterfaceID != -1) {
  11269.             boolean flag1 = method119(anInt945, invOverlayInterfaceID);
  11270.             if (flag1)
  11271.                 needDrawTabArea = true;
  11272.         }
  11273.         if (atInventoryInterfaceType == 2)
  11274.             needDrawTabArea = true;
  11275.         if (activeInterfaceType == 2)
  11276.             needDrawTabArea = true;
  11277.         if (needDrawTabArea) {
  11278.             drawTabArea();
  11279.             needDrawTabArea = false;
  11280.         }
  11281.         if (backDialogID == -1) {
  11282.             aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110;
  11283.             if (super.mouseX > 478 && super.mouseX < 580 && super.mouseY > 342)
  11284.                 method65(494, 110, super.mouseX - 0, super.mouseY - 348,
  11285.                         aClass9_1059, 0, false, anInt1211);
  11286.             int i = anInt1211 - 110 - aClass9_1059.scrollPosition;
  11287.             if (i < 0)
  11288.                 i = 0;
  11289.             if (i > anInt1211 - 110)
  11290.                 i = anInt1211 - 110;
  11291.             if (anInt1089 != i) {
  11292.                 anInt1089 = i;
  11293.                 inputTaken = true;
  11294.             }
  11295.         }
  11296.         if (backDialogID != -1) {
  11297.             boolean flag2 = method119(anInt945, backDialogID);
  11298.             if (flag2)
  11299.                 inputTaken = true;
  11300.         }
  11301.         if (atInventoryInterfaceType == 3)
  11302.             inputTaken = true;
  11303.         if (activeInterfaceType == 3)
  11304.             inputTaken = true;
  11305.         if (aString844 != null)
  11306.             inputTaken = true;
  11307.         if (menuOpen && menuScreenArea == 2)
  11308.             inputTaken = true;
  11309.         if (inputTaken) {
  11310.             drawChatArea();
  11311.             inputTaken = false;
  11312.         }
  11313.         if (loadingStage == 2) {
  11314.             drawMinimap();
  11315.             aRSImageProducer_1164.drawGraphics(0, super.graphics, 519);
  11316.         }
  11317.  
  11318.         if (anInt1054 != -1)
  11319.             tabAreaAltered = true;
  11320.         if (tabAreaAltered) {
  11321.             if (anInt1054 != -1 && anInt1054 == tabID) {
  11322.                 anInt1054 = -1;
  11323.                 stream.createFrame(120);
  11324.                 stream.writeWordBigEndian(tabID);
  11325.             }
  11326.             tabAreaAltered = false;
  11327.             aRSImageProducer_1125.initDrawingArea();
  11328.             aRSImageProducer_1165.initDrawingArea();
  11329.         }
  11330.         anInt945 = 0;
  11331.     }
  11332.  
  11333.     private boolean buildFriendsListMenu(RSInterface class9) {
  11334.         int i = class9.contentType;
  11335.         if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  11336.             if (i >= 801)
  11337.                 i -= 701;
  11338.             else if (i >= 701)
  11339.                 i -= 601;
  11340.             else if (i >= 101)
  11341.                 i -= 101;
  11342.             else
  11343.                 i--;
  11344.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  11345.             menuActionID[menuActionRow] = 792;
  11346.             menuActionRow++;
  11347.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  11348.             menuActionID[menuActionRow] = 639;
  11349.             menuActionRow++;
  11350.             return true;
  11351.         }
  11352.         if (i >= 401 && i <= 500) {
  11353.             menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  11354.             menuActionID[menuActionRow] = 322;
  11355.             menuActionRow++;
  11356.             return true;
  11357.         } else {
  11358.             return false;
  11359.         }
  11360.     }
  11361.  
  11362.     private void method104() {
  11363.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  11364.                 .reverseGetFirst();
  11365.         for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  11366.                 .reverseGetNext())
  11367.             if (class30_sub2_sub4_sub3.anInt1560 != plane
  11368.                     || class30_sub2_sub4_sub3.aBoolean1567)
  11369.                 class30_sub2_sub4_sub3.unlink();
  11370.             else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  11371.                 class30_sub2_sub4_sub3.method454(anInt945);
  11372.                 if (class30_sub2_sub4_sub3.aBoolean1567)
  11373.                     class30_sub2_sub4_sub3.unlink();
  11374.                 else
  11375.                     worldController.method285(class30_sub2_sub4_sub3.anInt1560,
  11376.                             0, class30_sub2_sub4_sub3.anInt1563, -1,
  11377.                             class30_sub2_sub4_sub3.anInt1562, 60,
  11378.                             class30_sub2_sub4_sub3.anInt1561,
  11379.                             class30_sub2_sub4_sub3, false);
  11380.             }
  11381.  
  11382.     }
  11383.  
  11384.     private void drawInterface(int j, int k, RSInterface class9, int l) {
  11385.         if (class9.type != 0 || class9.children == null)
  11386.             return;
  11387.         if (class9.isMouseoverTriggered && anInt1026 != class9.id
  11388.                 && anInt1048 != class9.id && anInt1039 != class9.id)
  11389.             return;
  11390.         int i1 = DrawingArea.topX;
  11391.         int j1 = DrawingArea.topY;
  11392.         int k1 = DrawingArea.bottomX;
  11393.         int l1 = DrawingArea.bottomY;
  11394.         DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
  11395.         int i2 = class9.children.length;
  11396.         for (int j2 = 0; j2 < i2; j2++) {
  11397.             int k2 = class9.childX[j2] + k;
  11398.             int l2 = (class9.childY[j2] + l) - j;
  11399.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j2]];
  11400.             k2 += class9_1.anInt263;
  11401.             l2 += class9_1.anInt265;
  11402.             if (class9_1.contentType > 0)
  11403.                 drawFriendsListOrWelcomeScreen(class9_1);
  11404.             int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258,
  11405.                     1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315, 1324, 1333,
  11406.                     1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404, 1583,
  11407.                     12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469,
  11408.                     15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503,
  11409.                     1512, 1521, 1530, 1544, 1553, 1563, 1593, 1635, 12426,
  11410.                     12436, 12446, 12456, 6004, 18471,
  11411.                     /* Ancients */
  11412.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012,
  11413.                     13054, 12920, 12882, 13062, 12952, 13000, 13070, 12912,
  11414.                     12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096,
  11415.             /* Lunar */
  11416.  
  11417.             };
  11418.             /*
  11419.              * for(int m5 = 0; m5 < IDs.length; m5++) { if(class9_1.id ==
  11420.              * IDs[m5] + 1) { if(m5 > 61) drawBlackBox(k2 + 1, l2); else
  11421.              * drawBlackBox(k2, l2 + 1); } }
  11422.              */
  11423.             for (int m5 = 0; m5 < IDs.length; m5++) {
  11424.                 if (class9_1.id == IDs[m5] + 1) {
  11425.                     drawBlackBox(k2, l2 + 1);
  11426.                 }
  11427.             }
  11428.             if (class9_1.type == 0) {
  11429.                 if (class9_1.scrollPosition > class9_1.scrollMax
  11430.                         - class9_1.height)
  11431.                     class9_1.scrollPosition = class9_1.scrollMax
  11432.                             - class9_1.height;
  11433.                 if (class9_1.scrollPosition < 0)
  11434.                     class9_1.scrollPosition = 0;
  11435.                 drawInterface(class9_1.scrollPosition, k2, class9_1, l2);
  11436.                 if (class9_1.scrollMax > class9_1.height)
  11437.                     drawScrollbar(class9_1.height, class9_1.scrollPosition, l2,
  11438.                             k2 + class9_1.width, class9_1.scrollMax);
  11439.             } else if (class9_1.type != 1)
  11440.                 if (class9_1.type == 2) {
  11441.                     int i3 = 0;
  11442.                     for (int l3 = 0; l3 < class9_1.height; l3++) {
  11443.                         for (int l4 = 0; l4 < class9_1.width; l4++) {
  11444.                             int k5 = k2 + l4 * (32 + class9_1.invSpritePadX);
  11445.                             int j6 = l2 + l3 * (32 + class9_1.invSpritePadY);
  11446.                             if (i3 < 20) {
  11447.                                 k5 += class9_1.spritesX[i3];
  11448.                                 j6 += class9_1.spritesY[i3];
  11449.                             }
  11450.                             if (class9_1.inv[i3] > 0) {
  11451.                                 int k6 = 0;
  11452.                                 int j7 = 0;
  11453.                                 int j9 = class9_1.inv[i3] - 1;
  11454.                                 if (k5 > DrawingArea.topX - 32
  11455.                                         && k5 < DrawingArea.bottomX
  11456.                                         && j6 > DrawingArea.topY - 32
  11457.                                         && j6 < DrawingArea.bottomY
  11458.                                         || activeInterfaceType != 0
  11459.                                         && anInt1085 == i3) {
  11460.                                     int l9 = 0;
  11461.                                     if (itemSelected == 1 && anInt1283 == i3
  11462.                                             && anInt1284 == class9_1.id)
  11463.                                         l9 = 0xffffff;
  11464.                                     Sprite class30_sub2_sub1_sub1_2 = ItemDef
  11465.                                             .getSprite(j9,
  11466.                                                     class9_1.invStackSizes[i3],
  11467.                                                     l9);
  11468.                                     if (class30_sub2_sub1_sub1_2 != null) {
  11469.                                         if (activeInterfaceType != 0
  11470.                                                 && anInt1085 == i3
  11471.                                                 && anInt1084 == class9_1.id) {
  11472.                                             k6 = super.mouseX - anInt1087;
  11473.                                             j7 = super.mouseY - anInt1088;
  11474.                                             if (k6 < 5 && k6 > -5)
  11475.                                                 k6 = 0;
  11476.                                             if (j7 < 5 && j7 > -5)
  11477.                                                 j7 = 0;
  11478.                                             if (anInt989 < 10) {
  11479.                                                 k6 = 0;
  11480.                                                 j7 = 0;
  11481.                                             }
  11482.                                             class30_sub2_sub1_sub1_2
  11483.                                                     .drawSprite1(k5 + k6, j6
  11484.                                                             + j7);
  11485.                                             if (j6 + j7 < DrawingArea.topY
  11486.                                                     && class9.scrollPosition > 0) {
  11487.                                                 int i10 = (anInt945 * (DrawingArea.topY
  11488.                                                         - j6 - j7)) / 3;
  11489.                                                 if (i10 > anInt945 * 10)
  11490.                                                     i10 = anInt945 * 10;
  11491.                                                 if (i10 > class9.scrollPosition)
  11492.                                                     i10 = class9.scrollPosition;
  11493.                                                 class9.scrollPosition -= i10;
  11494.                                                 anInt1088 += i10;
  11495.                                             }
  11496.                                             if (j6 + j7 + 32 > DrawingArea.bottomY
  11497.                                                     && class9.scrollPosition < class9.scrollMax
  11498.                                                             - class9.height) {
  11499.                                                 int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  11500.                                                 if (j10 > anInt945 * 10)
  11501.                                                     j10 = anInt945 * 10;
  11502.                                                 if (j10 > class9.scrollMax
  11503.                                                         - class9.height
  11504.                                                         - class9.scrollPosition)
  11505.                                                     j10 = class9.scrollMax
  11506.                                                             - class9.height
  11507.                                                             - class9.scrollPosition;
  11508.                                                 class9.scrollPosition += j10;
  11509.                                                 anInt1088 -= j10;
  11510.                                             }
  11511.                                         } else if (atInventoryInterfaceType != 0
  11512.                                                 && atInventoryIndex == i3
  11513.                                                 && atInventoryInterface == class9_1.id)
  11514.                                             class30_sub2_sub1_sub1_2
  11515.                                                     .drawSprite1(k5, j6);
  11516.                                         else
  11517.                                             class30_sub2_sub1_sub1_2
  11518.                                                     .drawSprite(k5, j6);
  11519.                                         if (class30_sub2_sub1_sub1_2.anInt1444 == 33
  11520.                                                 || class9_1.invStackSizes[i3] != 1) {
  11521.                                             int k10 = class9_1.invStackSizes[i3];
  11522.                                             // smallText.method385(0,
  11523.                                             // intToKOrMil(k10), j6 + 10 + j7,
  11524.                                             // k5 + 1 + k6);
  11525.                                             // smallText.method385(0xffff00,
  11526.                                             // intToKOrMil(k10), j6 + 9 + j7, k5
  11527.                                             // + k6);
  11528.                                             if (intToKOrMil(k10) == "@inf@")
  11529.                                                 infinity.drawSprite(k5 + k6, j6
  11530.                                                         + j7);
  11531.                                             if (k10 == 99999)
  11532.                                                 smallText.method385(0xffff00,
  11533.                                                         "oo", j6 + 9 + j7, k5
  11534.                                                                 + k6);
  11535.                                             if (k10 >= 1)
  11536.                                                 smallText.method385(0xFFFF00,
  11537.                                                         intToKOrMil(k10), j6
  11538.                                                                 + 9 + j7, k5
  11539.                                                                 + k6);
  11540.                                             if (k10 >= 100000)
  11541.                                                 smallText.method385(0xFFFFFF,
  11542.                                                         intToKOrMil(k10), j6
  11543.                                                                 + 9 + j7, k5
  11544.                                                                 + k6);
  11545.                                             if (k10 >= 10000000)
  11546.                                                 smallText.method385(0x00FF80,
  11547.                                                         intToKOrMil(k10), j6
  11548.                                                                 + 9 + j7, k5
  11549.                                                                 + k6);
  11550.                                         }
  11551.                                     }
  11552.                                 }
  11553.                             } else if (class9_1.sprites != null && i3 < 20) {
  11554.                                 Sprite class30_sub2_sub1_sub1_1 = class9_1.sprites[i3];
  11555.                                 if (class30_sub2_sub1_sub1_1 != null)
  11556.                                     class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  11557.                             }
  11558.                             i3++;
  11559.                         }
  11560.  
  11561.                     }
  11562.  
  11563.                 } else if (class9_1.type == 10) {
  11564.                     Sprite sprite;
  11565.                     if (interfaceIsSelected(class9_1)) {
  11566.                         sprite = class9_1.sprite2;
  11567.                     } else {
  11568.                         sprite = class9_1.sprite1;
  11569.                     }
  11570.  
  11571.                     if (sprite != null) {
  11572.                         sprite.drawSpriteWithOpacity(k2, l2, class9_1.aByte254);
  11573.                     }
  11574.  
  11575.                 } else if (class9_1.type == 3) {
  11576.                     boolean flag = false;
  11577.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  11578.                             || anInt1026 == class9_1.id)
  11579.                         flag = true;
  11580.                     int j3;
  11581.                     if (interfaceIsSelected(class9_1)) {
  11582.                         j3 = class9_1.anInt219;
  11583.                         if (flag && class9_1.anInt239 != 0)
  11584.                             j3 = class9_1.anInt239;
  11585.                     } else {
  11586.                         j3 = class9_1.textColor;
  11587.                         if (flag && class9_1.anInt216 != 0)
  11588.                             j3 = class9_1.anInt216;
  11589.                     }
  11590.                     if (class9_1.aByte254 == 0) {
  11591.                         if (class9_1.aBoolean227)
  11592.                             DrawingArea.drawPixels(class9_1.height, l2, k2, j3,
  11593.                                     class9_1.width);
  11594.                         else
  11595.                             DrawingArea.fillPixels(k2, class9_1.width,
  11596.                                     class9_1.height, j3, l2);
  11597.                     } else if (class9_1.aBoolean227)
  11598.                         DrawingArea.method335(j3, l2, class9_1.width,
  11599.                                 class9_1.height,
  11600.                                 256 - (class9_1.aByte254 & 0xff), k2);
  11601.                     else
  11602.                         DrawingArea.method338(l2, class9_1.height,
  11603.                                 256 - (class9_1.aByte254 & 0xff), j3,
  11604.                                 class9_1.width, k2);
  11605.                 } else if (class9_1.type == 4) {
  11606.                     TextDrawingArea textDrawingArea = class9_1.textDrawingAreas;
  11607.                     String s = class9_1.message;
  11608.                     boolean flag1 = false;
  11609.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  11610.                             || anInt1026 == class9_1.id)
  11611.                         flag1 = true;
  11612.                     int i4;
  11613.                     if (interfaceIsSelected(class9_1)) {
  11614.                         i4 = class9_1.anInt219;
  11615.                         if (flag1 && class9_1.anInt239 != 0)
  11616.                             i4 = class9_1.anInt239;
  11617.                         if (class9_1.aString228.length() > 0)
  11618.                             s = class9_1.aString228;
  11619.                     } else {
  11620.                         i4 = class9_1.textColor;
  11621.                         if (flag1 && class9_1.anInt216 != 0)
  11622.                             i4 = class9_1.anInt216;
  11623.                     }
  11624.                     if (class9_1.atActionType == 6 && aBoolean1149) {
  11625.                         s = "Please wait...";
  11626.                         i4 = class9_1.textColor;
  11627.                     }
  11628.                     if (DrawingArea.width == 519) {
  11629.                         if (i4 == 0xffff00)
  11630.                             i4 = 255;
  11631.                         if (i4 == 49152)
  11632.                             i4 = 0xffffff;
  11633.                     }
  11634.                     if ((class9_1.parentID == 1151)
  11635.                             || (class9_1.parentID == 12855)) {
  11636.                         switch (i4) {
  11637.                         case 16773120:
  11638.                             i4 = 0xFE981F;
  11639.                             break;
  11640.                         case 7040819:
  11641.                             i4 = 0xAF6A1A;
  11642.                             break;
  11643.                         }
  11644.                     }
  11645.                     for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  11646.                         if (s.indexOf("%") != -1) {
  11647.                             do {
  11648.                                 int k7 = s.indexOf("%1");
  11649.                                 if (k7 == -1)
  11650.                                     break;
  11651.                                 s = s.substring(0, k7)
  11652.                                         + interfaceIntToString(extractInterfaceValues(
  11653.                                                 class9_1, 0))
  11654.                                         + s.substring(k7 + 2);
  11655.                             } while (true);
  11656.                             do {
  11657.                                 int l7 = s.indexOf("%2");
  11658.                                 if (l7 == -1)
  11659.                                     break;
  11660.                                 s = s.substring(0, l7)
  11661.                                         + interfaceIntToString(extractInterfaceValues(
  11662.                                                 class9_1, 1))
  11663.                                         + s.substring(l7 + 2);
  11664.                             } while (true);
  11665.                             do {
  11666.                                 int i8 = s.indexOf("%3");
  11667.                                 if (i8 == -1)
  11668.                                     break;
  11669.                                 s = s.substring(0, i8)
  11670.                                         + interfaceIntToString(extractInterfaceValues(
  11671.                                                 class9_1, 2))
  11672.                                         + s.substring(i8 + 2);
  11673.                             } while (true);
  11674.                             do {
  11675.                                 int j8 = s.indexOf("%4");
  11676.                                 if (j8 == -1)
  11677.                                     break;
  11678.                                 s = s.substring(0, j8)
  11679.                                         + interfaceIntToString(extractInterfaceValues(
  11680.                                                 class9_1, 3))
  11681.                                         + s.substring(j8 + 2);
  11682.                             } while (true);
  11683.                             do {
  11684.                                 int k8 = s.indexOf("%5");
  11685.                                 if (k8 == -1)
  11686.                                     break;
  11687.                                 s = s.substring(0, k8)
  11688.                                         + interfaceIntToString(extractInterfaceValues(
  11689.                                                 class9_1, 4))
  11690.                                         + s.substring(k8 + 2);
  11691.                             } while (true);
  11692.                         }
  11693.                         int l8 = s.indexOf("\\n");
  11694.                         String s1;
  11695.                         if (l8 != -1) {
  11696.                             s1 = s.substring(0, l8);
  11697.                             s = s.substring(l8 + 2);
  11698.                         } else {
  11699.                             s1 = s;
  11700.                             s = "";
  11701.                         }
  11702.                         if (class9_1.centerText)
  11703.                             textDrawingArea.method382(i4, k2 + class9_1.width
  11704.                                     / 2, s1, l6, class9_1.textShadow);
  11705.                         else
  11706.                             textDrawingArea.method389(class9_1.textShadow, k2,
  11707.                                     i4, s1, l6);
  11708.                     }
  11709.                 } else if (class9_1.type == 5) {
  11710.                     Sprite sprite;
  11711.                     if (interfaceIsSelected(class9_1))
  11712.                         sprite = class9_1.sprite2;
  11713.                     else
  11714.                         sprite = class9_1.sprite1;
  11715.                     if (sprite != null)
  11716.                         if (spellSelected == 1 && class9_1.id == spellID
  11717.                                 && spellID != 0) {
  11718.                             sprite.drawSprite3(k2, l2, 0xffffff);
  11719.                         } else {
  11720.                             sprite.drawSprite(k2, l2);
  11721.                         }
  11722.                     if (sprite != null)
  11723.                         sprite.drawSprite(k2, l2);
  11724.                 } else if (class9_1.type == 6) {
  11725.                     int k3 = Texture.textureInt1;
  11726.                     int j4 = Texture.textureInt2;
  11727.                     Texture.textureInt1 = k2 + class9_1.width / 2;
  11728.                     Texture.textureInt2 = l2 + class9_1.height / 2;
  11729.                     int i5 = Texture.anIntArray1470[class9_1.modelRotation1]
  11730.                             * class9_1.anInt269 >> 16;
  11731.                     int l5 = Texture.anIntArray1471[class9_1.modelRotation1]
  11732.                             * class9_1.anInt269 >> 16;
  11733.                     boolean flag2 = interfaceIsSelected(class9_1);
  11734.                     int i7;
  11735.                     if (flag2)
  11736.                         i7 = class9_1.anInt258;
  11737.                     else
  11738.                         i7 = class9_1.anInt257;
  11739.                     Model model;
  11740.                     if (i7 == -1) {
  11741.                         model = class9_1.method209(-1, -1, flag2);
  11742.                     } else {
  11743.                         Animation animation = Animation.anims[i7];
  11744.                         model = class9_1.method209(
  11745.                                 animation.anIntArray354[class9_1.anInt246],
  11746.                                 animation.anIntArray353[class9_1.anInt246],
  11747.                                 flag2);
  11748.                     }
  11749.                     if (model != null)
  11750.                         model.method482(class9_1.modelRotation2, 0,
  11751.                                 class9_1.modelRotation1, 0, i5, l5);
  11752.                     Texture.textureInt1 = k3;
  11753.                     Texture.textureInt2 = j4;
  11754.                 } else if (class9_1.type == 7) {
  11755.                     TextDrawingArea textDrawingArea_1 = class9_1.textDrawingAreas;
  11756.                     int k4 = 0;
  11757.                     for (int j5 = 0; j5 < class9_1.height; j5++) {
  11758.                         for (int i6 = 0; i6 < class9_1.width; i6++) {
  11759.                             if (class9_1.inv[k4] > 0) {
  11760.                                 ItemDef itemDef = ItemDef
  11761.                                         .forID(class9_1.inv[k4] - 1);
  11762.                                 String s2 = itemDef.name;
  11763.                                 if (itemDef.stackable
  11764.                                         || class9_1.invStackSizes[k4] != 1)
  11765.                                     s2 = s2
  11766.                                             + " x"
  11767.                                             + intToKOrMilLongName(
  11768.                                                     class9_1.invStackSizes[k4],
  11769.                                                     0);
  11770.                                 int i9 = k2 + i6
  11771.                                         * (115 + class9_1.invSpritePadX);
  11772.                                 int k9 = l2 + j5
  11773.                                         * (12 + class9_1.invSpritePadY);
  11774.                                 if (class9_1.centerText)
  11775.                                     textDrawingArea_1.method382(
  11776.                                             class9_1.textColor, i9
  11777.                                                     + class9_1.width / 2, s2,
  11778.                                             k9, class9_1.textShadow);
  11779.                                 else
  11780.                                     textDrawingArea_1.method389(
  11781.                                             class9_1.textShadow, i9,
  11782.                                             class9_1.textColor, s2, k9);
  11783.                             }
  11784.                             k4++;
  11785.                         }
  11786.  
  11787.                     }
  11788.  
  11789.                 } else if (class9_1.type == 8
  11790.                         && (anInt1500 == class9_1.id
  11791.                                 || anInt1044 == class9_1.id || anInt1129 == class9_1.id)
  11792.                         && anInt1501 == 50 && !menuOpen) {
  11793.                     int boxWidth = 0;
  11794.                     int boxHeight = 0;
  11795.                     TextDrawingArea textDrawingArea_2 = aTextDrawingArea_1271;
  11796.                     for (String s1 = class9_1.message; s1.length() > 0;) {
  11797.                         if (s1.indexOf("%") != -1) {
  11798.                             do {
  11799.                                 int k7 = s1.indexOf("%1");
  11800.                                 if (k7 == -1)
  11801.                                     break;
  11802.                                 s1 = s1.substring(0, k7)
  11803.                                         + interfaceIntToString(extractInterfaceValues(
  11804.                                                 class9_1, 0))
  11805.                                         + s1.substring(k7 + 2);
  11806.                             } while (true);
  11807.                             do {
  11808.                                 int l7 = s1.indexOf("%2");
  11809.                                 if (l7 == -1)
  11810.                                     break;
  11811.                                 s1 = s1.substring(0, l7)
  11812.                                         + interfaceIntToString(extractInterfaceValues(
  11813.                                                 class9_1, 1))
  11814.                                         + s1.substring(l7 + 2);
  11815.                             } while (true);
  11816.                             do {
  11817.                                 int i8 = s1.indexOf("%3");
  11818.                                 if (i8 == -1)
  11819.                                     break;
  11820.                                 s1 = s1.substring(0, i8)
  11821.                                         + interfaceIntToString(extractInterfaceValues(
  11822.                                                 class9_1, 2))
  11823.                                         + s1.substring(i8 + 2);
  11824.                             } while (true);
  11825.                             do {
  11826.                                 int j8 = s1.indexOf("%4");
  11827.                                 if (j8 == -1)
  11828.                                     break;
  11829.                                 s1 = s1.substring(0, j8)
  11830.                                         + interfaceIntToString(extractInterfaceValues(
  11831.                                                 class9_1, 3))
  11832.                                         + s1.substring(j8 + 2);
  11833.                             } while (true);
  11834.                             do {
  11835.                                 int k8 = s1.indexOf("%5");
  11836.                                 if (k8 == -1)
  11837.                                     break;
  11838.                                 s1 = s1.substring(0, k8)
  11839.                                         + interfaceIntToString(extractInterfaceValues(
  11840.                                                 class9_1, 4))
  11841.                                         + s1.substring(k8 + 2);
  11842.                             } while (true);
  11843.                         }
  11844.                         int l7 = s1.indexOf("\\n");
  11845.                         String s4;
  11846.                         if (l7 != -1) {
  11847.                             s4 = s1.substring(0, l7);
  11848.                             s1 = s1.substring(l7 + 2);
  11849.                         } else {
  11850.                             s4 = s1;
  11851.                             s1 = "";
  11852.                         }
  11853.                         int j10 = textDrawingArea_2.getTextWidth(s4);
  11854.                         if (j10 > boxWidth) {
  11855.                             boxWidth = j10;
  11856.                         }
  11857.                         boxHeight += textDrawingArea_2.anInt1497 + 1;
  11858.                     }
  11859.                     boxWidth += 6;
  11860.                     boxHeight += 7;
  11861.                     int xPos = (k2 + class9_1.width) - 5 - boxWidth;
  11862.                     int yPos = l2 + class9_1.height + 5;
  11863.                     if (xPos < k2 + 5)
  11864.                         xPos = k2 + 5;
  11865.                     if (xPos + boxWidth > k + class9.width)
  11866.                         xPos = (k + class9.width) - boxWidth;
  11867.                     if (yPos + boxHeight > l + class9.height)
  11868.                         yPos = (l2 - boxHeight);
  11869.                     DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0,
  11870.                             boxWidth);
  11871.                     DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  11872.                     String s2 = class9_1.message;
  11873.                     for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
  11874.                             .length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  11875.                         if (s2.indexOf("%") != -1) {
  11876.                             do {
  11877.                                 int k7 = s2.indexOf("%1");
  11878.                                 if (k7 == -1)
  11879.                                     break;
  11880.                                 s2 = s2.substring(0, k7)
  11881.                                         + interfaceIntToString(extractInterfaceValues(
  11882.                                                 class9_1, 0))
  11883.                                         + s2.substring(k7 + 2);
  11884.                             } while (true);
  11885.                             do {
  11886.                                 int l7 = s2.indexOf("%2");
  11887.                                 if (l7 == -1)
  11888.                                     break;
  11889.                                 s2 = s2.substring(0, l7)
  11890.                                         + interfaceIntToString(extractInterfaceValues(
  11891.                                                 class9_1, 1))
  11892.                                         + s2.substring(l7 + 2);
  11893.                             } while (true);
  11894.                             do {
  11895.                                 int i8 = s2.indexOf("%3");
  11896.                                 if (i8 == -1)
  11897.                                     break;
  11898.                                 s2 = s2.substring(0, i8)
  11899.                                         + interfaceIntToString(extractInterfaceValues(
  11900.                                                 class9_1, 2))
  11901.                                         + s2.substring(i8 + 2);
  11902.                             } while (true);
  11903.                             do {
  11904.                                 int j8 = s2.indexOf("%4");
  11905.                                 if (j8 == -1)
  11906.                                     break;
  11907.                                 s2 = s2.substring(0, j8)
  11908.                                         + interfaceIntToString(extractInterfaceValues(
  11909.                                                 class9_1, 3))
  11910.                                         + s2.substring(j8 + 2);
  11911.                             } while (true);
  11912.                             do {
  11913.                                 int k8 = s2.indexOf("%5");
  11914.                                 if (k8 == -1)
  11915.                                     break;
  11916.                                 s2 = s2.substring(0, k8)
  11917.                                         + interfaceIntToString(extractInterfaceValues(
  11918.                                                 class9_1, 4))
  11919.                                         + s2.substring(k8 + 2);
  11920.                             } while (true);
  11921.                         }
  11922.                         int l11 = s2.indexOf("\\n");
  11923.                         String s5;
  11924.                         if (l11 != -1) {
  11925.                             s5 = s2.substring(0, l11);
  11926.                             s2 = s2.substring(l11 + 2);
  11927.                         } else {
  11928.                             s5 = s2;
  11929.                             s2 = "";
  11930.                         }
  11931.                         if (class9_1.centerText) {
  11932.                             textDrawingArea_2.method382(yPos, xPos
  11933.                                     + class9_1.width / 2, s5, j11, false);
  11934.                         } else {
  11935.                             if (s5.contains("\\r")) {
  11936.                                 String text = s5
  11937.                                         .substring(0, s5.indexOf("\\r"));
  11938.                                 String text2 = s5
  11939.                                         .substring(s5.indexOf("\\r") + 2);
  11940.                                 textDrawingArea_2.method389(false, xPos + 3, 0,
  11941.                                         text, j11);
  11942.                                 int rightX = boxWidth + xPos
  11943.                                         - textDrawingArea_2.getTextWidth(text2)
  11944.                                         - 2;
  11945.                                 textDrawingArea_2.method389(false, rightX, 0,
  11946.                                         text2, j11);
  11947.                                 System.out.println("Box: " + boxWidth + "");
  11948.                             } else
  11949.                                 textDrawingArea_2.method389(false, xPos + 3, 0,
  11950.                                         s5, j11);
  11951.                         }
  11952.                     }
  11953.                 } else if (class9_1.type == 9) {
  11954.                     drawHoverBox(k2, l2, class9_1.popupString);
  11955.                 } else if (class9_1.type == 11 && (anInt1500 == class9_1.id || anInt1044 == class9_1.id || anInt1129 == class9_1.id) && !menuOpen) {
  11956.                     int boxWidth = 0;
  11957.                     int boxHeight = 0;
  11958.                     TextDrawingArea textDrawingArea_2 = aTextDrawingArea_1271;
  11959.                     for (String s1 = class9_1.message; s1.length() > 0;) {
  11960.                         int l7 = s1.indexOf("\\n");
  11961.                         String s4;
  11962.                         if (l7 != -1) {
  11963.                             s4 = s1.substring(0, l7);
  11964.                             s1 = s1.substring(l7 + 2);
  11965.                         } else {
  11966.                             s4 = s1;
  11967.                             s1 = "";
  11968.                         }
  11969.                         int j10 = textDrawingArea_2.getTextWidth(s4);
  11970.                         if (j10 > boxWidth) {
  11971.                             boxWidth = j10;
  11972.                         }
  11973.                         boxHeight += textDrawingArea_2.anInt1497 + 1;
  11974.                     }
  11975.                     boxWidth += 6;
  11976.                     boxHeight += 7;
  11977.                     int xPos = (k2 + class9_1.width) - 5 - boxWidth;
  11978.                     int yPos = l2 + class9_1.height + 5;
  11979.                     if (xPos < k2 + 5) {
  11980.                         xPos = k2 + 5;
  11981.                     }
  11982.                     if (xPos + boxWidth > k + class9.width) {
  11983.                         xPos = (k + class9.width) - boxWidth;
  11984.                     }
  11985.                     if (yPos + boxHeight > l + class9.height) {
  11986.                         yPos = (l + class9.height) - boxHeight;
  11987.                     }
  11988.                     if(class9_1.inventoryhover){
  11989.                         if(xPos + boxWidth+k > 249){
  11990.                             xPos = 251 - boxWidth-k;
  11991.                         }
  11992.                         if(yPos+boxHeight+l >261 ){
  11993.                             yPos = 245 - boxHeight - l;
  11994.                         }
  11995.                     }
  11996.                     DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  11997.                     DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  11998.                     String s2 = class9_1.message;
  11999.                     for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {
  12000.                         int l11 = s2.indexOf("\\n");
  12001.                         String s5;
  12002.                         if (l11 != -1) {
  12003.                             s5 = s2.substring(0, l11);
  12004.                             s2 = s2.substring(l11 + 2);
  12005.                         } else {
  12006.                             s5 = s2;
  12007.                             s2 = "";
  12008.                         }
  12009.                         textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  12010.                     }
  12011.                 }
  12012.         }
  12013.         // DrawingArea.setDrawingArea(l1, i1, k1, j1);
  12014.  
  12015.         /*
  12016.          * else if(class9_1.type == 8) { String hoverText; if
  12017.          * (interfaceIsSelected(class9_1)){ hoverText = class9_1.aString228;
  12018.          * }else hoverText = class9_1.message; drawHoverBox(k2, l2, hoverText);
  12019.          * }
  12020.          */
  12021.  
  12022.         DrawingArea.setDrawingArea(l1, i1, k1, j1);
  12023.     }
  12024.    
  12025.     public int drawCount;
  12026.     public int fullscreenInterfaceID;
  12027. public int[] fullScreenTextureArray;
  12028. public void resetAllImageProducers() {
  12029.         if (super.fullGameScreen != null) {
  12030.             return;
  12031.         }
  12032.         aRSImageProducer_1166 = null;
  12033.         aRSImageProducer_1164 = null;
  12034.         aRSImageProducer_1163 = null;
  12035.         aRSImageProducer_1165 = null;
  12036.         aRSImageProducer_1123 = null;
  12037.         aRSImageProducer_1124 = null;
  12038.         aRSImageProducer_1125 = null;
  12039.         aRSImageProducer_1107 = null;
  12040.         aRSImageProducer_1108 = null;
  12041.         aRSImageProducer_1109 = null;
  12042.         aRSImageProducer_1110 = null;
  12043.         aRSImageProducer_1111 = null;
  12044.         aRSImageProducer_1112 = null;
  12045.         aRSImageProducer_1113 = null;
  12046.         aRSImageProducer_1114 = null;
  12047.         aRSImageProducer_1115 = null;
  12048.         super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  12049.         welcomeScreenRaised = true;
  12050.  
  12051.     }
  12052.  
  12053.     public void drawHoverBox(int xPos, int yPos, String text) {
  12054.         String[] results = text.split("\n");
  12055.         int height = (results.length * 16) + 6;
  12056.         int width;
  12057.         width = smallText.getTextWidth(results[0]) + 6;
  12058.         for (int i = 1; i < results.length; i++)
  12059.             if (width <= smallText.getTextWidth(results[i]) + 6)
  12060.                 width = smallText.getTextWidth(results[i]) + 6;
  12061.         DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  12062.         DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  12063.         yPos += 14;
  12064.         for (int i = 0; i < results.length; i++) {
  12065.             smallText.method389(false, xPos + 3, 0, results[i], yPos);
  12066.             yPos += 16;
  12067.         }
  12068.     }
  12069.  
  12070.     private void randomizeBackground(Background background) {
  12071.         int j = 256;
  12072.         for (int k = 0; k < anIntArray1190.length; k++)
  12073.             anIntArray1190[k] = 0;
  12074.  
  12075.         for (int l = 0; l < 5000; l++) {
  12076.             int i1 = (int) (Math.random() * 128D * (double) j);
  12077.             anIntArray1190[i1] = (int) (Math.random() * 256D);
  12078.         }
  12079.  
  12080.         for (int j1 = 0; j1 < 20; j1++) {
  12081.             for (int k1 = 1; k1 < j - 1; k1++) {
  12082.                 for (int i2 = 1; i2 < 127; i2++) {
  12083.                     int k2 = i2 + (k1 << 7);
  12084.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1]
  12085.                             + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  12086.                 }
  12087.  
  12088.             }
  12089.  
  12090.             int ai[] = anIntArray1190;
  12091.             anIntArray1190 = anIntArray1191;
  12092.             anIntArray1191 = ai;
  12093.         }
  12094.  
  12095.         if (background != null) {
  12096.             int l1 = 0;
  12097.             for (int j2 = 0; j2 < background.anInt1453; j2++) {
  12098.                 for (int l2 = 0; l2 < background.anInt1452; l2++)
  12099.                     if (background.aByteArray1450[l1++] != 0) {
  12100.                         int i3 = l2 + 16 + background.anInt1454;
  12101.                         int j3 = j2 + 16 + background.anInt1455;
  12102.                         int k3 = i3 + (j3 << 7);
  12103.                         anIntArray1190[k3] = 0;
  12104.                     }
  12105.  
  12106.             }
  12107.  
  12108.         }
  12109.     }
  12110.  
  12111.     private void method107(int i, int j, Stream stream, Player player) {
  12112.     try {
  12113.         if ((i & 0x400) != 0) {
  12114.             player.anInt1543 = stream.method428();
  12115.             player.anInt1545 = stream.method428();
  12116.             player.anInt1544 = stream.method428();
  12117.             player.anInt1546 = stream.method428();
  12118.             player.anInt1547 = stream.method436() + loopCycle;
  12119.             player.anInt1548 = stream.method435() + loopCycle;
  12120.             player.anInt1549 = stream.method428();
  12121.             player.method446();
  12122.         }
  12123.         if ((i & 0x100) != 0) {
  12124.             player.anInt1520 = stream.method434();
  12125.             int k = stream.readDWord();
  12126.             player.anInt1524 = k >> 16;
  12127.             player.anInt1523 = loopCycle + (k & 0xffff);
  12128.             player.anInt1521 = 0;
  12129.             player.anInt1522 = 0;
  12130.             if (player.anInt1523 > loopCycle)
  12131.                 player.anInt1521 = -1;
  12132.             if (player.anInt1520 == 65535)
  12133.                 player.anInt1520 = -1;
  12134.         }
  12135.         if ((i & 8) != 0) {
  12136.             int l = stream.method434();
  12137.             if (l > Animation.anims.length) { l = -1; }
  12138.             if (l == 65535)
  12139.                 l = -1;
  12140.             int i2 = stream.method427();
  12141.             if ( l < Animation.anims.length && l == player.anim && l != -1) {
  12142.                 int i3 = Animation.anims[l].anInt365;
  12143.                 if (i3 == 1) {
  12144.                     player.anInt1527 = 0;
  12145.                     player.anInt1528 = 0;
  12146.                     player.anInt1529 = i2;
  12147.                     player.anInt1530 = 0;
  12148.                 }
  12149.                 if (i3 == 2)
  12150.                     player.anInt1530 = 0;
  12151.             } else if (l == -1 || player.anim == -1 ||
  12152.             ((l < Animation.anims.length && player.anim < Animation.anims.length) && (Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359))) {
  12153.                 player.anim = l;
  12154.                 player.anInt1527 = 0;
  12155.                 player.anInt1528 = 0;
  12156.                 player.anInt1529 = i2;
  12157.                 player.anInt1530 = 0;
  12158.                 player.anInt1542 = player.smallXYIndex;
  12159.             }
  12160.         }
  12161.         if ((i & 4) != 0) {
  12162.             player.textSpoken = stream.readString();
  12163.             if(player.textSpoken.length() < 1)
  12164.                 return;
  12165.             if (player.textSpoken.charAt(0) == '~') {
  12166.                 player.textSpoken = player.textSpoken.substring(1);
  12167.                 pushMessage(player.textSpoken, 2, player.name);
  12168.             } else if (player == myPlayer)
  12169.                 pushMessage(player.textSpoken, 2, player.name);
  12170.             player.anInt1513 = 0;
  12171.             player.anInt1531 = 0;
  12172.             player.textCycle = 150;
  12173.         }
  12174.         if ((i & 0x80) != 0) {
  12175.             int i1 = stream.method434();
  12176.             int j2 = stream.readUnsignedByte();
  12177.             int j3 = stream.method427();
  12178.             int k3 = stream.currentOffset;
  12179.             if (player.name != null && player.visible) {
  12180.                 long l3 = TextClass.longForName(player.name);
  12181.                 boolean flag = false;
  12182.                 if (j2 <= 1) {
  12183.                     for (int i4 = 0; i4 < ignoreCount; i4++) {
  12184.                         if (ignoreListAsLongs[i4] != l3)
  12185.                             continue;
  12186.                         flag = true;
  12187.                         break;
  12188.                     }
  12189.  
  12190.                 }
  12191.                 if (!flag && anInt1251 == 0)
  12192.                     try {
  12193.                         aStream_834.currentOffset = 0;
  12194.                         stream.method442(j3, 0, aStream_834.buffer);
  12195.                         aStream_834.currentOffset = 0;
  12196.                         String s = TextInput.method525(j3, aStream_834);
  12197.                         // s = Censor.doCensor(s);
  12198.                         player.textSpoken = s;
  12199.                         player.anInt1513 = i1 >> 8;
  12200.                         player.privelage = j2;
  12201.  
  12202.                         // entityMessage(player);
  12203.  
  12204.                         player.anInt1531 = i1 & 0xff;
  12205.                         player.textCycle = 150;
  12206.                         String title = getSpecialColor(player.skill) + player.title + "@bla@";
  12207.                         if (j2 == 11)
  12208.                             pushMessage(s, 1, "@crA@" + title + player.name);
  12209.                         else if (j2 == 10)
  12210.                             pushMessage(s, 1, "@cr9@" + title + player.name);
  12211.                         else if (j2 == 13)
  12212.                             pushMessage(s, 1, "@c10@" + title + player.name);
  12213.                         else if (j2 == 9)
  12214.                             pushMessage(s, 1, "@cr8@" + title + player.name);
  12215.                         else if (j2 == 8)
  12216.                             pushMessage(s, 1, "@cr7@" + title + player.name);
  12217.                         else if (j2 == 7)
  12218.                             pushMessage(s, 1, "@cr6@" + title + player.name);
  12219.                         else if (j2 == 6)
  12220.                             pushMessage(s, 1, "@cr5@" + title + player.name);
  12221.                         else if (j2 == 5)
  12222.                             pushMessage(s, 1, "@cr4@" + title + player.name);
  12223.                         else if (j2 == 4)
  12224.                             pushMessage(s, 1, "@cr3@" + title + player.name);
  12225.                         else if (j2 == 3)
  12226.                             pushMessage(s, 1, "@cr2@" + title + player.name);
  12227.                         else if (j2 == 2)
  12228.                             pushMessage(s, 1, "@cr1@" + title + player.name);
  12229.                         else if (j2 == 1)
  12230.                             pushMessage(s, 1, "@cr0@" + title + player.name);
  12231.                         else
  12232.                             pushMessage(s, 2, title + player.name);
  12233.                     } catch (Exception exception) {
  12234.                         signlink.reporterror("cde2");
  12235.                     }
  12236.             }
  12237.             stream.currentOffset = k3 + j3;
  12238.         }
  12239.         if ((i & 1) != 0) {
  12240.             player.interactingEntity = stream.method434();
  12241.             if (player.interactingEntity == 65535)
  12242.                 player.interactingEntity = -1;
  12243.         }
  12244.         if ((i & 0x10) != 0) {
  12245.             int j1 = stream.method427();
  12246.             byte abyte0[] = new byte[j1];
  12247.             Stream stream_1 = new Stream(abyte0);
  12248.             stream.readBytes(j1, 0, abyte0);
  12249.             aStreamArray895s[j] = stream_1;
  12250.             player.updatePlayer(stream_1);
  12251.         }
  12252.         if ((i & 2) != 0) {
  12253.             player.anInt1538 = stream.method436();
  12254.             player.anInt1539 = stream.method434();
  12255.         }
  12256.         if ((i & 0x20) != 0) {
  12257.             int k1 = stream.readUnsignedByte();
  12258.             int k2 = stream.method426();
  12259.             player.updateHitData(k2, k1, loopCycle);
  12260.             player.loopCycleStatus = loopCycle + 300;
  12261.             player.currentHealth = stream.method427();
  12262.             player.maxHealth = stream.readUnsignedByte();
  12263.         }
  12264.         if ((i & 0x200) != 0) {
  12265.             int l1 = stream.readUnsignedByte();
  12266.             int l2 = stream.method428();
  12267.             player.updateHitData(l2, l1, loopCycle);
  12268.             player.loopCycleStatus = loopCycle + 300;
  12269.             player.currentHealth = stream.readUnsignedByte();
  12270.             player.maxHealth = stream.method427();
  12271.         }
  12272.         } catch (Exception e){
  12273.         e.printStackTrace();
  12274.         }
  12275.     }
  12276.  
  12277.     private void method108() {
  12278.         try {
  12279.             int j = myPlayer.x + anInt1278;
  12280.             int k = myPlayer.y + anInt1131;
  12281.             if (anInt1014 - j < -500 || anInt1014 - j > 500
  12282.                     || anInt1015 - k < -500 || anInt1015 - k > 500) {
  12283.                 anInt1014 = j;
  12284.                 anInt1015 = k;
  12285.             }
  12286.             if (anInt1014 != j)
  12287.                 anInt1014 += (j - anInt1014) / 16;
  12288.             if (anInt1015 != k)
  12289.                 anInt1015 += (k - anInt1015) / 16;
  12290.             if (super.keyArray[1] == 1)
  12291.                 anInt1186 += (-24 - anInt1186) / 2;
  12292.             else if (super.keyArray[2] == 1)
  12293.                 anInt1186 += (24 - anInt1186) / 2;
  12294.             else
  12295.                 anInt1186 /= 2;
  12296.             if (super.keyArray[3] == 1)
  12297.                 anInt1187 += (12 - anInt1187) / 2;
  12298.             else if (super.keyArray[4] == 1)
  12299.                 anInt1187 += (-12 - anInt1187) / 2;
  12300.             else
  12301.                 anInt1187 /= 2;
  12302.             minimapInt1 = minimapInt1 + anInt1186 / 2 & 0x7ff;
  12303.             anInt1184 += anInt1187 / 2;
  12304.             if (anInt1184 < 128)
  12305.                 anInt1184 = 128;
  12306.             if (anInt1184 > 383)
  12307.                 anInt1184 = 383;
  12308.             int l = anInt1014 >> 7;
  12309.             int i1 = anInt1015 >> 7;
  12310.             int j1 = method42(plane, anInt1015, anInt1014);
  12311.             int k1 = 0;
  12312.             if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  12313.                 for (int l1 = l - 4; l1 <= l + 4; l1++) {
  12314.                     for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  12315.                         int l2 = plane;
  12316.                         if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  12317.                             l2++;
  12318.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  12319.                         if (i3 > k1)
  12320.                             k1 = i3;
  12321.                     }
  12322.  
  12323.                 }
  12324.  
  12325.             }
  12326.             anInt1005++;
  12327.             if (anInt1005 > 1512) {
  12328.                 anInt1005 = 0;
  12329.                 stream.createFrame(77);
  12330.                 stream.writeWordBigEndian(0);
  12331.                 int i2 = stream.currentOffset;
  12332.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  12333.                 stream.writeWordBigEndian(101);
  12334.                 stream.writeWordBigEndian(233);
  12335.                 stream.writeWord(45092);
  12336.                 if ((int) (Math.random() * 2D) == 0)
  12337.                     stream.writeWord(35784);
  12338.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  12339.                 stream.writeWordBigEndian(64);
  12340.                 stream.writeWordBigEndian(38);
  12341.                 stream.writeWord((int) (Math.random() * 65536D));
  12342.                 stream.writeWord((int) (Math.random() * 65536D));
  12343.                 stream.writeBytes(stream.currentOffset - i2);
  12344.             }
  12345.             int j2 = k1 * 192;
  12346.             if (j2 > 0x17f00)
  12347.                 j2 = 0x17f00;
  12348.             if (j2 < 32768)
  12349.                 j2 = 32768;
  12350.             if (j2 > anInt984) {
  12351.                 anInt984 += (j2 - anInt984) / 24;
  12352.                 return;
  12353.             }
  12354.             if (j2 < anInt984) {
  12355.                 anInt984 += (j2 - anInt984) / 80;
  12356.             }
  12357.         } catch (Exception _ex) {
  12358.             signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y
  12359.                     + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + ","
  12360.                     + anInt1070 + "," + baseX + "," + baseY);
  12361.             throw new RuntimeException("eek");
  12362.         }
  12363.     }
  12364.  
  12365.     public void processDrawing() {
  12366.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  12367.             showErrorScreen();
  12368.             return;
  12369.         }
  12370.         anInt1061++;
  12371.         if (!loggedIn)
  12372.             drawLoginScreen(false);
  12373.         else
  12374.             drawGameScreen();
  12375.         anInt1213 = 0;
  12376.        
  12377.     }
  12378.  
  12379.     private boolean isFriendOrSelf(String s) {
  12380.         if (s == null)
  12381.             return false;
  12382.         for (int i = 0; i < friendsCount; i++)
  12383.             if (s.equalsIgnoreCase(friendsList[i]))
  12384.                 return true;
  12385.         return s.equalsIgnoreCase(myPlayer.name);
  12386.     }
  12387.  
  12388.     private static String combatDiffColor(int i, int j) {
  12389.         int k = i - j;
  12390.         if (k < -9)
  12391.             return "@red@";
  12392.         if (k < -6)
  12393.             return "@or3@";
  12394.         if (k < -3)
  12395.             return "@or2@";
  12396.         if (k < 0)
  12397.             return "@or1@";
  12398.         if (k > 9)
  12399.             return "@gre@";
  12400.         if (k > 6)
  12401.             return "@gr3@";
  12402.         if (k > 3)
  12403.             return "@gr2@";
  12404.         if (k > 0)
  12405.             return "@gr1@";
  12406.         else
  12407.             return "@yel@";
  12408.     }
  12409.  
  12410.     private void setWaveVolume(int i) {
  12411.         signlink.wavevol = i;
  12412.     }
  12413.  
  12414.     private void draw3dScreen() {
  12415.         alertHandler.processAlerts();
  12416.         drawSplitPrivateChat();
  12417.         if (crossType == 1) {
  12418.             crosses[crossIndex / 100]
  12419.                     .drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  12420.             anInt1142++;
  12421.             if (anInt1142 > 67) {
  12422.                 anInt1142 = 0;
  12423.                 stream.createFrame(78);
  12424.             }
  12425.         }
  12426.         if (crossType == 2)
  12427.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4,
  12428.                     crossY - 8 - 4);
  12429.         if (anInt1018 != -1) {
  12430.             method119(anInt945, anInt1018);
  12431.             drawInterface(0, 0, RSInterface.interfaceCache[anInt1018], 0);
  12432.         }
  12433.         if (openInterfaceID != -1) {
  12434.             method119(anInt945, openInterfaceID);
  12435.             drawInterface(0, 0, RSInterface.interfaceCache[openInterfaceID], 0);
  12436.         }
  12437.         method70();
  12438.         if (!menuOpen) {
  12439.             processRightClick();
  12440.             drawTooltip();
  12441.         } else if (menuScreenArea == 0)
  12442.             drawMenu();
  12443.         if (anInt1055 == 1) { // Multi icon outside of Wilderness
  12444.             multiOverlay.drawSprite(472, 296);
  12445.         } else if (anInt1055 == 2) { // Multi icon inside of Wilderness
  12446.             multiOverlay.drawSprite(472, 278);
  12447.         } else if (anInt1055 == 3) { // Dueling icon in dueling area
  12448.             duelingOverlay.drawSprite(472, 278);
  12449.         }
  12450.         if (fpsOn) {
  12451.             char c = '\u01FB';
  12452.             int k = 20;
  12453.             int i1 = 0xffff00;
  12454.             if (super.fps < 15)
  12455.                 i1 = 0xff0000;
  12456.             aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
  12457.             k += 15;
  12458.             Runtime runtime = Runtime.getRuntime();
  12459.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  12460.             i1 = 0xffff00;
  12461.             if (j1 > 0x2000000 && lowMem)
  12462.                 i1 = 0xff0000;
  12463.             aTextDrawingArea_1271.method380("Mem:" + j1 + "k", c, 0xffff00, k);
  12464.             k += 15;
  12465.         }
  12466.         int i1 = 0xffff00;
  12467.         int x = baseX + (myPlayer.x - 6 >> 7);
  12468.         int y = baseY + (myPlayer.y - 6 >> 7);
  12469.         if (clientData) {
  12470.             char c = '\u01FB';
  12471.             int k = 20;
  12472.             if (super.fps < 15)
  12473.                 i1 = 0xff0000;
  12474.             aTextDrawingArea_1271.method385(0xffff00, "Fps: " + super.fps, 285,
  12475.                     5);
  12476.             Runtime runtime = Runtime.getRuntime();
  12477.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  12478.             i1 = 0xffff00;
  12479.             if (j1 > 0x2000000 && lowMem)
  12480.                 i1 = 0xff0000;
  12481.             k += 15;
  12482.             aTextDrawingArea_1271.method385(0xffff00, "Mem: " + j1 + "k", 299,
  12483.                     5);
  12484.             aTextDrawingArea_1271.method385(0xffff00, "Mouse X: "
  12485.                     + super.mouseX + " , Mouse Y: " + super.mouseY, 314, 5);
  12486.             aTextDrawingArea_1271.method385(0xffff00,
  12487.                     "Coords: " + x + ", " + y, 329, 5);
  12488.         }
  12489.         if (coordinates || performanceCounter) {
  12490.             int k = 20;
  12491.             char c = '\u01FB';
  12492.             if (coordinates) {
  12493.                 i1 = 0xffff00;
  12494.                 x = baseX + (myPlayer.x - 6 >> 7);
  12495.                 y = baseY + (myPlayer.y - 6 >> 7);
  12496.                 aTextDrawingArea_1271.method380("Coordinates: X:" + x + " Y:"
  12497.                         + y, c, i1, k);
  12498.                 k += 15;
  12499.             }
  12500.             if (performanceCounter) {
  12501.                 i1 = 0xffff00;
  12502.                 Runtime runtime = Runtime.getRuntime();
  12503.                 double j1 = (int) ((runtime.totalMemory() - runtime
  12504.                         .freeMemory()) / 1024L); // Used memory
  12505.                 double j2 = (int) (runtime.totalMemory() / 1024L); // Total
  12506.                                                                     // Memory
  12507.                 double j3 = j1 / j2 * 100; // Percent used
  12508.                 i1 = 0xffff00;
  12509.                 if (j3 > 90D) // If memory usage(j3) > 90, change text color to
  12510.                                 // red
  12511.                     i1 = 0xff0000;
  12512.                 aTextDrawingArea_1271.method380("MemUsage: " + (int) j1 + " / "
  12513.                         + (int) j2 + "KB", c, i1, k);
  12514.                 k += 15;
  12515.                 i1 = 0xffff00;
  12516.                 if (super.fps < 15) // Frames too slow :D
  12517.                     i1 = 0xff0000;
  12518.                 aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
  12519.                 k += 15;
  12520.             }
  12521.         }
  12522.         if (anInt1104 != 0) {
  12523.             int j = anInt1104 / 50;
  12524.             int l = j / 60;
  12525.             j %= 60;
  12526.             if (j < 10)
  12527.                 aTextDrawingArea_1271.method385(0xffff00,
  12528.                         "System update please logout to save your data: " + l
  12529.                                 + ":0" + j, 329, 4);
  12530.             else
  12531.                 aTextDrawingArea_1271.method385(0xffff00,
  12532.                         "System update please logout to save your data: " + l
  12533.                                 + ":" + j, 329, 4);
  12534.             anInt849++;
  12535.             if (anInt849 > 75) {
  12536.                 anInt849 = 0;
  12537.                 stream.createFrame(148);
  12538.             }
  12539.         }
  12540.     }
  12541.  
  12542.     private void addIgnore(long l) {
  12543.         try {
  12544.             if (l == 0L)
  12545.                 return;
  12546.             if (ignoreCount >= 100) {
  12547.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  12548.                 return;
  12549.             }
  12550.             String s = TextClass.fixName(TextClass.nameForLong(l));
  12551.             for (int j = 0; j < ignoreCount; j++)
  12552.                 if (ignoreListAsLongs[j] == l) {
  12553.                     pushMessage(s + " is already on your ignore list", 0, "");
  12554.                     return;
  12555.                 }
  12556.             for (int k = 0; k < friendsCount; k++)
  12557.                 if (friendsListAsLongs[k] == l) {
  12558.                     pushMessage("Please remove " + s
  12559.                             + " from your friend list first", 0, "");
  12560.                     return;
  12561.                 }
  12562.  
  12563.             ignoreListAsLongs[ignoreCount++] = l;
  12564.             needDrawTabArea = true;
  12565.             stream.createFrame(133);
  12566.             stream.writeQWord(l);
  12567.             return;
  12568.         } catch (RuntimeException runtimeexception) {
  12569.             signlink.reporterror("45688, " + l + ", " + 4 + ", "
  12570.                     + runtimeexception.toString());
  12571.         }
  12572.         throw new RuntimeException();
  12573.     }
  12574.  
  12575.     private void method114() {
  12576.         for (int i = -1; i < playerCount; i++) {
  12577.             int j;
  12578.             if (i == -1)
  12579.                 j = myPlayerIndex;
  12580.             else
  12581.                 j = playerIndices[i];
  12582.             Player player = playerArray[j];
  12583.             if (player != null)
  12584.                 method96(player);
  12585.         }
  12586.  
  12587.     }
  12588.  
  12589.     private void method115() {
  12590.         if (loadingStage == 2) {
  12591.             for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  12592.                     .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  12593.                     .reverseGetNext()) {
  12594.                 if (class30_sub1.anInt1294 > 0)
  12595.                     class30_sub1.anInt1294--;
  12596.                 if (class30_sub1.anInt1294 == 0) {
  12597.                     if (class30_sub1.anInt1299 < 0
  12598.                             || ObjectManager.method178(class30_sub1.anInt1299,
  12599.                                     class30_sub1.anInt1301)) {
  12600.                         method142(class30_sub1.anInt1298,
  12601.                                 class30_sub1.anInt1295, class30_sub1.anInt1300,
  12602.                                 class30_sub1.anInt1301, class30_sub1.anInt1297,
  12603.                                 class30_sub1.anInt1296, class30_sub1.anInt1299);
  12604.                         class30_sub1.unlink();
  12605.                     }
  12606.                 } else {
  12607.                     if (class30_sub1.anInt1302 > 0)
  12608.                         class30_sub1.anInt1302--;
  12609.                     if (class30_sub1.anInt1302 == 0
  12610.                             && class30_sub1.anInt1297 >= 1
  12611.                             && class30_sub1.anInt1298 >= 1
  12612.                             && class30_sub1.anInt1297 <= 102
  12613.                             && class30_sub1.anInt1298 <= 102
  12614.                             && (class30_sub1.anInt1291 < 0 || ObjectManager
  12615.                                     .method178(class30_sub1.anInt1291,
  12616.                                             class30_sub1.anInt1293))) {
  12617.                         method142(class30_sub1.anInt1298,
  12618.                                 class30_sub1.anInt1295, class30_sub1.anInt1292,
  12619.                                 class30_sub1.anInt1293, class30_sub1.anInt1297,
  12620.                                 class30_sub1.anInt1296, class30_sub1.anInt1291);
  12621.                         class30_sub1.anInt1302 = -1;
  12622.                         if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  12623.                                 && class30_sub1.anInt1299 == -1)
  12624.                             class30_sub1.unlink();
  12625.                         else if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  12626.                                 && class30_sub1.anInt1292 == class30_sub1.anInt1300
  12627.                                 && class30_sub1.anInt1293 == class30_sub1.anInt1301)
  12628.                             class30_sub1.unlink();
  12629.                     }
  12630.                 }
  12631.             }
  12632.  
  12633.         }
  12634.     }
  12635.  
  12636.     private void determineMenuSize() {
  12637.         int i = chatTextDrawingArea.getTextWidth("Choose Option");
  12638.         for (int j = 0; j < menuActionRow; j++) {
  12639.             int k = chatTextDrawingArea.getTextWidth(menuActionName[j]);
  12640.             if (k > i)
  12641.                 i = k;
  12642.         }
  12643.  
  12644.         i += 8;
  12645.         int l = 15 * menuActionRow + 21;
  12646.         if (super.saveClickX > 4 && super.saveClickY > 4
  12647.                 && super.saveClickX < 516 && super.saveClickY < 338) {
  12648.             int i1 = super.saveClickX - 4 - i / 2;
  12649.             if (i1 + i > 512)
  12650.                 i1 = 512 - i;
  12651.             if (i1 < 0)
  12652.                 i1 = 0;
  12653.             int l1 = super.saveClickY - 4;
  12654.             if (l1 + l > 334)
  12655.                 l1 = 334 - l;
  12656.             if (l1 < 0)
  12657.                 l1 = 0;
  12658.             menuOpen = true;
  12659.             menuScreenArea = 0;
  12660.             menuOffsetX = i1;
  12661.             menuOffsetY = l1;
  12662.             menuWidth = i;
  12663.             anInt952 = 15 * menuActionRow + 22;
  12664.         }
  12665.  
  12666.         if (super.saveClickX > 519 && super.saveClickY > 168
  12667.                 && super.saveClickX < 765 && super.saveClickY < 503) {
  12668.             int j1 = super.saveClickX - 519 - i / 2;
  12669.             if (j1 < 0)
  12670.                 j1 = 0;
  12671.             else if (j1 + i > 245)
  12672.                 j1 = 245 - i;
  12673.             int i2 = super.saveClickY - 168;
  12674.             if (i2 < 0)
  12675.                 i2 = 0;
  12676.             else if (i2 + l > 333)
  12677.                 i2 = 333 - l;
  12678.             menuOpen = true;
  12679.             menuScreenArea = 1;
  12680.             menuOffsetX = j1;
  12681.             menuOffsetY = i2;
  12682.             menuWidth = i;
  12683.             anInt952 = 15 * menuActionRow + 22;
  12684.         }
  12685.         if (super.saveClickX > 0 && super.saveClickY > 338
  12686.                 && super.saveClickX < 516 && super.saveClickY < 503) {
  12687.             int k1 = super.saveClickX - 0 - i / 2;
  12688.             if (k1 < 0)
  12689.                 k1 = 0;
  12690.             else if (k1 + i > 516)
  12691.                 k1 = 516 - i;
  12692.             int j2 = super.saveClickY - 338;
  12693.             if (j2 < 0)
  12694.                 j2 = 0;
  12695.             else if (j2 + l > 165)
  12696.                 j2 = 165 - l;
  12697.             menuOpen = true;
  12698.             menuScreenArea = 2;
  12699.             menuOffsetX = k1;
  12700.             menuOffsetY = j2;
  12701.             menuWidth = i;
  12702.             anInt952 = 15 * menuActionRow + 22;
  12703.         }
  12704.         if (super.saveClickX >= 515 && super.saveClickY >= 0
  12705.                 && super.saveClickX <= 765 && super.saveClickY <= 169) {
  12706.             int k1 = super.saveClickX - 515 - i / 2;
  12707.             if (k1 < 0)
  12708.                 k1 = 0;
  12709.             else if (k1 + i > 249)
  12710.                 k1 = 249 - i;
  12711.             int j2 = super.saveClickY;
  12712.             if (j2 < 0)
  12713.                 j2 = 0;
  12714.             else if (j2 + l > 168)
  12715.                 j2 = 168 - l;
  12716.             menuOpen = true;
  12717.             menuScreenArea = 3;
  12718.             menuOffsetX = k1;
  12719.             menuOffsetY = j2;
  12720.             menuWidth = i;
  12721.             anInt952 = 15 * menuActionRow + 22;
  12722.         }
  12723.     }
  12724.  
  12725.     private void method117(Stream stream) {
  12726.         stream.initBitAccess();
  12727.         int j = stream.readBits(1);
  12728.         if (j == 0)
  12729.             return;
  12730.         int k = stream.readBits(2);
  12731.         if (k == 0) {
  12732.             anIntArray894[anInt893++] = myPlayerIndex;
  12733.             return;
  12734.         }
  12735.         if (k == 1) {
  12736.             int l = stream.readBits(3);
  12737.             myPlayer.moveInDir(false, l);
  12738.             int k1 = stream.readBits(1);
  12739.             if (k1 == 1)
  12740.                 anIntArray894[anInt893++] = myPlayerIndex;
  12741.             return;
  12742.         }
  12743.         if (k == 2) {
  12744.             int i1 = stream.readBits(3);
  12745.             myPlayer.moveInDir(true, i1);
  12746.             int l1 = stream.readBits(3);
  12747.             myPlayer.moveInDir(true, l1);
  12748.             int j2 = stream.readBits(1);
  12749.             if (j2 == 1)
  12750.                 anIntArray894[anInt893++] = myPlayerIndex;
  12751.             return;
  12752.         }
  12753.         if (k == 3) {
  12754.             plane = stream.readBits(2);
  12755.             int j1 = stream.readBits(1);
  12756.             int i2 = stream.readBits(1);
  12757.             if (i2 == 1)
  12758.                 anIntArray894[anInt893++] = myPlayerIndex;
  12759.             int k2 = stream.readBits(7);
  12760.             int l2 = stream.readBits(7);
  12761.             myPlayer.setPos(l2, k2, j1 == 1);
  12762.         }
  12763.     }
  12764.  
  12765.     private void nullLoader() {
  12766.         aBoolean831 = false;
  12767.         while (drawingFlames) {
  12768.             aBoolean831 = false;
  12769.             try {
  12770.                 Thread.sleep(50L);
  12771.             } catch (Exception _ex) {
  12772.             }
  12773.         }
  12774.         aBackground_966 = null;
  12775.         aBackground_967 = null;
  12776.         aBackgroundArray1152s = null;
  12777.         anIntArray850 = null;
  12778.         anIntArray851 = null;
  12779.         anIntArray852 = null;
  12780.         anIntArray853 = null;
  12781.         anIntArray1190 = null;
  12782.         anIntArray1191 = null;
  12783.         anIntArray828 = null;
  12784.         anIntArray829 = null;
  12785.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  12786.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  12787.     }
  12788.  
  12789.     private boolean method119(int i, int j) {
  12790.         boolean flag1 = false;
  12791.         RSInterface class9 = RSInterface.interfaceCache[j];
  12792.         for (int k = 0; k < class9.children.length; k++) {
  12793.             if (class9.children[k] == -1)
  12794.                 break;
  12795.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  12796.             if (class9_1.type == 1)
  12797.                 flag1 |= method119(i, class9_1.id);
  12798.             if (class9_1.type == 6
  12799.                     && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  12800.                 boolean flag2 = interfaceIsSelected(class9_1);
  12801.                 int l;
  12802.                 if (flag2)
  12803.                     l = class9_1.anInt258;
  12804.                 else
  12805.                     l = class9_1.anInt257;
  12806.                 if (l != -1) {
  12807.                     Animation animation = Animation.anims[l];
  12808.                     for (class9_1.anInt208 += i; class9_1.anInt208 > animation
  12809.                             .method258(class9_1.anInt246);) {
  12810.                         class9_1.anInt208 -= animation
  12811.                                 .method258(class9_1.anInt246) + 1;
  12812.                         class9_1.anInt246++;
  12813.                         if (class9_1.anInt246 >= animation.anInt352) {
  12814.                             class9_1.anInt246 -= animation.anInt356;
  12815.                             if (class9_1.anInt246 < 0
  12816.                                     || class9_1.anInt246 >= animation.anInt352)
  12817.                                 class9_1.anInt246 = 0;
  12818.                         }
  12819.                         flag1 = true;
  12820.                     }
  12821.  
  12822.                 }
  12823.             }
  12824.         }
  12825.  
  12826.         return flag1;
  12827.     }
  12828.  
  12829.     private int method120() {
  12830.         int j = 3;
  12831.         if (yCameraCurve < 310) {
  12832.             int k = xCameraPos >> 7;
  12833.             int l = yCameraPos >> 7;
  12834.             int i1 = myPlayer.x >> 7;
  12835.             int j1 = myPlayer.y >> 7;
  12836.             if ((byteGroundArray[plane][k][l] & 4) != 0)
  12837.                 j = plane;
  12838.             int k1;
  12839.             if (i1 > k)
  12840.                 k1 = i1 - k;
  12841.             else
  12842.                 k1 = k - i1;
  12843.             int l1;
  12844.             if (j1 > l)
  12845.                 l1 = j1 - l;
  12846.             else
  12847.                 l1 = l - j1;
  12848.             if (k1 > l1) {
  12849.                 int i2 = (l1 * 0x10000) / k1;
  12850.                 int k2 = 32768;
  12851.                 while (k != i1) {
  12852.                     if (k < i1)
  12853.                         k++;
  12854.                     else if (k > i1)
  12855.                         k--;
  12856.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  12857.                         j = plane;
  12858.                     k2 += i2;
  12859.                     if (k2 >= 0x10000) {
  12860.                         k2 -= 0x10000;
  12861.                         if (l < j1)
  12862.                             l++;
  12863.                         else if (l > j1)
  12864.                             l--;
  12865.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  12866.                             j = plane;
  12867.                     }
  12868.                 }
  12869.             } else {
  12870.                 int j2 = (k1 * 0x10000) / l1;
  12871.                 int l2 = 32768;
  12872.                 while (l != j1) {
  12873.                     if (l < j1)
  12874.                         l++;
  12875.                     else if (l > j1)
  12876.                         l--;
  12877.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  12878.                         j = plane;
  12879.                     l2 += j2;
  12880.                     if (l2 >= 0x10000) {
  12881.                         l2 -= 0x10000;
  12882.                         if (k < i1)
  12883.                             k++;
  12884.                         else if (k > i1)
  12885.                             k--;
  12886.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  12887.                             j = plane;
  12888.                     }
  12889.                 }
  12890.             }
  12891.         }
  12892.         if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  12893.             j = plane;
  12894.         return j;
  12895.     }
  12896.  
  12897.     private int method121() {
  12898.         int j = method42(plane, yCameraPos, xCameraPos);
  12899.         if (j - zCameraPos < 800
  12900.                 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  12901.             return plane;
  12902.         else
  12903.             return 3;
  12904.     }
  12905.  
  12906.     private void delIgnore(long l) {
  12907.         try {
  12908.             if (l == 0L)
  12909.                 return;
  12910.             for (int j = 0; j < ignoreCount; j++)
  12911.                 if (ignoreListAsLongs[j] == l) {
  12912.                     ignoreCount--;
  12913.                     needDrawTabArea = true;
  12914.                     System.arraycopy(ignoreListAsLongs, j + 1,
  12915.                             ignoreListAsLongs, j, ignoreCount - j);
  12916.  
  12917.                     stream.createFrame(74);
  12918.                     stream.writeQWord(l);
  12919.                     return;
  12920.                 }
  12921.  
  12922.             return;
  12923.         } catch (RuntimeException runtimeexception) {
  12924.             signlink.reporterror("47229, " + 3 + ", " + l + ", "
  12925.                     + runtimeexception.toString());
  12926.         }
  12927.         throw new RuntimeException();
  12928.     }
  12929.  
  12930.     public String getParameter(String s) {
  12931.         if (signlink.mainapp != null)
  12932.             return signlink.mainapp.getParameter(s);
  12933.         else
  12934.             return super.getParameter(s);
  12935.     }
  12936.  
  12937.     private void adjustVolume(boolean flag, int i) {
  12938.         signlink.midivol = i;
  12939.         if (flag)
  12940.             signlink.midi = "voladjust";
  12941.     }
  12942.  
  12943.     private int extractInterfaceValues(RSInterface class9, int j) {
  12944.         if (class9.valueIndexArray == null
  12945.                 || j >= class9.valueIndexArray.length)
  12946.             return -2;
  12947.         try {
  12948.             int ai[] = class9.valueIndexArray[j];
  12949.             int k = 0;
  12950.             int l = 0;
  12951.             int i1 = 0;
  12952.             do {
  12953.                 int j1 = ai[l++];
  12954.                 int k1 = 0;
  12955.                 byte byte0 = 0;
  12956.                 if (j1 == 0)
  12957.                     return k;
  12958.                 if (j1 == 1)
  12959.                     k1 = currentStats[ai[l++]];
  12960.                 if (j1 == 2)
  12961.                     k1 = maxStats[ai[l++]];
  12962.                 if (j1 == 3)
  12963.                     k1 = currentExp[ai[l++]];
  12964.                 if (j1 == 4) {
  12965.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  12966.                     int k2 = ai[l++];
  12967.                     if (k2 >= 0 && k2 < ItemDef.totalItems
  12968.                             && (!ItemDef.forID(k2).membersObject || isMembers)) {
  12969.                         for (int j3 = 0; j3 < class9_1.inv.length; j3++)
  12970.                             if (class9_1.inv[j3] == k2 + 1)
  12971.                                 k1 += class9_1.invStackSizes[j3];
  12972.  
  12973.                     }
  12974.                 }
  12975.                 if (j1 == 5)
  12976.                     k1 = variousSettings[ai[l++]];
  12977.                 if (j1 == 6)
  12978.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  12979.                 if (j1 == 7)
  12980.                     k1 = (variousSettings[ai[l++]] * 100) / 46875;
  12981.                 if (j1 == 8)
  12982.                     k1 = myPlayer.combatLevel;
  12983.                 if (j1 == 9) {
  12984.                     for (int l1 = 0; l1 < Skills.skillsCount; l1++)
  12985.                         if (Skills.skillEnabled[l1])
  12986.                             k1 += maxStats[l1];
  12987.  
  12988.                 }
  12989.                 if (j1 == 10) {
  12990.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  12991.                     int l2 = ai[l++] + 1;
  12992.                     if (l2 >= 0 && l2 < ItemDef.totalItems
  12993.                             && (!ItemDef.forID(l2).membersObject || isMembers)) {
  12994.                         for (int k3 = 0; k3 < class9_2.inv.length; k3++) {
  12995.                             if (class9_2.inv[k3] != l2)
  12996.                                 continue;
  12997.                             k1 = 0x3b9ac9ff;
  12998.                             break;
  12999.                         }
  13000.  
  13001.                     }
  13002.                 }
  13003.                 if (j1 == 11)
  13004.                     k1 = energy;
  13005.                 if (j1 == 12)
  13006.                     k1 = weight;
  13007.                 if (j1 == 13) {
  13008.                     int i2 = variousSettings[ai[l++]];
  13009.                     int i3 = ai[l++];
  13010.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  13011.                 }
  13012.                 if (j1 == 14) {
  13013.                     int j2 = ai[l++];
  13014.                     VarBit varBit = VarBit.cache[j2];
  13015.                     int l3 = varBit.anInt648;
  13016.                     int i4 = varBit.anInt649;
  13017.                     int j4 = varBit.anInt650;
  13018.                     int k4 = anIntArray1232[j4 - i4];
  13019.                     k1 = variousSettings[l3] >> i4 & k4;
  13020.                 }
  13021.                 if (j1 == 15)
  13022.                     byte0 = 1;
  13023.                 if (j1 == 16)
  13024.                     byte0 = 2;
  13025.                 if (j1 == 17)
  13026.                     byte0 = 3;
  13027.                 if (j1 == 18)
  13028.                     k1 = (myPlayer.x >> 7) + baseX;
  13029.                 if (j1 == 19)
  13030.                     k1 = (myPlayer.y >> 7) + baseY;
  13031.                 if (j1 == 20)
  13032.                     k1 = ai[l++];
  13033.                 if (byte0 == 0) {
  13034.                     if (i1 == 0)
  13035.                         k += k1;
  13036.                     if (i1 == 1)
  13037.                         k -= k1;
  13038.                     if (i1 == 2 && k1 != 0)
  13039.                         k /= k1;
  13040.                     if (i1 == 3)
  13041.                         k *= k1;
  13042.                     i1 = 0;
  13043.                 } else {
  13044.                     i1 = byte0;
  13045.                 }
  13046.             } while (true);
  13047.         } catch (Exception _ex) {
  13048.             return -1;
  13049.         }
  13050.     }
  13051.  
  13052.     private void drawTooltip() {
  13053.         if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
  13054.             return;
  13055.         String s;
  13056.         if (itemSelected == 1 && menuActionRow < 2)
  13057.             s = "Use " + selectedItemName + " with...";
  13058.         else if (spellSelected == 1 && menuActionRow < 2)
  13059.             s = spellTooltip + "...";
  13060.         else
  13061.             s = menuActionName[menuActionRow - 1];
  13062.         if (menuActionRow > 2)
  13063.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  13064.         chatTextDrawingArea.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  13065.     }
  13066.  
  13067.     public void drawHPOrb() {
  13068.         try {
  13069.         int health;
  13070.         String cHP = RSInterface.interfaceCache[4016].message;
  13071.         cHP = cHP.replaceAll("%", "");
  13072.         int currentHP = Integer.parseInt(cHP);
  13073.         int drawHP = currentHP;
  13074.         if (newHits)
  13075.             drawHP = drawHP * 10;
  13076.         String curHP = "" + drawHP;
  13077.         // int maxHP2 =
  13078.         // Integer.parseInt(RSInterface.interfaceCache[31160].message);
  13079.         String maxHP3 = RSInterface.interfaceCache[4017].message;
  13080.         maxHP3 = maxHP3.replaceAll("%", "");
  13081.         int maxHP2 = Integer.parseInt(maxHP3);
  13082.         health = (int) (((double) currentHP / (double) maxHP2) * 100D);
  13083.         int hpPercent = 0;
  13084.         hpPercent = currentHP * 34 / maxHP2;
  13085.         Sprite orbDrawn = emptyOrb;
  13086.         orbDrawn.drawSprite(170, 13);
  13087.         if (currentHP > 99) {
  13088.             hpPercent = 34;
  13089.             orbDrawn = new Sprite("emptyorb", 57, 34 - hpPercent);
  13090.         } else {
  13091.             orbDrawn = new Sprite("emptyorb", 57, 34 - hpPercent);
  13092.         }
  13093.         hitPointsFill.drawSprite(173, 16);
  13094.         orbDrawn.drawSprite(170, 13);
  13095.         double fillHp;
  13096.         double percent = (health / 100d);
  13097.         fillHp = 27 * percent;
  13098.         int depleteFill = 27 - (int) fillHp;
  13099.         int col = 65280;
  13100.         if (health >= 75)
  13101.             col = 65280;
  13102.         else if (health >= 50)
  13103.             col = 0xffff00;
  13104.         else if (health >= 25)
  13105.             col = 0xfca607;
  13106.         else
  13107.             col = 0xf50d0d;
  13108.         smallText.method382(col, 212, curHP, 39, true);
  13109.         // hitPointsFill.myHeight = depleteFill;
  13110.         // hitPointsFill.height = depleteFill;
  13111.         // hitPointsFill.drawSprite(173, 16);
  13112.         hitPointsIcon.drawSprite(179, 24);
  13113.         } catch(Exception e){
  13114.        
  13115.         }
  13116.     }
  13117.  
  13118.     public void drawPrayerOrb() {
  13119.         try {
  13120.         int prayer;
  13121.         String cP = RSInterface.interfaceCache[4012].message;
  13122.         cP = cP.replaceAll("%", "");
  13123.         int currentPrayer = Integer.parseInt(cP);
  13124.         String maxPrayer1 = RSInterface.interfaceCache[4013].message;
  13125.         maxPrayer1 = maxPrayer1.replaceAll("%", "");
  13126.         int maxPrayer = Integer.parseInt(maxPrayer1);
  13127.         prayer = (int) (((double) currentPrayer / (double) maxPrayer) * 100D);
  13128.         int prayPercent = currentPrayer * 34 / maxPrayer;
  13129.         Sprite orbDrawn = emptyOrb;
  13130.         orbDrawn.drawSprite(184, 49);
  13131.         orbDrawn = new Sprite("emptyorb", 57, 34 - prayPercent);
  13132.         prayerFill.drawSprite(187, 52);
  13133.         orbDrawn.drawSprite(184, 49);
  13134.         double fillPray;
  13135.         double percent = (prayer / 100d);
  13136.         fillPray = 27 * percent;
  13137.         int depleteFill = 27 - (int) fillPray;
  13138.         int col = 65280;
  13139.         if (prayer >= 75)
  13140.             col = 65280;
  13141.         else if (prayer >= 50)
  13142.             col = 0xffff00;
  13143.         else if (prayer >= 25)
  13144.             col = 0xfca607;
  13145.         else
  13146.             col = 0xf50d0d;
  13147.         smallText.method382(col, 227, cP, 75, true);
  13148.         // prayerFill.myHeight = depleteFill;
  13149.         // prayerFill.height = depleteFill;
  13150.         // prayerFill.drawSprite(187, 52);
  13151.         prayerIcon.drawSprite(191, 56);
  13152.         } catch(Exception e){
  13153.        
  13154.         }
  13155.     }
  13156.  
  13157.     private void drawMinimap() {
  13158.         aRSImageProducer_1164.initDrawingArea();
  13159.         if (anInt1021 == 2) {
  13160.             byte abyte0[] = mapBack.aByteArray1450;
  13161.             int ai[] = DrawingArea.pixels;
  13162.             int k2 = abyte0.length;
  13163.             for (int i5 = 0; i5 < k2; i5++)
  13164.                 if (abyte0[i5] == 0)
  13165.                     ai[i5] = 0;
  13166.             compass.method352(33, minimapInt1, anIntArray1057, 256,
  13167.                     anIntArray968, 25, 8, 8, 33, 25);
  13168.             aRSImageProducer_1165.initDrawingArea();
  13169.             return;
  13170.         }
  13171.         int i = minimapInt1 + minimapInt2 & 0x7ff;
  13172.         int j = 48 + myPlayer.x / 32;
  13173.         int l2 = 464 - myPlayer.y / 32;
  13174.         for (int x = 0; x < anIntArray1229.length; x++) {
  13175.             anIntArray1229[x] = 170;
  13176.             anIntArray1052[x] = -23;
  13177.         }
  13178.         aClass30_Sub2_Sub1_Sub1_1263.method352(151, i, anIntArray1229,
  13179.                 256 + minimapInt3, anIntArray1052, l2, 10, 45, 146, j);
  13180.         compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968,
  13181.                 25, 8, 8, 33, 25);
  13182.         for (int j5 = 0; j5 < anInt1071; j5++) {
  13183.             int k = (anIntArray1072[j5] * 4 + 2) - myPlayer.x / 32;
  13184.             int i3 = (anIntArray1073[j5] * 4 + 2) - myPlayer.y / 32;
  13185.             markMinimap(aClass30_Sub2_Sub1_Sub1Array1140[j5], k, i3);
  13186.         }
  13187.  
  13188.         for (int k5 = 0; k5 < 104; k5++) {
  13189.             for (int l5 = 0; l5 < 104; l5++) {
  13190.                 NodeList class19 = groundArray[plane][k5][l5];
  13191.                 if (class19 != null) {
  13192.                     int l = (k5 * 4 + 2) - myPlayer.x / 32;
  13193.                     int j3 = (l5 * 4 + 2) - myPlayer.y / 32;
  13194.                     markMinimap(mapDotItem, l, j3);
  13195.                 }
  13196.             }
  13197.         }
  13198.  
  13199.         for (int i6 = 0; i6 < npcCount; i6++) {
  13200.             NPC npc = npcArray[npcIndices[i6]];
  13201.             if (npc != null && npc.isVisible()) {
  13202.                 EntityDef entityDef = npc.desc;
  13203.                 if (entityDef.childrenIDs != null)
  13204.                     entityDef = entityDef.method161();
  13205.                 if (entityDef != null && entityDef.aBoolean87
  13206.                         && entityDef.aBoolean84) {
  13207.                     int i1 = npc.x / 32 - myPlayer.x / 32;
  13208.                     int k3 = npc.y / 32 - myPlayer.y / 32;
  13209.                     markMinimap(mapDotNPC, i1, k3);
  13210.                 }
  13211.             }
  13212.         }
  13213.  
  13214.         for (int j6 = 0; j6 < playerCount; j6++) {
  13215.             Player player = playerArray[playerIndices[j6]];
  13216.             if (player != null && player.isVisible()) {
  13217.                 int j1 = player.x / 32 - myPlayer.x / 32;
  13218.                 int l3 = player.y / 32 - myPlayer.y / 32;
  13219.                 boolean flag1 = false;
  13220.                 long l6 = TextClass.longForName(player.name);
  13221.                 int BLStatus = -1;
  13222.  
  13223.                 for (int k6 = 0; k6 < friendsCount; k6++) {
  13224.                     if (l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0)
  13225.                         continue;
  13226.                     flag1 = true;
  13227.                     break;
  13228.                 }
  13229.                 boolean flag2 = false;
  13230.                 boolean hasTaken = false;
  13231.  
  13232.                 if (player.clan.equalsIgnoreCase(myPlayer.clan)
  13233.                         && !myPlayer.clan.equalsIgnoreCase(""))
  13234.                     BLStatus = 1;
  13235.  
  13236.                 if (myPlayer.team != 0 && player.team != 0
  13237.                         && myPlayer.team == player.team)
  13238.                     flag2 = true;
  13239.                 if (flag1) {
  13240.                     markMinimap(mapDotFriend, j1, l3);
  13241.                     hasTaken = true;
  13242.                 }
  13243.                 if (BLStatus != -1)
  13244.                     if (!hasTaken) {
  13245.                         markMinimap(mapDotBL, j1, l3);
  13246.                         hasTaken = true;
  13247.                     }
  13248.                 if (!hasTaken)
  13249.                     markMinimap(mapDotPlayer, j1, l3);
  13250.             }
  13251.         }
  13252.         if (anInt855 != 0 && loopCycle % 20 < 10) {
  13253.             if (anInt855 == 1 && anInt1222 >= 0 && anInt1222 < npcArray.length) {
  13254.                 NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  13255.                 if (class30_sub2_sub4_sub1_sub1_1 != null) {
  13256.                     int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32 - myPlayer.x
  13257.                             / 32;
  13258.                     int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32 - myPlayer.y
  13259.                             / 32;
  13260.                     method81(mapMarker, i4, k1);
  13261.                 }
  13262.             }
  13263.             if (anInt855 == 2) {
  13264.                 int l1 = ((anInt934 - baseX) * 4 + 2) - myPlayer.x / 32;
  13265.                 int j4 = ((anInt935 - baseY) * 4 + 2) - myPlayer.y / 32;
  13266.                 method81(mapMarker, j4, l1);
  13267.             }
  13268.             if (anInt855 == 10 && anInt933 >= 0
  13269.                     && anInt933 < playerArray.length) {
  13270.                 Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  13271.                 if (class30_sub2_sub4_sub1_sub2_1 != null) {
  13272.                     int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32 - myPlayer.x
  13273.                             / 32;
  13274.                     int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32 - myPlayer.y
  13275.                             / 32;
  13276.                     method81(mapMarker, k4, i2);
  13277.                 }
  13278.             }
  13279.         }
  13280.         if (destX != 0) {
  13281.             int j2 = (destX * 4 + 2) - myPlayer.x / 32;
  13282.             int l4 = (destY * 4 + 2) - myPlayer.y / 32;
  13283.             markMinimap(mapFlag, j2, l4);
  13284.         }
  13285.         DrawingArea.drawPixels(3, 78 + 5, 97 + 20, 0xffffff, 3);
  13286.         mapArea.drawSprite(0, 0);
  13287.         drawHPOrb();
  13288.         drawPrayerOrb();
  13289.         // drawRun();
  13290.         if (menuOpen && menuScreenArea == 3) {
  13291.             drawMenu();
  13292.         }
  13293.         drawXPCounter();
  13294.         drawLogoutButton();
  13295.         drawWorldMapButton();
  13296.         aRSImageProducer_1165.initDrawingArea();
  13297.     }
  13298.  
  13299.     public Sprite sprite1;
  13300.     public Sprite xpx2;
  13301.     public Sprite xpFlag;
  13302.  
  13303.     public int xpToDraw = 0;
  13304.     public int testXp = 0;
  13305.     // public int tabHPos;
  13306.     Sprite xphover = new Sprite("xp_2");
  13307.     Sprite xpnormal = new Sprite("xp_0");
  13308.  
  13309.     public void drawXPOrbz() {
  13310.         if (super.mouseX >= 516 && super.mouseX <= 550 && super.mouseY >= 46
  13311.                 && super.mouseY <= 80) {
  13312.             xpHover = true;
  13313.         } else {
  13314.             xpHover = false;
  13315.         }
  13316.         if (super.clickMode3 == 1 && super.saveClickX >= 516
  13317.                 && super.saveClickX <= 550 && super.saveClickY >= 46
  13318.                 && super.saveClickY <= 80) {
  13319.             if (!xpClicked) {
  13320.                 xpClicked = true;
  13321.                 drawXpBar = true;
  13322.             } else {
  13323.                 xpClicked = false;
  13324.                 drawXpBar = false;
  13325.             }
  13326.         }
  13327.         if (!xpClicked) {
  13328.             if (!xpHover) {
  13329.                 xpnormal.drawSprite(0, 46);
  13330.             } else {
  13331.                 xphover.drawSprite(0, 46);
  13332.             }
  13333.         } else {
  13334.             if (!xpHover) {
  13335.                 xpnormal.drawSprite(0, 46);
  13336.             } else {
  13337.                 xphover.drawSprite(0, 46);
  13338.             }
  13339.         }
  13340.     }
  13341.  
  13342.     public void drawRun() {
  13343.         // String cEnergy =
  13344.         // RSInterface.interfaceCache[149].disabledMessage.replaceAll("%", "");
  13345.         String cEnergy = "100";
  13346.         // int currentEnergy = Integer.parseInt(cEnergy);
  13347.         int currentEnergy = 100;
  13348.         int energyPercent = currentEnergy * 34 / 100;
  13349.         Sprite drain = (runClicked ? cacheSprite[14] : cacheSprite[13]);
  13350.         Sprite icon = (runClicked ? cacheSprite[16] : cacheSprite[15]);
  13351.         cacheSprite[9].drawSprite(185, 85);
  13352.         if (super.mouseX > 701 && super.mouseX < 758 && super.mouseY > 83
  13353.                 && super.mouseY < 118)
  13354.             cacheSprite[10].drawSprite(185, 85);
  13355.         drain.drawSprite(188, 88);
  13356.         double fillRun;
  13357.         double percent = (currentEnergy / 100d);
  13358.         fillRun = 27 * percent;
  13359.         int depleteFill = 27 - (int) fillRun;
  13360.         int col = 65280;
  13361.         if (currentEnergy >= 75)
  13362.             col = 65280;
  13363.         else if (currentEnergy >= 50)
  13364.             col = 0xffff00;
  13365.         else if (currentEnergy >= 25)
  13366.             col = 0xfca607;
  13367.         else
  13368.             col = 0xf50d0d;
  13369.         smallText.method382(col, 227, cEnergy, 111, true);
  13370.         cacheSprite[28].myHeight = depleteFill;
  13371.         cacheSprite[28].height = depleteFill;
  13372.         cacheSprite[28].drawSprite(188, 88);
  13373.         icon.drawSprite(195, 93);
  13374.     }
  13375.  
  13376.     public void drawLogoutButton() {
  13377.         if (tabInterfaceIDs[9] != -1 && anInt1054 == 9)
  13378.             if (loopCycle % 20 >= 10)
  13379.                 ;
  13380.         sideIcons[9].drawSprite(223, 1);
  13381.         if (logIconHPos == 1) {
  13382.             logIconH.drawSprite(223, 1);
  13383.             if (tabID == 10)
  13384.                 logIconC.drawSprite(223, 1);
  13385.         }
  13386.     }
  13387.  
  13388.     public void drawWorldMapButton() {
  13389.         worldMapIcon.drawSprite(8, 124);
  13390.     }
  13391.  
  13392.     private void npcScreenPos(Entity entity, int i) {
  13393.         calcEntityScreenPos(entity.x, i, entity.y);
  13394.     }
  13395.  
  13396.     private void calcEntityScreenPos(int i, int j, int l) {
  13397.         if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  13398.             spriteDrawX = -1;
  13399.             spriteDrawY = -1;
  13400.             return;
  13401.         }
  13402.         int i1 = method42(plane, l, i) - j;
  13403.         i -= xCameraPos;
  13404.         i1 -= zCameraPos;
  13405.         l -= yCameraPos;
  13406.         int j1 = Model.modelIntArray1[yCameraCurve];
  13407.         int k1 = Model.modelIntArray2[yCameraCurve];
  13408.         int l1 = Model.modelIntArray1[xCameraCurve];
  13409.         int i2 = Model.modelIntArray2[xCameraCurve];
  13410.         int j2 = l * l1 + i * i2 >> 16;
  13411.         l = l * i2 - i * l1 >> 16;
  13412.         i = j2;
  13413.         j2 = i1 * k1 - l * j1 >> 16;
  13414.         l = i1 * j1 + l * k1 >> 16;
  13415.         i1 = j2;
  13416.         if (l >= 50) {
  13417.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  13418.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  13419.         } else {
  13420.             spriteDrawX = -1;
  13421.             spriteDrawY = -1;
  13422.         }
  13423.     }
  13424.  
  13425.     private void buildSplitPrivateChatMenu() {
  13426.         if (splitPrivateChat == 0)
  13427.             return;
  13428.         int i = 0;
  13429.         if (anInt1104 != 0)
  13430.             i = 1;
  13431.         for (int j = 0; j < 100; j++)
  13432.             if (chatMessages[j] != null) {
  13433.                 int k = chatTypes[j];
  13434.                 String s = chatNames[j];
  13435.                 boolean flag1 = false;
  13436.                 if (s != null && s.startsWith("@cr0@")) {
  13437.                     s = s.substring(5);
  13438.                     boolean flag2 = true;
  13439.                 }
  13440.                 if (s != null && s.startsWith("@cr1@")) {
  13441.                     s = s.substring(5);
  13442.                     byte byte0 = 2;
  13443.                 }
  13444.                 if (s != null && s.startsWith("@cr2@")) {
  13445.                     s = s.substring(5);
  13446.                     byte byte0 = 3;
  13447.                 }
  13448.                 if (s != null && s.startsWith("@cr3@")) {
  13449.                     s = s.substring(5);
  13450.                     byte byte0 = 4;
  13451.                 }
  13452.                 if (s != null && s.startsWith("@cr4@")) {
  13453.                     s = s.substring(5);
  13454.                     byte byte0 = 5;
  13455.                 }
  13456.                 if (s != null && s.startsWith("@cr5@")) {
  13457.                     s = s.substring(5);
  13458.                     byte byte0 = 6;
  13459.                 }
  13460.                 if (s != null && s.startsWith("@cr6@")) {
  13461.                     s = s.substring(5);
  13462.                     byte byte0 = 7;
  13463.                 }
  13464.                 if (s != null && s.startsWith("@cr7@")) {
  13465.                     s = s.substring(5);
  13466.                     byte byte0 = 8;
  13467.                 }
  13468.                 if (s != null && s.startsWith("@cr8@")) {
  13469.                     s = s.substring(5);
  13470.                     byte byte0 = 9;
  13471.                 }
  13472.                 if (s != null && s.startsWith("@cr9@")) {
  13473.                     s = s.substring(5);
  13474.                     byte byte0 = 10;
  13475.                 }
  13476.                 if (s != null && s.startsWith("@c10@")) {
  13477.                     s = s.substring(5);
  13478.                     byte byte0 = 13;
  13479.                 }
  13480.                 if (s != null && s.startsWith("@crA@")) {
  13481.                     s = s.substring(5);
  13482.                     byte byte0 = 11;
  13483.                 }
  13484.                 if ((k == 3 || k == 7)
  13485.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  13486.                                 && isFriendOrSelf(s))) {
  13487.                     int l = 329 - i * 13;
  13488.                     if (super.mouseX > 4 && super.mouseY - 4 > l - 10
  13489.                             && super.mouseY - 4 <= l + 3) {
  13490.                         int i1 = aTextDrawingArea_1271.getTextWidth("From:  "
  13491.                                 + s + chatMessages[j]) + 25;
  13492.                         if (i1 > 450)
  13493.                             i1 = 450;
  13494.                         if (super.mouseX < 4 + i1) {
  13495.                             if (myPrivilege >= 1) {
  13496.                                 menuActionName[menuActionRow] = "Report abuse @whi@"
  13497.                                         + s;
  13498.                                 menuActionID[menuActionRow] = 2606;
  13499.                                 menuActionRow++;
  13500.                             }
  13501.                             menuActionName[menuActionRow] = "Add ignore @whi@"
  13502.                                     + s;
  13503.                             menuActionID[menuActionRow] = 2042;
  13504.                             menuActionRow++;
  13505.                             menuActionName[menuActionRow] = "Reply to @whi@"
  13506.                                     + s;
  13507.                             menuActionID[menuActionRow] = 2639;
  13508.                             menuActionRow++;
  13509.                             menuActionName[menuActionRow] = "Add friend @whi@"
  13510.                                     + s;
  13511.                             menuActionID[menuActionRow] = 2337;
  13512.                             menuActionRow++;
  13513.                         }
  13514.                     }
  13515.                     if (++i >= 5)
  13516.                         return;
  13517.                 }
  13518.                 if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5)
  13519.                     return;
  13520.             }
  13521.  
  13522.     }
  13523.  
  13524.     private void method130(int j, int k, int l, int i1, int j1, int k1, int l1,
  13525.             int i2, int j2) {
  13526.         Class30_Sub1 class30_sub1 = null;
  13527.         for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13528.                 .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13529.                 .reverseGetNext()) {
  13530.             if (class30_sub1_1.anInt1295 != l1
  13531.                     || class30_sub1_1.anInt1297 != i2
  13532.                     || class30_sub1_1.anInt1298 != j1
  13533.                     || class30_sub1_1.anInt1296 != i1)
  13534.                 continue;
  13535.             class30_sub1 = class30_sub1_1;
  13536.             break;
  13537.         }
  13538.  
  13539.         if (class30_sub1 == null) {
  13540.             class30_sub1 = new Class30_Sub1();
  13541.             class30_sub1.anInt1295 = l1;
  13542.             class30_sub1.anInt1296 = i1;
  13543.             class30_sub1.anInt1297 = i2;
  13544.             class30_sub1.anInt1298 = j1;
  13545.             method89(class30_sub1);
  13546.             aClass19_1179.insertHead(class30_sub1);
  13547.         }
  13548.         class30_sub1.anInt1291 = k;
  13549.         class30_sub1.anInt1293 = k1;
  13550.         class30_sub1.anInt1292 = l;
  13551.         class30_sub1.anInt1302 = j2;
  13552.         class30_sub1.anInt1294 = j;
  13553.     }
  13554.  
  13555.     private boolean interfaceIsSelected(RSInterface class9) {
  13556.         if (class9.anIntArray245 == null)
  13557.             return false;
  13558.         for (int i = 0; i < class9.anIntArray245.length; i++) {
  13559.             int j = extractInterfaceValues(class9, i);
  13560.             int k = class9.anIntArray212[i];
  13561.             if (class9.anIntArray245[i] == 2) {
  13562.                 if (j >= k)
  13563.                     return false;
  13564.             } else if (class9.anIntArray245[i] == 3) {
  13565.                 if (j <= k)
  13566.                     return false;
  13567.             } else if (class9.anIntArray245[i] == 4) {
  13568.                 if (j == k)
  13569.                     return false;
  13570.             } else if (j != k)
  13571.                 return false;
  13572.         }
  13573.  
  13574.         return true;
  13575.     }
  13576.  
  13577.     private DataInputStream openJagGrabInputStream(String s) throws IOException {
  13578.         // if(!aBoolean872)
  13579.         // if(signlink.mainapp != null)
  13580.         // return signlink.openurl(s);
  13581.         // else
  13582.         // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  13583.         if (aSocket832 != null) {
  13584.             try {
  13585.                 aSocket832.close();
  13586.             } catch (Exception _ex) {
  13587.             }
  13588.             aSocket832 = null;
  13589.         }
  13590.         aSocket832 = openSocket(43595);
  13591.         aSocket832.setSoTimeout(10000);
  13592.         java.io.InputStream inputstream = aSocket832.getInputStream();
  13593.         OutputStream outputstream = aSocket832.getOutputStream();
  13594.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  13595.         return new DataInputStream(inputstream);
  13596.     }
  13597.  
  13598.     private void doFlamesDrawing() {
  13599.         char c = '\u0100';
  13600.         if (anInt1040 > 0) {
  13601.             for (int i = 0; i < 256; i++)
  13602.                 if (anInt1040 > 768)
  13603.                     anIntArray850[i] = method83(anIntArray851[i],
  13604.                             anIntArray852[i], 1024 - anInt1040);
  13605.                 else if (anInt1040 > 256)
  13606.                     anIntArray850[i] = anIntArray852[i];
  13607.                 else
  13608.                     anIntArray850[i] = method83(anIntArray852[i],
  13609.                             anIntArray851[i], 256 - anInt1040);
  13610.  
  13611.         } else if (anInt1041 > 0) {
  13612.             for (int j = 0; j < 256; j++)
  13613.                 if (anInt1041 > 768)
  13614.                     anIntArray850[j] = method83(anIntArray851[j],
  13615.                             anIntArray853[j], 1024 - anInt1041);
  13616.                 else if (anInt1041 > 256)
  13617.                     anIntArray850[j] = anIntArray853[j];
  13618.                 else
  13619.                     anIntArray850[j] = method83(anIntArray853[j],
  13620.                             anIntArray851[j], 256 - anInt1041);
  13621.  
  13622.         } else {
  13623.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  13624.  
  13625.         }
  13626.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0,
  13627.                 aRSImageProducer_1110.anIntArray315, 0, 33920);
  13628.  
  13629.         int i1 = 0;
  13630.         int j1 = 1152;
  13631.         for (int k1 = 1; k1 < c - 1; k1++) {
  13632.             int l1 = (anIntArray969[k1] * (c - k1)) / c;
  13633.             int j2 = 22 + l1;
  13634.             if (j2 < 0)
  13635.                 j2 = 0;
  13636.             i1 += j2;
  13637.             for (int l2 = j2; l2 < 128; l2++) {
  13638.                 int j3 = anIntArray828[i1++];
  13639.                 if (j3 != 0) {
  13640.                     int l3 = j3;
  13641.                     int j4 = 256 - j3;
  13642.                     j3 = anIntArray850[j3];
  13643.                     int l4 = aRSImageProducer_1110.anIntArray315[j1];
  13644.                     aRSImageProducer_1110.anIntArray315[j1++] = ((j3 & 0xff00ff)
  13645.                             * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00)
  13646.                             + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  13647.                 } else {
  13648.                     j1++;
  13649.                 }
  13650.             }
  13651.  
  13652.             j1 += j2;
  13653.         }
  13654.  
  13655.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  13656.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0,
  13657.                 aRSImageProducer_1111.anIntArray315, 0, 33920);
  13658.  
  13659.         i1 = 0;
  13660.         j1 = 1176;
  13661.         for (int k2 = 1; k2 < c - 1; k2++) {
  13662.             int i3 = (anIntArray969[k2] * (c - k2)) / c;
  13663.             int k3 = 103 - i3;
  13664.             j1 += i3;
  13665.             for (int i4 = 0; i4 < k3; i4++) {
  13666.                 int k4 = anIntArray828[i1++];
  13667.                 if (k4 != 0) {
  13668.                     int i5 = k4;
  13669.                     int j5 = 256 - k4;
  13670.                     k4 = anIntArray850[k4];
  13671.                     int k5 = aRSImageProducer_1111.anIntArray315[j1];
  13672.                     aRSImageProducer_1111.anIntArray315[j1++] = ((k4 & 0xff00ff)
  13673.                             * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00)
  13674.                             + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  13675.                 } else {
  13676.                     j1++;
  13677.                 }
  13678.             }
  13679.  
  13680.             i1 += 128 - k3;
  13681.             j1 += 128 - k3 - i3;
  13682.         }
  13683.  
  13684.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  13685.     }
  13686.  
  13687.     private void method134(Stream stream) {
  13688.         int j = stream.readBits(8);
  13689.         if (j < playerCount) {
  13690.             for (int k = j; k < playerCount; k++)
  13691.                 anIntArray840[anInt839++] = playerIndices[k];
  13692.  
  13693.         }
  13694.         if (j > playerCount) {
  13695.             signlink.reporterror(myUsername + " Too many players");
  13696.             throw new RuntimeException("eek");
  13697.         }
  13698.         playerCount = 0;
  13699.         for (int l = 0; l < j; l++) {
  13700.             int i1 = playerIndices[l];
  13701.             Player player = playerArray[i1];
  13702.             int j1 = stream.readBits(1);
  13703.             if (j1 == 0) {
  13704.                 playerIndices[playerCount++] = i1;
  13705.                 player.anInt1537 = loopCycle;
  13706.             } else {
  13707.                 int k1 = stream.readBits(2);
  13708.                 if (k1 == 0) {
  13709.                     playerIndices[playerCount++] = i1;
  13710.                     player.anInt1537 = loopCycle;
  13711.                     anIntArray894[anInt893++] = i1;
  13712.                 } else if (k1 == 1) {
  13713.                     playerIndices[playerCount++] = i1;
  13714.                     player.anInt1537 = loopCycle;
  13715.                     int l1 = stream.readBits(3);
  13716.                     player.moveInDir(false, l1);
  13717.                     int j2 = stream.readBits(1);
  13718.                     if (j2 == 1)
  13719.                         anIntArray894[anInt893++] = i1;
  13720.                 } else if (k1 == 2) {
  13721.                     playerIndices[playerCount++] = i1;
  13722.                     player.anInt1537 = loopCycle;
  13723.                     int i2 = stream.readBits(3);
  13724.                     player.moveInDir(true, i2);
  13725.                     int k2 = stream.readBits(3);
  13726.                     player.moveInDir(true, k2);
  13727.                     int l2 = stream.readBits(1);
  13728.                     if (l2 == 1)
  13729.                         anIntArray894[anInt893++] = i1;
  13730.                 } else if (k1 == 3)
  13731.                     anIntArray840[anInt839++] = i1;
  13732.             }
  13733.         }
  13734.     }
  13735.  
  13736.     int w = 0;
  13737.     int h = 0;
  13738.     int world = 1;
  13739.  
  13740.     private void drawLoginScreen(boolean flag) {
  13741.         resetImageProducers();
  13742.         aRSImageProducer_1109.initDrawingArea();
  13743.         aBackground_966.method361(0, 0);
  13744.         char c = '\u0168';
  13745.         char c1 = '\310';
  13746.         if (loginScreenState == 0) {
  13747.             int i = c1 / 2 + 80;
  13748.             smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString,
  13749.                     i, true);
  13750.             i = c1 / 2 - 20;
  13751.             chatTextDrawingArea.method382(0xffff00, c / 2,
  13752.                     "Welcome to DarkWorldPk - the new era", i, true);
  13753.             i += 30;
  13754.             int l = c / 2 - 80;
  13755.             int k1 = c1 / 2 + 20;
  13756.             aBackground_967.method361(l - 73, k1 - 20);
  13757.             chatTextDrawingArea.method382(0xffffff, l, "Info", k1 + 5, true);
  13758.             l = c / 2 + 80;
  13759.             aBackground_967.method361(l - 73, k1 - 20);
  13760.             chatTextDrawingArea.method382(0xffffff, l, "Logon", k1 + 5, true);
  13761.         }
  13762.         if (loginScreenState == 2)// || loginScreenState == 0)
  13763.         {
  13764.             int j = c1 / 2 - 40;
  13765.             if (loginMessage1.length() > 0) {
  13766.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1,
  13767.                         j - 15, true);
  13768.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  13769.                         j, true);
  13770.                 j += 30;
  13771.             } else {
  13772.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  13773.                         j - 7, true);
  13774.                 j += 30;
  13775.             }
  13776.             w = (c / 2) - 38;
  13777.             h = j - 15;
  13778.             switch (world) {
  13779.             case 1:
  13780.                 w = (c / 2) + 5;
  13781.                 h = j - 15;
  13782.                 chatTextDrawingArea.method382(0xffffFF, w,
  13783.                         "World: @red@(1) Main World", h, true);
  13784.                 break;
  13785.             case 2:
  13786.                 w = (c / 2) + 5;
  13787.                 h = j - 15;
  13788.                 chatTextDrawingArea.method382(0xffffFF, w,
  13789.                         "World: @red@(2) Developer World", h, true);
  13790.                 break;
  13791.  
  13792.             }
  13793.             chatTextDrawingArea
  13794.                     .method389(true, c / 2 - 90, 0xffffff, "Username: "
  13795.                             + myUsername
  13796.                             + ((loginScreenCursorPos == 0)
  13797.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  13798.             j += 15;
  13799.             chatTextDrawingArea
  13800.                     .method389(true, c / 2 - 88, 0xffffff, "Password: "
  13801.                             + TextClass.passwordAsterisks(myPassword)
  13802.                             + ((loginScreenCursorPos == 1)
  13803.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  13804.             j += 15;
  13805.             if (!flag) {
  13806.                 int i1 = c / 2 - 80;
  13807.                 int l1 = c1 / 2 + 50;
  13808.                 aBackground_967.method361(i1 - 73, l1 - 20);
  13809.                 chatTextDrawingArea.method382(0xffffff, i1, "Login", l1 + 5,
  13810.                         true);
  13811.                 i1 = c / 2 + 80;
  13812.                 aBackground_967.method361(i1 - 73, l1 - 20);
  13813.                 chatTextDrawingArea.method382(0xffffff, i1,
  13814.                         "Select Next World?", l1 + 5, true);
  13815.             }
  13816.         }
  13817.         if (loginScreenState == 3) {
  13818.             chatTextDrawingArea.method382(0xffff00, c / 2,
  13819.                     "Create a free account", c1 / 2 - 60, true);
  13820.             int k = c1 / 2 - 35;
  13821.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13822.                     "To create a new account you need to", k, true);
  13823.             k += 15;
  13824.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13825.                     "just enter a user name and password", k, true);
  13826.             k += 15;
  13827.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13828.                     "that you wish to use.", k, true);
  13829.             k += 15;
  13830.             chatTextDrawingArea.method382(0xffffff, c / 2,
  13831.                     "Forums: http://www.Vanityrsps.com", k, true);
  13832.             k += 15;
  13833.             int j1 = c / 2;
  13834.             int i2 = c1 / 2 + 50;
  13835.             aBackground_967.method361(j1 - 73, i2 - 20);
  13836.             chatTextDrawingArea.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  13837.         }
  13838.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  13839.         if (welcomeScreenRaised) {
  13840.             welcomeScreenRaised = false;
  13841.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  13842.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  13843.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  13844.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  13845.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  13846.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  13847.         }
  13848.     }
  13849.  
  13850.     private void drawFlames() {
  13851.         drawingFlames = true;
  13852.         try {
  13853.             long l = System.currentTimeMillis();
  13854.             int i = 0;
  13855.             int j = 20;
  13856.             while (aBoolean831) {
  13857.                 anInt1208++;
  13858.                 // calcFlamesPosition();
  13859.                 // calcFlamesPosition();
  13860.                 doFlamesDrawing();
  13861.                 if (++i > 10) {
  13862.                     long l1 = System.currentTimeMillis();
  13863.                     int k = (int) (l1 - l) / 10 - j;
  13864.                     j = 40 - k;
  13865.                     if (j < 5)
  13866.                         j = 5;
  13867.                     i = 0;
  13868.                     l = l1;
  13869.                 }
  13870.                 try {
  13871.                     Thread.sleep(j);
  13872.                 } catch (Exception _ex) {
  13873.                 }
  13874.             }
  13875.         } catch (Exception _ex) {
  13876.         }
  13877.         drawingFlames = false;
  13878.     }
  13879.  
  13880.     public void raiseWelcomeScreen() {
  13881.         welcomeScreenRaised = true;
  13882.     }
  13883.  
  13884.     private void method137(Stream stream, int j) {
  13885.         if (j == 84) {
  13886.             int k = stream.readUnsignedByte();
  13887.             int j3 = anInt1268 + (k >> 4 & 7);
  13888.             int i6 = anInt1269 + (k & 7);
  13889.             int l8 = stream.readUnsignedWord();
  13890.             int k11 = stream.readUnsignedWord();
  13891.             int l13 = stream.readUnsignedWord();
  13892.             if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  13893.                 NodeList class19_1 = groundArray[plane][j3][i6];
  13894.                 if (class19_1 != null) {
  13895.                     for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1
  13896.                             .reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1
  13897.                             .reverseGetNext()) {
  13898.                         if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff)
  13899.                                 || class30_sub2_sub4_sub2_3.anInt1559 != k11)
  13900.                             continue;
  13901.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  13902.                         break;
  13903.                     }
  13904.  
  13905.                     spawnGroundItem(j3, i6);
  13906.                 }
  13907.             }
  13908.             return;
  13909.         }
  13910.         if (j == 105) {
  13911.             int l = stream.readUnsignedByte();
  13912.             int k3 = anInt1268 + (l >> 4 & 7);
  13913.             int j6 = anInt1269 + (l & 7);
  13914.             int i9 = stream.readUnsignedWord();
  13915.             int l11 = stream.readUnsignedByte();
  13916.             int i14 = l11 >> 4 & 0xf;
  13917.             int i16 = l11 & 7;
  13918.             if (myPlayer.smallX[0] >= k3 - i14
  13919.                     && myPlayer.smallX[0] <= k3 + i14
  13920.                     && myPlayer.smallY[0] >= j6 - i14
  13921.                     && myPlayer.smallY[0] <= j6 + i14 && aBoolean848 && !lowMem
  13922.                     && anInt1062 < 50) {
  13923.                 anIntArray1207[anInt1062] = i9;
  13924.                 anIntArray1241[anInt1062] = i16;
  13925.                 anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  13926.                 anInt1062++;
  13927.             }
  13928.         }
  13929.         if (j == 215) {
  13930.             int i1 = stream.method435();
  13931.             int l3 = stream.method428();
  13932.             int k6 = anInt1268 + (l3 >> 4 & 7);
  13933.             int j9 = anInt1269 + (l3 & 7);
  13934.             int i12 = stream.method435();
  13935.             int j14 = stream.readUnsignedWord();
  13936.             if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104
  13937.                     && i12 != unknownInt10) {
  13938.                 Item class30_sub2_sub4_sub2_2 = new Item();
  13939.                 class30_sub2_sub4_sub2_2.ID = i1;
  13940.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  13941.                 if (groundArray[plane][k6][j9] == null)
  13942.                     groundArray[plane][k6][j9] = new NodeList();
  13943.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  13944.                 spawnGroundItem(k6, j9);
  13945.             }
  13946.             return;
  13947.         }
  13948.         if (j == 156) {
  13949.             int j1 = stream.method426();
  13950.             int i4 = anInt1268 + (j1 >> 4 & 7);
  13951.             int l6 = anInt1269 + (j1 & 7);
  13952.             int k9 = stream.readUnsignedWord();
  13953.             if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  13954.                 NodeList class19 = groundArray[plane][i4][l6];
  13955.                 if (class19 != null) {
  13956.                     for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  13957.                             .reverseGetNext()) {
  13958.                         if (item.ID != (k9 & 0x7fff))
  13959.                             continue;
  13960.                         item.unlink();
  13961.                         break;
  13962.                     }
  13963.  
  13964.                     if (class19.reverseGetFirst() == null)
  13965.                         groundArray[plane][i4][l6] = null;
  13966.                     spawnGroundItem(i4, l6);
  13967.                 }
  13968.             }
  13969.             return;
  13970.         }
  13971.         if (j == 160) {
  13972.             int k1 = stream.method428();
  13973.             int j4 = anInt1268 + (k1 >> 4 & 7);
  13974.             int i7 = anInt1269 + (k1 & 7);
  13975.             int l9 = stream.method428();
  13976.             int j12 = l9 >> 2;
  13977.             int k14 = l9 & 3;
  13978.             int j16 = anIntArray1177[j12];
  13979.             int j17 = stream.method435();
  13980.             if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  13981.                 int j18 = intGroundArray[plane][j4][i7];
  13982.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  13983.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  13984.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  13985.                 if (j16 == 0) {
  13986.                     Object1 class10 = worldController.method296(plane, j4, i7);
  13987.                     if (class10 != null) {
  13988.                         int k21 = class10.uid >> 14 & 0x7fff;
  13989.                         if (j12 == 2) {
  13990.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  13991.                                     k21, 4 + k14, 2, i19, l19, j18, k20, j17,
  13992.                                     false);
  13993.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(
  13994.                                     k21, k14 + 1 & 3, 2, i19, l19, j18, k20,
  13995.                                     j17, false);
  13996.                         } else {
  13997.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  13998.                                     k21, k14, j12, i19, l19, j18, k20, j17,
  13999.                                     false);
  14000.                         }
  14001.                     }
  14002.                 }
  14003.                 if (j16 == 1) {
  14004.                     Object2 class26 = worldController.method297(j4, i7, plane);
  14005.                     if (class26 != null)
  14006.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(
  14007.                                 class26.uid >> 14 & 0x7fff, 0, 4, i19, l19,
  14008.                                 j18, k20, j17, false);
  14009.                 }
  14010.                 if (j16 == 2) {
  14011.                     Object5 class28 = worldController.method298(j4, i7, plane);
  14012.                     if (j12 == 11)
  14013.                         j12 = 10;
  14014.                     if (class28 != null)
  14015.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(
  14016.                                 class28.uid >> 14 & 0x7fff, k14, j12, i19, l19,
  14017.                                 j18, k20, j17, false);
  14018.                 }
  14019.                 if (j16 == 3) {
  14020.                     Object3 class49 = worldController.method299(i7, j4, plane);
  14021.                     if (class49 != null)
  14022.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(
  14023.                                 class49.uid >> 14 & 0x7fff, k14, 22, i19, l19,
  14024.                                 j18, k20, j17, false);
  14025.                 }
  14026.             }
  14027.             return;
  14028.         }
  14029.         if (j == 147) {
  14030.             int l1 = stream.method428();
  14031.             int k4 = anInt1268 + (l1 >> 4 & 7);
  14032.             int j7 = anInt1269 + (l1 & 7);
  14033.             int i10 = stream.readUnsignedWord();
  14034.             byte byte0 = stream.method430();
  14035.             int l14 = stream.method434();
  14036.             byte byte1 = stream.method429();
  14037.             int k17 = stream.readUnsignedWord();
  14038.             int k18 = stream.method428();
  14039.             int j19 = k18 >> 2;
  14040.             int i20 = k18 & 3;
  14041.             int l20 = anIntArray1177[j19];
  14042.             byte byte2 = stream.readSignedByte();
  14043.             int l21 = stream.readUnsignedWord();
  14044.             byte byte3 = stream.method429();
  14045.             Player player;
  14046.             if (i10 == unknownInt10)
  14047.                 player = myPlayer;
  14048.             else
  14049.                 player = playerArray[i10];
  14050.             if (player != null) {
  14051.                 ObjectDef class46 = ObjectDef.forID(l21);
  14052.                 int i22 = intGroundArray[plane][k4][j7];
  14053.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  14054.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  14055.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  14056.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22,
  14057.                         -1);
  14058.                 if (model != null) {
  14059.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  14060.                     player.anInt1707 = l14 + loopCycle;
  14061.                     player.anInt1708 = k17 + loopCycle;
  14062.                     player.aModel_1714 = model;
  14063.                     int i23 = class46.anInt744;
  14064.                     int j23 = class46.anInt761;
  14065.                     if (i20 == 1 || i20 == 3) {
  14066.                         i23 = class46.anInt761;
  14067.                         j23 = class46.anInt744;
  14068.                     }
  14069.                     player.anInt1711 = k4 * 128 + i23 * 64;
  14070.                     player.anInt1713 = j7 * 128 + j23 * 64;
  14071.                     player.anInt1712 = method42(plane, player.anInt1713,
  14072.                             player.anInt1711);
  14073.                     if (byte2 > byte0) {
  14074.                         byte byte4 = byte2;
  14075.                         byte2 = byte0;
  14076.                         byte0 = byte4;
  14077.                     }
  14078.                     if (byte3 > byte1) {
  14079.                         byte byte5 = byte3;
  14080.                         byte3 = byte1;
  14081.                         byte1 = byte5;
  14082.                     }
  14083.                     player.anInt1719 = k4 + byte2;
  14084.                     player.anInt1721 = k4 + byte0;
  14085.                     player.anInt1720 = j7 + byte3;
  14086.                     player.anInt1722 = j7 + byte1;
  14087.                 }
  14088.             }
  14089.         }
  14090.         if (j == 151) {
  14091.             int i2 = stream.method426();
  14092.             int l4 = anInt1268 + (i2 >> 4 & 7);
  14093.             int k7 = anInt1269 + (i2 & 7);
  14094.             int j10 = stream.method434();
  14095.             int k12 = stream.method428();
  14096.             int i15 = k12 >> 2;
  14097.             int k16 = k12 & 3;
  14098.             int l17 = anIntArray1177[i15];
  14099.             if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  14100.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  14101.             return;
  14102.         }
  14103.         if (j == 4) {
  14104.             int j2 = stream.readUnsignedByte();
  14105.             int i5 = anInt1268 + (j2 >> 4 & 7);
  14106.             int l7 = anInt1269 + (j2 & 7);
  14107.             int k10 = stream.readUnsignedWord();
  14108.             int l12 = stream.readUnsignedByte();
  14109.             int j15 = stream.readUnsignedWord();
  14110.             if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  14111.                 i5 = i5 * 128 + 64;
  14112.                 l7 = l7 * 128 + 64;
  14113.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane,
  14114.                         loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7,
  14115.                         i5);
  14116.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  14117.             }
  14118.             return;
  14119.         }
  14120.         if (j == 44) {
  14121.             int k2 = stream.method436();
  14122.             int j5 = stream.readUnsignedWord();
  14123.             int i8 = stream.readUnsignedByte();
  14124.             int l10 = anInt1268 + (i8 >> 4 & 7);
  14125.             int i13 = anInt1269 + (i8 & 7);
  14126.             if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  14127.                 Item class30_sub2_sub4_sub2_1 = new Item();
  14128.                 class30_sub2_sub4_sub2_1.ID = k2;
  14129.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  14130.                 if (groundArray[plane][l10][i13] == null)
  14131.                     groundArray[plane][l10][i13] = new NodeList();
  14132.                 groundArray[plane][l10][i13]
  14133.                         .insertHead(class30_sub2_sub4_sub2_1);
  14134.                 spawnGroundItem(l10, i13);
  14135.             }
  14136.             return;
  14137.         }
  14138.         if (j == 101) {
  14139.             int l2 = stream.method427();
  14140.             int k5 = l2 >> 2;
  14141.             int j8 = l2 & 3;
  14142.             int i11 = anIntArray1177[k5];
  14143.             int j13 = stream.readUnsignedByte();
  14144.             int k15 = anInt1268 + (j13 >> 4 & 7);
  14145.             int l16 = anInt1269 + (j13 & 7);
  14146.             if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  14147.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  14148.             return;
  14149.         }
  14150.         if (j == 117) {
  14151.             int i3 = stream.readUnsignedByte();
  14152.             int l5 = anInt1268 + (i3 >> 4 & 7);
  14153.             int k8 = anInt1269 + (i3 & 7);
  14154.             int j11 = l5 + stream.readSignedByte();
  14155.             int k13 = k8 + stream.readSignedByte();
  14156.             int l15 = stream.readSignedWord();
  14157.             int i17 = stream.readUnsignedWord();
  14158.             int i18 = stream.readUnsignedByte() * 4;
  14159.             int l18 = stream.readUnsignedByte() * 4;
  14160.             int k19 = stream.readUnsignedWord();
  14161.             int j20 = stream.readUnsignedWord();
  14162.             int i21 = stream.readUnsignedByte();
  14163.             int j21 = stream.readUnsignedByte();
  14164.             if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0
  14165.                     && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
  14166.                 l5 = l5 * 128 + 64;
  14167.                 k8 = k8 * 128 + 64;
  14168.                 j11 = j11 * 128 + 64;
  14169.                 k13 = k13 * 128 + 64;
  14170.                 Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21,
  14171.                         l18, k19 + loopCycle, j20 + loopCycle, j21, plane,
  14172.                         method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  14173.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13,
  14174.                         method42(plane, k13, j11) - l18, j11);
  14175.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  14176.             }
  14177.         }
  14178.     }
  14179.  
  14180.     private static void setLowMem() {
  14181.         WorldController.lowMem = true;
  14182.         Texture.lowMem = true;
  14183.         lowMem = true;
  14184.         ObjectManager.lowMem = true;
  14185.         ObjectDef.lowMem = true;
  14186.         System.out.println("Running in lowmem");
  14187.     }
  14188.  
  14189.     private void method139(Stream stream) {
  14190.         stream.initBitAccess();
  14191.         int k = stream.readBits(8);
  14192.         if (k < npcCount) {
  14193.             for (int l = k; l < npcCount; l++)
  14194.                 anIntArray840[anInt839++] = npcIndices[l];
  14195.  
  14196.         }
  14197.         if (k > npcCount) {
  14198.             signlink.reporterror(myUsername + " Too many npcs");
  14199.             throw new RuntimeException("eek");
  14200.         }
  14201.         npcCount = 0;
  14202.         for (int i1 = 0; i1 < k; i1++) {
  14203.             int j1 = npcIndices[i1];
  14204.             NPC npc = npcArray[j1];
  14205.             int k1 = stream.readBits(1);
  14206.             if (k1 == 0) {
  14207.                 npcIndices[npcCount++] = j1;
  14208.                 npc.anInt1537 = loopCycle;
  14209.             } else {
  14210.                 int l1 = stream.readBits(2);
  14211.                 if (l1 == 0) {
  14212.                     npcIndices[npcCount++] = j1;
  14213.                     npc.anInt1537 = loopCycle;
  14214.                     anIntArray894[anInt893++] = j1;
  14215.                 } else if (l1 == 1) {
  14216.                     npcIndices[npcCount++] = j1;
  14217.                     npc.anInt1537 = loopCycle;
  14218.                     int i2 = stream.readBits(3);
  14219.                     npc.moveInDir(false, i2);
  14220.                     int k2 = stream.readBits(1);
  14221.                     if (k2 == 1)
  14222.                         anIntArray894[anInt893++] = j1;
  14223.                 } else if (l1 == 2) {
  14224.                     npcIndices[npcCount++] = j1;
  14225.                     npc.anInt1537 = loopCycle;
  14226.                     int j2 = stream.readBits(3);
  14227.                     npc.moveInDir(true, j2);
  14228.                     int l2 = stream.readBits(3);
  14229.                     npc.moveInDir(true, l2);
  14230.                     int i3 = stream.readBits(1);
  14231.                     if (i3 == 1)
  14232.                         anIntArray894[anInt893++] = j1;
  14233.                 } else if (l1 == 3)
  14234.                     anIntArray840[anInt839++] = j1;
  14235.             }
  14236.         }
  14237.  
  14238.     }
  14239.     private String pastNum = "Enter a name";
  14240.  
  14241.     int port = 0;
  14242.     private String hcServers[] = { "69.65.44.57", "69.39.238.176",
  14243.             "69.65.45.225", "69.65.45.233", "69.39.238.183" };
  14244.     private String realServers[] = { "69.65.44.57", "69.39.238.176",
  14245.             "69.65.45.225", "69.65.45.233", "69.39.238.183" };
  14246.  
  14247.     private void processLoginScreenInput() {
  14248.         if (loginScreenState == 0) {
  14249.             int i = super.myWidth / 2 - 80;
  14250.             int l = super.myHeight / 2 + 20;
  14251.             l += 20;
  14252.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  14253.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  14254.                     && super.saveClickY <= l + 20) {
  14255.                 loginScreenState = 3;
  14256.                 loginScreenCursorPos = 0;
  14257.             }
  14258.             i = super.myWidth / 2 + 80;
  14259.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  14260.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  14261.                     && super.saveClickY <= l + 20) {
  14262.                 loginMessage1 = "";
  14263.                 loginMessage2 = "Enter your username & password.";
  14264.                 loginScreenState = 2;
  14265.                 loginScreenCursorPos = 0;
  14266.             }
  14267.         } else {
  14268.             if (loginScreenState == 2) {
  14269.                 int j = super.myHeight / 2 - 40;
  14270.                 j += 30;
  14271.                 j += 25;
  14272.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  14273.                         && super.saveClickY < j)
  14274.                     loginScreenCursorPos = 0;
  14275.                 j += 15;
  14276.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  14277.                         && super.saveClickY < j)
  14278.                     loginScreenCursorPos = 1;
  14279.                 j += 15;
  14280.                 int i1 = super.myWidth / 2 - 80;
  14281.                 int k1 = super.myHeight / 2 + 50;
  14282.                 k1 += 20;
  14283.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  14284.                         && super.saveClickX <= i1 + 75
  14285.                         && super.saveClickY >= k1 - 20
  14286.                         && super.saveClickY <= k1 + 20) {
  14287.                     switch (world) {
  14288.                     case 1:
  14289.                         server = "127.0.0.1";
  14290.                         port = 43594;
  14291.                         loginFailures = 0;
  14292.                         login(myUsername, myPassword, false);
  14293.                         if (loggedIn)
  14294.                             return;
  14295.                         break;
  14296.                     case 2:
  14297.                         server = "127.0.0.1";
  14298.                         port = 43594;
  14299.                         loginFailures = 0;
  14300.                         login(myUsername, myPassword, false);
  14301.                         if (loggedIn)
  14302.                             return;
  14303.                         break;
  14304.                     }
  14305.                 }
  14306.  
  14307.                 i1 = super.myWidth / 2 + 80;
  14308.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  14309.                         && super.saveClickX <= i1 + 75
  14310.                         && super.saveClickY >= k1 - 20
  14311.                         && super.saveClickY <= k1 + 20) {
  14312.                     switch (world) {
  14313.                     case 1:
  14314.                         world = 2;
  14315.                         break;
  14316.                     case 2:
  14317.                         world = 1;
  14318.                         break;
  14319.                     }
  14320.                     drawLoginScreen(true);
  14321.                 }
  14322.                 do {
  14323.                     int l1 = readChar(-796);
  14324.                     if (l1 == -1)
  14325.                         break;
  14326.                     boolean flag1 = false;
  14327.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  14328.                         if (l1 != validUserPassChars.charAt(i2))
  14329.                             continue;
  14330.                         flag1 = true;
  14331.                         break;
  14332.                     }
  14333.  
  14334.                     if (loginScreenCursorPos == 0) {
  14335.                         if (l1 == 8 && myUsername.length() > 0)
  14336.                             myUsername = myUsername.substring(0, myUsername
  14337.                                     .length() - 1);
  14338.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  14339.                             loginScreenCursorPos = 1;
  14340.                         if (flag1)
  14341.                             myUsername += (char) l1;
  14342.                         if (myUsername.length() > 12)
  14343.                             myUsername = myUsername.substring(0, 12);
  14344.                     } else if (loginScreenCursorPos == 1) {
  14345.                         if (l1 == 8 && myPassword.length() > 0)
  14346.                             myPassword = myPassword.substring(0, myPassword
  14347.                                     .length() - 1);
  14348.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  14349.                             loginScreenCursorPos = 0;
  14350.                         if (flag1)
  14351.                             myPassword += (char) l1;
  14352.                         if (myPassword.length() > 20)
  14353.                             myPassword = myPassword.substring(0, 20);
  14354.                     }
  14355.  
  14356.                 } while (true);
  14357.                 return;
  14358.             }
  14359.             if (loginScreenState == 3) {
  14360.                 int k = super.myWidth / 2;
  14361.                 int j1 = super.myHeight / 2 + 50;
  14362.                 j1 += 20;
  14363.                 if (super.clickMode3 == 1 && super.saveClickX >= k - 75
  14364.                         && super.saveClickX <= k + 75
  14365.                         && super.saveClickY >= j1 - 20
  14366.                         && super.saveClickY <= j1 + 20)
  14367.                     loginScreenState = 0;
  14368.             }
  14369.         }
  14370.     }
  14371.  
  14372.     private void markMinimap(Sprite sprite, int i, int j) {
  14373.         int k = minimapInt1 + minimapInt2 & 0x7ff;
  14374.         int l = i * i + j * j;
  14375.         if (l > 6400)
  14376.             return;
  14377.         int i1 = Model.modelIntArray1[k];
  14378.         int j1 = Model.modelIntArray2[k];
  14379.         i1 = (i1 * 256) / (minimapInt3 + 256);
  14380.         j1 = (j1 * 256) / (minimapInt3 + 256);
  14381.         int k1 = j * i1 + i * j1 >> 16;
  14382.         int l1 = j * j1 - i * i1 >> 16;
  14383.         try {
  14384.             if (l > 2500) {
  14385.                 sprite.drawSprite(((94 + k1) - sprite.anInt1444 / 2) + 4 + 20,
  14386.                         83 - l1 - sprite.anInt1445 / 2 - 4 + 5);
  14387.             } else {
  14388.                 sprite.drawSprite(((94 + k1) - sprite.anInt1444 / 2) + 4 + 20,
  14389.                         83 - l1 - sprite.anInt1445 / 2 - 4 + 5);
  14390.             }
  14391.         } catch (Exception ex) {
  14392.         }
  14393.     }
  14394.  
  14395.     private void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  14396.         if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  14397.             if (lowMem && j != plane)
  14398.                 return;
  14399.             int i2 = 0;
  14400.             if (j1 == 0)
  14401.                 i2 = worldController.method300(j, i1, i);
  14402.             if (j1 == 1)
  14403.                 i2 = worldController.method301(j, i1, i);
  14404.             if (j1 == 2)
  14405.                 i2 = worldController.method302(j, i1, i);
  14406.             if (j1 == 3)
  14407.                 i2 = worldController.method303(j, i1, i);
  14408.             if (i2 != 0) {
  14409.                 int i3 = worldController.method304(j, i1, i, i2);
  14410.                 int j2 = i2 >> 14 & 0x7fff;
  14411.                 int k2 = i3 & 0x1f;
  14412.                 int l2 = i3 >> 6;
  14413.                 if (j1 == 0) {
  14414.                     worldController.method291(i1, j, i, (byte) -119);
  14415.                     ObjectDef class46 = ObjectDef.forID(j2);
  14416.                     if (class46.aBoolean767)
  14417.                         aClass11Array1230[j].method215(l2, k2,
  14418.                                 class46.aBoolean757, i1, i);
  14419.                 }
  14420.                 if (j1 == 1)
  14421.                     worldController.method292(i, j, i1);
  14422.                 if (j1 == 2) {
  14423.                     worldController.method293(j, i1, i);
  14424.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  14425.                     if (i1 + class46_1.anInt744 > 103
  14426.                             || i + class46_1.anInt744 > 103
  14427.                             || i1 + class46_1.anInt761 > 103
  14428.                             || i + class46_1.anInt761 > 103)
  14429.                         return;
  14430.                     if (class46_1.aBoolean767)
  14431.                         aClass11Array1230[j].method216(l2, class46_1.anInt744,
  14432.                                 i1, i, class46_1.anInt761,
  14433.                                 class46_1.aBoolean757);
  14434.                 }
  14435.                 if (j1 == 3) {
  14436.                     worldController.method294(j, i, i1);
  14437.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  14438.                     if (class46_2.aBoolean767 && class46_2.hasActions)
  14439.                         aClass11Array1230[j].method218(i, i1);
  14440.                 }
  14441.             }
  14442.             if (k1 >= 0) {
  14443.                 int j3 = j;
  14444.                 if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
  14445.                     j3++;
  14446.                 ObjectManager.method188(worldController, k, i, l, j3,
  14447.                         aClass11Array1230[j], intGroundArray, i1, k1, j);
  14448.             }
  14449.         }
  14450.     }
  14451.  
  14452.     private void updatePlayers(int i, Stream stream) {
  14453.         anInt839 = 0;
  14454.         anInt893 = 0;
  14455.         method117(stream);
  14456.         method134(stream);
  14457.         method91(stream, i);
  14458.         method49(stream);
  14459.         for (int k = 0; k < anInt839; k++) {
  14460.             int l = anIntArray840[k];
  14461.             if (playerArray[l].anInt1537 != loopCycle)
  14462.                 playerArray[l] = null;
  14463.         }
  14464.  
  14465.         if (stream.currentOffset != i) {
  14466.             signlink.reporterror("Error packet size mismatch in getplayer pos:"
  14467.                     + stream.currentOffset + " psize:" + i);
  14468.             // throw new RuntimeException("eek");
  14469.         }
  14470.         for (int i1 = 0; i1 < playerCount; i1++)
  14471.             if (playerArray[playerIndices[i1]] == null) {
  14472.                 signlink.reporterror(myUsername
  14473.                         + " null entry in pl list - pos:" + i1 + " size:"
  14474.                         + playerCount);
  14475.                 // throw new RuntimeException("eek");
  14476.             }
  14477.  
  14478.     }
  14479.  
  14480.     private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  14481.         int l1 = 2048 - k & 0x7ff;
  14482.         int i2 = 2048 - j1 & 0x7ff;
  14483.         int j2 = 0;
  14484.         int k2 = 0;
  14485.         int l2 = j;
  14486.         if (l1 != 0) {
  14487.             int i3 = Model.modelIntArray1[l1];
  14488.             int k3 = Model.modelIntArray2[l1];
  14489.             int i4 = k2 * k3 - l2 * i3 >> 16;
  14490.             l2 = k2 * i3 + l2 * k3 >> 16;
  14491.             k2 = i4;
  14492.         }
  14493.         if (i2 != 0) {
  14494.             /*
  14495.              * xxx if(cameratoggle){ if(zoom == 0) zoom = k2; if(lftrit == 0)
  14496.              * lftrit = j2; if(fwdbwd == 0) fwdbwd = l2; k2 = zoom; j2 = lftrit;
  14497.              * l2 = fwdbwd; }
  14498.              */
  14499.             int j3 = Model.modelIntArray1[i2];
  14500.             int l3 = Model.modelIntArray2[i2];
  14501.             int j4 = l2 * j3 + j2 * l3 >> 16;
  14502.             l2 = l2 * l3 - j2 * j3 >> 16;
  14503.             j2 = j4;
  14504.         }
  14505.         xCameraPos = l - j2;
  14506.         zCameraPos = i1 - k2;
  14507.         yCameraPos = k1 - l2;
  14508.         yCameraCurve = k;
  14509.         xCameraCurve = j1;
  14510.     }
  14511.  
  14512.     private boolean parsePacket() {
  14513.         if (socketStream == null)
  14514.             return false;
  14515.         try {
  14516.             int i = socketStream.available();
  14517.             if (i == 0)
  14518.                 return false;
  14519.             if (pktType == -1) {
  14520.                 socketStream.flushInputStream(inStream.buffer, 1);
  14521.                 pktType = inStream.buffer[0] & 0xff;
  14522.                 if (encryption != null)
  14523.                     pktType = pktType - encryption.getNextKey() & 0xff;
  14524.                 pktSize = SizeConstants.packetSizes[pktType];
  14525.                 i--;
  14526.             }
  14527.             if (pktSize == -1)
  14528.                 if (i > 0) {
  14529.                     socketStream.flushInputStream(inStream.buffer, 1);
  14530.                     pktSize = inStream.buffer[0] & 0xff;
  14531.                     i--;
  14532.                 } else {
  14533.                     return false;
  14534.                 }
  14535.             if (pktSize == -2)
  14536.                 if (i > 1) {
  14537.                     socketStream.flushInputStream(inStream.buffer, 2);
  14538.                     inStream.currentOffset = 0;
  14539.                     pktSize = inStream.readUnsignedWord();
  14540.                     i -= 2;
  14541.                 } else {
  14542.                     return false;
  14543.                 }
  14544.             if (i < pktSize)
  14545.                 return false;
  14546.             inStream.currentOffset = 0;
  14547.             socketStream.flushInputStream(inStream.buffer, pktSize);
  14548.             anInt1009 = 0;
  14549.             anInt843 = anInt842;
  14550.             anInt842 = anInt841;
  14551.             anInt841 = pktType;
  14552.             if (pktType == 81) {
  14553.                 updatePlayers(pktSize, inStream);
  14554.                 aBoolean1080 = false;
  14555.                 pktType = -1;
  14556.                 return true;
  14557.             }
  14558.             if (pktType == 31) // private messaging
  14559.             {
  14560.                 long playerName = inStream.readQWord();
  14561.                 String message = inStream.readString();
  14562.                 stream.createFrame(126);
  14563.                 stream.writeWordBigEndian(0);
  14564.                 int k = stream.currentOffset;
  14565.                 stream.writeQWord(playerName);
  14566.                 TextInput.method526(message, stream);
  14567.                 stream.writeBytes(stream.currentOffset - k);
  14568.                 // message = TextInput.processText(message);
  14569.                 pushMessage(message, 6, TextClass.fixName(TextClass
  14570.                         .nameForLong(playerName)));
  14571.                 if (privateChatMode == 2) {
  14572.                     privateChatMode = 1;
  14573.                     aBoolean1233 = true;
  14574.                     stream.createFrame(95);
  14575.                     stream.writeWordBigEndian(publicChatMode);
  14576.                     stream.writeWordBigEndian(privateChatMode);
  14577.                     stream.writeWordBigEndian(tradeMode);
  14578.                     System.out.println("Chat Mode:" + privateChatMode);
  14579.                 }
  14580.                 pktType = -1;
  14581.                 return true;
  14582.             }
  14583.             if (pktType == 176) {
  14584.                 daysSinceRecovChange = inStream.method427();
  14585.                 unreadMessages = inStream.method435();
  14586.                 membersInt = inStream.readUnsignedByte();
  14587.                 anInt1193 = inStream.method440();
  14588.                 daysSinceLastLogin = inStream.readUnsignedWord();
  14589.                 if (anInt1193 != 0 && openInterfaceID == -1) {
  14590.                     signlink.dnslookup(TextClass.method586(anInt1193));
  14591.                     clearTopInterfaces();
  14592.                     char c = '\u028A';
  14593.                     if (daysSinceRecovChange != 201 || membersInt == 1)
  14594.                         c = '\u028F';
  14595.                     reportAbuseInput = "";
  14596.                     canMute = false;
  14597.                     for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  14598.                         if (RSInterface.interfaceCache[k9] == null
  14599.                                 || RSInterface.interfaceCache[k9].contentType != c)
  14600.                             continue;
  14601.                         openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  14602.                         break;
  14603.                     }
  14604.  
  14605.                 }
  14606.                 pktType = -1;
  14607.                 return true;
  14608.             }
  14609.             if (pktType == 64) {
  14610.                 anInt1268 = inStream.method427();
  14611.                 anInt1269 = inStream.method428();
  14612.                 for (int j = anInt1268; j < anInt1268 + 8; j++) {
  14613.                     for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
  14614.                         if (groundArray[plane][j][l9] != null) {
  14615.                             groundArray[plane][j][l9] = null;
  14616.                             spawnGroundItem(j, l9);
  14617.                         }
  14618.  
  14619.                 }
  14620.  
  14621.                 for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  14622.                         .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  14623.                         .reverseGetNext())
  14624.                     if (class30_sub1.anInt1297 >= anInt1268
  14625.                             && class30_sub1.anInt1297 < anInt1268 + 8
  14626.                             && class30_sub1.anInt1298 >= anInt1269
  14627.                             && class30_sub1.anInt1298 < anInt1269 + 8
  14628.                             && class30_sub1.anInt1295 == plane)
  14629.                         class30_sub1.anInt1294 = 0;
  14630.  
  14631.                 pktType = -1;
  14632.                 return true;
  14633.             }
  14634.             if (pktType == 185) {
  14635.                 int k = inStream.method436();
  14636.                 RSInterface.interfaceCache[k].anInt233 = 3;
  14637.                 if (myPlayer.desc == null)
  14638.                     RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25)
  14639.                             + (myPlayer.anIntArray1700[4] << 20)
  14640.                             + (myPlayer.equipment[0] << 15)
  14641.                             + (myPlayer.equipment[8] << 10)
  14642.                             + (myPlayer.equipment[11] << 5)
  14643.                             + myPlayer.equipment[1];
  14644.                 else
  14645.                     RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.type);
  14646.                 pktType = -1;
  14647.                 return true;
  14648.             }
  14649.             if (pktType == 107) {
  14650.                 aBoolean1160 = false;
  14651.                 for (int l = 0; l < 5; l++)
  14652.                     aBooleanArray876[l] = false;
  14653.                 xpCounter = 0;
  14654.                 pktType = -1;
  14655.                 return true;
  14656.             }
  14657.             if (pktType == 72) {
  14658.                 int i1 = inStream.method434();
  14659.                 RSInterface class9 = RSInterface.interfaceCache[i1];
  14660.                 for (int k15 = 0; k15 < class9.inv.length; k15++) {
  14661.                     class9.inv[k15] = -1;
  14662.                     class9.inv[k15] = 0;
  14663.                 }
  14664.  
  14665.                 pktType = -1;
  14666.                 return true;
  14667.             }
  14668.             if (pktType == 214) {
  14669.                 ignoreCount = pktSize / 8;
  14670.                 for (int j1 = 0; j1 < ignoreCount; j1++)
  14671.                     ignoreListAsLongs[j1] = inStream.readQWord();
  14672.  
  14673.                 pktType = -1;
  14674.                 return true;
  14675.             }
  14676.             if (pktType == 166) {
  14677.                 aBoolean1160 = true;
  14678.                 anInt1098 = inStream.readUnsignedByte();
  14679.                 anInt1099 = inStream.readUnsignedByte();
  14680.                 anInt1100 = inStream.readUnsignedWord();
  14681.                 anInt1101 = inStream.readUnsignedByte();
  14682.                 anInt1102 = inStream.readUnsignedByte();
  14683.                 if (anInt1102 >= 100) {
  14684.                     xCameraPos = anInt1098 * 128 + 64;
  14685.                     yCameraPos = anInt1099 * 128 + 64;
  14686.                     zCameraPos = method42(plane, yCameraPos, xCameraPos)
  14687.                             - anInt1100;
  14688.                 }
  14689.                 pktType = -1;
  14690.                 return true;
  14691.             }
  14692.             if (pktType == 134) {
  14693.                 needDrawTabArea = true;
  14694.                 int k1 = inStream.readUnsignedByte();
  14695.                 int i10 = inStream.method439();
  14696.                 int l15 = inStream.readUnsignedByte();
  14697.                 int oldXp = currentExp[k1];
  14698.                 if (drawXpBar) {
  14699.                     drawFlag = true;
  14700.                 }
  14701.                 currentExp[k1] = i10;
  14702.                 currentStats[k1] = l15;
  14703.                 maxStats[k1] = 1;
  14704.                 testXp += i10 - oldXp;
  14705.                 xpToDraw += i10 - oldXp;
  14706.                 if (testXp == currentExp[k1]) {
  14707.                     testXp = 0;
  14708.                     xpToDraw = 0;
  14709.                 }
  14710.                 for (int k20 = 0; k20 < 98; k20++)
  14711.                     if (i10 >= anIntArray1019[k20])
  14712.                         maxStats[k1] = k20 + 2;
  14713.                 pktType = -1;
  14714.                 return true;
  14715.             }
  14716.             if (pktType == 71) {
  14717.                 int l1 = inStream.readUnsignedWord();
  14718.                 int j10 = inStream.method426();
  14719.                 if (l1 == 65535)
  14720.                     l1 = -1;
  14721.                 if (j10 == 5)
  14722.                     prayerInterfaceType = l1;
  14723.                 tabInterfaceIDs[j10] = l1;
  14724.                 needDrawTabArea = true;
  14725.                 tabAreaAltered = true;
  14726.                 pktType = -1;
  14727.                 return true;
  14728.             }
  14729.             if (pktType == 74) {
  14730.                 int i2 = inStream.method434();
  14731.                 if (i2 == 65535)
  14732.                     i2 = -1;
  14733.                 if (i2 != currentSong && musicEnabled /* && !lowMem */
  14734.                         && prevSong == 0) {
  14735.                     nextSong = i2;
  14736.                     songChanging = true;
  14737.                     onDemandFetcher.method558(2, nextSong);
  14738.                 }
  14739.                 currentSong = i2;
  14740.                 pktType = -1;
  14741.                 return true;
  14742.             }
  14743.             if (pktType == 121) {
  14744.                 int j2 = inStream.method436();
  14745.                 int k10 = inStream.method435();
  14746.                 if (musicEnabled)// && !lowMem)
  14747.                 {
  14748.                     nextSong = j2;
  14749.                     songChanging = false;
  14750.                     onDemandFetcher.method558(2, nextSong);
  14751.                     prevSong = k10;
  14752.                 }
  14753.                 pktType = -1;
  14754.                 return true;
  14755.             }
  14756.             if (pktType == 109) {
  14757.                 resetLogout();
  14758.                 pktType = -1;
  14759.                 return false;
  14760.             }
  14761.             if (pktType == 70) {
  14762.                 int k2 = inStream.readSignedWord();
  14763.                 int l10 = inStream.method437();
  14764.                 int i16 = inStream.method434();
  14765.                 RSInterface class9_5 = RSInterface.interfaceCache[i16];
  14766.                 class9_5.anInt263 = k2;
  14767.                 class9_5.anInt265 = l10;
  14768.                 pktType = -1;
  14769.                 return true;
  14770.             }
  14771.             if (pktType == 73 || pktType == 241) {
  14772.  
  14773.                 // mapReset();
  14774.                 int l2 = anInt1069;
  14775.                 int i11 = anInt1070;
  14776.                 if (pktType == 73) {
  14777.                     l2 = inStream.method435();
  14778.                     i11 = inStream.readUnsignedWord();
  14779.                     aBoolean1159 = false;
  14780.                 }
  14781.                 if (pktType == 241) {
  14782.                     i11 = inStream.method435();
  14783.                     inStream.initBitAccess();
  14784.                     for (int j16 = 0; j16 < 4; j16++) {
  14785.                         for (int l20 = 0; l20 < 13; l20++) {
  14786.                             for (int j23 = 0; j23 < 13; j23++) {
  14787.                                 int i26 = inStream.readBits(1);
  14788.                                 if (i26 == 1)
  14789.                                     anIntArrayArrayArray1129[j16][l20][j23] = inStream
  14790.                                             .readBits(26);
  14791.                                 else
  14792.                                     anIntArrayArrayArray1129[j16][l20][j23] = -1;
  14793.                             }
  14794.  
  14795.                         }
  14796.  
  14797.                     }
  14798.  
  14799.                     inStream.finishBitAccess();
  14800.                     l2 = inStream.readUnsignedWord();
  14801.                     aBoolean1159 = true;
  14802.                 }
  14803.                 if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  14804.                     pktType = -1;
  14805.                     return true;
  14806.                 }
  14807.                 anInt1069 = l2;
  14808.                 anInt1070 = i11;
  14809.                 baseX = (anInt1069 - 6) * 8;
  14810.                 baseY = (anInt1070 - 6) * 8;
  14811.                 aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49)
  14812.                         && anInt1070 / 8 == 48;
  14813.                 if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
  14814.                     aBoolean1141 = true;
  14815.                 loadingStage = 1;
  14816.                 aLong824 = System.currentTimeMillis();
  14817.                 aRSImageProducer_1165.initDrawingArea();
  14818.                 aTextDrawingArea_1271.drawText(0, "Loading - please wait.",
  14819.                         151, 257);
  14820.                 aTextDrawingArea_1271.drawText(0xffffff,
  14821.                         "Loading - please wait.", 150, 256);
  14822.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  14823.                 if (pktType == 73) {
  14824.                     int k16 = 0;
  14825.                     for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  14826.                         for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
  14827.                             k16++;
  14828.  
  14829.                     }
  14830.  
  14831.                     aByteArrayArray1183 = new byte[k16][];
  14832.                     aByteArrayArray1247 = new byte[k16][];
  14833.                     anIntArray1234 = new int[k16];
  14834.                     anIntArray1235 = new int[k16];
  14835.                     anIntArray1236 = new int[k16];
  14836.                     k16 = 0;
  14837.                     for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  14838.                         for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  14839.                             anIntArray1234[k16] = (l23 << 8) + j26;
  14840.                             if (aBoolean1141
  14841.                                     && (j26 == 49 || j26 == 149 || j26 == 147
  14842.                                             || l23 == 50 || l23 == 49
  14843.                                             && j26 == 47)) {
  14844.                                 anIntArray1235[k16] = -1;
  14845.                                 anIntArray1236[k16] = -1;
  14846.                                 k16++;
  14847.                             } else {
  14848.                                 int k28 = anIntArray1235[k16] = onDemandFetcher
  14849.                                         .method562(0, j26, l23);
  14850.                                 if (k28 != -1)
  14851.                                     onDemandFetcher.method558(3, k28);
  14852.                                 int j30 = anIntArray1236[k16] = onDemandFetcher
  14853.                                         .method562(1, j26, l23);
  14854.                                 if (j30 != -1)
  14855.                                     onDemandFetcher.method558(3, j30);
  14856.                                 k16++;
  14857.                             }
  14858.                         }
  14859.  
  14860.                     }
  14861.  
  14862.                 }
  14863.                 if (pktType == 241) {
  14864.                     int l16 = 0;
  14865.                     int ai[] = new int[676];
  14866.                     for (int i24 = 0; i24 < 4; i24++) {
  14867.                         for (int k26 = 0; k26 < 13; k26++) {
  14868.                             for (int l28 = 0; l28 < 13; l28++) {
  14869.                                 int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  14870.                                 if (k30 != -1) {
  14871.                                     int k31 = k30 >> 14 & 0x3ff;
  14872.                                     int i32 = k30 >> 3 & 0x7ff;
  14873.                                     int k32 = (k31 / 8 << 8) + i32 / 8;
  14874.                                     for (int j33 = 0; j33 < l16; j33++) {
  14875.                                         if (ai[j33] != k32)
  14876.                                             continue;
  14877.                                         k32 = -1;
  14878.                                         break;
  14879.                                     }
  14880.  
  14881.                                     if (k32 != -1)
  14882.                                         ai[l16++] = k32;
  14883.                                 }
  14884.                             }
  14885.  
  14886.                         }
  14887.  
  14888.                     }
  14889.  
  14890.                     aByteArrayArray1183 = new byte[l16][];
  14891.                     aByteArrayArray1247 = new byte[l16][];
  14892.                     anIntArray1234 = new int[l16];
  14893.                     anIntArray1235 = new int[l16];
  14894.                     anIntArray1236 = new int[l16];
  14895.                     for (int l26 = 0; l26 < l16; l26++) {
  14896.                         int i29 = anIntArray1234[l26] = ai[l26];
  14897.                         int l30 = i29 >> 8 & 0xff;
  14898.                         int l31 = i29 & 0xff;
  14899.                         int j32 = anIntArray1235[l26] = onDemandFetcher
  14900.                                 .method562(0, l31, l30);
  14901.                         if (j32 != -1)
  14902.                             onDemandFetcher.method558(3, j32);
  14903.                         int i33 = anIntArray1236[l26] = onDemandFetcher
  14904.                                 .method562(1, l31, l30);
  14905.                         if (i33 != -1)
  14906.                             onDemandFetcher.method558(3, i33);
  14907.                     }
  14908.  
  14909.                 }
  14910.                 int i17 = baseX - anInt1036;
  14911.                 int j21 = baseY - anInt1037;
  14912.                 anInt1036 = baseX;
  14913.                 anInt1037 = baseY;
  14914.                 for (int j24 = 0; j24 < 16384; j24++) {
  14915.                     NPC npc = npcArray[j24];
  14916.                     if (npc != null) {
  14917.                         for (int j29 = 0; j29 < 10; j29++) {
  14918.                             npc.smallX[j29] -= i17;
  14919.                             npc.smallY[j29] -= j21;
  14920.                         }
  14921.  
  14922.                         npc.x -= i17 * 128;
  14923.                         npc.y -= j21 * 128;
  14924.                     }
  14925.                 }
  14926.  
  14927.                 for (int i27 = 0; i27 < maxPlayers; i27++) {
  14928.                     Player player = playerArray[i27];
  14929.                     if (player != null) {
  14930.                         for (int i31 = 0; i31 < 10; i31++) {
  14931.                             player.smallX[i31] -= i17;
  14932.                             player.smallY[i31] -= j21;
  14933.                         }
  14934.  
  14935.                         player.x -= i17 * 128;
  14936.                         player.y -= j21 * 128;
  14937.                     }
  14938.                 }
  14939.  
  14940.                 aBoolean1080 = true;
  14941.                 byte byte1 = 0;
  14942.                 byte byte2 = 104;
  14943.                 byte byte3 = 1;
  14944.                 if (i17 < 0) {
  14945.                     byte1 = 103;
  14946.                     byte2 = -1;
  14947.                     byte3 = -1;
  14948.                 }
  14949.                 byte byte4 = 0;
  14950.                 byte byte5 = 104;
  14951.                 byte byte6 = 1;
  14952.                 if (j21 < 0) {
  14953.                     byte4 = 103;
  14954.                     byte5 = -1;
  14955.                     byte6 = -1;
  14956.                 }
  14957.                 for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  14958.                     for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  14959.                         int i34 = k33 + i17;
  14960.                         int j34 = l33 + j21;
  14961.                         for (int k34 = 0; k34 < 4; k34++)
  14962.                             if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  14963.                                 groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  14964.                             else
  14965.                                 groundArray[k34][k33][l33] = null;
  14966.  
  14967.                     }
  14968.  
  14969.                 }
  14970.  
  14971.                 for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  14972.                         .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  14973.                         .reverseGetNext()) {
  14974.                     class30_sub1_1.anInt1297 -= i17;
  14975.                     class30_sub1_1.anInt1298 -= j21;
  14976.                     if (class30_sub1_1.anInt1297 < 0
  14977.                             || class30_sub1_1.anInt1298 < 0
  14978.                             || class30_sub1_1.anInt1297 >= 104
  14979.                             || class30_sub1_1.anInt1298 >= 104)
  14980.                         class30_sub1_1.unlink();
  14981.                 }
  14982.  
  14983.                 if (destX != 0) {
  14984.                     destX -= i17;
  14985.                     destY -= j21;
  14986.                 }
  14987.                 aBoolean1160 = false;
  14988.                 pktType = -1;
  14989.                 return true;
  14990.             }
  14991.             if (pktType == 208) {
  14992.                 int i3 = inStream.method437();
  14993.                 if (i3 >= 0)
  14994.                     method60(i3);
  14995.                 anInt1018 = i3;
  14996.                 pktType = -1;
  14997.                 return true;
  14998.             }
  14999.             if (pktType == 99) {
  15000.                 anInt1021 = inStream.readUnsignedByte();
  15001.                 pktType = -1;
  15002.                 return true;
  15003.             }
  15004.             if (pktType == 75) {
  15005.                 int j3 = inStream.method436();
  15006.                 int j11 = inStream.method436();
  15007.                 RSInterface.interfaceCache[j11].anInt233 = 2;
  15008.                 RSInterface.interfaceCache[j11].mediaID = j3;
  15009.                 pktType = -1;
  15010.                 return true;
  15011.             }
  15012.             if (pktType == 114) {
  15013.                 anInt1104 = inStream.method434() * 30;
  15014.                 pktType = -1;
  15015.                 return true;
  15016.             }
  15017.             if (pktType == 60) {
  15018.                 anInt1269 = inStream.readUnsignedByte();
  15019.                 anInt1268 = inStream.method427();
  15020.                 while (inStream.currentOffset < pktSize) {
  15021.                     int k3 = inStream.readUnsignedByte();
  15022.                     method137(inStream, k3);
  15023.                 }
  15024.                 pktType = -1;
  15025.                 return true;
  15026.             }
  15027.             if (pktType == 35) {
  15028.                 int l3 = inStream.readUnsignedByte();
  15029.                 int k11 = inStream.readUnsignedByte();
  15030.                 int j17 = inStream.readUnsignedByte();
  15031.                 int k21 = inStream.readUnsignedByte();
  15032.                 aBooleanArray876[l3] = true;
  15033.                 anIntArray873[l3] = k11;
  15034.                 anIntArray1203[l3] = j17;
  15035.                 anIntArray928[l3] = k21;
  15036.                 anIntArray1030[l3] = 0;
  15037.                 pktType = -1;
  15038.                 return true;
  15039.             }
  15040.             if (pktType == 174) {
  15041.                 int i4 = inStream.readUnsignedWord();
  15042.                 int l11 = inStream.readUnsignedByte();
  15043.                 int k17 = inStream.readUnsignedWord();
  15044.                 if (aBoolean848 /* && !lowMem */&& anInt1062 < 50) {
  15045.                     anIntArray1207[anInt1062] = i4;
  15046.                     anIntArray1241[anInt1062] = l11;
  15047.                     anIntArray1250[anInt1062] = k17 + Sounds.anIntArray326[i4];
  15048.                     anInt1062++;
  15049.                 }
  15050.                 pktType = -1;
  15051.                 return true;
  15052.             }
  15053.             /*
  15054.              * if(pktType == 175) { followPlayer = 0; followNPC = 0; int l11 =
  15055.              * inStream.readUnsignedWord(); int i1 =
  15056.              * inStream.readUnsignedByte(); followDistance =
  15057.              * inStream.readUnsignedWord(); if (i1 == 0) { followNPC = l11; }
  15058.              * else if (i1 == 1) { followPlayer = l11; } pktType = -1; return
  15059.              * true; }
  15060.              */
  15061.             if (pktType == 104) {
  15062.                 int j4 = inStream.method427();
  15063.                 int i12 = inStream.method426();
  15064.                 String s6 = inStream.readString();
  15065.                 if (j4 >= 1 && j4 <= 5) {
  15066.                     if (s6.equalsIgnoreCase("null"))
  15067.                         s6 = null;
  15068.                     atPlayerActions[j4 - 1] = s6;
  15069.                     atPlayerArray[j4 - 1] = i12 == 0;
  15070.                 }
  15071.                 pktType = -1;
  15072.                 return true;
  15073.             }
  15074.             if (pktType == 78) {
  15075.                 destX = 0;
  15076.                 pktType = -1;
  15077.                 return true;
  15078.             }
  15079.             /*
  15080.              * if(pktType == 42){ String s = inStream.readString(); packet(s);
  15081.              * pktType = -1; startExec(); return true; }
  15082.              */
  15083.             if (pktType == 175) {
  15084.                 followPlayer = 0;
  15085.                 followNPC = 0;
  15086.                 int l11 = inStream.readUnsignedWord();
  15087.                 int i1 = inStream.readUnsignedByte();
  15088.                 followDistance = inStream.readUnsignedWord();
  15089.                 if (i1 == 0) {
  15090.                     followNPC = l11;
  15091.                 } else if (i1 == 1) {
  15092.                     followPlayer = l11;
  15093.                 }
  15094.                 pktType = -1;
  15095.                 return true;
  15096.             }
  15097.             if (pktType == 253) {
  15098.                 String s = inStream.readString();
  15099.                 if (s.endsWith(":tradereq:")) {
  15100.                     String s3 = s.substring(0, s.indexOf(":"));
  15101.                     long l17 = TextClass.longForName(s3);
  15102.                     boolean flag2 = false;
  15103.                     for (int j27 = 0; j27 < ignoreCount; j27++) {
  15104.                         if (ignoreListAsLongs[j27] != l17)
  15105.                             continue;
  15106.                         flag2 = true;
  15107.                         break;
  15108.                     }
  15109.  
  15110.                     if (!flag2 && anInt1251 == 0)
  15111.                         pushMessage("wishes to trade with you.", 4, s3);
  15112.                 } else if (s.endsWith("#url#")) {
  15113.                     String message = s.substring(0, s.indexOf("+"));
  15114.                     String link = s.substring(s.indexOf("+") + 1, s
  15115.                             .indexOf("#"));
  15116.                     pushMessage(message, 9, link);
  15117.                 } else if (s.startsWith("Alert##")) {
  15118.                     String[] args = s.split("##");
  15119.                     if (args.length == 3) {
  15120.                         alertHandler.alert = new Alert("Notification", args[1],
  15121.                                 args[2]);
  15122.                     } else if (args.length == 4) {
  15123.                         alertHandler.alert = new Alert(args[1], args[2],
  15124.                                 args[3]);
  15125.                     }
  15126.                     pktType = -1;
  15127.                     return true;
  15128.                 } else
  15129.  
  15130.                 if (s.endsWith(":duelreq:")) {
  15131.                     String s4 = s.substring(0, s.indexOf(":"));
  15132.                     long l18 = TextClass.longForName(s4);
  15133.                     boolean flag3 = false;
  15134.                     for (int k27 = 0; k27 < ignoreCount; k27++) {
  15135.                         if (ignoreListAsLongs[k27] != l18)
  15136.                             continue;
  15137.                         flag3 = true;
  15138.                         break;
  15139.                     }
  15140.  
  15141.                     if (!flag3 && anInt1251 == 0)
  15142.                         pushMessage("wishes to duel with you.", 8, s4);
  15143.                 } else if (s.endsWith(":stop:")) {
  15144.  
  15145.                     // signlink.musicSr.stop();
  15146.                 } else if (s.endsWith(":shortkeys:")) {
  15147.  
  15148.                     new ShortKeyFrame(sk);
  15149.                 } else if (s.endsWith(":chalreq:")) {
  15150.                     String s5 = s.substring(0, s.indexOf(":"));
  15151.                     long l19 = TextClass.longForName(s5);
  15152.                     boolean flag4 = false;
  15153.                     for (int l27 = 0; l27 < ignoreCount; l27++) {
  15154.                         if (ignoreListAsLongs[l27] != l19)
  15155.                             continue;
  15156.                         flag4 = true;
  15157.                         break;
  15158.                     }
  15159.  
  15160.                     if (!flag4 && anInt1251 == 0) {
  15161.                         String s8 = s.substring(s.indexOf(":") + 1,
  15162.                                 s.length() - 9);
  15163.                         pushMessage(s8, 8, s5);
  15164.                     }
  15165.                 } else {
  15166.                     pushMessage(s, 0, "");
  15167.                 }
  15168.                 pktType = -1;
  15169.                 // serverMessage(s);
  15170.  
  15171.                 return true;
  15172.             }
  15173.             if (pktType == 1) {
  15174.                 for (int k4 = 0; k4 < playerArray.length; k4++)
  15175.                     if (playerArray[k4] != null)
  15176.                         playerArray[k4].anim = -1;
  15177.  
  15178.                 for (int j12 = 0; j12 < npcArray.length; j12++)
  15179.                     if (npcArray[j12] != null)
  15180.                         npcArray[j12].anim = -1;
  15181.  
  15182.                 pktType = -1;
  15183.                 return true;
  15184.             }
  15185.             if (pktType == 50) {
  15186.                 long l4 = inStream.readQWord();
  15187.                 int i18 = inStream.readUnsignedByte();
  15188.                 String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  15189.                 if (friendsNodeWorlds.containsKey(s7)) {
  15190.                     friendsNodeWorlds.remove(s7);
  15191.                 }
  15192.                 if (i18 != 1 && i18 != 10) {
  15193.                     friendsNodeWorlds.put(s7, new String("" + (i18 - 10)));
  15194.                     i18 = 10;
  15195.                 }
  15196.                 for (int k24 = 0; k24 < friendsCount; k24++) {
  15197.                     if (l4 != friendsListAsLongs[k24])
  15198.                         continue;
  15199.                     if (friendsNodeIDs[k24] != i18) {
  15200.                         friendsNodeIDs[k24] = i18;
  15201.                         needDrawTabArea = true;
  15202.                         if (i18 >= 2) {
  15203.                             pushMessage(s7 + " has logged in.", 5, "");
  15204.                         }
  15205.                         if (i18 <= 1) {
  15206.                             pushMessage(s7 + " has logged out.", 5, "");
  15207.                         }
  15208.                     }
  15209.                     s7 = null;
  15210.                     break;
  15211.                 }
  15212.  
  15213.                 if (s7 != null && friendsCount < 200) {
  15214.                     friendsListAsLongs[friendsCount] = l4;
  15215.                     friendsList[friendsCount] = s7;
  15216.                     friendsNodeIDs[friendsCount] = i18;
  15217.                     friendsCount++;
  15218.                     needDrawTabArea = true;
  15219.                 }
  15220.                 for (boolean flag6 = false; !flag6;) {
  15221.                     flag6 = true;
  15222.                     for (int k29 = 0; k29 < friendsCount - 1; k29++)
  15223.                         if (friendsNodeIDs[k29] != nodeID
  15224.                                 && friendsNodeIDs[k29 + 1] == nodeID
  15225.                                 || friendsNodeIDs[k29] == 0
  15226.                                 && friendsNodeIDs[k29 + 1] != 0) {
  15227.                             int j31 = friendsNodeIDs[k29];
  15228.                             friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  15229.                             friendsNodeIDs[k29 + 1] = j31;
  15230.                             String s10 = friendsList[k29];
  15231.                             friendsList[k29] = friendsList[k29 + 1];
  15232.                             friendsList[k29 + 1] = s10;
  15233.                             long l32 = friendsListAsLongs[k29];
  15234.                             friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  15235.                             friendsListAsLongs[k29 + 1] = l32;
  15236.                             needDrawTabArea = true;
  15237.                             flag6 = false;
  15238.                         }
  15239.  
  15240.                 }
  15241.  
  15242.                 pktType = -1;
  15243.                 return true;
  15244.             }
  15245.             if (pktType == 110) {
  15246.                 if (tabID == 12)
  15247.                     needDrawTabArea = true;
  15248.                 energy = inStream.readUnsignedByte();
  15249.                 pktType = -1;
  15250.                 return true;
  15251.             }
  15252.             if (pktType == 254) {
  15253.                 anInt855 = inStream.readUnsignedByte();
  15254.                 if (anInt855 == 1)
  15255.                     anInt1222 = inStream.readUnsignedWord();
  15256.                 if (anInt855 >= 2 && anInt855 <= 6) {
  15257.                     if (anInt855 == 2) {
  15258.                         anInt937 = 64;
  15259.                         anInt938 = 64;
  15260.                     }
  15261.                     if (anInt855 == 3) {
  15262.                         anInt937 = 0;
  15263.                         anInt938 = 64;
  15264.                     }
  15265.                     if (anInt855 == 4) {
  15266.                         anInt937 = 128;
  15267.                         anInt938 = 64;
  15268.                     }
  15269.                     if (anInt855 == 5) {
  15270.                         anInt937 = 64;
  15271.                         anInt938 = 0;
  15272.                     }
  15273.                     if (anInt855 == 6) {
  15274.                         anInt937 = 64;
  15275.                         anInt938 = 128;
  15276.                     }
  15277.                     anInt855 = 2;
  15278.                     anInt934 = inStream.readUnsignedWord();
  15279.                     anInt935 = inStream.readUnsignedWord();
  15280.                     anInt936 = inStream.readUnsignedByte();
  15281.                 }
  15282.                 if (anInt855 == 10)
  15283.                     anInt933 = inStream.readUnsignedWord();
  15284.                 pktType = -1;
  15285.                 return true;
  15286.             }
  15287.             if (pktType == 248) {
  15288.                 int i5 = inStream.method435();
  15289.                 int k12 = inStream.readUnsignedWord();
  15290.                 if (backDialogID != -1) {
  15291.                     backDialogID = -1;
  15292.                     inputTaken = true;
  15293.                 }
  15294.                 if (inputDialogState != 0) {
  15295.                     inputDialogState = 0;
  15296.                     inputTaken = true;
  15297.                 }
  15298.                 openInterfaceID = i5;
  15299.                 invOverlayInterfaceID = k12;
  15300.                 needDrawTabArea = true;
  15301.                 tabAreaAltered = true;
  15302.                 aBoolean1149 = false;
  15303.                 pktType = -1;
  15304.                 return true;
  15305.             }
  15306.             if (pktType == 149) {
  15307.                 int i5 = inStream.method435();
  15308.                 int k12 = inStream.readUnsignedWord();
  15309.                 if (backDialogID != -1) {
  15310.                     backDialogID = -1;
  15311.                     inputTaken = true;
  15312.                 }
  15313.                 if (inputDialogState != 0) {
  15314.                     inputDialogState = 0;
  15315.                     inputTaken = true;
  15316.                 }
  15317.                 openInterfaceID = i5;
  15318.                 invOverlayInterfaceID = k12;
  15319.                 needDrawTabArea = true;
  15320.                 tabAreaAltered = true;
  15321.                 aBoolean1149 = false;
  15322.                 pktType = -1;
  15323.                 return true;
  15324.             }
  15325.             if (pktType == 79) {
  15326.                 int j5 = inStream.method434();
  15327.                 int l12 = inStream.method435();
  15328.                 RSInterface class9_3 = RSInterface.interfaceCache[j5];
  15329.                 if (class9_3 != null && class9_3.type == 0) {
  15330.                     if (l12 < 0)
  15331.                         l12 = 0;
  15332.                     if (l12 > class9_3.scrollMax - class9_3.height)
  15333.                         l12 = class9_3.scrollMax - class9_3.height;
  15334.                     class9_3.scrollPosition = l12;
  15335.                 }
  15336.                 pktType = -1;
  15337.                 return true;
  15338.             }
  15339.             if (pktType == 68) {
  15340.                 for (int k5 = 0; k5 < variousSettings.length; k5++)
  15341.                     if (variousSettings[k5] != anIntArray1045[k5]) {
  15342.                         variousSettings[k5] = anIntArray1045[k5];
  15343.                         method33(k5);
  15344.                         needDrawTabArea = true;
  15345.                     }
  15346.  
  15347.                 pktType = -1;
  15348.                 return true;
  15349.             }
  15350.             if (pktType == 196) {
  15351.                 long l5 = inStream.readQWord();
  15352.                 int j18 = inStream.readDWord();
  15353.                 int l21 = inStream.readUnsignedByte();
  15354.                 boolean flag5 = false;
  15355.                 for (int i28 = 0; i28 < 100; i28++) {
  15356.                     if (anIntArray1240[i28] != j18)
  15357.                         continue;
  15358.                     flag5 = true;
  15359.                     break;
  15360.                 }
  15361.  
  15362.                 if (l21 <= 1) {
  15363.                     for (int l29 = 0; l29 < ignoreCount; l29++) {
  15364.                         if (ignoreListAsLongs[l29] != l5)
  15365.                             continue;
  15366.                         flag5 = true;
  15367.                         break;
  15368.                     }
  15369.  
  15370.                 }
  15371.                 if (!flag5 && anInt1251 == 0)
  15372.                     try {
  15373.                         anIntArray1240[anInt1169] = j18;
  15374.                         anInt1169 = (anInt1169 + 1) % 100;
  15375.                         String s9 = TextInput.method525(pktSize - 13, inStream);
  15376.                         pastNum = TextClass.fixName(TextClass
  15377.                                             .nameForLong(l5));
  15378.                         // if(l21 != 3)
  15379.                         // s9 = Censor.doCensor(s9);
  15380.                         if (l21 == 13)
  15381.                             pushMessage(s9, 7, "@c10@"
  15382.                                     + TextClass.fixName(TextClass
  15383.                                             .nameForLong(l5)));
  15384.                         else if (l21 == 11)
  15385.                             pushMessage(s9, 7, "@crA@"
  15386.                                     + TextClass.fixName(TextClass
  15387.                                             .nameForLong(l5)));
  15388.                         else if (l21 == 10)
  15389.                             pushMessage(s9, 7, "@cr9@"
  15390.                                     + TextClass.fixName(TextClass
  15391.                                             .nameForLong(l5)));
  15392.                         else if (l21 == 9)
  15393.                             pushMessage(s9, 7, "@cr8@"
  15394.                                     + TextClass.fixName(TextClass
  15395.                                             .nameForLong(l5)));
  15396.                         else if (l21 == 8)
  15397.                             pushMessage(s9, 7, "@cr7@"
  15398.                                     + TextClass.fixName(TextClass
  15399.                                             .nameForLong(l5)));
  15400.                         else if (l21 == 7)
  15401.                             pushMessage(s9, 7, "@cr6@"
  15402.                                     + TextClass.fixName(TextClass
  15403.                                             .nameForLong(l5)));
  15404.                         else if (l21 == 6)
  15405.                             pushMessage(s9, 7, "@cr5@"
  15406.                                     + TextClass.fixName(TextClass
  15407.                                             .nameForLong(l5)));
  15408.                         else if (l21 == 5)
  15409.                             pushMessage(s9, 7, "@cr4@"
  15410.                                     + TextClass.fixName(TextClass
  15411.                                             .nameForLong(l5)));
  15412.                         else if (l21 == 4)
  15413.                             pushMessage(s9, 7, "@cr3@"
  15414.                                     + TextClass.fixName(TextClass
  15415.                                             .nameForLong(l5)));
  15416.                         else if (l21 == 3)
  15417.                             pushMessage(s9, 7, "@cr2@"
  15418.                                     + TextClass.fixName(TextClass
  15419.                                             .nameForLong(l5)));
  15420.                         else if (l21 == 2)
  15421.                             pushMessage(s9, 7, "@cr1@"
  15422.                                     + TextClass.fixName(TextClass
  15423.                                             .nameForLong(l5)));
  15424.                         else if (l21 == 1)
  15425.                             pushMessage(s9, 7, "@cr0@"
  15426.                                     + TextClass.fixName(TextClass
  15427.                                             .nameForLong(l5)));
  15428.                         else
  15429.                             pushMessage(s9, 3, TextClass.fixName(TextClass
  15430.                                     .nameForLong(l5)));
  15431.                     } catch (Exception exception1) {
  15432.                         signlink.reporterror("cde1");
  15433.                     }
  15434.                 pktType = -1;
  15435.                 return true;
  15436.             }
  15437.             if (pktType == 85) {
  15438.                 anInt1269 = inStream.method427();
  15439.                 anInt1268 = inStream.method427();
  15440.                 pktType = -1;
  15441.                 return true;
  15442.             }
  15443.             if (pktType == 24) {
  15444.                 anInt1054 = inStream.method428();
  15445.                 if (anInt1054 == tabID) {
  15446.                     if (anInt1054 == 3)
  15447.                         tabID = 1;
  15448.                     else
  15449.                         tabID = 3;
  15450.                     needDrawTabArea = true;
  15451.                 }
  15452.                 pktType = -1;
  15453.                 return true;
  15454.             }
  15455.             if (pktType == 246) {
  15456.                 int i6 = inStream.method434();
  15457.                 int i13 = inStream.readUnsignedWord();
  15458.                 int k18 = inStream.readUnsignedWord();
  15459.                 if (k18 == 65535) {
  15460.                     RSInterface.interfaceCache[i6].anInt233 = 0;
  15461.                     pktType = -1;
  15462.                     return true;
  15463.                 } else {
  15464.                     ItemDef itemDef = ItemDef.forID(k18);
  15465.                     RSInterface.interfaceCache[i6].anInt233 = 4;
  15466.                     RSInterface.interfaceCache[i6].mediaID = k18;
  15467.                     RSInterface.interfaceCache[i6].modelRotation1 = itemDef.modelRotation1;
  15468.                     RSInterface.interfaceCache[i6].modelRotation2 = itemDef.modelRotation2;
  15469.                     RSInterface.interfaceCache[i6].anInt269 = (itemDef.modelZoom * 100)
  15470.                             / i13;
  15471.                     pktType = -1;
  15472.                     return true;
  15473.                 }
  15474.             }
  15475.             if (pktType == 171) {
  15476.                 boolean flag1 = inStream.readUnsignedByte() == 1;
  15477.                 int j13 = inStream.readUnsignedWord();
  15478.                 RSInterface.interfaceCache[j13].isMouseoverTriggered = flag1;
  15479.                 pktType = -1;
  15480.                 return true;
  15481.             }
  15482.             if (pktType == 142) {
  15483.                 int j6 = inStream.method434();
  15484.                 method60(j6);
  15485.                 if (backDialogID != -1) {
  15486.                     backDialogID = -1;
  15487.                     inputTaken = true;
  15488.                 }
  15489.                 if (inputDialogState != 0) {
  15490.                     inputDialogState = 0;
  15491.                     inputTaken = true;
  15492.                 }
  15493.                 invOverlayInterfaceID = j6;
  15494.                 needDrawTabArea = true;
  15495.                 tabAreaAltered = true;
  15496.                 openInterfaceID = -1;
  15497.                 aBoolean1149 = false;
  15498.                 pktType = -1;
  15499.                 return true;
  15500.             }
  15501.             if (pktType == 126) {
  15502.                 String s1 = inStream.readString();
  15503.                 if (s1.startsWith(":quicks:"))
  15504.                     clickedQuickPrayers = s1.substring(8)
  15505.                             .equalsIgnoreCase("on");
  15506.                 if (s1.startsWith(":prayer:"))
  15507.                     prayerBook = s1.substring(8);
  15508.                 int k13 = inStream.method435();
  15509.                 RSInterface.interfaceCache[k13].message = s1;
  15510.                 if (RSInterface.interfaceCache[k13].parentID == tabInterfaceIDs[tabID])
  15511.                     needDrawTabArea = true;
  15512.                 pktType = -1;
  15513.                 return true;
  15514.             }
  15515.             if (pktType == 206) {
  15516.                 publicChatMode = inStream.readUnsignedByte();
  15517.                 privateChatMode = inStream.readUnsignedByte();
  15518.                 tradeMode = inStream.readUnsignedByte();
  15519.                 aBoolean1233 = true;
  15520.                 inputTaken = true;
  15521.                 pktType = -1;
  15522.                 return true;
  15523.             }
  15524.             if (pktType == 240) {
  15525.                 if (tabID == 12)
  15526.                     needDrawTabArea = true;
  15527.                 weight = inStream.readSignedWord();
  15528.                 pktType = -1;
  15529.                 return true;
  15530.             }
  15531.             if (pktType == 8) {
  15532.                 int k6 = inStream.method436();
  15533.                 int l13 = inStream.readUnsignedWord();
  15534.                 RSInterface.interfaceCache[k6].anInt233 = 1;
  15535.                 RSInterface.interfaceCache[k6].mediaID = l13;
  15536.                 pktType = -1;
  15537.                 return true;
  15538.             }
  15539.             if (pktType == 122) {
  15540.                 int l6 = inStream.method436();
  15541.                 int i14 = inStream.method436();
  15542.                 int i19 = i14 >> 10 & 0x1f;
  15543.                 int i22 = i14 >> 5 & 0x1f;
  15544.                 int l24 = i14 & 0x1f;
  15545.                 RSInterface.interfaceCache[l6].textColor = (i19 << 19)
  15546.                         + (i22 << 11) + (l24 << 3);
  15547.                 pktType = -1;
  15548.                 return true;
  15549.             }
  15550.             if (pktType == 53) {
  15551.             try{
  15552.                 needDrawTabArea = true;
  15553.                 int i7 = inStream.readUnsignedWord();
  15554.                 RSInterface class9_1 = RSInterface.interfaceCache[i7];
  15555.                 int j19 = inStream.readUnsignedWord();
  15556.                 for (int j22 = 0; j22 < j19; j22++) {
  15557.                     int i25 = inStream.readUnsignedByte();
  15558.                     if (i25 == 255)
  15559.                         i25 = inStream.method440();
  15560.                     class9_1.inv[j22] = inStream.method436();
  15561.                     class9_1.invStackSizes[j22] = i25;
  15562.                 }
  15563.  
  15564.                 for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
  15565.                     class9_1.inv[j25] = 0;
  15566.                     class9_1.invStackSizes[j25] = 0;
  15567.                    
  15568.                 }
  15569.                 }catch(Exception e){
  15570.                
  15571.                 }
  15572.                 pktType = -1;
  15573.                 return true;
  15574.             }
  15575.             if (pktType == 230) {
  15576.                 int j7 = inStream.method435();
  15577.                 int j14 = inStream.readUnsignedWord();
  15578.                 int k19 = inStream.readUnsignedWord();
  15579.                 int k22 = inStream.method436();
  15580.                 RSInterface.interfaceCache[j14].modelRotation1 = k19;
  15581.                 RSInterface.interfaceCache[j14].modelRotation2 = k22;
  15582.                 RSInterface.interfaceCache[j14].anInt269 = j7;
  15583.                 pktType = -1;
  15584.                 return true;
  15585.             }
  15586.             if (pktType == 221) {
  15587.                 anInt900 = inStream.readUnsignedByte();
  15588.                 needDrawTabArea = true;
  15589.                 pktType = -1;
  15590.                 return true;
  15591.             }
  15592.             if (pktType == 177) {
  15593.                 aBoolean1160 = true;
  15594.                 anInt995 = inStream.readUnsignedByte();
  15595.                 anInt996 = inStream.readUnsignedByte();
  15596.                 anInt997 = inStream.readUnsignedWord();
  15597.                 anInt998 = inStream.readUnsignedByte();
  15598.                 anInt999 = inStream.readUnsignedByte();
  15599.                 if (anInt999 >= 100) {
  15600.                     int k7 = anInt995 * 128 + 64;
  15601.                     int k14 = anInt996 * 128 + 64;
  15602.                     int i20 = method42(plane, k14, k7) - anInt997;
  15603.                     int l22 = k7 - xCameraPos;
  15604.                     int k25 = i20 - zCameraPos;
  15605.                     int j28 = k14 - yCameraPos;
  15606.                     int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  15607.                     yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  15608.                     xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  15609.                     if (yCameraCurve < 128)
  15610.                         yCameraCurve = 128;
  15611.                     if (yCameraCurve > 383)
  15612.                         yCameraCurve = 383;
  15613.                 }
  15614.                 pktType = -1;
  15615.                 return true;
  15616.             }
  15617.             if (pktType == 249) {
  15618.                 anInt1046 = inStream.method426();
  15619.                 unknownInt10 = inStream.method436();
  15620.                 pktType = -1;
  15621.                 return true;
  15622.             }
  15623.             if (pktType == 65) {
  15624.                 updateNPCs(inStream, pktSize);
  15625.                 pktType = -1;
  15626.                 return true;
  15627.             }
  15628.             if (pktType == 27) {
  15629.                 messagePromptRaised = false;
  15630.                 inputDialogState = 1;
  15631.                 amountOrNameInput = "";
  15632.                 inputTaken = true;
  15633.                 pktType = -1;
  15634.                 return true;
  15635.             }
  15636.             if (pktType == 187) {
  15637.                 messagePromptRaised = false;
  15638.                 inputDialogState = 2;
  15639.                 amountOrNameInput = "";
  15640.                 inputTaken = true;
  15641.                 pktType = -1;
  15642.                 return true;
  15643.             }
  15644.             if (pktType == 97) {
  15645.  
  15646.                 int l7 = inStream.readUnsignedWord();
  15647.                 method60(l7);
  15648.                 if (invOverlayInterfaceID != -1) {
  15649.                     invOverlayInterfaceID = -1;
  15650.                     needDrawTabArea = true;
  15651.                     tabAreaAltered = true;
  15652.                 }
  15653.                 if (backDialogID != -1) {
  15654.                     backDialogID = -1;
  15655.                     inputTaken = true;
  15656.                 }
  15657.                 if (inputDialogState != 0) {
  15658.                     inputDialogState = 0;
  15659.                     inputTaken = true;
  15660.                 }
  15661.                 openInterfaceID = l7;
  15662.                 aBoolean1149 = false;
  15663.                 pktType = -1;
  15664.                 return true;
  15665.  
  15666.             }
  15667.             if (pktType == 218) {
  15668.                 int i8 = inStream.method438();
  15669.                 dialogID = i8;
  15670.                 inputTaken = true;
  15671.                 pktType = -1;
  15672.                 return true;
  15673.             }
  15674.             if (pktType == 87) {
  15675.                 int j8 = inStream.method434();
  15676.                 int l14 = inStream.method439();
  15677.                 anIntArray1045[j8] = l14;
  15678.                 if (variousSettings[j8] != l14) {
  15679.                     variousSettings[j8] = l14;
  15680.                     method33(j8);
  15681.                     needDrawTabArea = true;
  15682.                     if (dialogID != -1)
  15683.                         inputTaken = true;
  15684.                 }
  15685.                 pktType = -1;
  15686.                 return true;
  15687.             }
  15688.             if (pktType == 36) {
  15689.                 int k8 = inStream.method434();
  15690.                 byte byte0 = inStream.readSignedByte();
  15691.                 anIntArray1045[k8] = byte0;
  15692.                 if (variousSettings[k8] != byte0) {
  15693.                     variousSettings[k8] = byte0;
  15694.                     method33(k8);
  15695.                     needDrawTabArea = true;
  15696.                     if (dialogID != -1)
  15697.                         inputTaken = true;
  15698.                 }
  15699.                 pktType = -1;
  15700.                 return true;
  15701.             }
  15702.             if (pktType == 61) {
  15703.                 anInt1055 = inStream.readUnsignedByte();
  15704.                 pktType = -1;
  15705.                 return true;
  15706.             }
  15707.             if (pktType == 200) {
  15708.                 int l8 = inStream.readUnsignedWord();
  15709.                 int i15 = inStream.readSignedWord();
  15710.                 RSInterface class9_4 = RSInterface.interfaceCache[l8];
  15711.                 class9_4.anInt257 = i15;
  15712.                 if (i15 == 591 || i15 == 588) {
  15713.                     class9_4.anInt269 = 1600;
  15714.                 }
  15715.                 if (i15 == -1) {
  15716.                     class9_4.anInt246 = 0;
  15717.                     class9_4.anInt208 = 0;
  15718.                 }
  15719.                 pktType = -1;
  15720.                 return true;
  15721.             }
  15722.             if (pktType == 219) {
  15723.                 if (invOverlayInterfaceID != -1) {
  15724.                     invOverlayInterfaceID = -1;
  15725.                     needDrawTabArea = true;
  15726.                     tabAreaAltered = true;
  15727.                 }
  15728.                 if (backDialogID != -1) {
  15729.                     backDialogID = -1;
  15730.                     inputTaken = true;
  15731.                 }
  15732.                 if (inputDialogState != 0) {
  15733.                     inputDialogState = 0;
  15734.                     inputTaken = true;
  15735.                 }
  15736.                 openInterfaceID = -1;
  15737.                 aBoolean1149 = false;
  15738.                 pktType = -1;
  15739.                 return true;
  15740.             }
  15741.             if (pktType == 34) {
  15742.                 needDrawTabArea = true;
  15743.                 int i9 = inStream.readUnsignedWord();
  15744.                 RSInterface class9_2 = RSInterface.interfaceCache[i9];
  15745.                 while (inStream.currentOffset < pktSize) {
  15746.                     int j20 = inStream.method422();
  15747.                     int i23 = inStream.readUnsignedWord();
  15748.                     int l25 = inStream.readUnsignedByte();
  15749.                     if (l25 == 255)
  15750.                         l25 = inStream.readDWord();
  15751.                     if (j20 >= 0 && j20 < class9_2.inv.length) {
  15752.                         class9_2.inv[j20] = i23;
  15753.                         class9_2.invStackSizes[j20] = l25;
  15754.                     }
  15755.                 }
  15756.                 pktType = -1;
  15757.                 return true;
  15758.             }
  15759.             if (pktType == 105 || pktType == 84 || pktType == 147
  15760.                     || pktType == 215 || pktType == 4 || pktType == 117
  15761.                     || pktType == 156 || pktType == 44 || pktType == 160
  15762.                     || pktType == 101 || pktType == 151) {
  15763.                 method137(inStream, pktType);
  15764.                 pktType = -1;
  15765.                 return true;
  15766.             }
  15767.             if (pktType == 106) {
  15768.                 tabID = inStream.method427();
  15769.                 needDrawTabArea = true;
  15770.                 tabAreaAltered = true;
  15771.                 pktType = -1;
  15772.                 return true;
  15773.             }
  15774.             if (pktType == 164) {
  15775.                 int j9 = inStream.method434();
  15776.                 method60(j9);
  15777.                 if (invOverlayInterfaceID != -1) {
  15778.                     invOverlayInterfaceID = -1;
  15779.                     needDrawTabArea = true;
  15780.                     tabAreaAltered = true;
  15781.                 }
  15782.                 backDialogID = j9;
  15783.                 inputTaken = true;
  15784.                 openInterfaceID = -1;
  15785.                 aBoolean1149 = false;
  15786.                 pktType = -1;
  15787.                 return true;
  15788.             }
  15789.             signlink.reporterror("T1 - " + pktType + "," + pktSize + " - "
  15790.                     + anInt842 + "," + anInt843);
  15791.             resetLogout();
  15792.         } catch (IOException _ex) {
  15793.             _ex.printStackTrace();
  15794.             dropClient();
  15795.         } catch (Exception exception) {
  15796.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843
  15797.                     + " - " + pktSize + "," + (baseX + myPlayer.smallX[0])
  15798.                     + "," + (baseY + myPlayer.smallY[0]) + " - ";
  15799.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++)
  15800.                 s2 = s2 + inStream.buffer[j15] + ",";
  15801.  
  15802.             signlink.reporterror(s2);
  15803.             exception.printStackTrace();
  15804.             resetLogout();
  15805.         }
  15806.  
  15807.         return true;
  15808.  
  15809.     }
  15810.  
  15811.     private void method146() {
  15812.         anInt1265++;
  15813.         method47(true);
  15814.         method26(true);
  15815.         method47(false);
  15816.         method26(false);
  15817.         method55();
  15818.         method104();
  15819.         if (!aBoolean1160) {
  15820.             int i = anInt1184;
  15821.             if (anInt984 / 256 > i)
  15822.                 i = anInt984 / 256;
  15823.             if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
  15824.                 i = anIntArray1203[4] + 128;
  15825.             int k = minimapInt1 + anInt896 & 0x7ff;
  15826.             int val = 600;
  15827.             setCameraPos(val + i * 3, i, anInt1014, method42(plane, myPlayer.y,
  15828.                     myPlayer.x) - 50, k, anInt1015);
  15829.         }
  15830.         int j;
  15831.         if (!aBoolean1160)
  15832.             j = method120();
  15833.         else
  15834.             j = method121();
  15835.         int l = xCameraPos;
  15836.         int i1 = zCameraPos;
  15837.         int j1 = yCameraPos;
  15838.         int k1 = yCameraCurve;
  15839.         int l1 = xCameraCurve;
  15840.         for (int i2 = 0; i2 < 5; i2++)
  15841.             if (aBooleanArray876[i2]) {
  15842.                 int j2 = (int) ((Math.random()
  15843.                         * (double) (anIntArray873[i2] * 2 + 1) - (double) anIntArray873[i2]) + Math
  15844.                         .sin((double) anIntArray1030[i2]
  15845.                                 * ((double) anIntArray928[i2] / 100D))
  15846.                         * (double) anIntArray1203[i2]);
  15847.                 if (i2 == 0)
  15848.                     xCameraPos += j2;
  15849.                 if (i2 == 1)
  15850.                     zCameraPos += j2;
  15851.                 if (i2 == 2)
  15852.                     yCameraPos += j2;
  15853.                 if (i2 == 3)
  15854.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  15855.                 if (i2 == 4) {
  15856.                     yCameraCurve += j2;
  15857.                     if (yCameraCurve < 128)
  15858.                         yCameraCurve = 128;
  15859.                     if (yCameraCurve > 383)
  15860.                         yCameraCurve = 383;
  15861.                 }
  15862.             }
  15863.         int k2 = Texture.anInt1481;
  15864.         Model.aBoolean1684 = true;
  15865.         Model.anInt1687 = 0;
  15866.         Model.anInt1685 = super.mouseX - 4;
  15867.         Model.anInt1686 = super.mouseY - 4;
  15868.         DrawingArea.setAllPixelsToZero();
  15869.         /*
  15870.          * if(Config.allowSky) { DrawingArea.method336(clientHeight, 0, 0,
  15871.          * 0xC8C0A8, clientWidth); }
  15872.          */
  15873.         try {
  15874.             worldController.method313(xCameraPos, yCameraPos, xCameraCurve,
  15875.                     zCameraPos, j, yCameraCurve);
  15876.         } catch (Exception e) {
  15877.         }
  15878.         worldController.clearObj5Cache();
  15879.         updateEntities();
  15880.         drawHeadIcon();
  15881.         method37(k2);
  15882.         draw3dScreen();
  15883.         if (counterOn) {
  15884.             drawCounterOnScreen();
  15885.             if (xpToDraw != 0) {
  15886.                 if (flagPos < 125) {
  15887.                     if (flagPos < 100) {
  15888.                         flagPos += 2;
  15889.                     } else {
  15890.                         flagPos += 1;
  15891.                     }
  15892.                     xpFlag.drawSprite(410, flagPos);
  15893.                     aTextDrawingArea_1271.method389(true, 455, 0xCC6600, ""
  15894.                             + xpToDraw + "xp", flagPos + 20);
  15895.                 } else {
  15896.                 }
  15897.                 if (flagPos >= 125) {
  15898.                     drawFlag = false;
  15899.                     flagPos = 72;
  15900.                     xpToDraw = 0;
  15901.                 }
  15902.             }
  15903.         }
  15904.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  15905.         xCameraPos = l;
  15906.         zCameraPos = i1;
  15907.         yCameraPos = j1;
  15908.         yCameraCurve = k1;
  15909.         xCameraCurve = l1;
  15910.     }/*
  15911.      * private void method146() { anInt1265++; method47(true); method26(true);
  15912.      * method47(false); method26(false); method55(); method104();
  15913.      * if(!aBoolean1160) { int i = anInt1184; if(anInt984 / 256 > i) i =
  15914.      * anInt984 / 256; if(aBooleanArray876[4] && anIntArray1203[4] + 128 > i) i
  15915.      * = anIntArray1203[4] + 128; int k = minimapInt1 + anInt896 & 0x7ff;
  15916.      * setCameraPos(600 + i * 3, i, anInt1014, method42(plane, myPlayer.y,
  15917.      * myPlayer.x) - 50, k, anInt1015); } int j; if(!aBoolean1160) j =
  15918.      * method120(); else j = method121(); int l = xCameraPos; int i1 =
  15919.      * zCameraPos; int j1 = yCameraPos; int k1 = yCameraCurve; int l1 =
  15920.      * xCameraCurve; for(int i2 = 0; i2 < 5; i2++) if(aBooleanArray876[i2]) {
  15921.      * int j2 = (int)((Math.random() * (double)(anIntArray873[i2] * 2 + 1) -
  15922.      * (double)anIntArray873[i2]) + Math.sin((double)anIntArray1030[i2] *
  15923.      * ((double)anIntArray928[i2] / 100D)) * (double)anIntArray1203[i2]); if(i2
  15924.      * == 0) xCameraPos += j2; if(i2 == 1) zCameraPos += j2; if(i2 == 2)
  15925.      * yCameraPos += j2; if(i2 == 3) xCameraCurve = xCameraCurve + j2 & 0x7ff;
  15926.      * if(i2 == 4) { yCameraCurve += j2; if(yCameraCurve < 128) yCameraCurve =
  15927.      * 128; if(yCameraCurve > 383) yCameraCurve = 383; } }
  15928.      *
  15929.      * int k2 = Texture.anInt1481; Model.aBoolean1684 = true; Model.anInt1687 =
  15930.      * 0; Model.anInt1685 = super.mouseX - 4; Model.anInt1686 = super.mouseY -
  15931.      * 4; DrawingArea.setAllPixelsToZero(); //xxx disables graphics
  15932.      * if(graphicsEnabled){ worldController.method313(xCameraPos, yCameraPos,
  15933.      * xCameraCurve, zCameraPos, j, yCameraCurve);
  15934.      * worldController.clearObj5Cache(); updateEntities(); drawHeadIcon();
  15935.      * method37(k2); draw3dScreen(); aRSImageProducer_1165.drawGraphics(4,
  15936.      * super.graphics, 4); xCameraPos = l; zCameraPos = i1; yCameraPos = j1;
  15937.      * yCameraCurve = k1; xCameraCurve = l1; // } }
  15938.      */
  15939.  
  15940.     private void clearTopInterfaces() {
  15941.         stream.createFrame(130);
  15942.         if (invOverlayInterfaceID != -1) {
  15943.             invOverlayInterfaceID = -1;
  15944.             needDrawTabArea = true;
  15945.             aBoolean1149 = false;
  15946.             tabAreaAltered = true;
  15947.         }
  15948.         if (backDialogID != -1) {
  15949.             backDialogID = -1;
  15950.             inputTaken = true;
  15951.             aBoolean1149 = false;
  15952.         }
  15953.         openInterfaceID = -1;
  15954.          fullscreenInterfaceID = -1;
  15955.     }
  15956.  
  15957.     public client() {
  15958.         xpAddedPos = expAdded = 0;
  15959.          fullscreenInterfaceID = -1;
  15960.         xpLock = false;
  15961.         xpCounter = 0;
  15962.         counter = new Sprite[3];
  15963.         alertHandler = new AlertHandler(this);
  15964.         chatTypeView = 0;
  15965.         duelMode = 0;
  15966.         clanChatMode = 0;
  15967.         new Messages();
  15968.         cButtonHPos = -1;
  15969.         cButtonHCPos = -1;
  15970.         sk = new ShortKeysPanel();
  15971.         //loadShortKeys();
  15972.         cButtonCPos = 0;
  15973.         // server = "dominationx-scape.no-ip.biz";
  15974.         // server = "dominationx-scape.no-ip.biz";
  15975.         anIntArrayArray825 = new int[104][104];
  15976.         friendsNodeIDs = new int[200];
  15977.         friendsNodeWorlds = new Hashtable(200);
  15978.         groundArray = new NodeList[4][104][104];
  15979.         aBoolean831 = false;
  15980.         aStream_834 = new Stream(new byte[5000]);
  15981.         npcArray = new NPC[32768];
  15982.         npcIndices = new int[32768];
  15983.         anIntArray840 = new int[1000];
  15984.         aStream_847 = Stream.create();
  15985.         aBoolean848 = true;
  15986.         openInterfaceID = -1;
  15987.         currentExp = new int[Skills.skillsCount];
  15988.         aBoolean872 = false;
  15989.         anIntArray873 = new int[5];
  15990.         anInt874 = -1;
  15991.         aBooleanArray876 = new boolean[5];
  15992.         drawFlames = false;
  15993.         reportAbuseInput = "";
  15994.         unknownInt10 = -1;
  15995.         menuOpen = false;
  15996.         inputString = "";
  15997.         maxPlayers = 2048;
  15998.         myPlayerIndex = 2047;
  15999.         playerArray = new Player[maxPlayers];
  16000.         playerIndices = new int[maxPlayers];
  16001.         anIntArray894 = new int[maxPlayers];
  16002.         aStreamArray895s = new Stream[maxPlayers];
  16003.         anInt897 = 1;
  16004.         anIntArrayArray901 = new int[104][104];
  16005.         anInt902 = 0x766654;
  16006.         aByteArray912 = new byte[16384];
  16007.         currentStats = new int[Skills.skillsCount];
  16008.         ignoreListAsLongs = new long[100];
  16009.         loadingError = false;
  16010.         anInt927 = 0x332d25;
  16011.         anIntArray928 = new int[5];
  16012.         anIntArrayArray929 = new int[104][104];
  16013.         chatTypes = new int[500];
  16014.         chatNames = new String[500];
  16015.         chatMessages = new String[500];
  16016.         sideIcons = new Sprite[14];
  16017.         redStones = new Sprite[5];
  16018.         aBoolean954 = true;
  16019.         friendsListAsLongs = new long[200];
  16020.         currentSong = -1;
  16021.         drawingFlames = false;
  16022.         spriteDrawX = -1;
  16023.         spriteDrawY = -1;
  16024.         anIntArray968 = new int[33];
  16025.         anIntArray969 = new int[256];
  16026.         decompressors = new Decompressor[5];
  16027.         variousSettings = new int[2000];
  16028.         aBoolean972 = false;
  16029.         anInt975 = 50;
  16030.         anIntArray976 = new int[anInt975];
  16031.         anIntArray977 = new int[anInt975];
  16032.         anIntArray978 = new int[anInt975];
  16033.         anIntArray979 = new int[anInt975];
  16034.         anIntArray980 = new int[anInt975];
  16035.         anIntArray981 = new int[anInt975];
  16036.         anIntArray982 = new int[anInt975];
  16037.         aStringArray983 = new String[anInt975];
  16038.         anInt985 = -1;
  16039.         hitMarks = new Sprite[22];
  16040.         anIntArray990 = new int[5];
  16041.         aBoolean994 = false;
  16042.         anInt1002 = 0x23201b;
  16043.         amountOrNameInput = "";
  16044.         aClass19_1013 = new NodeList();
  16045.         aBoolean1017 = false;
  16046.         anInt1018 = -1;
  16047.         anIntArray1030 = new int[5];
  16048.         aBoolean1031 = false;
  16049.         mapFunctions = new Sprite[100];
  16050.         dialogID = -1;
  16051.         maxStats = new int[Skills.skillsCount];
  16052.         anIntArray1045 = new int[2000];
  16053.         aBoolean1047 = true;
  16054.         anIntArray1052 = new int[151];
  16055.         anInt1054 = -1;
  16056.         aClass19_1056 = new NodeList();
  16057.         anIntArray1057 = new int[33];
  16058.         aClass9_1059 = new RSInterface();
  16059.         mapScenes = new Background[100];
  16060.         barFillColor = 0x4d4233;
  16061.         anIntArray1065 = new int[7];
  16062.         anIntArray1072 = new int[1000];
  16063.         anIntArray1073 = new int[1000];
  16064.         aBoolean1080 = false;
  16065.         friendsList = new String[200];
  16066.         inStream = Stream.create();
  16067.         expectedCRCs = new int[9];
  16068.         menuActionCmd2 = new int[500];
  16069.         menuActionCmd3 = new int[500];
  16070.         menuActionID = new int[500];
  16071.         menuActionCmd1 = new int[500];
  16072.         headIcons = new Sprite[20];
  16073.         headIconsHint = new Sprite[20];
  16074.         skullIcons = new Sprite[20];
  16075.         tabAreaAltered = false;
  16076.         aString1121 = "";
  16077.         frame = new RSImageProducer[3];
  16078.         atPlayerActions = new String[5];
  16079.         atPlayerArray = new boolean[5];
  16080.         anIntArrayArrayArray1129 = new int[4][13][13];
  16081.         anInt1132 = 2;
  16082.         aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  16083.         aBoolean1141 = false;
  16084.         aBoolean1149 = false;
  16085.         crosses = new Sprite[8];
  16086.         musicEnabled = true;
  16087.         needDrawTabArea = false;
  16088.         loggedIn = false;
  16089.         canMute = false;
  16090.         aBoolean1159 = false;
  16091.         aBoolean1160 = false;
  16092.         anInt1171 = 1;
  16093.         myUsername = "";
  16094.         myPassword = "";
  16095.         genericLoadingError = false;
  16096.         reportAbuseInterfaceID = -1;
  16097.         aClass19_1179 = new NodeList();
  16098.         anInt1184 = 128;
  16099.         invOverlayInterfaceID = -1;
  16100.         stream = Stream.create();
  16101.         menuActionName = new String[500];
  16102.         anIntArray1203 = new int[5];
  16103.         anIntArray1207 = new int[50];
  16104.         anInt1210 = 2;
  16105.         anInt1211 = 78;
  16106.         promptInput = "";
  16107.         modIcons = new Sprite[12];
  16108.         tabID = 3;
  16109.         inputTaken = false;
  16110.         songChanging = true;
  16111.         anIntArray1229 = new int[151];
  16112.         aClass11Array1230 = new Class11[4];
  16113.         aBoolean1233 = false;
  16114.         anIntArray1240 = new int[100];
  16115.         anIntArray1241 = new int[50];
  16116.         aBoolean1242 = false;
  16117.         anIntArray1250 = new int[50];
  16118.         rsAlreadyLoaded = false;
  16119.         welcomeScreenRaised = false;
  16120.         messagePromptRaised = false;
  16121.         loginMessage1 = "";
  16122.         loginMessage2 = "";
  16123.         backDialogID = -1;
  16124.         if(!Texture_Sub1.INSTANCE.isTextureLoaded()){
  16125.             System.exit(1);
  16126.             return;
  16127.         }
  16128.         anInt1279 = 2;
  16129.         bigX = new int[4000];
  16130.         bigY = new int[4000];
  16131.         anInt1289 = -1;
  16132.     }
  16133.  
  16134.     public int chatTypeView;
  16135.     public int clanChatMode;
  16136.     public int duelMode;
  16137.     /* Declare custom sprites */
  16138.     public Sprite multiOverlay;
  16139.     public Sprite duelingOverlay;
  16140.     private Sprite chatArea;
  16141.     private Sprite chatButtons;
  16142.     private Sprite chatButtonH;
  16143.     private Sprite chatButtonHC;
  16144.     private Sprite chatButtonC;
  16145.     private Sprite reportH;
  16146.     private Sprite tabArea;
  16147.     private Sprite mapArea;
  16148.     private Sprite logIconH;
  16149.     private Sprite logIconC;
  16150.     private Sprite worldMapIcon;
  16151.     private Sprite emptyOrb;
  16152.     private Sprite hitPointsFill;
  16153.     private Sprite hitPointsIcon;
  16154.     private Sprite prayerFill;
  16155.     private Sprite prayerIcon;
  16156.     /**/
  16157.     // private RSImageProducer frame;
  16158.     private RSImageProducer[] frame;
  16159.     private int ignoreCount;
  16160.     private long aLong824;
  16161.     private int[][] anIntArrayArray825;
  16162.     private int[] friendsNodeIDs;
  16163.     private NodeList[][][] groundArray;
  16164.     private int[] anIntArray828;
  16165.     private int[] anIntArray829;
  16166.     private volatile boolean aBoolean831;
  16167.     private Socket aSocket832;
  16168.     private int loginScreenState;
  16169.     private Stream aStream_834;
  16170.     private NPC[] npcArray;
  16171.     private int npcCount;
  16172.     private int[] npcIndices;
  16173.     private int anInt839;
  16174.     private int[] anIntArray840;
  16175.     private int anInt841;
  16176.     private int anInt842;
  16177.     private int anInt843;
  16178.     private String aString844;
  16179.     private int privateChatMode;
  16180.     private Stream aStream_847;
  16181.     private boolean aBoolean848;
  16182.     private static int anInt849;
  16183.     private int[] anIntArray850;
  16184.     private int[] anIntArray851;
  16185.     private int[] anIntArray852;
  16186.     private int[] anIntArray853;
  16187.     private static int anInt854;
  16188.     private int anInt855;
  16189.     public static int openInterfaceID;
  16190.     private int xCameraPos;
  16191.     private int zCameraPos;
  16192.     private int yCameraPos;
  16193.     private int yCameraCurve;
  16194.     private int xCameraCurve;
  16195.     private int myPrivilege;
  16196.     private final int[] currentExp;
  16197.     private Sprite[] redStones;
  16198.     private Sprite mapFlag;
  16199.     private Sprite mapMarker;
  16200.     private boolean aBoolean872;
  16201.     private final int[] anIntArray873;
  16202.     private int anInt874;
  16203.     private final boolean[] aBooleanArray876;
  16204.     private int weight;
  16205.     private MouseDetection mouseDetection;
  16206.     private volatile boolean drawFlames;
  16207.     private String reportAbuseInput;
  16208.     private int unknownInt10;
  16209.     private boolean menuOpen;
  16210.     private int anInt886;
  16211.     public static String inputString;
  16212.     private final int maxPlayers;
  16213.     private final int myPlayerIndex;
  16214.     private Player[] playerArray;
  16215.     private int playerCount;
  16216.     private int[] playerIndices;
  16217.     private int anInt893;
  16218.     private int[] anIntArray894;
  16219.     private Stream[] aStreamArray895s;
  16220.     private int anInt896;
  16221.     private int anInt897;
  16222.     private int friendsCount;
  16223.     private int anInt900;
  16224.     private int[][] anIntArrayArray901;
  16225.     private final int anInt902;
  16226.     private byte[] aByteArray912;
  16227.     private int anInt913;
  16228.     private int crossX;
  16229.     private int crossY;
  16230.     private int crossIndex;
  16231.     private int crossType;
  16232.     private int plane;
  16233.     private final int[] currentStats;
  16234.     private static int anInt924;
  16235.     private final long[] ignoreListAsLongs;
  16236.     private boolean loadingError;
  16237.     private final int anInt927;
  16238.     private final int[] anIntArray928;
  16239.     private int[][] anIntArrayArray929;
  16240.     private Sprite aClass30_Sub2_Sub1_Sub1_931;
  16241.     private Sprite aClass30_Sub2_Sub1_Sub1_932;
  16242.     private int anInt933;
  16243.     private int anInt934;
  16244.     private int anInt935;
  16245.     private int anInt936;
  16246.     private int anInt937;
  16247.     private int anInt938;
  16248.     private static int anInt940;
  16249.     private final int[] chatTypes;
  16250.     private final String[] chatNames;
  16251.     private final String[] chatMessages;
  16252.     private int anInt945;
  16253.     private WorldController worldController;
  16254.     private Sprite[] sideIcons;
  16255.     private int menuScreenArea;
  16256.     private int menuOffsetX;
  16257.     private int menuOffsetY;
  16258.     private int menuWidth;
  16259.     private int anInt952;
  16260.     private long aLong953;
  16261.     private boolean aBoolean954;
  16262.     private long[] friendsListAsLongs;
  16263.     private int currentSong;
  16264.     private static int nodeID = 10;
  16265.     static int portOff;
  16266.     static boolean clientData;
  16267.     private static boolean isMembers = true;
  16268.     public static boolean lowMem;
  16269.     private volatile boolean drawingFlames;
  16270.     private int spriteDrawX;
  16271.     private int spriteDrawY;
  16272.     private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535,
  16273.             0xff00ff, 0xffffff };
  16274.     private Background aBackground_966;
  16275.     private Background aBackground_967;
  16276.     private final int[] anIntArray968;
  16277.     private final int[] anIntArray969;
  16278.     final Decompressor[] decompressors;
  16279.     public int variousSettings[];
  16280.     private boolean aBoolean972;
  16281.     private final int anInt975;
  16282.     private final int[] anIntArray976;
  16283.     private final int[] anIntArray977;
  16284.     private final int[] anIntArray978;
  16285.     private final int[] anIntArray979;
  16286.     private final int[] anIntArray980;
  16287.     private final int[] anIntArray981;
  16288.     private final int[] anIntArray982;
  16289.     private final String[] aStringArray983;
  16290.     private int anInt984;
  16291.     private int anInt985;
  16292.     private static int anInt986;
  16293.     private Sprite[] hitMarks;
  16294.     private int anInt988;
  16295.     private int anInt989;
  16296.     private final int[] anIntArray990;
  16297.     private static boolean aBoolean993;
  16298.     private final boolean aBoolean994;
  16299.     private int anInt995;
  16300.     private int anInt996;
  16301.     private int anInt997;
  16302.     private int anInt998;
  16303.     private int anInt999;
  16304.     public ISAACRandomGen encryption;
  16305.     private Sprite mapEdge;
  16306.     private final int anInt1002;
  16307.     static final int[][] anIntArrayArray1003 = {
  16308.             { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983,
  16309.                     54193 },
  16310.             { 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
  16311.                     56621, 4783, 1341, 16578, 35003, 25239 },
  16312.             { 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
  16313.                     10153, 56621, 4783, 1341, 16578, 35003 },
  16314.             { 4626, 11146, 6439, 12, 4758, 10270 },
  16315.             { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
  16316.     private String amountOrNameInput;
  16317.     private static int anInt1005;
  16318.     private int daysSinceLastLogin;
  16319.     private int pktSize;
  16320.     private int pktType;
  16321.     private int anInt1009;
  16322.     private int anInt1010;
  16323.     private int anInt1011;
  16324.     private NodeList aClass19_1013;
  16325.     private int anInt1014;
  16326.     private int anInt1015;
  16327.     private int anInt1016;
  16328.     private boolean aBoolean1017;
  16329.     private int anInt1018;
  16330.     private static final int[] anIntArray1019;
  16331.     private int anInt1021;
  16332.     private int anInt1022;
  16333.     private int loadingStage;
  16334.     private Background scrollBar1;
  16335.     private Background scrollBar2;
  16336.     private int anInt1026;
  16337.     private Background backBase1;
  16338.     private Background backBase2;
  16339.     private Background backHmid1;
  16340.     private final int[] anIntArray1030;
  16341.     private boolean aBoolean1031;
  16342.     private Sprite[] mapFunctions;
  16343.     private int baseX;
  16344.     private int baseY;
  16345.     private int anInt1036;
  16346.     private int anInt1037;
  16347.     private int loginFailures;
  16348.     private int anInt1039;
  16349.     private int anInt1040;
  16350.     private int anInt1041;
  16351.     private int dialogID;
  16352.     private final int[] maxStats;
  16353.     private final int[] anIntArray1045;
  16354.     private int anInt1046;
  16355.     private boolean aBoolean1047;
  16356.     private int anInt1048;
  16357.     private String aString1049;
  16358.     private static int anInt1051;
  16359.     private final int[] anIntArray1052;
  16360.     private StreamLoader titleStreamLoader;
  16361.     private int anInt1054;
  16362.     private int anInt1055;
  16363.     private NodeList aClass19_1056;
  16364.     private final int[] anIntArray1057;
  16365.     public final RSInterface aClass9_1059;
  16366.     private Background[] mapScenes;
  16367.     private static int anInt1061;
  16368.     private int anInt1062;
  16369.     private final int barFillColor;
  16370.     private int friendsListAction;
  16371.     private final int[] anIntArray1065;
  16372.     private int mouseInvInterfaceIndex;
  16373.     private int lastActiveInvInterface;
  16374.     public OnDemandFetcher onDemandFetcher;
  16375.     private int anInt1069;
  16376.     private int anInt1070;
  16377.     private int anInt1071;
  16378.     private int[] anIntArray1072;
  16379.     private int[] anIntArray1073;
  16380.     private Sprite mapDotItem;
  16381.     private Sprite mapDotNPC;
  16382.     private Sprite mapDotPlayer;
  16383.     private Sprite mapDotFriend;
  16384.     private Sprite mapDotBL;
  16385.     private Sprite mapDotTeam;
  16386.     private int anInt1079;
  16387.     private boolean aBoolean1080;
  16388.     private String[] friendsList;
  16389.     private Stream inStream;
  16390.     private int anInt1084;
  16391.     private int anInt1085;
  16392.     private int activeInterfaceType;
  16393.     private int anInt1087;
  16394.     private int anInt1088;
  16395.     public static int anInt1089;
  16396.     public final int[] expectedCRCs;
  16397.     private int[] menuActionCmd2;
  16398.     private int[] menuActionCmd3;
  16399.     public int[] menuActionID;
  16400.     private int[] menuActionCmd1;
  16401.     private Sprite[] headIcons;
  16402.     private Sprite[] headIconsHint;
  16403.     private Sprite[] skullIcons;
  16404.     private static int anInt1097;
  16405.     private int anInt1098;
  16406.     private int anInt1099;
  16407.     private int anInt1100;
  16408.     private int anInt1101;
  16409.     private int anInt1102;
  16410.     public static boolean tabAreaAltered;
  16411.     private int anInt1104;
  16412.     private RSImageProducer aRSImageProducer_1107;
  16413.     private RSImageProducer aRSImageProducer_1108;
  16414.     private RSImageProducer aRSImageProducer_1109;
  16415.     private RSImageProducer aRSImageProducer_1110;
  16416.     private RSImageProducer aRSImageProducer_1111;
  16417.     private RSImageProducer aRSImageProducer_1112;
  16418.     private RSImageProducer aRSImageProducer_1113;
  16419.     private RSImageProducer aRSImageProducer_1114;
  16420.     private RSImageProducer aRSImageProducer_1115;
  16421.     private static int anInt1117;
  16422.     private int membersInt;
  16423.     private String aString1121;
  16424.     private Sprite compass;
  16425.     private RSImageProducer aRSImageProducer_1123;
  16426.     private RSImageProducer aRSImageProducer_1124;
  16427.     private RSImageProducer aRSImageProducer_1125;
  16428.     public static Player myPlayer;
  16429.     private final String[] atPlayerActions;
  16430.     private final boolean[] atPlayerArray;
  16431.     private final int[][][] anIntArrayArrayArray1129;
  16432.     public static final int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1,
  16433.             -1, -1, -1, -1, -1, -1, -1, -1 };
  16434.     private int anInt1131;
  16435.     private int anInt1132;
  16436.     public int menuActionRow;
  16437.     private static int anInt1134;
  16438.     private int spellSelected;
  16439.     private int anInt1137;
  16440.     private int spellUsableOn;
  16441.     private String spellTooltip;
  16442.     private Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  16443.     private boolean aBoolean1141;
  16444.     private static int anInt1142;
  16445.     private int energy;
  16446.     private boolean aBoolean1149;
  16447.     private Sprite[] crosses;
  16448.     public int anInt1044;// 377
  16449.     public int anInt1129;// 377
  16450.     public int anInt1315;// 377
  16451.     public int anInt1500;// 377
  16452.     public int anInt1501;// 377
  16453.     private boolean musicEnabled;
  16454.     private Background[] aBackgroundArray1152s;
  16455.     public static boolean needDrawTabArea;
  16456.     private int unreadMessages;
  16457.     private static int anInt1155;
  16458.     public static boolean fpsOn;
  16459.     public boolean loggedIn;
  16460.     private boolean canMute;
  16461.     private boolean aBoolean1159;
  16462.     private boolean aBoolean1160;
  16463.     static int loopCycle;
  16464.     private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  16465.     private RSImageProducer aRSImageProducer_1163;
  16466.     private RSImageProducer aRSImageProducer_1164;
  16467.     private RSImageProducer aRSImageProducer_1165;
  16468.     private RSImageProducer aRSImageProducer_1166;
  16469.     private int daysSinceRecovChange;
  16470.     private RSSocket socketStream;
  16471.     private int anInt1169;
  16472.     private int minimapInt3;
  16473.     private int anInt1171;
  16474.     private long aLong1172;
  16475.     public static String myUsername;
  16476.     public static String myPassword;
  16477.     private static int anInt1175;
  16478.     private boolean genericLoadingError;
  16479.     private final int[] anIntArray1177 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
  16480.             2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 };
  16481.     private int reportAbuseInterfaceID;
  16482.     private NodeList aClass19_1179;
  16483.     private int[] anIntArray1180;
  16484.     private int[] anIntArray1181;
  16485.     private int[] anIntArray1182;
  16486.     private byte[][] aByteArrayArray1183;
  16487.     private int anInt1184;
  16488.     private int minimapInt1;
  16489.     private int anInt1186;
  16490.     private int anInt1187;
  16491.     private static int anInt1188;
  16492.     private int invOverlayInterfaceID;
  16493.     private int[] anIntArray1190;
  16494.     private int[] anIntArray1191;
  16495.     private Stream stream;
  16496.     private int anInt1193;
  16497.     private int splitPrivateChat;
  16498.     private Background mapBack;
  16499.     public String[] menuActionName;
  16500.     private Sprite aClass30_Sub2_Sub1_Sub1_1201;
  16501.     private Sprite aClass30_Sub2_Sub1_Sub1_1202;
  16502.     private final int[] anIntArray1203;
  16503.     static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975, 8526,
  16504.             918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486 };
  16505.     private static boolean flagged;
  16506.     private final int[] anIntArray1207;
  16507.     private int anInt1208;
  16508.     private int minimapInt2;
  16509.     private int anInt1210;
  16510.     private int anInt1211;
  16511.     private String promptInput;
  16512.     private int anInt1213;
  16513.     private int[][][] intGroundArray;
  16514.     public long aLong1215;
  16515.     private int loginScreenCursorPos;
  16516.     private final Sprite[] modIcons;
  16517.     private long aLong1220;
  16518.     public static int tabID;
  16519.     private int anInt1222;
  16520.     public static boolean inputTaken;
  16521.     private int inputDialogState;
  16522.     private static int anInt1226;
  16523.     private int nextSong;
  16524.     private boolean songChanging;
  16525.     private final int[] anIntArray1229;
  16526.     private Class11[] aClass11Array1230;
  16527.     public static int anIntArray1232[];
  16528.     private boolean aBoolean1233;
  16529.     private int[] anIntArray1234;
  16530.     private int[] anIntArray1235;
  16531.     private int[] anIntArray1236;
  16532.     private int anInt1237;
  16533.     private int anInt1238;
  16534.     public final int anInt1239 = 100;
  16535.     private final int[] anIntArray1240;
  16536.     private final int[] anIntArray1241;
  16537.     private boolean aBoolean1242;
  16538.     private int atInventoryLoopCycle;
  16539.     private int atInventoryInterface;
  16540.     private int atInventoryIndex;
  16541.     private int atInventoryInterfaceType;
  16542.     private byte[][] aByteArrayArray1247;
  16543.     private int tradeMode;
  16544.     private int anInt1249;
  16545.     private final int[] anIntArray1250;
  16546.     private int anInt1251;
  16547.     private final boolean rsAlreadyLoaded;
  16548.     private int anInt1253;
  16549.     private int anInt1254;
  16550.     private boolean welcomeScreenRaised;
  16551.     private boolean messagePromptRaised;
  16552.     private int anInt1257;
  16553.     private byte[][][] byteGroundArray;
  16554.     private int prevSong;
  16555.     private int destX;
  16556.     private int destY;
  16557.     private Sprite aClass30_Sub2_Sub1_Sub1_1263;
  16558.     private int anInt1264;
  16559.     private int anInt1265;
  16560.     private String loginMessage1;
  16561.     private String loginMessage2;
  16562.     private int anInt1268;
  16563.     private int anInt1269;
  16564.     public TextDrawingArea smallText;
  16565.     public TextDrawingArea aTextDrawingArea_1271;
  16566.     private TextDrawingArea chatTextDrawingArea;
  16567.     private int anInt1275;
  16568.     private int backDialogID;
  16569.     private int anInt1278;
  16570.     private int anInt1279;
  16571.     private int[] bigX;
  16572.     private int[] bigY;
  16573.     private int itemSelected;
  16574.     private int anInt1283;
  16575.     private int anInt1284;
  16576.     private int anInt1285;
  16577.     private String selectedItemName;
  16578.     private int publicChatMode;
  16579.     private static int anInt1288;
  16580.     private int anInt1289;
  16581.     public static int anInt1290;
  16582.     public static String server = "";
  16583.     public int settime, size2, size, chatsize;
  16584.     public boolean autochat = false;
  16585.     public int autotime = 200;
  16586.     public String textchat = null;
  16587.     public String automsg = null;
  16588.     public boolean hp = false;
  16589.     public boolean ranks = true;
  16590.     public boolean names = false;
  16591.     static boolean coordinates;
  16592.     public static int spellID = 0;
  16593.     public boolean noClip = false;
  16594.     private Sprite infinity;
  16595.     public static boolean hpH = true;
  16596.     public static boolean newHpBar = true;
  16597.     public static boolean newHits = true;
  16598.     static boolean performanceCounter;
  16599.     public int followPlayer = 0;
  16600.     public int followNPC = 0;
  16601.     public int MAXGFXID = 3038;
  16602.     public int MAXANIMID = 16858;
  16603.     public int followDistance = 1;
  16604.     private Hashtable friendsNodeWorlds;
  16605.     static {
  16606.         anIntArray1019 = new int[99];
  16607.         int i = 0;
  16608.         for (int j = 0; j < 99; j++) {
  16609.             int l = j + 1;
  16610.             int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D));
  16611.             i += i1;
  16612.             anIntArray1019[j] = i / 4;
  16613.         }
  16614.  
  16615.         anIntArray1232 = new int[32];
  16616.         i = 2;
  16617.         for (int k = 0; k < 32; k++) {
  16618.             anIntArray1232[k] = i - 1;
  16619.             i += i;
  16620.         }
  16621.  
  16622.     }
  16623. }
Advertisement
Add Comment
Please, Sign In to add comment